Can K-Means be used to find colour clusters? My objective is to find the most common colours (HSV colour space) that occur in an image.
Can I give the function kmeans()
a comparison function to determine 2 colours distance between each other? Ie;
int sameColour(const Vec3b& color1, const Vec3b& color2)
{
return (abs(color1[0] - color2[0]) +
abs(color1[1] - color2[1]) +
abs(color1[2] - color2[2])) < 30;
}
This way I get the 'general' colour clusters in an image.