Hough circles on edges

1.4k views Asked by At

I have the following image in which I've detected the borders, representing 7 circles. In my opinion, it is fairly easy to identify the circles on it, but I am having trouble detecting all circles with the opencv Hough transform. Here it is what I've tried:

img = cv2.imread('sample.png',0)
edges = cv2.Canny(img,20,120)
circles = cv2.HoughCircles(edges,cv2.HOUGH_GRADIENT,1,100,
                                param2=40,minRadius=0,maxRadius=250)

I either get the central circle, the outer one or a lot of circles, depending on the parameters I input on the function. Do you guys have a set of parameters that would output all the circles?

Thanks in advance circle borders

1

There are 1 answers

0
Fernando Bordignon On

Solved with this example from scikit-image adjusting canny thresholds to match the posted image and also the radii range. Thanks to @barny