I used to find centroid of a single image. My area of interest was in black color.
Code for centroid of single image:
I = imread('images\img1.jpg');
Ibw = im2bw(I2);
Ibw = imfill(Ibw,'holes');
Ilabel = bwlabel(Ibw);
stat = regionprops(~Ilabel,'centroid');
imshow(I2); hold on;
for x = 1: numel(stat)
plot(stat(x).Centroid(1),stat(x).Centroid(2),'ro');
end