How to use kmeans for an image

1 vue (au cours des 30 derniers jours)
Mathew Cherian Carathedathu
Mathew Cherian Carathedathu le 19 Déc 2011
Hi..
I need to apply kmeans clustering for a grayscale image (the clustering should be based on the value of the pixels and not the distance). I tried to apply the inbuilt function to do that but the documentation says I will get only a n-by-1 vector as the output. How do I then get the cluster values for each of the pixels?
Thank you,
Mathew

Réponse acceptée

Image Analyst
Image Analyst le 19 Déc 2011
Here's an example that you should be able to modify from color to grayscale rather easily: http://www.mathworks.com/products/demos/image/color_seg_k/ipexhistology.html

Plus de réponses (1)

Walter Roberson
Walter Roberson le 19 Déc 2011
What do you mean by "the cluster values" ? kmeans() returns the cluster number for each point (each row is considered a point) as the first output. That kmeans() cannot return the cluster probabilities, but the four-output version will return the distance from each point to each centroid.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by