Detcting irregular circles with different sizes

Hi friends,
I am going to detect some circles with different size in an image. I already binarized the image and applied the cannyy edge detection. But still have problem in seprating the circles from the other object in the image. I will appreciate if you tell me how I can solve this problem? I attached the picture here.
Thank you,

Réponses (1)

David Young
David Young le 19 Fév 2015

0 votes

You could consider the Hough Transform. The best place to start is imfindcircles. There are also some circle Hough Transform implementations in the file exchange.
By the way, note that Canny edge detection should normally be applied to the grayscale image, not to a binarized image. It sounded like maybe you binarized then applied Canny, which is not usually the best approach.

6 commentaires

Thank you for your answer, As you said I applied imfindcircles. but as you see in the picture, the circles are not full circles and they are like a partial circle, so this command just gives me a full circle that may not detect the object it is really needed. Since I also want to get the center of these circles and accuracy is important, I need to detect them as accurate as possible. can you give me a solution regarding this issue?
Tank you
David Young
David Young le 20 Fév 2015
The CHT, used in imfindcircles, will detect circles even if they are only partially visible. It will return the centres of the full circles by finding a good fit to the part of the circle that is visible. It is pretty accurate, though I suppose you could refine the result to get sub-pixel accuracy using a least-squares fit.
I'm not sure exactly what the problem is with imfindcircles. Is it failing to detect the circles at all, or is it that you need sub-pixel accuracy?
Thank you for your answe, Actually, there is a radius range in imfindcircles that is needed to specify before applying thi command. so this command just fit a full circle on the areas where may not be the full circle. I mean sometimes this adjustment is not accurate. As far as I tried, It can detect many circles randomly depending on the sensitivity value and radius range, sometimes included the circles of interest sometimes not. Since I also need the subpixel accuracy, I found that it may not be a good option. Anyway, I will be thankful to let me know if you got any accurate results after applying this command on my image.
thank you,
David Young
David Young le 21 Fév 2015
Sorry, I won't be able to take this further, as it would be a substantial amount of work to determine the parameters that work best for your image, and it would need new coding to get a subpixel result.
Thank you david for your helps, I fortunately found a way through "regionprops" to solve this problem. This method can also give me subpixel accuracy.
Evidently you didn't understand David's answer. And though you can use regionprops to find blobs that are circular, you must have the blobs to begin with - and that is where the substantial work comes in that David and I just don't have time to help you with. Just using some edge detection or threshold will give you some blobs of course, but that doesn't mean those blobs are all the circles in the image and that no circles were missed during that segmentation.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by