My complete Code:
function mesh
ImageFile=('GIST_S16_03.tif');
RGB = imread(ImageFile);
GRAY = rgb2gray(RGB);
threshold = adaptthresh(GRAY,0.613);
BW = imbinarize(GRAY, threshold);
BW = ~ BW;
binaryImage = imfill(BW,'holes');
binaryImage = bwareaopen(binaryImage, 800);
[labeledImage, numberOfObjects] = bwlabel(binaryImage);
filledImage = imfill(binaryImage, 'holes');
boundaries = bwboundaries(filledImage);
figure
imshow(labeledImage);
title('Binary Image with centriods');
hold on
s = regionprops(labeledImage,'centroid');
centroids = cat(1, s.Centroid);
x=centroids(:,1);
y=centroids(:,2);
plot(x,y, 'r*');
for blobNumber = 1 : numberOfObjects
thisBoundary = boundaries{blobNumber};
plot(thisBoundary(:,2), thisBoundary(:,1), 'r', 'LineWidth', 2);
overlayMessage = sprintf('%d',blobNumber);
text(centroids(blobNumber,1), centroids(blobNumber,2), ...
overlayMessage, 'Color', 'g','FontSize',14);
end