Skip to content

Commit 270fcd1

Browse files
committed
Use absdiff to avoid saturation
1 parent 2c237bb commit 270fcd1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/ximgproc/src/thinning.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,13 @@ void thinning(InputArray input, OutputArray output, int thinningType){
190190
processed /= 255;
191191

192192
Mat prev = processed.clone();
193+
Mat diff;
193194

194195
do {
195196
thinningIteration(processed, 0, thinningType);
196197
thinningIteration(processed, 1, thinningType);
197-
if (!hasNonZero(processed - prev)) break;
198+
absdiff(processed, prev, diff);
199+
if (!hasNonZero(diff)) break;
198200
processed.copyTo(prev);
199201
}
200202
while (true);

0 commit comments

Comments
 (0)