Friday, 28 March 2008

Identifying Colours

I've almost finished my Tamagotchi app. I have something that's alive for a bit getting hungrier, dirtier and older and can be fed, played-with and cleaned by taking pictures. The pet demands that you take a picture of something that is a specified colour to successfully play/clean etc. Unfortunately its colour matching seems slightly flawed - I've just taken pictures as follows:

Took Blue - Identified Blue
Took White - Identified Yellow (but reflection from green wall/shadows?)
Took Red - Identified Blue
Took Green - Identified Green
Took Black/Blue - Identified Red

Clearly something is not so great in my colour matching. I'm currently going through all the pixels in the image and identifying them as one of: black, white, grey, red, yellow, green, cyan, blue and magenta. I keep a count of how many pixels are of each colour and say that the picture is whatever the modal colour is. If two or more values are equally common then I return whichever of the most common colours appear first in the list of colours.

I guess I shall have to try a few more methods and see what works best.

No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...