views:

62

answers:

3

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

My first attempt was based purely on pythagorean distance within the three-dimensional RGB colour space - this wasn't massively succesful as most of the named colour points were at the edges of the space (eg Blue at 0, 0, 255), so, for most colours in the middle of the space, the named colour 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 colourspace - 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 colour 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 realise 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 colour 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 colour 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!

Tim

+5  A: 

Name that Color seems to determine the name based on both the RGB and HSL values, perhaps you could use something similar.

After having a quick look at the script, it seems to pick the color that is closest to the given color in terms of both RGB and HSL. It's basically just a big map of predefined colors and does nothing advanced, such as weighted values, but given the large amount of defined color names, it may be 'good enough', depending on your requirements.

Niels van der Rest
i love it : "Being a typical guy, I have no clue what the colors Lavender and Mauve look like. So I made this little app..."
Simon_Weaver
Aah, that's interesting! Good point regarding setting a large amount of colour names in order to find closer matches - will investigate!
mistertim
A: 

Is there a way of adapting bayesian networks to deal with probabilities that are continuous on the variable being tested?

Yes. I'm not the best person to answer how to do this, but there should be existing information on how to do this. Just use "continuous" during your search.

Carlos Rendon
A: 

For my answer, I'm going to think outside the Baysian box. If I had to tackle this problem, I would try one of three approaches:

1) Fuzzy logic, perhaps based on empirical data gathered from users. It's possible that fuzzy logic may capture, and make it easier to automatically infer, what people mean when they talk about color better than would crisp statistical measures. (There are also techniques which combine Baysian inference and fuzzy logic, IIRC.)

2) I once played around with the idea of using Kohonen networks to automatically classify colors. I didn't take it very far, but the early results were promising in that that networks tended to converge on solutions that were pleasing and intuitive from a human perspective. The nodes tended to cluster in patterns that seemed to correspond to human labels like "red," "orange," and had obvious transition zones like "red-orange."

3) I also did some experiments which used genetic algorithms to develop optimized pallettes for particular images. Again, I didn't take it very far, but the initial tests showed promise.

TechNeilogy