49 {
50 it->Begin();
54 Image pix = pixCreate(width, height, depth);
56 if (depth == 8) {
57 pixSetAll(pix);
58 }
59 do {
60 int left, top, right, bottom;
62
63 if (!it->BoundingBox(level, &left, &top, &right, &bottom)) {
65 EXPECT_TRUE(it->BoundingBox(im_level, &left, &top, &right, &bottom));
66 }
67 LOG(
INFO) <<
"BBox: [L:" << left <<
", T:" << top <<
", R:" << right <<
", B:" << bottom
68 << "]"
69 << "\n";
70 Image block_pix;
71 if (depth == 1) {
72 block_pix = it->GetBinaryImage(im_level);
73 pixRasterop(pix, left, top, right - left, bottom - top, PIX_SRC ^ PIX_DST, block_pix, 0, 0);
74 } else {
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);
78 }
79 CHECK(block_pix !=
nullptr);
80 block_pix.destroy();
81 } while (it->Next(level));
82
83
84 pixRasterop(pix, 0, 0, width, height, PIX_SRC ^ PIX_DST,
src_pix_, 0, 0);
85 if (depth == 8) {
86 Image binary_pix = pixThresholdToBinary(pix, 128);
87 pix.destroy();
88 pixInvert(binary_pix, binary_pix);
89 pix = binary_pix;
90 }
91
92
93 l_int32 pixcount;
94 pixCountPixels(pix, &pixcount, nullptr);
95 if (pixcount > max_diff) {
97 LOG(
INFO) <<
"outfile = " << outfile <<
"\n";
98 pixWrite(outfile.c_str(), pix, IFF_PNG);
99 }
100 pix.destroy();
101 LOG(
INFO) <<
"At level " << level <<
": pix diff = " << pixcount <<
"\n";
103
104 }
#define EXPECT_TRUE(condition)
#define EXPECT_LE(val1, val2)
std::string OutputNameToPath(const std::string &name)