What is the meaning of k means clustering of an image?

2 views (last 30 days)
I am doing a proj. on classifying faults using SVM. People advised me to use k-means for segmenting the images. I understand k-means for a normal data set but I don't quite understand the meaning when it comes to applying it for an image. Some brief explanation would help me.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Feb 2017
k-means can be applied to the image intensities, in order to find groups of similar image intensities. Instead of having to put specific numbers to the boundary between groups of intensities, you can say "break it into the best 3 groups" for example.

More Answers (1)

Image Analyst
Image Analyst on 6 Feb 2017
They basically will classify your image into two intensity classes, presumably/hopefully "normal" and "faulty" (foreground and background).
kmeans and SVM may find similar gray levels to distinguish (threshold) between the two intensity classes if your classes are well separated. And of course it's possible that neither will divide the image up into intensity classes that make sense to you. I'm attaching a kmeans example, and a PCA example. It may be quite possible that by designing your own thresholding algorithm you can do better than kmeans or SVM. For example I find that the majority of cases I deal with (single-model skewed histograms), a triangle threshold is a very good guess that matches well with what people would pick. If you want to have people pick, then I have a nice visual, interactive thresholding app in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Try the Classification Learner app on the Apps tab of the MATLAB tool ribbon. You can try kmeans, SVM, and others to see if any one of them is better than the others over a good selection of images that you expect to encounter.

Community Treasure Hunt

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

Start Hunting!