# AI / Statistical methods for determining the name of a colour

1 view

I'm thinking about writing a little library to guess the name of an (RGB value) color, from a predetermined list of candidates.

My first attempt was based purely on Pythagorean distance within the three-dimensional RGB color space - this wasn't massively successful as most of the named color points were at the edges of the space (eg Blue at 0, 0, 255), so, for most colors in the middle of the space, the named color that it was closest too was fairly arbitrary.

So, I'm thinking about better approaches and have come up with a few candidates

• Cylindrical distance within an HSV color space - which may well have similar problems to the above, however, HSV seems to be more meaningful in a human sort of sense than RGB, which could be useful.

• Either of the above, but with each named color point being weighted with an arbitrary value that denotes the strength of its attraction to points in the surrounding space. is there a name for such a model? I realize this is a bit vague, but it seems like a fairly intuitive idea to me.

• A Bayesian network that examines properties of an HSV colour and returns the most likely colour name (I'm imagining nodes similar to, for instance P(Black | Saturation < 10), P(Red | Hue = 0), However, this seems less than ideal - for instance, the probability that a given color is red is proportional to how close its hue is to 0, rather than being a discrete value. Is there a way of adapting Bayesian networks to deal with probabilities that are continuous on the variable being tested?

• Finally, I was wondering if some sort of Support Vector Machine-based classification within either the HSV or RGB color space, but not being massively familiar with these, I'm unsure whether this will offer any particular advantage over the Pythagorean distance-based approach I tried originally, especially as I'm only dealing with a three dimensional space.

Therefore, I was wondering, do any of you have any experience with similar problems or know of any resources that might be able to help me to decide on an approach? If anyone could point me in the right direction (whether it's one of the above, or something entirely different) I'd be extremely grateful.

Cheers!

by (67.6k points)

It seems to select the color that is closest to the given color in terms of both RGB and HSL. Name that Color appears to determine the name based on both the RGB and HSL values, perhaps you could use something similar. It's just a big map of predefined colors and does nothing advanced, such as weighted values, but given a large number of defined color names, it may be 'good enough', depending on your requirements.