k-means clustering in Image Processing

2 Ansichten (letzte 30 Tage)
Hafiz Muhammad Tayyab Abbas
Hafiz Muhammad Tayyab Abbas am 27 Jun. 2021
Kommentiert: Image Analyst am 28 Jun. 2021
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.

Antworten (1)

Image Analyst
Image Analyst am 27 Jun. 2021
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 Kommentare
Hafiz Muhammad Tayyab Abbas
Hafiz Muhammad Tayyab Abbas am 28 Jun. 2021
Bearbeitet: Hafiz Muhammad Tayyab Abbas am 28 Jun. 2021
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 am 28 Jun. 2021
I don't know. Try it and see.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by