How can find the cartesian coordinates of circle in a image

1 次查看(过去 30 天)
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

回答(1 个)

Jon
Jon 2015-8-6
编辑:Jon 2015-8-6
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!

Translated by