Ask Your Question
0

template matching in multiple images

asked 2013-03-29 06:27:05 -0600

Aditya gravatar image

How can i Access result from matchTemplate(InputArray image, InputArray templ, OutputArray result, int method) ???

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-03-29 06:52:15 -0600

updated 2013-03-29 06:59:00 -0600

Looking at the description of the actual method:

http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#cv.MatchTemplate

void matchTemplate(InputArray image, InputArray templ, OutputArray result, int method)

It states that the results are stored in a comparison results map.

Beneath the explanation you can find this text:

After the function finishes the comparison, the best matches can be found as global minimums (when CV_TM_SQDIFF was used) or maximums (when CV_TM_CCORR or CV_TM_CCOEFF was used) using the minMaxLoc() function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.

So basically try to find global maxima in the output map. This means you need to go over your output matrix and look for maximal values.

ADDITION 1

--> go read tutorial on template matching, it is all explained there:

http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html

edit flag offensive delete link more

Comments

And how am i supposed to do that ??? Sorry for asking such question, but i am new to this :( And thanx for replying.

Aditya gravatar imageAditya ( 2013-03-29 06:55:42 -0600 )edit

Look at my addition and except answers if they serve you well :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-29 06:59:38 -0600 )edit

Question Tools

Stats

Asked: 2013-03-29 06:27:05 -0600

Seen: 1,254 times

Last updated: Mar 29 '13