Skip to content

Commit

Permalink
Use absdiff to avoid saturation
Browse files Browse the repository at this point in the history
  • Loading branch information
vrabaud committed May 28, 2024
1 parent 2c237bb commit 270fcd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/ximgproc/src/thinning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,13 @@ void thinning(InputArray input, OutputArray output, int thinningType){
processed /= 255;

Mat prev = processed.clone();
Mat diff;

do {
thinningIteration(processed, 0, thinningType);
thinningIteration(processed, 1, thinningType);
if (!hasNonZero(processed - prev)) break;
absdiff(processed, prev, diff);
if (!hasNonZero(diff)) break;
processed.copyTo(prev);
}
while (true);
Expand Down

0 comments on commit 270fcd1

Please sign in to comment.