Skip to content

Commit 332588f

Browse files
authored
Fix bug: non-maximum suppression for hough circle
The non-maximum suppression in the Hough accumulator incorrectly ignores maxima that extend over more than one cell, i.e. two neighboring cells both have the same accumulator value. This maximum is dropped completely instead of picking at least one of the entries. This frequently results in obvious circles being missed. The behavior is now changed to be the same as for hough_lines. See also opencv#4440
1 parent 7475d23 commit 332588f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/imgproc/src/hough.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,8 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
11121112
{
11131113
int base = y*(acols+2) + x;
11141114
if( adata[base] > acc_threshold &&
1115-
adata[base] > adata[base-1] && adata[base] > adata[base+1] &&
1116-
adata[base] > adata[base-acols-2] && adata[base] > adata[base+acols+2] )
1115+
adata[base] > adata[base-1] && adata[base] >= adata[base+1] &&
1116+
adata[base] > adata[base-acols-2] && adata[base] >= adata[base+acols+2] )
11171117
cvSeqPush(centers, &base);
11181118
}
11191119
}

0 commit comments

Comments
 (0)