本文整理汇总了C++中ImageData::GetChannelImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageData::GetChannelImage方法的具体用法?C++ ImageData::GetChannelImage怎么用?C++ ImageData::GetChannelImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageData
的用法示例。
在下文中一共展示了ImageData::GetChannelImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AreImagesEqual
bool AreImagesEqual(
const ImageData& image1,
const ImageData& image2,
const double diff_tolerance) {
const int num_channels = image1.GetNumChannels();
if (num_channels != image2.GetNumChannels()) {
std::cout << "Images do not have the same number of channels: "
<< num_channels << " vs. "
<< image2.GetNumChannels() << std::endl;
return false;
}
// If the given diff_tolerance is zero, use "epsilon" to account for possible
// double precision numerical errors.
double applied_diff_tolerance = diff_tolerance;
if (diff_tolerance < std::numeric_limits<double>::epsilon()) {
applied_diff_tolerance = std::numeric_limits<double>::epsilon();
}
for (int channel_index = 0; channel_index < num_channels; ++channel_index) {
if (!AreMatricesEqual(
image1.GetChannelImage(channel_index),
image2.GetChannelImage(channel_index),
applied_diff_tolerance)) {
return false;
}
}
return true;
}