Ask Your Question

Should I blur the template used in matchTemplate()?

asked 2013-08-24 17:09:30 -0600

MattiasR gravatar image

updated 2013-08-26 02:20:07 -0600

When I create a template to use wiuth matchTemplate, should I blur the template a bit, or should I use a nice and clean image?

I am matching a template containing parts of the face, could be a nose, mouth, eye or similar. Grayscale. Before I run the matchTemplate method I use a gaussianBlur on the original cam frame.

Do the "matchTemplate" blur the image & template? if not, then blur the template might be better?


edit retag flag offensive close merge delete


Small remark. We suggest not to use hashtags in the tags of your topic. They generate a lot of double tags, rendering the search and filter options useless. Keep this in mind at your next post, adjusted it for you now.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-26 02:21:23 -0600 )edit

I'm sorry about that. I guess that you mean tags with a '#'?? Didn't know what that meant so I just used that. But now I know :D, thanks for telling me!

MattiasR gravatar imageMattiasR ( 2013-08-27 04:23:13 -0600 )edit

Yes, it seemed to got to us about a month ago and now the forum is flooded with double tags. First step is to make people use normal tags, second one will be to remove the hashtag containing tags. You are welcome.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-27 04:30:22 -0600 )edit

1 answer

Sort by » oldest newest most voted

answered 2013-08-26 06:06:06 -0600

Jean-François Côté gravatar image

My understanding of the matchTemplate is that it's a very basic algorithm. It will move your template all over the image to find the best match. If you find a match that is over the specified threshold, it will return the position. If you blur the template, it will search for this blured template. Maybe it can help in your case but if your image is nice and clear, forget that.

By the way, if you are looking to find parts of face, there are already a ton of tools to do that in openCV. You should use the XML that have been trained with traincascade.exe and that are given with openCV code. The last time I checked, they can find nose, eyes, mouth, etc...

Hope it helps!

edit flag offensive delete link more



Like he said, using template matching for face recognition/detection has been researched and been thrown overboard since it doesn't work. You need to look for techniques that include face variation and scene variation. For this like at stuff like the Viola & Jones framework.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-26 06:10:41 -0600 )edit

I dont use the template matching method to detect/recognition. With the method I analyze movements & behaviour of the face. It works perfect but I wanted some understanding about the method. Thanks anyway for telling me! And thanks for the answer!

MattiasR gravatar imageMattiasR ( 2013-08-27 07:40:46 -0600 )edit

Question Tools


Asked: 2013-08-24 17:09:30 -0600

Seen: 768 times

Last updated: Aug 26 '13