K-means clustering

2 views (last 30 days)
RAVI CHANDRA
RAVI CHANDRA on 23 Apr 2016
Commented: Image Analyst on 23 Apr 2016
I'm using K-means clustering to segment the image that consists of a hand into three clusters. A cluster consists of only hand part and second the background and third cluster is remaining similar pixels. Every time I run the code it randomly chooses the contents of each cluster. Is there any method through which I can identify the cluster that contains the hand from the three since I need to use the clustered hand for further processing in my same code. Thank you.

Accepted Answer

John D'Errico
John D'Errico on 23 Apr 2016
Since k-means uses a random start, the clusters have no particular order they come out in. Therefore, you need to identify which cluster is a hand.
Surely there are features about a hand that make it different from the background? Color perhaps, or shape. You need to start thinking about what makes a hand a hand.
  1 Comment
RAVI CHANDRA
RAVI CHANDRA on 23 Apr 2016
Thanks for suggestion. I tried by calculating mean value of pixels of the clustered images but its not seeming that helpful. Could you help me with any method directly to select that cluster because its the only part left in my project.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 23 Apr 2016
What are the features you're passing to kmeans()? Are you passing all the red, green, and blue values of all pixels in the image? Okay, then if sometimes it comes out that the hand is cluster #1, and sometimes it's #2 or #3, you need to look at the mean RGB value of the pixels it identified as each class. This is what John is saying. For example, if it's skin tone, you will know in advance that the mean red value of the pixels identified in a particular cluster will be higher than the mean green value and that will be higher than the mean blue value. And let's say the background was black, so if the mean R, G, and B are all less than 40 gray levels or whatever, then that cluster must be the "black" cluster. And let's say you had lights or sky in there. If the mean RGB values were all over 200 or whatever, then that must be the "lights" cluster. So, like John said, you will know some information in advance that will help you decide if the skin/hand is cluster #1, cluster #2, or cluster #3.
  2 Comments
RAVI CHANDRA
RAVI CHANDRA on 23 Apr 2016
Thank you. if you don't mind could you share it in coded format. It might be helpful.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!