1 | initial version |
Take a photo of the cube so that you can see all the colors. Cut the image in parts so that each part contains one square. Take the mean in the H ans S channels for each square. You'll have two means for each color (Hi and Si where i=1..6). As the luminosity channel depends on the illumination, it's better to forget it.
Then, for a given pixel p, get the distance between the color and the means you got earlier: di=dist(Hp,Hi;Sp,Si). The smallest distance will give you the color you are looking for.
You can make your method more robust by computing the variance on each color, too.
You can get the min and max values for each color with the same method; but it will be less robust because the noise.