Get the Centroid of a specific object in an image
2 views (last 30 days)
I have a binarized image with a circle as shown below, and I wish to get the centroid of the circle.
Can anyone please guide me how?
I have tried with using 'regionprops' with 'Centroid', however it does not provide me the centroid of the circle but the centroid of the whole image.
props = regionprops(binaryImage,'Centroid');
boundingBox = props.Centroid;
Also, I tried using 'BoundingBox' with 'regionprops' as well. But I am not sure whether the value given is location of the circle or the centroid of it.
props = regionprops(binaryImage,'BoundingBox');
boundingBox = props.BoundingBox;
Thank you if anyone would like to help me.