<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>jagged tooth v2.1 &#187; pattern recognition</title>
	<atom:link href="http://incisors.wordpress.com/tag/pattern-recognition/feed/" rel="self" type="application/rss+xml" />
	<link>http://incisors.wordpress.com</link>
	<description>Blog for AP 186</description>
	<lastBuildDate>Mon, 06 Oct 2008 13:54:14 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='incisors.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/ddf399ffdf73266657059c785470b710?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>jagged tooth v2.1 &#187; pattern recognition</title>
		<link>http://incisors.wordpress.com</link>
	</image>
			<item>
		<title>Activity 6: Fourier Transform Model of Image</title>
		<link>http://incisors.wordpress.com/2008/07/08/activity-6-fourier-transform-model-of-image/</link>
		<comments>http://incisors.wordpress.com/2008/07/08/activity-6-fourier-transform-model-of-image/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 03:15:50 +0000</pubDate>
		<dc:creator>jptugaff</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[convolution]]></category>
		<category><![CDATA[correlation]]></category>
		<category><![CDATA[edge detection]]></category>
		<category><![CDATA[fourier]]></category>
		<category><![CDATA[pattern recognition]]></category>

		<guid isPermaLink="false">http://incisors.wordpress.com/?p=48</guid>
		<description><![CDATA[Activity 6-A: Familiarization with discrete FT
Doing the Fourier transform on a circle  :

yields

However, the FFT algorithm inverts the quadrants of the FT plane and this has to be corrected using the fftshift() command. This process yields the correct FT of a circle whose analytical solution is the Airy circle, as shown in the figure [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=incisors.wordpress.com&blog=3941311&post=48&subd=incisors&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Activity 6-A: Familiarization with discrete FT</strong></p>
<p>Doing the Fourier transform on a circle  :</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/circle.png"><img class="size-medium wp-image-49 aligncenter" src="http://incisors.files.wordpress.com/2008/07/circle.png?w=128&#038;h=128" alt="" width="128" height="128" /></a></p>
<p style="text-align:left;">yields</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/fftcircle.png"><img class="size-medium wp-image-50 aligncenter" src="http://incisors.files.wordpress.com/2008/07/fftcircle.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p style="text-align:left;">However, the FFT algorithm inverts the quadrants of the FT plane and this has to be corrected using the fftshift() command. This process yields the correct FT of a circle whose analytical solution is the Airy circle, as shown in the figure below</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/fftfftcircle.png"><img class="size-medium wp-image-52 aligncenter" src="http://incisors.files.wordpress.com/2008/07/fftfftcircle.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p style="text-align:left;">Performing an FFT on th FFT of an image results to the original image, and is one of the properties of FFT. The image below indeed confirms this.</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/fftshiftcircle.png"><img class="size-medium wp-image-51 aligncenter" src="http://incisors.files.wordpress.com/2008/07/fftshiftcircle.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p><em>I = imread(&#8216;circle.bmp&#8217;);<br />
Igray = im2gray(I);<br />
FIgray = fft2(Igray); //remember, FIgray is complex<br />
h=scf(1);<br />
imshow(abs((FIgray)), []); xset(&#8220;colormap&#8221;, hotcolormap(64));<br />
h=scf(2);<br />
imshow(abs(fftshift(FIgray)),[]); xset(&#8220;colormap&#8221;, hotcolormap(64));<br />
h=scf(3);<br />
imshow(abs(fft2(FIgray)), []); xset(&#8220;colormap&#8221;, hotcolormap(64));<br />
</em></p>
<p style="text-align:center;">-oOo-</p>
<p style="text-align:left;"><strong>Convolution</strong></p>
<p style="text-align:center;">Convolution is process wherein the product of two functions f and g has the effect of transforming f and g.</p>
<p style="text-align:center;"><a href="http://upload.wikimedia.org/math/2/2/4/224e6196394ee9f310ff19ebd4479499.png"><img class="aligncenter" src="http://upload.wikimedia.org/math/2/2/4/224e6196394ee9f310ff19ebd4479499.png" alt="" /></a></p>
<p style="text-align:left;">Also, the convolution theorem states that the Fourier transform of a convolution is the product of the individual Fourier transform times a constant <em>k</em>.</p>
<p style="text-align:left;">In optics, this concept can be applied to lenses wherein we have an original image <em>f</em> and a lens <em>g</em>. Thus, with a finite lens, we can never reconstruct an image 100%.</p>
<p style="text-align:left;">We obtain the FT of the letter J and obtained</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/jfft.png"><img class="size-medium wp-image-53 aligncenter" src="http://incisors.files.wordpress.com/2008/07/jfft.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p style="text-align:left;">After fftshift, we had</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/jfftshift.png"><img class="size-medium wp-image-54 aligncenter" src="http://incisors.files.wordpress.com/2008/07/jfftshift.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p style="text-align:left;">And doing an fft again results to an inverted J.</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/jfftfft.png"><img class="size-medium wp-image-55 aligncenter" src="http://incisors.files.wordpress.com/2008/07/jfftfft.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p style="text-align:left;">We  now convolve the image with a circular aperture and this results to:<a href="http://incisors.files.wordpress.com/2008/07/jconvolution.png"><img class="size-medium wp-image-56 aligncenter" src="http://incisors.files.wordpress.com/2008/07/jconvolution.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p style="text-align:left;">We can see that the image has been blurred because of the finite size of the aperture. We then investigate the effect of varying the lens/aperture size with the resulting image. From our simulations, we saw that decreasing the size of the lens decreases the clarity of the image, as show in the following figure.</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/varying-aperture.png"><img class="size-medium wp-image-57 aligncenter" src="http://incisors.files.wordpress.com/2008/07/varying-aperture.png?w=364&#038;h=148" alt="" width="364" height="148" /></a></p>
<p style="text-align:left;"><em>clear all;<br />
r=imread(&#8217;smallest.bmp&#8217;);<br />
a=imread(&#8216;letters.bmp&#8217;);<br />
rgray = im2gray(r);<br />
agray = im2gray(a);<br />
Fr = fftshift(rgray);<br />
Fa = fft2(agray);</em></p>
<p><em>FRA = Fr.*(Fa);<br />
IRA = fft2(FRA); //inverse FFT<br />
FImage = abs(IRA);<br />
h=scf(1);<br />
imshow(FImage, []); </em></p>
<p style="text-align:center;">-oOo-</p>
<p style="text-align:left;"><strong>Template Matching</strong></p>
<p style="text-align:left;">We performed template matching of the images. From the text below, we located areas where they have a high degree of correlation and similarity with the template &#8220;A&#8221;. There is a high degree of correlation in places where there is high degree of similarity.</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/word.png"><img class="size-medium wp-image-58 aligncenter" src="http://incisors.files.wordpress.com/2008/07/word.png?w=128&#038;h=128" alt="" width="128" height="128" /></a></p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/a.png"><img class="size-medium wp-image-59 aligncenter" src="http://incisors.files.wordpress.com/2008/07/a.png?w=128&#038;h=128" alt="" width="128" height="128" /></a></p>
<p style="text-align:left;">Places with high correlation is indicated by bright white spots. However, the image is upside-down and left-side right. Rotating the image of the correlation would correspond would yield a direct correspondence with the places in the original text.</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/correlation1.png"><img class="size-medium wp-image-61 aligncenter" src="http://incisors.files.wordpress.com/2008/07/correlation1.png?w=300&#038;h=194" alt="" width="300" height="194" /></a></p>
<p style="text-align:left;"><em>words=imread(&#8220;word.bmp&#8221;);<br />
a=imread(&#8220;A.bmp&#8221;);<br />
words=im2gray(words);<br />
a=im2gray(a);<br />
ftwords=fft2(words);<br />
fta=fft2(a);<br />
correlation=ifft(fta.*conj(ftwords));<br />
imshow(abs(fftshift(correlation)), []); xset(&#8220;colormap&#8221;, hotcolormap(256); </em></p>
<p style="text-align:center;">-oOo-</p>
<p style="text-align:left;"><strong>Edge Detection</strong></p>
<p style="text-align:left;">We performed edge-detection using vertical, and horizontal filters using the command imcorrcoef(). This command is similar to template matching but instead uses a kernel template, and doesn&#8217;t care with the size of the template and the image.</p>
<p style="text-align:center;"><a href="http://incisors.files.wordpress.com/2008/07/edgedetection.png"><img class="size-medium wp-image-62 aligncenter" src="http://incisors.files.wordpress.com/2008/07/edgedetection.png?w=300&#038;h=138" alt="" width="300" height="138" /></a></p>
<p style="text-align:left;"><em>let=imread(&#8220;L.bmp&#8221;);<br />
let=im2gray(let);<br />
hor = [-1 -1 -1; 2 2 2; -1 -1 -1];<br />
vert= [-1  2 -1; -1 2 -1;-1  2 -1];<br />
von = [-1 -1 -1; -1 8 -1; -1 -1 -1];<br />
pattern=von //im2gray(vert);<br />
c=imcorrcoef(let, pattern);<br />
imshow(c); </em></p>
<p style="text-align:left;">We can see from the figure above that the correlation technique is helpful in finding the horizontal and vertical edges of the letter L. But we want to get the outline of an image, we can use the &#8220;von&#8221; pattern located above that locates only boundaries may it be horizontal or vertical.</p>
<p style="text-align:left;">
<p style="text-align:left;">Rating: 9.5 because i wasn&#8217;t reading some of the instruction although i was able to perform all the required tasks.</p>
<p style="text-align:left;">Acknowledgments: Julie, Cole, Benj and Lei.</p>
<p style="text-align:left;">
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/incisors.wordpress.com/48/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/incisors.wordpress.com/48/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/incisors.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/incisors.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/incisors.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/incisors.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/incisors.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/incisors.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/incisors.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/incisors.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/incisors.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/incisors.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=incisors.wordpress.com&blog=3941311&post=48&subd=incisors&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://incisors.wordpress.com/2008/07/08/activity-6-fourier-transform-model-of-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7180bfbb1df0d02507e75d02e265e0fa?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">jptugaff</media:title>
		</media:content>

		<media:content url="http://incisors.files.wordpress.com/2008/07/circle.png?w=128" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/fftcircle.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/fftfftcircle.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/fftshiftcircle.png?w=300" medium="image" />

		<media:content url="http://upload.wikimedia.org/math/2/2/4/224e6196394ee9f310ff19ebd4479499.png" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/jfft.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/jfftshift.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/jfftfft.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/jconvolution.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/varying-aperture.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/word.png?w=128" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/a.png?w=128" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/correlation1.png?w=300" medium="image" />

		<media:content url="http://incisors.files.wordpress.com/2008/07/edgedetection.png?w=300" medium="image" />
	</item>
	</channel>
</rss>