Find occurrences of smaller image in a bigger image

What procedure is needed if I want to find a template in an image?
A subimage in a bigger image?
For example in an image of a pdf with text, find all the occurrences of the letter “a”.

1 Like

Although I am not exactly sure, I think this is a classic pattern recognition problem in computer version, and it can be achieved by opencv-does not have to use DL.

If you’re not just working with text, you might be looking for image segmentation, e.g. faster r-cnn, which locates (& IDs) objects within an image.

See this forum for more examples & details

If you’re really just looking for smaller versions of an image in a bigger image, you should look into features like SIFT, SURF, ORB, etc.

It sounds like this tutorial is pretty close to what you’re looking for…

http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.html#py-feature-homography

Those won’t work on text (document image).

This is a computer vision problem but the old way is feature engineering, that’s why I’m asking for a DL method.

Don’t see why key point extraction wouldn’t work for your example (especially if looking for individual letters). You could also just do cross correlation with the letter at a few scales and rotations.

If all the same font, deep learning is really over powered for this problem.

The methods used in lesson 7 should work.

Any new code/projects for template matching?

Interesting.
I have an open source project to implement this feature: findimage .

By some pattern recognition algorithoms, the small template image will be found in the larger image, even if there’s little difference. But indeed, traditional methods are not well suited to the job. For example: If the image you are looking for is rotated by an angle, or if the text in it has changed font and color, it will not match.

There should be an smarter algorithom, maybe an an AI model to do it, but i haven’t find until now.