Skip to content

Commit

Permalink
Fix regression in layout detection since 5.0.0 (fixes issue tesseract…
Browse files Browse the repository at this point in the history
…-ocr#4014)

"auto" resulted in unsigned numbers, but htext_score and vtest_score
can be negative.

Fixes: 842cca1 ("Fix more signed/unsigned compiler warnings")
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 4, 2023
1 parent 7e0c1d7 commit 8146b3b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/textord/colpartitiongrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1609,10 +1609,10 @@ BlobRegionType ColPartitionGrid::SmoothInOneDirection(
}
// See if we have a decision yet.
auto image_count = counts[NPT_IMAGE];
auto htext_score = counts[NPT_HTEXT] + counts[NPT_WEAK_HTEXT] -
(image_count + counts[NPT_WEAK_VTEXT]);
auto vtext_score = counts[NPT_VTEXT] + counts[NPT_WEAK_VTEXT] -
(image_count + counts[NPT_WEAK_HTEXT]);
int htext_score = counts[NPT_HTEXT] + counts[NPT_WEAK_HTEXT] -
(image_count + counts[NPT_WEAK_VTEXT]);
int vtext_score = counts[NPT_VTEXT] + counts[NPT_WEAK_VTEXT] -
(image_count + counts[NPT_WEAK_HTEXT]);
if (image_count > 0 && image_bias - htext_score >= kSmoothDecisionMargin &&
image_bias - vtext_score >= kSmoothDecisionMargin) {
*best_distance = dists[NPT_IMAGE][0];
Expand Down

0 comments on commit 8146b3b

Please sign in to comment.