Ask Your Question

how to use the opencv matching template to load multiple images and one template

asked 2013-04-29 04:46:17 -0500

wovra gravatar image

updated 2013-04-30 01:44:25 -0500

Hi everyone,

How to use the opencv matching template to load multiple images and one template?

For my example I try to look at messi in barcelona football team and in the team of Argentina, then it works with

. / MatchingTemplate barca.jpg messi.jpg (I think messi)

but if I try

. / MatchingTemplate barca.jpg argentina.jpg messi.jpg" (it does not work)


I executed by (./MatchinngTemplate image1 image2 image3, ... mytemplate) in linux with cpp I work with the basic source code of MatchingTemplate

edit retag flag offensive close merge delete


if Template Matching not working. I will work with what function?.

I personally think I have to work with facial recognition

wovra gravatar imagewovra ( 2013-04-29 05:20:59 -0500 )edit

hi, i think maybe you can use list.add(image) method & for loop then use matching template.

wuling gravatar imagewuling ( 2013-04-29 09:20:55 -0500 )edit

but the problem is that I need to make a facial reconaisance (Matching template compares only one area of ​​an image with the image model).

wovra gravatar imagewovra ( 2013-04-29 09:24:40 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2013-04-29 23:40:38 -0500

NightLife gravatar image

The solution that I can suggest you is using "vector <mat> images" to load simultaneously every number of image and then compare the template with each element of vector.

edit flag offensive delete link more

answered 2013-04-30 10:33:54 -0500

unxnut gravatar image

The problem with creating avector is that you are going to have to set aside a large amount of memory to hold images. And the example you suggested above kind of supports that. I'll suggest that you turn it around to

./MatchingTemplate messi.jpg barca.jpg argentina.jpg ...

This way, you will read the template first. Then, you can read in the images one by one and look for the template in those. You can continue as long as you have arguments and reuse the memory to hold the images one by one. You can hold the names of the images, and any other relevant data, in the vector.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-04-29 04:46:17 -0500

Seen: 407 times

Last updated: Apr 30 '13