本文整理汇总了C++中imagebuf::ConstIterator::deep_samples方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstIterator::deep_samples方法的具体用法?C++ ConstIterator::deep_samples怎么用?C++ ConstIterator::deep_samples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imagebuf::ConstIterator
的用法示例。
在下文中一共展示了ConstIterator::deep_samples方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: a
static bool
compare_ (const ImageBuf &A, const ImageBuf &B,
float failthresh, float warnthresh,
ImageBufAlgo::CompareResults &result,
ROI roi, int nthreads)
{
imagesize_t npels = roi.npixels();
imagesize_t nvals = npels * roi.nchannels();
int Achannels = A.nchannels(), Bchannels = B.nchannels();
// Compare the two images.
//
double totalerror = 0;
double totalsqrerror = 0;
result.maxerror = 0;
result.maxx=0, result.maxy=0, result.maxz=0, result.maxc=0;
result.nfail = 0, result.nwarn = 0;
float maxval = 1.0; // max possible value
ImageBuf::ConstIterator<Atype> a (A, roi, ImageBuf::WrapBlack);
ImageBuf::ConstIterator<Btype> b (B, roi, ImageBuf::WrapBlack);
bool deep = A.deep();
// Break up into batches to reduce cancelation errors as the error
// sums become too much larger than the error for individual pixels.
const int batchsize = 4096; // As good a guess as any
for ( ; ! a.done(); ) {
double batcherror = 0;
double batch_sqrerror = 0;
if (deep) {
for (int i = 0; i < batchsize && !a.done(); ++i, ++a, ++b) {
bool warned = false, failed = false; // For this pixel
for (int c = roi.chbegin; c < roi.chend; ++c)
for (int s = 0, e = a.deep_samples(); s < e; ++s) {
compare_value (a, c, a.deep_value(c,s),
b.deep_value(c,s), result, maxval,
batcherror, batch_sqrerror,
failed, warned, failthresh, warnthresh);
}
}
} else { // non-deep
for (int i = 0; i < batchsize && !a.done(); ++i, ++a, ++b) {
bool warned = false, failed = false; // For this pixel
for (int c = roi.chbegin; c < roi.chend; ++c)
compare_value (a, c, c < Achannels ? a[c] : 0.0f,
c < Bchannels ? b[c] : 0.0f,
result, maxval, batcherror, batch_sqrerror,
failed, warned, failthresh, warnthresh);
}
}
totalerror += batcherror;
totalsqrerror += batch_sqrerror;
}
result.meanerror = totalerror / nvals;
result.rms_error = sqrt (totalsqrerror / nvals);
result.PSNR = 20.0 * log10 (maxval / result.rms_error);
return result.nfail == 0;
}