Hello everyone. I would be very grateful if anyone can help to see if there is any problem with the centroid extracted by this program.

1 view (last 30 days)
BW = imread('k.png');
s = regionprops(BW,'centroid');
centroids = cat(1,s.Centroid);
hold on

Accepted Answer

Rishabh Mishra
Rishabh Mishra on 21 Dec 2020
I have tried reproducing the issue on my end. I would state that you are following the correct method to extract the centroid of the given figure. The centroid coordinate so obtained is the mean of coordinates of all the contour points in the given image. I am attaching the image of the figure along with its centroid.
Hope this helps.

More Answers (0)


Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!