I am doing color based segmentation using kmeans clustering.I am using inbuilt function of matlab(kmeans).My input image has object and background where I need to segment the object. so I am using cluster value as 2.But while doing this, for few images, the background has a cluster index of 2 and object as 1 while in some other images, background has cluster index 1 while object 2. How does K-means clustering decide the index for clusters? If there are to be two clusters, will the background be labeled with number 2 and object with 1 or vice-versa?
MATLAB: K-means Clustering
image processingk means clustering
Best Answer