k-means clustering in Image Processing

2 ビュー (過去 30 日間)
Hafiz Muhammad Tayyab Abbas
Hafiz Muhammad Tayyab Abbas 2021 年 6 月 27 日
コメント済み: Image Analyst 2021 年 6 月 28 日
Hi, i'm doing k-mean clustering on an image (fruit tree image) with k=4 clusters. when i display 4 clusters seperately, fruits goes to cluster1, stem goes to cluster 2, leaves goes to clster3 and background goes to cluster4. i'm further interested in fruit clutser only. the probelm is when i change image to another fruit tree image, fruit cluster goes to cluster2 or sometimes to clsuter3 or 4. my wish is to not change the cluster for fruit, means if fruit is in cluster1 it should be in cluster1 in all images of fruit tree. how can i do that? 2ndly if its not possible i want to select that cluster automatically which contains fruit. how can i do that? thanks in advance.

回答 (1 件)

Image Analyst
Image Analyst 2021 年 6 月 27 日
You're right - the class numbers are random. You can reorder your clusters to the class number you want after you've called kmeans. See attached demo.
In the above demo, the original class numbers are shown on the left. But let's say I wanted them to go in order of distance from the origin. So I relabeled them and got the cluster labels shown on the right.
  2 件のコメント
Hafiz Muhammad Tayyab Abbas
Hafiz Muhammad Tayyab Abbas 2021 年 6 月 28 日
編集済み: Hafiz Muhammad Tayyab Abbas 2021 年 6 月 28 日
Great work, but how it work for images using imsegkmeans? as i want same process for images. Thanks in advance for help.
Image Analyst
Image Analyst 2021 年 6 月 28 日
I don't know. Try it and see.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by