Ask Your Question

How can I modify the edge detection method for the HoughCircles function?

asked 2017-06-23 17:43:25 -0500

updated 2017-06-24 01:31:33 -0500

berak gravatar image

I'm currently using the HoughCircles function in Python OpenCV to detect and measure the radii of some silica microsphere images. However, the detection rate isn't as high as I would like. I've tried playing around with the Canny edge detector parameters and the other parameters in the function as well as applying different blurs and thresholds but I'm still not quite happy.

Is there any way that I can change the edge detection method for the HoughCircles function to a Sobel edge detector? In that light, is the source code for the HoughCircles function available to view and to be modified?

Thank you for your help.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2017-06-24 01:03:29 -0500

berak gravatar image

opencv is a c++ library, the python bindings are only shallow wrappers.

so no, there's nothing you can change from python.

if you want to take a look, src code is here

edit flag offensive delete link more

answered 2017-06-24 14:08:41 -0500

akash29 gravatar image

Rather playing with the parameters of Canny Edge Detection use adaptive Canny Edge Detector. It will give a far better result. Adaptive Canny works on finding median over the image and uses that value for upper and lower threshold. You can go through this documentation:- Zero Parameter Auto Canny Detection:// I think this will help you find better edges.

edit flag offensive delete link more


that's a nice idea, unfortunately, all HoughXXX functions take grayscale images as input, and the Canny / Sobel passes are done inside those (c++) functions, so how would it work here ?

berak gravatar imageberak ( 2017-06-26 02:25:38 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-06-23 17:43:25 -0500

Seen: 217 times

Last updated: Jun 24 '17