find the center of the circle in image

4 views (last 30 days)
mathScience
mathScience on 22 Feb 2015
Commented: Image Analyst on 22 Feb 2015
Hello,
I am trying to find the center of the circle by just clicking inside of the circle.
I learned how to get the position where I clicked with
[x, y] = ginput
and how to find the center of circle with
[centers, radii] = imfindcircles(image,[Rmin Rmax])
But, what I want to do is to find the center of a circle by clicking anywhere inside a circle when I have many circles in the image.
Please let me know if you have any advice.
Thank you

Answers (1)

Image Analyst
Image Analyst on 22 Feb 2015
It depends on what information you have. Do you have a list of each circle that exists? Like an N by 3 array of x,y,radius? If so, just see which x,y in the array is closest to where you clicked. Do you have an image of circles? You might need to segment the image until you get an array of x,y,radius locations of every circle in the image. See my Image Segmentation Tutorial in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. What kind of data are you starting with? Please read this and then attach a screenshot.
  2 Comments
mathScience
mathScience on 22 Feb 2015
I would like to find the center of circle although I don't know any information about the circles. What I want to do is click anywhere inside a circle and get information (mainly center of the circle) about the circle I clicked.
The image below is the example of circles. Circles with different positions and radius.
Thank you
Image Analyst
Image Analyst on 22 Feb 2015
That's EXACTLY what my tutorial does that I referred you to. Did you look at the link and see the tutorial? Here is a link to the one,specific tutorial that you need: http://www.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial---blobsdemo-- Just replace the image with your image and you should be ready to go.
See the numbers? I put those at the centroids.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!