Finding closest color (beyond basic colors)
I have 12 Duplo bricks in different colors and would like for the ColorSensor to tell which is which with good probability. Finding base colors like Blue, Red or Yellow is easy enough, but I would like to know the best way to find out other colors, like "light blue" or "black" (I even have a transparent Cyan one, but let's disregard this for now).
My current algorithm notes all brick colors (as recorded with the color sensor), then during program run converts the current RGB into Hue Saturation Value, and then does a closest match as below:
This works well for some bricks, and not so well for others (e.g. it can't really differentiate betwen red and brown).
Is there a better way?