Skip to content

Commit 9e3da4a

Browse files
committed
Add Image::operator|=().
1 parent e077b72 commit 9e3da4a

File tree

7 files changed

+12
-7
lines changed

7 files changed

+12
-7
lines changed

src/ccmain/pagesegmain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ int Tesseract::AutoPageSeg(PageSegMode pageseg_mode, BLOCK_LIST *blocks, TO_BLOC
216216
if (musicmask_pix != nullptr) {
217217
// TODO(rays) pass the musicmask_pix into FindBlocks and mark music
218218
// blocks separately. For now combine with photomask_pix.
219-
pixOr(photomask_pix, photomask_pix, musicmask_pix);
219+
photomask_pix |= musicmask_pix;
220220
}
221221
#ifndef DISABLED_LEGACY_ENGINE
222222
if (equ_detect_) {

src/ccstruct/image.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ bool Image::isZero() const {
3939
return r == 1;
4040
}
4141

42+
void Image::operator|=(Image i) {
43+
pixOr(pix_, pix_, i);
44+
}
45+
4246
}

src/ccstruct/image.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class TESS_API Image {
3939
Image copy() const; // does full copy
4040
void destroy();
4141
bool isZero() const;
42+
void operator|=(Image);
4243
};
4344

4445
} // namespace tesseract

src/textord/colfind.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ int ColumnFinder::FindBlocks(PageSegMode pageseg_mode, Image scaled_color, int s
287287
TO_BLOCK *input_block, Image photo_mask_pix, Image thresholds_pix,
288288
Image grey_pix, DebugPixa *pixa_debug, BLOCK_LIST *blocks,
289289
BLOBNBOX_LIST *diacritic_blobs, TO_BLOCK_LIST *to_blocks) {
290-
pixOr(photo_mask_pix, photo_mask_pix, nontext_map_);
290+
photo_mask_pix |= nontext_map_;
291291
stroke_width_->FindLeaderPartitions(input_block, &part_grid_);
292292
stroke_width_->RemoveLineResidue(&big_parts_);
293293
FindInitialTabVectors(nullptr, min_gutter_width_, tabfind_aligned_gap_fraction_, input_block);

src/textord/imagefind.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Image ImageFind::FindImages(Image pix, DebugPixa *pixa_debug) {
110110

111111
// Fill to capture pixels near the mask edges that were missed
112112
Image pixt = pixSeedfillBinary(nullptr, pixht, pix, 8);
113-
pixOr(pixht, pixht, pixt);
113+
pixht |= pixt;
114114
pixt.destroy();
115115

116116
// Eliminate lines and bars that may be joined to images.
@@ -146,7 +146,7 @@ Image ImageFind::FindImages(Image pix, DebugPixa *pixa_debug) {
146146
}
147147
// Make the result image the same size as the input.
148148
Image result = pixCreate(pixGetWidth(pix), pixGetHeight(pix), 1);
149-
pixOr(result, result, pixht);
149+
result |= pixht;
150150
pixht.destroy();
151151
return result;
152152
}

src/textord/linefind.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ void LineFinder::GetLineMasks(int resolution, Image src_pix, Image *pix_vline, I
646646
pixSeedfillBinary(*pix_non_vline, *pix_non_vline, pix_nonlines, 8);
647647
if (!h_empty) {
648648
// Candidate hlines are not vlines.
649-
pixOr(*pix_non_vline, *pix_non_vline, *pix_hline);
649+
*pix_non_vline |= *pix_hline;
650650
pixSubtract(*pix_non_vline, *pix_non_vline, *pix_intersections);
651651
}
652652
if (!FilterFalsePositives(resolution, *pix_non_vline, *pix_intersections, *pix_vline)) {
@@ -670,7 +670,7 @@ void LineFinder::GetLineMasks(int resolution, Image src_pix, Image *pix_vline, I
670670
*pix_non_hline = pixErodeBrick(nullptr, pix_nonlines, 1, kMaxLineResidue);
671671
pixSeedfillBinary(*pix_non_hline, *pix_non_hline, pix_nonlines, 8);
672672
if (extra_non_hlines != nullptr) {
673-
pixOr(*pix_non_hline, *pix_non_hline, extra_non_hlines);
673+
*pix_non_hline |= extra_non_hlines;
674674
extra_non_hlines.destroy();
675675
}
676676
if (!FilterFalsePositives(resolution, *pix_non_hline, *pix_intersections, *pix_hline)) {

src/training/pango/stringrenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ int StringRenderer::RenderAllFontsToImage(double min_coverage, const char *text,
875875
v_margin_ /= 8;
876876
Image title_image = nullptr;
877877
RenderToBinaryImage(title, strlen(title), 128, &title_image);
878-
pixOr(*image, *image, title_image);
878+
*image |= title_image;
879879
title_image.destroy();
880880

881881
v_margin_ *= 8;

0 commit comments

Comments
 (0)