Function for finding circle radius
3 views (last 30 days)
Show older comments
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!!!
0 Comments
Answers (2)
Image Analyst
on 18 Jun 2018
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).
0 Comments
Image Analyst
on 18 Jun 2018
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.
See my Image Segmentation Tutorial https://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
4 Comments
Image Analyst
on 19 Jun 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?
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!