Skip to content

Commit

Permalink
Fill convex hull mask correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed May 31, 2024
1 parent ff366a8 commit 0e3931a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shared/util/convex_hull_image_mask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ void computeMask(const ConvexHull &convex_hull, Image<raw8> &mask) {
// linescan, top - bot, left - right
// first find where the whites should be painted, and then paint them
for (int y = 0; y < mask.getHeight(); ++y) {
int minX = mask.getHeight(); // never min
int minX = mask.getWidth(); // never min
int maxX = 0;
for (int x = 0; x < mask.getWidth(); ++x) {
if (mask.getPixel(x, y) == WHITE) {
minX = minX <= x ? minX : x;
maxX = x;
}
}
if (minX == mask.getHeight() || // no whites
if (minX == mask.getWidth() || // no whites
minX == maxX) // single white
continue;

Expand Down

0 comments on commit 0e3931a

Please sign in to comment.