You can detect circles in an image using the Hough method.
The basic idea is to let each edge pixel vote for all the circles that can run through it, and then select the circles that receive a lot of votes. How many votes are needed for a circle to be selected? That’s tuneable. It depends on the image and the need. If you are getting a lot of false positives (circles that aren’t really circles), then you might want to consider increasing your voting threshold. If you are getting no circles, you might want to decrease it.
Similar to the voting threshold, there are other tunable parameters when doing circle detection using a Hough method. Each image/case requires different values for these parameters. This app lets you tune those parameters for a particular image.
The image on the left is the edge pixels used. The image on the right shows the circles found. Click ‘Browse’ to select your own image.
Use the app below or click here for the full screen version.