Find image position inside larger image

Basically, I want to find the pixel location of a small image inside a large image. I was looking for something similar to this, but no luck.

+6
c # image-recognition
source share
4 answers

It depends on how much you want the result to match your query. If you are trying to match the corresponding parts of different photorealistic images, see the Discovery feature on the Wikipedia page. What you want to use depends on what kind of transformation you expect one image to become another.

However, if you're looking for exact pixel matching, brute force searches are probably bad. This may be O(m^2*n^2) for the m*m image used to search in the n*n image. Using the best algorithms, it can be improved to O(n^2) , linear in the number of pixels. A good approach can be reduced by sampling both images and performing a hierarchical search.

+1
source share

Perhaps you can use the AForge Framework to do something like this. It offers many image processing tools. Perhaps you could use their blob extraction to extract the drop, and then compare these drops with the saved image that you have and see if they match.

0
source share

If the images are equal in half, you can start by looking for one pixel with the same color as the pixel (0,0) in the small image. Once you find, compare each pixel in the area that will be covered with a small image. If there are no differences, you have found your position. Otherwise, start over by looking for the next pixel match (0,0).

0
source share

A Booyer-Moore search sounds like a solution here if you treat your pixels as characters and are looking for an exact match. Much faster than pixel search.

0
source share

All Articles