File Exchange

image thumbnail

Template Matching

version 1.0 (55.1 KB) by

finding template image inside a target image



View License

two functions used to implement template matching. the program finds the template image inside the target image using correlation.

Comments and Ratings (15)

Tuong Nguyen


Hey Alaa Eleyan,

I'm Thilina a Software Engineering Student. And Im a starter in Image Processing.
I would like to know what do you mean by Power of The Image and DC components in your implementation of Template Matching. I would like get hear from you very soon.

Thank you for the time.



Ahmad (view profile)

did you try fast-fourier?

pham bao

hi.It's verry slow. We can using Fast-Fourier.

john john

perfect =)

may i know the whole coding for this template matching? now i'm doing the project is similar to this...i'm no idea how to do ... thanks


Aiden (view profile)

hi.. how do you find multiple letters in the template file?

need help


Hanaa (view profile)

Hi Everyone,

This is great. But how do you detect facial features using template matching?

I'll be very grateful for your help. Thanks! :)

Chen yuan

one of the code in tmp.m file: M(i,j)=corr/sqrt(sum(sum(Nimage.^2))) that used for Nimage(target image) normalization, whether is it lack of a normalizated for image22(template image)? i modified M(i,j):M(i,j)=corr/sqre(sum(sum(Nimage.^2))) *sum(sum(image22.^2)))) , is it necessary?

Lee Borland

Hi there.

Can I ask how to implement this? When you say 2 functions are used, which 2? And you're trying to match image2 to image1? I have to match a scale marking in my image(scale is 10mm). So if i have an image of just the 10mm marking, i call it "image2" and then just rename my origional "image1"??

Sorry, little confused.


Jessica Keating

Hello!this was quite useful to me. But the detection ends once it finds one instance. Is there a way to mark a rectangle over all the instances that it finds?

Legesse Zerubabel

MATLAB Release
MATLAB 7.1.0 (R14SP3)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video