Opencv finds image cordinates on another image

How to find the image The coordinates "A" on the image "B", which contains the image "A".

I wrote this program that checks only pixel values, does anyone know if there is any library tool.

+7
source share
3 answers

As Throwback1986 suggested, you probably want to use matchTemplate . Here is one of my answers showing how to detect the sun from a virtual spaceship. Here is the new OpenCV tutorial on using matchTemplate . Now there are some caveats for using the matchTemplate approach. If image β€œA” can be in any position (for example, zooming, rotation, perspective, etc.) on image β€œB”, then matchTemplate will not work very well. If this happens, you will want to use the function discovery route, as suggested by Adrian Popovich.

+6
source

You should take a look at the last 3 tutorials at this link: http://opencv.itseez.com/doc/tutorials/features2d/table_of_content_features2d/table_of_content_features2d.html

I don't think pixel checking is a good approach.

+5
source

You might consider something like pattern matching, as described in this tutorial .

A rougher approach is to β€œslide” the image. Gradually over the image B searches for the point of least difference. (Note that this assumes that image A is some fairly small subset of image B.) You can use the cvNorm function to calculate, which is equivalent to calculating the sum of squared differences (SSD). Use parameter CV_L1. Here is a link describing the use of SSD in image correlation.

0
source

All Articles