本文整理汇总了C++中CByteImage::ClearPixels方法的典型用法代码示例。如果您正苦于以下问题:C++ CByteImage::ClearPixels方法的具体用法?C++ CByteImage::ClearPixels怎么用?C++ CByteImage::ClearPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CByteImage
的用法示例。
在下文中一共展示了CByteImage::ClearPixels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeNonoccMask
void makeNonoccMask(CFloatImage disp0, CFloatImage disp0y, CFloatImage disp1,
int dir, float thresh, CByteImage &mask)
{
CShape sh = disp0.Shape();
int width = sh.width, height = sh.height;
if (sh != disp1.Shape())
throw CError("shapes differ");
int ydisps = (sh == disp0y.Shape());
mask.ReAllocate(sh);
mask.ClearPixels();
int x, y;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
float dx = disp0.Pixel(x, y, 0);
float dy = (ydisps ? disp0y.Pixel(x, y, 0) : 0.0);
if (dx == INFINITY) // unknown
continue;
mask.Pixel(x, y, 0) = 128; // occluded
// find nonocc
int x1 = (int)round(x + dir * dx);
int y1 = (int)round(y + dy);
if (x1 < 0 || x1 >= width || y1 < 0 || y1 >= height)
continue;
float dx1 = disp1.Pixel(x1, y1, 0);
float diff = dx - dx1;
if (fabs(diff) > thresh)
continue; // fails cross checking -- occluded
mask.Pixel(x, y, 0) = 255; // cross-checking OK
}
}
}