Reputation: 319
What is the best color space (like RGB, HSV, YIQ, XYZ, Lab) to use to cluster an image using K-Means Clustering Method to an image which has white background and more than one object which is other color except white background just like an image of some fruits over white cloth with sufficient light. Additional info: the cluster is determine as fixed as two cluster and the result of the segmentation are two clusters, the first is the background's cluster (white color of cloth) and the second is the object or some objects's cluster. Thanks before.
Upvotes: 5
Views: 3349
Reputation: 77454
All have their benefits and drawbacks.
For example, one might argue that a difference of 0.1 in R and a difference of 0.1 in B are the same, and thus RGB and Euclidean distance are appropriate. While in HSB, the Hue ranges from 0 to 360, while S and V range 0 to 1 (rescaling hue to 0-1 does not really solve this issue either!), and thus the whole euclidean distance is dominated by the Hue. Plus, a Hue of 355.5 and 0.5 are almost identical, but euclidean distance does not know of this wrap-around. I.e. don't use HSV with Euclidean distance (and thus, not with k-means!)
I'm not familiar enough with all the color spaces to be able to tell you which are an Euclidean space, and thus where Euclidean distance and k-means are appropriate. RGB probably is, and HSV (since it is cyclic in H) definitely is not. Lab from what I read is non-linear? But you need a linear space for k-means!
For HSB etc., Even if you had a distance function that takes care of the cyclic space and non-linearity, you cannot use k-means, unless you also fix the mean function. E.g. the mean of Hue 0.5 and 355.5 (both very close to red) is 179, approximately cyan. => k-means results will be nonsense.
Upvotes: 4
Reputation: 6797
I would go for Lab as it decorrelates luminance from chrominance information and you are most interested in chrominance information.
Upvotes: 4