Is this a image similarity problem?
I have developed a very similar system to do this. My algorithm was propriety, but luckily I am also aware of other well performing methods.

First of all, there are many publicly available commercial packages, such as this one. Yet, I would rather be informative on the algorithmic parts on how to implement such a system. According to my experimentation, one good algorithm is provided in the documentation of National Instruments Vision library. You can find it here and here. Their algorithm is also published:

Color characterization for image indexing and machine vision
Siming H. Lin, Dinesh Nair
Proc. SPIE 4116, Advanced Signal Processing Algorithms, Architectures, and Implementations X


You could also use other color similarity metrics. For that, I would refer to the surveys, such as:

Colour difference ∆E - A survey
Mokrzycki W.S., Tatol M.


or

[Similarity and Dissimilarity Measures][4]


Let me know in case you need more information.