How can find the cartesian coordinates of circle in a image

5 views (last 30 days)
Hello guys..
I have this image (attached in the post) that has two red circles... How can I find the cartesian coordinates of each circle ? Thanks

Answers (1)

Jon
Jon on 6 Aug 2015
Edited: Jon on 6 Aug 2015
First, convert the image to binary using im2bw. Then use bwboundaries to return each object boundary. The result of bwboundaries should be a 2-element cell (one for each blob). Each cell has two columns; the first is the y-coordinates, the second is the x-coordinates.
If you'll be doing any more image processing, you should really go through this very nice tutorial by Image Analyst: https://www.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial
EDIT: if you want ALL the x,y coordinates, not just the boundaries, after converting to binary just use
allcoords = find(BW);
Remember that y-coordinates are returned in the first column, x in the second.

Community Treasure Hunt

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

Start Hunting!