Task: I have a camera mounted on the end of our assembly line, which
captures images of produced items. Let’s for example say, that we
produce tickets (with some text and pictures on them). So every
produced ticket is photographed and saved to disk as image. Now I
would like to check these saved images for anomalies (i.e. compare
them to an image (a template), which is OK). So if there is a problem
with a ticket on our assembly line (missing picture, a stain,…), my
application should find it (because its image differs too much from my
template).
Question: What is the easiest way to compare pictures and find
differences between them? Do I need to write my own methods, or can I
use existing ones? It would be great if I just set a tolerance value
(i.e. images can differ for 1%), put both images in a function and get
a return value of true or false 🙂
Tools: C# or VB.NET, Emgu.CV (.NET wrapper for OpenCV) or something similar
I’d recommend looking at AForge Imaging library as it has a lot of really useful functions in it for this type of work.
There are several methods you could use:
Also you need to make sure you know which parts of the ticket are more important. For instance I guess that a missing logo or watermark is a big problem. But some areas could have variable text, such as a serial number and so you’d expect them to be different. Basically you might need to treat some areas of the image differently from others.