How to plot the centroids of kmeans in an image?

조회 수: 1 (최근 30일)
chang zhao
chang zhao 2019년 7월 24일
답변: Yogesh Khurana 2019년 7월 29일
I have a binary images (black and white) to cluster using
[idx, C] = kmeans(img, 3)
and now i want to plot the centroid in this image ,may i ask how to draw the centroids of kmeans?
should i expand the image into a column?

답변 (1개)

Yogesh Khurana
Yogesh Khurana 2019년 7월 29일
kmeans returns a numeric matrix containing Centroid location. Once you have locations you can plot these locations using plot function. I am assuming you want to plot these centroids on the same image as background. For that you can use MATLAB’s uistack function that reorders visual stacking of UI components. You can refer to following function’s documentations for more information:
Hope this helps!

태그

Community Treasure Hunt

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

Start Hunting!

Translated by