Path: news.mathworks.com!not-for-mail
From: "Dave Robinson" <dave.robinson@somewhere.biz>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Template Matching
Date: Thu, 3 Apr 2008 10:52:02 +0000 (UTC)
Organization: STFC Rutherford Appleton Laboratory
Lines: 41
Message-ID: <ft2csi$o0j$1@fred.mathworks.com>
References: <fsnera$t69$1@fred.mathworks.com> <26b8ffaf-1a49-4276-826a-6941f16bb5e8@y21g2000hsf.googlegroups.com> <5bd63180-92b7-401f-acac-fe5c63f19d7d@q27g2000prf.googlegroups.com>
Reply-To: "Dave Robinson" <dave.robinson@somewhere.biz>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1207219922 24595 172.30.248.35 (3 Apr 2008 10:52:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 3 Apr 2008 10:52:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 968489
Xref: news.mathworks.com comp.soft-sys.matlab:460788


androalpha_v7@yahoo.com wrote in message <5bd63180-92b7-
401f-acac-fe5c63f19d7d@q27g2000prf.googlegroups.com>...
> thanx ImageAnalyst;
> 
> the image i will use is in grayscale..
> can u all suggest the other matching 2 image techique 
that available
> in MAtlab

Providing that the subimages you are searching for do not 
rotate, and are the same scale as your templates, then 
probably an efficient way of doing what you want is to use 
fast correlation.

Take your three template images, and place them in a blank 
frame which has the same size as the image you are scanning.

Do a 2D fast Fourier transform on your search image, and 
your three buffered template images. Multiply pixel by 
pixel (.*) the Fourier domain version of your search image 
(remember these will be complex numbers) by the complex 
conjugate of the Fourier transforms of your buffered 
template images inturn. The inverse transform of these 
three product transforms which will show a bright spot at 
the point where your template exists within your search 
image.

If your target position is close to the edge, then you 
should increase the size of your 'blank buffer' frames to 
m+n-1 where m is the size of your search image, and n is 
the size of your templates. In this case embed your search 
image into an identical buffer frame.

From memory I think that the Filter operation (imfilt()?) 
in the image toolbox does this complete operation for you, 
but you must remember to set the operation to undertake 
correlation - not convolution.

Regards

Dave Robinson