Rather than using RGB, try using an HSL (Hue, Saturation, Lightness) or HSV (Hue, Saturation and Value) color model. Then experiment with different elements of bias, e.g. Hue being more important than luminance when you're calculating the distance.
I believe this may help (very similar problem): stackoverflow.com/questions/1678457/best....
Jon Skeet is right. You need to use a system with Hue as a component instead of RGB if you are concerned about the color component of the match differing too much. HSL or HSV will both work fine for this purpose.
Then you need to fiddle with the distance formula to weight up hue until you are happy with the results. Note that you will find the problem is actually essentially insoluble unless you have a large number of colors to match against or your input colors are confined to a small range of possible values. This is because although it might seem you can pin any color you want to one of 8 (red, orange yellow, green, blue, violet, black and white) or one of 16, in reality you'll find your algorithm will always find what seem to be obviously incorrect matches because with 3 axis of movement (hue, saturation, value or red, green, blue), there are a lot more "basic" colors than you might think at first glance.
1 The idea is, the sensor finds the "closest" color within a list of colors. The application of this problem is a robot which must detect splodges of 4 predetermined colors on a white background. – Eric Nov 12 '09 at 22:15 2 Depends on what "closest" means.
Green was closest to grey by RGB RMS error in your original code. So was it wrong? Given that you say yes, you are clearly imposing some other kind of idea of closest based upon color perception.
And I'm telling you will find you aren't really happy with the results until you have something like 64 well-chosen colors to match to. At least to the human eye. Your code presented should work for comparing to 4 predetermined splotches, assuming the splotches don't look too much like each other.
– Southern Hospitality Nov 13 '09 at 3:44.
I would think that if you treat colors as RGB coordinates in 3-space and compute distance from sampled to known values, you could determine the closest match. I probably would also try scaling R G B according to eye sensitivity (ie, Y = 0.3*R + 0.59*G + 0.11*B) you'd achieve the best result.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.