54 Image pix = pixCreate(width, height, depth);
55 EXPECT_TRUE(depth == 1 || depth == 8);
60 int left, top, right, bottom;
63 if (!it->BoundingBox(level, &left, &top, &right, &bottom)) {
65 EXPECT_TRUE(it->BoundingBox(im_level, &left, &top, &right, &bottom));
67 LOG(
INFO) <<
"BBox: [L:" << left <<
", T:" << top <<
", R:" << right <<
", B:" << bottom
72 block_pix = it->GetBinaryImage(im_level);
73 pixRasterop(pix, left, top, right - left, bottom - top, PIX_SRC ^ PIX_DST, block_pix, 0, 0);
75 block_pix = it->GetImage(im_level, 2,
src_pix_, &left, &top);
76 pixRasterop(pix, left, top, pixGetWidth(block_pix), pixGetHeight(block_pix),
77 PIX_SRC & PIX_DST, block_pix, 0, 0);
79 CHECK(block_pix !=
nullptr);
81 }
while (it->Next(level));
84 pixRasterop(pix, 0, 0, width, height, PIX_SRC ^ PIX_DST,
src_pix_, 0, 0);
86 Image binary_pix = pixThresholdToBinary(pix, 128);
88 pixInvert(binary_pix, binary_pix);
94 pixCountPixels(pix, &pixcount,
nullptr);
95 if (pixcount > max_diff) {
97 LOG(
INFO) <<
"outfile = " << outfile <<
"\n";
98 pixWrite(outfile.c_str(), pix, IFF_PNG);
101 LOG(
INFO) <<
"At level " << level <<
": pix diff = " << pixcount <<
"\n";
102 EXPECT_LE(pixcount, max_diff);
std::string OutputNameToPath(const std::string &name)