Sorry, this content is no longer available

Ask Your Question
0

template matching in multiple images

asked Mar 29 '13

Aditya gravatar image

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

Preview: (hide)

1 answer

Sort by » oldest newest most voted
1

answered Mar 29 '13

updated Mar 29 '13

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

Preview: (hide)

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 (Mar 29 '13)edit

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

StevenPuttemans gravatar imageStevenPuttemans (Mar 29 '13)edit

Question Tools

Stats

Asked: Mar 29 '13

Seen: 1,349 times

Last updated: Mar 29 '13