After that, if you need spatial centroids (x,y,z locations) in addition to color centroids (the RGB values of the color clusters' centroids), it's a simple matter to find centroids using bwlabel() and regionprops(), like in my BlobsDemo (http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 ).
Threshold the image into black and white, and then call regionprops on the black and white image to get the centroid property.
Note: if the black part is your information and the white part is background, then call regionprops on the logical negation of your black and white image,
Best Answer