MATLAB: Problem in kmeans, image segmentation algorithm.

clusteringimage processingImage Processing Toolboximage segmentationkmeans algorithmStatistics and Machine Learning Toolbox

In K-means clustering using tutorial
images we get after clustering are random as cluster centers are randomly selected. I am using this code to land use and land cover analysis where regions such as green/forest area, water area, soil area road area, built up area etc etc are clustered out as an output. Now, I want to use only green/forest area for further coding and since that clustered image, sometimes comes under cluster 1; sometimes under cluster 5/4/3/2; it is impossible to code further.
Can anybody help me in how to avoid random selection of cluster centers in kmeans.

Best Answer

You can do
... = kmeans(...,'start',M);
where M is a matrix of the initial locations of the centers (each row of M is a vector representing the location of one cluster center).
The other alternative would be to post-process -- look at the centroids returned and pick the one that is the most "green".