nobody
nobody

Reputation: 835

Hough circle detection: Blurring the image before calling hough circle algorithm?

http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_houghcircles/py_houghcircles.html

In the example here, I do not know why it called the median filter first before the hough circle algorithm. Is this meant to give better detection?

Also, is there any other tricks in general that maybe useful when calling Hough circle algorithm? In particular, if the circular object has same brightness with its background, hence looking homogeneous on the grey scale, is there anything I can do here?

Also, if I cannot get perfect detection, I would prefer having less detected circles but rather the detected ones are correct.

Thanks

Upvotes: 3

Views: 2714

Answers (2)

user1123701
user1123701

Reputation: 21

Yes, it is meant to reduce the noise within the image, with the aim to improve edge detection. Edge detection algorithms are sensitive to noise.

Described here: https://en.wikipedia.org/wiki/Median_filter

But this image better illustrates how blur improves (even your brain's) edge detection: https://upload.wikimedia.org/wikipedia/commons/6/62/Cappadocia_Gaussian_Blur.svg

This image is from an article on Gaussian Blur, another smoothing technique that reduces noise in signals (like images). However, Median Filter preserves edges better than Gaussian Blur, hence its use in image processing. (Described under "Edge preservation properties" in Wiki's Median Filter article)

Upvotes: 1

Richard Peterson
Richard Peterson

Reputation: 883

The blur will help avoid false circle detection by reducing noise, because openCV uses a gradient version of the hough circle detection algorithm, outlined here: http://homepages.inf.ed.ac.uk/rbf/BOOKS/BANDB/LIB/bandb4_3.pdf

The size of the blur will interplay with the upper threshold for the internal Canny edge detector, which is param_1. You'll want to play around with that.

To get around the brightness problem, try detecting just with isolated R, G and B channels. To get more complete results, you can then shift hue by 60 and then use isolated channels again.

Upvotes: 1

Related Questions