How to plot or mark the centroid of each cluster in the output image?

12 views (last 30 days)
MINO GEORGE
MINO GEORGE on 2 Sep 2021
Commented: Nadav Alkaslassy on 21 Jan 2022 at 21:35
I have used k means algorithm to cluster the image into 6. After this how can i view the centroids of each cluster in the image? Any help is appreciated

Answers (2)

Alamanda Ponappa Poovaya
Alamanda Ponappa Poovaya on 7 Sep 2021
I understand you want to plot the centroid of your clusters. You can use the second argument of kmeans() output. Please refer to the answer belwo, it seems to be similar to your question, as well as the documentation link
https://www.mathworks.com/help/stats/kmeans.html
  1 Comment
Nadav Alkaslassy
Nadav Alkaslassy on 21 Jan 2022 at 21:35
Can you provide a more clear answer to this please? The link you provided does not give a precise answer. The question is how to output the centroid locations.

Sign in to comment.


Sreedhar Arumugam
Sreedhar Arumugam on 7 Sep 2021
I am assuming you're using the built-in function of MATLAB to perform k-means clustering of your data.
[idx,C] = kmeans(data,6) % As you are dividing into 6 categories
The matrix C would be a 6x2 matrix containing the centroids of each cluster.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by