Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!s15g2000yqs.googlegroups.com!not-for-mail
From: ImageAnalyst <imageanalyst@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Template matchine with binary image
Date: Mon, 9 Nov 2009 05:14:43 -0800 (PST)
Organization: http://groups.google.com
Lines: 22
Message-ID: <46a9efa9-2038-421f-a08a-7375c8a5925e@s15g2000yqs.googlegroups.com>
References: <hd8n5u$au1$1@fred.mathworks.com>
NNTP-Posting-Host: 192.44.136.113
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1257772483 29883 127.0.0.1 (9 Nov 2009 13:14:43 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 9 Nov 2009 13:14:43 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: s15g2000yqs.googlegroups.com; posting-host=192.44.136.113; 
	posting-account=0rLUzAkAAABojYSRC64DkTbtiSCX77HH
User-Agent: G2/1.0
X-HTTP-Via: 1.1 bdci2px (NetCache NetApp/6.0.7)
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
	CyberSafe-IWA-Enable; .NET CLR 1.1.4322; .NET CLR 2.0.50727; MS-RTC LM 8; 
	.NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 
	3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:583529


On Nov 9, 4:25 am, "Prasanna " <pmgunaward...@gmail.com> wrote:
> Hi all,
> I am having a binary image "I" which is 480*640 size.
> And my templates are "temp1"(size 146*149 binary) and temp2 (size 96*96 binary).
>
> Now I want to match these 2 templates with image "I" and identify the matching locations in the image "I".
>
> Please some one send me the MATLAB code for this. Because I'm not familiar with the this section.

-------------------------------------------------------------------------------------------------------
I'm not sure how long it will take, but if your templates are in the
image (i.e. the version of the template in the image is not scaled or
rotated) you can use the xcorr2() function in the Signal Processing
Toolbox to do a cross correlation of the images.  This is a simple one-
liner solution - actually a little more because you'd have to search
the resulting array for the max using the find() function or similar
alternate ways.  If you don't have that toolbox, you can easily write
it yourself in a few lines (4 nested for loops in the spatial domain).