Template matching giving incorrect location
When i perform the openCV template matching, i for some reason get my min location to be at the upper left corner, and my max location to be at the upper right corner, which is not where my template is.. I don't why i doesn't perform like that..
it implemented as such.
The full code can be viewed on my github. https://github.com/Keerthikan/PTU-Fac...
The image is a gray image, and it doesn't matter which method i use.. The result is always the same.. what am I doing wrong?
Here is some test images http://imgur.com/2iooqbI
It would be better to understand your issue if you post some sample images and results.
http://imgur.com/2iooqbI... The circle in the source shows the maxLoc.
It seems that you have a list of points and you compute matchTemplate on a small window around the location of each point. I think that the common approach to perform template matching when I see your image is to directly use matchTemplate with the whole template image like in this tutorial.
I will add the full code now.. I changed somethings and made it move to some other location.. But it doesn't work as i had expected, i was hoping that the maxLoc would be the center position of where the patch fits.. I don't understand why it says that it is corner that has max location.
"I don't understand why it says that it is corner that has max location."
You should look at this: If image is WxH and templ is wxh , then result is (W-w+1)x(H-h+1). It is just a question of coordinates change between the result image size and the input image size.
But it doesn't say what that coordinate is... I mean is it the center of the face, top, tl, br? It still doesn't place the circle where i expect it be.. which the center of where the template matches.m