<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265333</link>
    <title>MATLAB Central Newsreader - Template matchine with binary image</title>
    <description>Feed for thread: Template matchine with binary image</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 09 Nov 2009 09:25:19 -0500</pubDate>
      <title>Template matchine with binary image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265333#693160</link>
      <author>Prasanna </author>
      <description>Hi all,&lt;br&gt;
I am having a binary image &quot;I&quot; which is 480*640 size. &lt;br&gt;
And my templates are &quot;temp1&quot;(size 146*149 binary) and temp2 (size 96*96 binary). &lt;br&gt;
&lt;br&gt;
Now I want to match these 2 templates with image &quot;I&quot; and identify the matching locations in the image &quot;I&quot;.&lt;br&gt;
&lt;br&gt;
Please some one send me the MATLAB code for this. Because I'm not familiar with the this section. </description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 13:14:43 -0500</pubDate>
      <title>Re: Template matchine with binary image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265333#693195</link>
      <author>ImageAnalyst</author>
      <description>On Nov 9, 4:25&#160;am, &quot;Prasanna &quot; &amp;lt;pmgunaward...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; I am having a binary image &quot;I&quot; which is 480*640 size.&lt;br&gt;
&amp;gt; And my templates are &quot;temp1&quot;(size 146*149 binary) and temp2 (size 96*96 binary).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now I want to match these 2 templates with image &quot;I&quot; and identify the matching locations in the image &quot;I&quot;.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Please some one send me the MATLAB code for this. Because I'm not familiar with the this section.&lt;br&gt;
&lt;br&gt;
-------------------------------------------------------------------------------------------------------&lt;br&gt;
I'm not sure how long it will take, but if your templates are in the&lt;br&gt;
image (i.e. the version of the template in the image is not scaled or&lt;br&gt;
rotated) you can use the xcorr2() function in the Signal Processing&lt;br&gt;
Toolbox to do a cross correlation of the images.  This is a simple one-&lt;br&gt;
liner solution - actually a little more because you'd have to search&lt;br&gt;
the resulting array for the max using the find() function or similar&lt;br&gt;
alternate ways.  If you don't have that toolbox, you can easily write&lt;br&gt;
it yourself in a few lines (4 nested for loops in the spatial domain).</description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 18:39:04 -0500</pubDate>
      <title>Re: Template matchine with binary image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265333#693280</link>
      <author>Prasanna </author>
      <description>Thanks 4 replying. Below display the template matching code that I wrote. I did this using several demos those are in the MATLAB 2008a version. Here &quot;someblobsI&quot; means the binary image. &quot;Icropped&quot; means the template(which is also binary). no rotations and scalings happenning to both image and the template. Is this code relevant to my application or should I change something here?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
C = real(ifft2(fft2(someblobsI) .* fft2(rot90(Icropped,2),480,640))); &lt;br&gt;
&lt;br&gt;
figure, imshow(C,[]);&lt;br&gt;
max(C(:))&lt;br&gt;
&lt;br&gt;
thresh = 1000 ; % Use a threshold that's a little less than max.&lt;br&gt;
figure, imshow(C &amp;gt; thresh); % identification&lt;br&gt;
&lt;br&gt;
regards&lt;br&gt;
Prasanna</description>
    </item>
  </channel>
</rss>

