MATLAB: Centroid of an image

digital image processingshape analysis

I want to find the centroid of an image.How to proceed?

Best Answer

Hi,
did you mean 'find centroid of objects in an image'??
use regionprops with property : centroid
Eg : stat = regionprops(Ilabel,'centroid');
I = imread('coins.png');
Ibw = im2bw(I);
Ibw = imfill(Ibw,'holes');
Ilabel = bwlabel(Ibw);
stat = regionprops(Ilabel,'centroid');
imshow(I); hold on;
for x = 1: numel(stat)
plot(stat(x).Centroid(1),stat(x).Centroid(2),'ro');
end