Function for finding circle radius

Hello everyone,
I've made a diffraction experiment in which I got diffraction circles, and I need to measure the radius. For the task, I've taken pictures of the circles, and I'm trying to measure the circles with Matlab. For this, the camera was always in the same position, and I've taken a picture of a ruler so then I can relate pixels to length.
To measure the radius, first I thought of adjusting a function of a circle (f(x,y)=R^2((x-x_0)^2+(y_0)^2)), being the domain (x,y) the points of the image and the value f(x,y) the intensity of the image at that point. I thought of using the function fit, but I had problems at this point defining the fitType paramter. Is this a right aprroach? Should I fit a function or rather maximize one? I had doubts about this.
I did a little more research, and I found at this link https://la.mathworks.com/help/images/examples/detect-and-measure-circular-objects-in-an-image.html a Matlab tutorial for detecting circles with the function imfindcircles. However, the function did not work, as I suspect it only works with solid circles. Does someone know another function that can help me, or made one that can be useful?
I attach pictures of the circles. Any help is appreciated.
EDIT: Sample picture added
Thanks!!!

Réponses (2)

Image Analyst
Image Analyst le 18 Juin 2018

0 votes

Please unzip one of the images and attach it in your original message so we can see it more easily (there are many who won't bother to unzip and then load your image).
Image Analyst
Image Analyst le 18 Juin 2018

0 votes

How do you define when the circle "ends"? Some brightness level? See my attached demos to get the average radial profile. Use it to find a good threshold. It's somewhat of a judgment call since the radius is fuzzy - not sharp. Then threshold and use regionprops to get the Equivalent Circular Diameter.

4 commentaires

Miguel Perez Andrade
Miguel Perez Andrade le 19 Juin 2018
Hello Image Analyst,
Thanks for the quick answer!
Regarding the paper you shared, it looks very useful for an efficient implementation of an elipse detector, but on this occasion unfortunately I don't have the time to implement it.
Your tutorial is really complete and useful. I haven't finished reading it, I will have to end it tomorrow, but for what i have read, I think I need a different approach for my problem. In your demo, I understand (I may be wrong, as I'm totaly newbie here, and I even don't understand terms like "blob" or "connected component") that your strategy is separating the image in regions, identifing those regions and then getting the properties of those regions. In my image, I think that is not possible, as the circles are concentrical. And even if they weren't, they aren't "solid" circles, as the circle is just in the boundary, and the inside does not have any particular property (it's not like a coin, it's just a circle on a screen). So I don't think the functions you used are suitable for this problem. Anyway, I still have to finnish reading your tutorial, but I'm really short on time, so any extra help is apreciated.
Thanks again!! I will post any advance/news in this topic.
Image Analyst
Image Analyst le 19 Juin 2018
Are you saying that you need to measure multiple circles on each image? Also, are you saying that thresholding to find circles based on their intensity is no good? If not, then why not and what do you think it is, if not intensity, that defines the circle(s)?
Miguel Perez Andrade
Miguel Perez Andrade le 19 Juin 2018
I realize I've been expressing myself wrongly: what I need to measure aren't circles, they are rings. What I need is the radius of the rings that are seen in the picture, that are 2 in all cases. Maybe this distinction betwenn circles and rings makes the problem more clear
Image Analyst
Image Analyst le 19 Juin 2018
So you want the inner and outer radius of the outermost two rings?
And why don't you think thresholding is the way to go? Why can't you just threshold, clean up a bit to get only two rings and get rid of noise, then call bwboundaries(), and pass the boundaries into the FAQ code to get the center and radius of the inner and outer boundaries?

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