Given an image of a billiard ball, I want to be able to tell what ball it is. The colors for the balls are reasonably known and don't often deviate from a few known exceptions. But what's the best way recognize a particular ball?
My approach is, given a picture that we know contains nothing but a billiard ball (no background, etc), is to map each pixel to a known color that we expect for billiard balls. Ideally, this mapping would only ever have white (all balls have some white), black (even less black, for the writing, except for the 8 ball), and the color of the ball that determines its number. So for the 2 ball, I would expect maybe 90% red, 7% white and 3% black, give or take. The approach has had some moderate success.
The problem is how to properly map the color of a pixel to one of the known colors. Hue alone works well for most, but for some (pink 4 + red 3), the hue can be the same, but with different saturation.
I feel I could possibly come up with my own set of rules for this, and tweak it for some time, but I wanted to see if there was any better option available. I've tried an implementation of CIE76, but it has had disappointing results. I'd like to not have to role my own implementation of a known algorithm, but can if there is a good explanation that is programmer friendly.
Advice, thoughts, or resources?