Question

I have a simple template grayscale image, with white background and black shape over it, and I have several similar test images, I want to compare these two images and see if template matches any of the test images. Can you please suggest a simple(easy to use) pattern recognition library for C++ which takes two images and compares them and shows the result?

Was it helpful?

Solution

Just do image1-image2 for all pixels. Then sum up all the differences. The lower the results, the closer the images.

If your pattern could be of several sizes, then you have to resize it and check it for each positions.

OTHER TIPS

Implement a Neural Network on the image. Inputs should be the greyscales of your image. you should train your network to a train set, chose proper regularization parameters using a cross validation set, and finally test your network on a test set.

http://www.codeproject.com/Articles/13582/Back-propagation-Neural-Net

(I have done this myself to train a network to recognise hand written digits - it works very well.)

How simple the library you need is depends on the specific parameters of your problem. OpenCV is a great image processing library that should be able to do what you need it to. Here is a tutorial on template matching in OpenCV. It makes it very easy to switch between matching metrics and choose the best one for your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top