MATLAB: Image segmentation using k means clustering

color segmentationdiscriminant analysisImage Processing Toolboximage segmentationk means clusteringStatistics and Machine Learning Toolbox

Hello, I have a question and I appreciate your help. I don't know how to use a kmeans clustering results in image segmentation. I have an RGB image of a tissue which has 5 colors for 5 biomarkers and I need to do k means clustering to segment every color in a cluster. Thank you so much for your help.

Best Answer

I'm attaching a color kmeans demo that doesn't require a recent version of the stats toolbox or image processing toolbox.
Personally I don't think kmeans works that great (perhaps because it's untrained), as you'll probably see, and you might try a trained discriminant analysis instead. I attach demos for both.