<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4368583600769835334</id><updated>2011-07-28T23:55:21.679-07:00</updated><category term='Plot'/><title type='text'>Pure awesomeness..</title><subtitle type='html'>Ask and it will be given... ^^</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-1862156020800841990</id><published>2009-10-09T10:42:00.000-07:00</published><updated>2009-10-10T08:50:33.587-07:00</updated><title type='text'>Activity 19 - Restoration of blurred image</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;In this activity, we are tasked to perform restoration algorithm to motion blurred images with additive noise.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Model&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Degradation process is modeled as a degradation function (see figure below), together with an additive noise, applied to an input image.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Ss9-hlt1MDI/AAAAAAAAAmE/MziOTrapOK0/s1600-h/degradation.png"&gt;&lt;img style="cursor: pointer; width: 414px; height: 138px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Ss9-hlt1MDI/AAAAAAAAAmE/MziOTrapOK0/s400/degradation.png" alt="" id="BLOGGER_PHOTO_ID_5390666394510897202" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The blurring process is taken as the convolution of the degradation function &lt;span style="font-style: italic;"&gt;h&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) with the input image &lt;span style="font-style: italic;"&gt;f&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;)&lt;span style="font-style: italic;"&gt;. &lt;/span&gt;With the addition of noise, the output image becomes:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;h&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;)*&lt;span style="font-style: italic;"&gt;f&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) + &lt;span style="font-style: italic;"&gt;η&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;We take the Fourier transform (FT) of the output function which results to a simple algebraic form:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;G&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;H&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;)&lt;span style="font-style: italic;"&gt;F&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;) + &lt;span style="font-style: italic;"&gt;N&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Now, the degradation transfer function &lt;span style="font-style: italic;"&gt;H&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;) is given by:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;H&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;) =[&lt;sup style="font-style: italic;"&gt;T&lt;/sup&gt;/&lt;sub&gt;&lt;span style="font-style: italic;"&gt;π&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;ua&lt;/span&gt;+&lt;span style="font-style: italic;"&gt;vb&lt;/span&gt;)&lt;/sub&gt;] sin [&lt;span style="font-style: italic;"&gt;π&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;ua&lt;/span&gt;+&lt;span style="font-style: italic;"&gt;vb&lt;/span&gt;)]e&lt;sup&gt;-&lt;span style="font-style: italic;"&gt;jπ&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;ua&lt;/span&gt;+&lt;span style="font-style: italic;"&gt;vb&lt;/span&gt;)&lt;/sup&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;where a,b are the displacement of the image along the &lt;span style="font-style: italic;"&gt;x&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;y&lt;/span&gt; direction, &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; is the exposure time of the capture (shutter speed).&lt;br /&gt;&lt;br /&gt;Below is an example of an blurred image (&lt;span style="font-style: italic;"&gt;a&lt;/span&gt; = 0.1, &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; = 0.1, &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; = 1) with an additional Gaussian noise (&lt;span style="font-style: italic;"&gt;μ&lt;/span&gt; = 0.01,&lt;span style="font-style: italic;"&gt;σ&lt;/span&gt; = 0.001).&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Ss-P7QiWl2I/AAAAAAAAAmk/KUVtBzoZmFM/s1600-h/hilarygray.png"&gt;&lt;img style="cursor: pointer; width: 194px; height: 241px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Ss-P7QiWl2I/AAAAAAAAAmk/KUVtBzoZmFM/s400/hilarygray.png" alt="" id="BLOGGER_PHOTO_ID_5390685527199881058" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Ss-RAVyen1I/AAAAAAAAAms/OWlEh1GwqiE/s1600-h/blurred-2.png"&gt;&lt;img style="cursor: pointer; width: 194px; height: 241px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Ss-RAVyen1I/AAAAAAAAAms/OWlEh1GwqiE/s400/blurred-2.png" alt="" id="BLOGGER_PHOTO_ID_5390686714020667218" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. (a) Image of Hilary Duff[3] and (b) the blurred image using  a = b = 0.1, T = 1&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In restoring blurred images, we use the Minimum square error (Weiner) filtering. This technique incorporates the degradation function (blurring process) and the noise to reconstruct a corrupted image (&lt;span style="font-style: italic;"&gt;f&lt;/span&gt;) and finding an estimate &lt;span style="font-style: italic;"&gt;f&lt;/span&gt;&lt;sup&gt; ^&lt;/sup&gt; such that, as the name implies, the mean square error between them is minimum. The best estimate of the image in the frequency domain is given by:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Ss9-h5VVgqI/AAAAAAAAAmM/sR-miXwFjRc/s1600-h/filterwnok.png"&gt;&lt;img style="cursor: pointer; width: 327px; height: 67px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Ss9-h5VVgqI/AAAAAAAAAmM/sR-miXwFjRc/s400/filterwnok.png" alt="" id="BLOGGER_PHOTO_ID_5390666399776866978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;where &lt;span style="font-style: italic;"&gt;S&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;η&lt;/sub&gt; = |&lt;span style="font-style: italic;"&gt;N&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;)|&lt;sup&gt;2&lt;/sup&gt; (power spectrum of the noise) and &lt;span style="font-style: italic;"&gt;S&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;f&lt;/sub&gt; = |&lt;span style="font-style: italic;"&gt;F&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;u,v&lt;/span&gt;)|&lt;sup&gt;2&lt;/sup&gt; (power spectrum of the undergraded image).&lt;br /&gt;Using the above equation, we demonstrate the following restorations at various exposure times (&lt;span style="font-style: italic;"&gt;T&lt;/span&gt;) and motion blur displacements (&lt;span style="font-style: italic;"&gt;a,b&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Ss94fhtwNXI/AAAAAAAAAl0/Eie6wErCLZI/s1600-h/no-K.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 294px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Ss94fhtwNXI/AAAAAAAAAl0/Eie6wErCLZI/s400/no-K.png" alt="" id="BLOGGER_PHOTO_ID_5390659762007324018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Restored images (down) increasing motion displacements &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; = &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; = 0.01, 0.1, 1 and (from left) increasing &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; (0.1, 1, 5, 10 and 50).&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;From the figure, we observed that increasing &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; results to a better restoration of the image. As previously mentioned, &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; is the exposure time of capture. It measures the amount of light coming into the sensor of an imaging device. This is the reason why we notice that images using small T tend to be relatively darker than when using larger &lt;span style="font-style: italic;"&gt;T&lt;/span&gt;. Moreover, &lt;span style="font-style: italic;"&gt;T &lt;/span&gt;also affects how movements appear in a picture[2]. Less &lt;span style="font-style: italic;"&gt;T&lt;/span&gt;s are intended for freeze fast moving objects, such as in sports. High &lt;span style="font-style: italic;"&gt;T&lt;/span&gt;s, on the other hand, are intended for intentional blurring of images for artistic purposes[2]. &lt;span&gt;Our results suggest that higher &lt;span style="font-style: italic;"&gt;T &lt;/span&gt;renders better image restoration. At these values, we gain&lt;/span&gt;&lt;span&gt; more information of the blurring process; thus we are able to have improved estimate of the original image.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;Also, as seen from the figure, the quality of the restored image decreases with increasing motion blur displacements. As expected, increasing the values of  &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; enhance the blur resulting to an inevitably poor restoration of the image.&lt;br /&gt;&lt;br /&gt;Most of the time, given an image regardless as being blurred or not, we do not have an idea of the distribution of the noise contained in that image. Hence, the equation above cannot be solved if we do not know the power spectrum of the noise. We thus approximate the equation by replacing the last term of the denominator with a specified constant &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; (shown below).&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Ss9-icJ3f0I/AAAAAAAAAmU/I9nKlqils24/s1600-h/Fwithk.png"&gt;&lt;img style="cursor: pointer; width: 259px; height: 67px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Ss9-icJ3f0I/AAAAAAAAAmU/I9nKlqils24/s400/Fwithk.png" alt="" id="BLOGGER_PHOTO_ID_5390666409124003650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We explored on the effect of the value of &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; to the quality of the restoration. The figure below shows the restored images as &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; varies. As seen, the restoration quality decreases with &lt;span style="font-style: italic;"&gt;K&lt;/span&gt;. From the equation above, &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; replaces the ratio &lt;span style="font-style: italic;"&gt;S&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;η&lt;/sub&gt;/&lt;span style="font-style: italic;"&gt;S&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;f&lt;/sub&gt; (the ration of the spectrum of noise and the spectrum of the undergraded image). &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; determines the relative degree of noise with respect to the image. The choice of higher values of &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; comes with the assumption that the image  contains a high degree of noise. Hence, increased &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; (&lt;span style="font-style: italic;"&gt;K&lt;/span&gt; higher than the actual &lt;span style="font-style: italic;"&gt;S&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;η&lt;/sub&gt;/&lt;span style="font-style: italic;"&gt;S&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;f&lt;/sub&gt;) implies lesser possibility of rendering a good result.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Ss94g5vDdmI/AAAAAAAAAl8/lgSy6rJvamQ/s1600-h/with+K+at+T50.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 364px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Ss94g5vDdmI/AAAAAAAAAl8/lgSy6rJvamQ/s400/with+K+at+T50.png" alt="" id="BLOGGER_PHOTO_ID_5390659785635100258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 3. Restored images (down) increasing motion displacements &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; = &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; = 0.01, 0.1, 1 and (from left) increasing &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; (0.00001, 0.001, 0.1, and 10).&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;: Most of the results presented were qualitatively described i.e, the qualification of a good or bad quality of the images is subjective. A better and meaningful presentation of the results is to take the Linfoot's criterion (FCQ) as a qualifier and plot it with the parameters &lt;span style="font-style: italic;"&gt;a&lt;/span&gt;,&lt;span style="font-style: italic;"&gt;b&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;K&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;T&lt;/span&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for performing the activity well.&lt;br /&gt;&lt;br /&gt;I thank Kaye, Irene and Mark Jayson for useful discussions.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;References:&lt;br /&gt;[1] Applied Physics 186 Activity 19 manual&lt;br /&gt;[2] http://en.wikipedia.org/wiki/Shutter_speed&lt;br /&gt;[3] http://www.smashingapps.com/wp-content/uploads/2009/04/grayscale-technique.jpg&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-1862156020800841990?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/1862156020800841990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/10/activity-19-restoration-of-blurred.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/1862156020800841990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/1862156020800841990'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/10/activity-19-restoration-of-blurred.html' title='Activity 19 - Restoration of blurred image'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_BnAGna7nCnA/Ss9-hlt1MDI/AAAAAAAAAmE/MziOTrapOK0/s72-c/degradation.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-3993509383807087141</id><published>2009-09-24T07:40:00.000-07:00</published><updated>2009-09-28T09:50:51.031-07:00</updated><title type='text'>Activity 18 - Noise model and basic image restoration</title><content type='html'>&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Several factors affect the quality of a digital image. For one, the lenses of the camera, especially for single-lens cameras, distort the captured image. In our previous activity, we performed image processing techniques to correct such distortions. Aside from distortion, noise which is random variation of brightness and color information of images[2], also cause undesirable degradation to the captured image that usually arises during acquisition. For instance, temperature which alters the response of a camera sensor affects the amount of noise in an image[1]. In restoring such images, we use our knowledge of the degradation phenomenon, model it and perform an inverse process in order to recover the image.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;Noise are composed of random variables characterized by certain probability distribution function (PDF)[1].  In this activity, we explore on most common noise models found in image processing applications as well as some basic noise-reduction filters used in image restoration.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Noise Model&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;s&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;Gaussian noise&lt;/span&gt;&lt;span style="font-size:100%;"&gt;:&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;p&lt;/span&gt;&lt;span style="font-size:100%;"&gt;(&lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;z&lt;/span&gt;&lt;span style="font-size:100%;"&gt;) = (&lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;sup&gt;1&lt;/sup&gt;/√&lt;sub&gt;&lt;span style="text-decoration: overline;"&gt; &lt;span&gt;2&lt;/span&gt;&lt;span style="font-style: italic;"&gt;πσ&lt;/span&gt;&lt;/span&gt;&lt;/sub&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;)e&lt;sup&gt;&lt;sup&gt;-(&lt;span style="font-style: italic;"&gt;z-μ&lt;/span&gt;)&lt;sup&gt;2&lt;/sup&gt;&lt;/sup&gt;/&lt;sub&gt;2&lt;span style="font-style: italic;"&gt;σ&lt;/span&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/sub&gt;&lt;/sup&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;Rayleigh noise: &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = (&lt;sup&gt;2&lt;/sup&gt;/&lt;sub style="font-style: italic;"&gt;b&lt;/sub&gt;)(&lt;span style="font-style: italic;"&gt;z - a&lt;/span&gt;)e&lt;sup&gt;&lt;sup&gt;-(&lt;span style="font-style: italic;"&gt;z-a&lt;/span&gt;)&lt;sup&gt;2&lt;/sup&gt;&lt;/sup&gt;/&lt;sub style="font-style: italic;"&gt;b&lt;/sub&gt;&lt;/sup&gt;  for &lt;span style="font-style: italic;"&gt;z&lt;/span&gt; &lt;b style="text-decoration: underline;"&gt;&lt;i&gt;&gt;&lt;/i&gt;&lt;/b&gt; &lt;span style="font-style: italic;"&gt;a&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; else &lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;p&lt;/span&gt;&lt;span style="font-size:100%;"&gt;(&lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;z&lt;/span&gt;&lt;span style="font-size:100%;"&gt;) = 0&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;br /&gt;Erlang (Gamma) Noise:&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = [&lt;sup&gt;&lt;span style="font-style: italic;"&gt;a&lt;/span&gt;&lt;sup style="font-style: italic;"&gt;b&lt;/sup&gt;&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;&lt;sup style="font-style: italic;"&gt;b-&lt;/sup&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/sup&gt;/&lt;sub&gt;(&lt;span style="font-style: italic;"&gt;b&lt;/span&gt;-1)!&lt;/sub&gt;] e&lt;sup&gt;-&lt;span style="font-style: italic;"&gt;az&lt;/span&gt;&lt;/sup&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;for &lt;span style="font-style: italic;"&gt;z&lt;/span&gt; &lt;b style="text-decoration: underline;"&gt;&lt;i&gt;&gt;&lt;/i&gt;&lt;/b&gt; &lt;span style="font-style: italic;"&gt;a&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; else &lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;p&lt;/span&gt;&lt;span style="font-size:100%;"&gt;(&lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;z&lt;/span&gt;&lt;span style="font-size:100%;"&gt;) = 0&lt;/span&gt;&lt;/div&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;br /&gt;Exponential Noise:&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;a&lt;/span&gt;e&lt;sup&gt;-&lt;span style="font-style: italic;"&gt;az&lt;/span&gt;&lt;/sup&gt;&lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt; for &lt;span style="font-style: italic;"&gt;z&lt;/span&gt; &lt;b style="text-decoration: underline;"&gt;&lt;i&gt;&gt;&lt;/i&gt;&lt;/b&gt; &lt;span style="font-style: italic;"&gt;a&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; else &lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;p&lt;/span&gt;&lt;span style="font-size:100%;"&gt;(&lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt;z&lt;/span&gt;&lt;span style="font-size:100%;"&gt;) = 0&lt;/span&gt;&lt;/div&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;br /&gt;Uniform Noise:&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = &lt;sup&gt;1&lt;/sup&gt;/&lt;sub&gt;(&lt;span style="font-style: italic;"&gt;b-a&lt;/span&gt;)&lt;/sub&gt;&lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt; if &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; &lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;b style="text-decoration: underline;"&gt;&lt;i&gt;&lt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt; &lt;span style="font-style: italic;"&gt;z&lt;/span&gt; &lt;b style="text-decoration: underline;"&gt;&lt;i&gt;&lt;&lt;/i&gt;&lt;/b&gt; &lt;span style="font-style: italic;"&gt;b&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; else &lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = 0&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;br /&gt;Impulse (salt an pepper) Noise:&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;P&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;a&lt;/sub&gt; for z = a&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;P&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;b&lt;/sub&gt; for z = b&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="white-space: nowrap;font-size:100%;" &gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;) = 0 otherwise&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;The figure below demonstrates the effect of each noise PDF to an image. Here we initially observe a grainy effect of the noise.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Srugjh5UkiI/AAAAAAAAAig/Rf1YmuFPD-c/s1600-h/noise.png"&gt;&lt;img style="cursor: pointer; width: 359px; height: 165px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Srugjh5UkiI/AAAAAAAAAig/Rf1YmuFPD-c/s400/noise.png" alt="" id="BLOGGER_PHOTO_ID_5385074311706219042" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;Figure 1. (left) Original image and (right) the image added with (clockwise from upper left) Gaussian, gamma, exponential, Rayleigh, uniform and, salt&amp;amp;pepper noise. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;From the original grayscale value histogram of the image (shown in Figure 2), upon application of the noise to the image, the histogram was transformed as in Figure 3.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Sr-CKTo9d7I/AAAAAAAAAjI/RFf6jGPouvI/s1600-h/iamge+histogram.png"&gt;&lt;img style="cursor: pointer; width: 285px; height: 223px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Sr-CKTo9d7I/AAAAAAAAAjI/RFf6jGPouvI/s400/iamge+histogram.png" alt="" id="BLOGGER_PHOTO_ID_5386166792940779442" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Grayscale value histogram of the image&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Sruh8Efo7iI/AAAAAAAAAio/AXQ8AEEm__w/s1600-h/histograms.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 201px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Sruh8Efo7iI/AAAAAAAAAio/AXQ8AEEm__w/s400/histograms.png" alt="" id="BLOGGER_PHOTO_ID_5385075832822230562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 3. Histogram of grayscale values from the generated noisy images: (clockwise from upper left) &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Gaussian, gamma, exponential, Rayleigh, uniform and, salt&amp;amp;pepper noise.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Basic noise-reduction filters&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;These filters takes a window &lt;span style="font-style: italic;"&gt;S&lt;sub&gt;xy&lt;/sub&gt;&lt;/span&gt; in an image with center &lt;span style="font-style: italic;"&gt;x&lt;/span&gt;,&lt;span style="font-style: italic;"&gt;y&lt;/span&gt; and perform averaging.&lt;br /&gt;Arithmetic mean filter (AMF)&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/Sr-FTXnYloI/AAAAAAAAAjQ/ogkoBT86oOk/s1600-h/AMF.png"&gt;&lt;img style="cursor: pointer; width: 143px; height: 42px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/Sr-FTXnYloI/AAAAAAAAAjQ/ogkoBT86oOk/s400/AMF.png" alt="" id="BLOGGER_PHOTO_ID_5386170247161616002" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Geometric mean filter (GMF)&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Sr-FYYIR9RI/AAAAAAAAAjY/hIWgV710Q04/s1600-h/GMF.png"&gt;&lt;img style="cursor: pointer; width: 144px; height: 61px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Sr-FYYIR9RI/AAAAAAAAAjY/hIWgV710Q04/s400/GMF.png" alt="" id="BLOGGER_PHOTO_ID_5386170333198939410" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;Harmonic mean filter (HMF)&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Sr-FY1-nAiI/AAAAAAAAAjg/cRHQzj29Dk0/s1600-h/HMF.png"&gt;&lt;img style="cursor: pointer; width: 140px; height: 62px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Sr-FY1-nAiI/AAAAAAAAAjg/cRHQzj29Dk0/s400/HMF.png" alt="" id="BLOGGER_PHOTO_ID_5386170341211439650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Contraharmonic mean filter (CMF)&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Sr-FZK8LqeI/AAAAAAAAAjo/9m9q0rnakKo/s1600-h/contraharmonic.png"&gt;&lt;img style="cursor: pointer; width: 147px; height: 86px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Sr-FZK8LqeI/AAAAAAAAAjo/9m9q0rnakKo/s400/contraharmonic.png" alt="" id="BLOGGER_PHOTO_ID_5386170346838403554" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;CMF is good in removing salt&amp;amp;pepper noise. If &lt;span style="font-style: italic;"&gt;Q&lt;/span&gt;&gt;0, it removes pepper noise. If &lt;span style="font-style: italic;"&gt;Q&lt;/span&gt;&lt;0, it removes salt noise.&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Restoration&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We have tested the effect of the window size to the quality of the reconstructed image. The figure below shows the reconstructed images using the four filters for sizes of &lt;span style="font-style: italic;"&gt;S&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;xy&lt;/sub&gt; = {3x3, 5x5, 9x9}. We observe that smaller window size resulted to a relatively grainy restoration than with that of larger window size. On the other hand, large window size resulted to a more blurry image.  In the following reconstructions, we used a window size of 5x5.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SruGQRuuDyI/AAAAAAAAAiY/bvgMQhKOnQU/s1600-h/gaussina.png"&gt;&lt;img style="cursor: pointer; width: 299px; height: 400px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SruGQRuuDyI/AAAAAAAAAiY/bvgMQhKOnQU/s400/gaussina.png" alt="" id="BLOGGER_PHOTO_ID_5385045393646948130" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 4. Reconstructed image of Gaussian-noised image using (from top to bottom) AMF, GMF, HMF and CMF (Q= 1) at different window sizes (left to right) 3x3, 5x5, 9x9.&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;Here we show the effects of the filters to the noised images.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SrupnGl5i3I/AAAAAAAAAiw/hEl087Eks6g/s1600-h/allat5.png"&gt;&lt;img style="cursor: pointer; width: 342px; height: 400px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SrupnGl5i3I/AAAAAAAAAiw/hEl087Eks6g/s400/allat5.png" alt="" id="BLOGGER_PHOTO_ID_5385084268701125490" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 5. (right)Reconstruction of (left)noisy images: (top to bottom) Gaussian, gamma, exponential, Rayleigh, uniform and, salt&amp;amp;pepper noise using (from 2&lt;sup&gt;nd&lt;/sup&gt; column to the right) AMF, GMF, HMF and CMF (Q=1).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: justify;"&gt;From Fig. 5, we see that for all noised images, the AMF produced a consistent results although may not be the best result. This technique can thus be use generically for noisy images. GMF also produced a very good restoration for all noised images except for the salt&amp;amp;pepper-noised image. HMF is also resulted to a good reconstruction except for Guassian and salt&amp;amp;pepper-noised images. CMF (Q= 1) produced a good result except for exponential and salt&amp;amp;pepper-noised image. Salt&amp;amp;pepper-noised image was harder to restore compared to others. Moreover, we see that CMF (Q=1) was not able to correctly restore a salt&amp;amp;pepper-noised image, as previously said. Now we demonstrate the effect of CMF to salt-only and pepper-only-noised image.&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Sru1BfK68JI/AAAAAAAAAjA/JwLDML2REwQ/s1600-h/salt+and+pepper.png"&gt;&lt;img style="cursor: pointer; width: 294px; height: 310px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Sru1BfK68JI/AAAAAAAAAjA/JwLDML2REwQ/s400/salt+and+pepper.png" alt="" id="BLOGGER_PHOTO_ID_5385096816603361426" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 6. Image reconstruction of Q = 1 and Q= -1 CMF for (top to bottom) the image with salt and pepper, salt-only and pepper-only noise. CMF cannot properly reconstruct a salt&amp;amp; pepper-noised image. Salt is removed when &lt;span style="font-style: italic;"&gt;Q&lt;/span&gt; is negative. Pepper is removed when &lt;span style="font-style: italic;"&gt;Q&lt;/span&gt; is positive&lt;span style="font-size:100%;"&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;We indeed see that CMF can perfectly restore images with salt noise and pepper noise alone.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-f1jM-kCI/AAAAAAAAAlA/-4IWLqhBA0I/s1600-h/fatherandson.jpg"&gt;&lt;img style="cursor: pointer; width: 323px; height: 230px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-f1jM-kCI/AAAAAAAAAlA/-4IWLqhBA0I/s400/fatherandson.jpg" alt="" id="BLOGGER_PHOTO_ID_5386199421689958434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 7. Test image taken from [3]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Below are reconstructions of noised images using (from upperleft clockwise) AMF, GMF, CMF, and HMF.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-dlfkDr5I/AAAAAAAAAkQ/8mzZkJNw0hQ/s1600-h/guassian.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 286px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-dlfkDr5I/AAAAAAAAAkQ/8mzZkJNw0hQ/s400/guassian.png" alt="" id="BLOGGER_PHOTO_ID_5386196946811858834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure8. Reconstruction of a Gaussian-noised image.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-dmABYPpI/AAAAAAAAAkY/VFukL7oZocY/s1600-h/gamma.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 285px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-dmABYPpI/AAAAAAAAAkY/VFukL7oZocY/s400/gamma.png" alt="" id="BLOGGER_PHOTO_ID_5386196955524775570" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 9. &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Reconstruction of a gamma-noised image.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/Sr-dmpa70iI/AAAAAAAAAkg/lIqmikNvtfE/s1600-h/exponential.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 286px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/Sr-dmpa70iI/AAAAAAAAAkg/lIqmikNvtfE/s400/exponential.png" alt="" id="BLOGGER_PHOTO_ID_5386196966637818402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 10. &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Reconstruction of a exponential-noised image.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-dnPg8BqI/AAAAAAAAAko/k7AwwZe9nzw/s1600-h/rayleigh.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 285px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-dnPg8BqI/AAAAAAAAAko/k7AwwZe9nzw/s400/rayleigh.png" alt="" id="BLOGGER_PHOTO_ID_5386196976863544994" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 11. &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Reconstruction of a Rayleigh-noised image.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/Sr-fHRDQmoI/AAAAAAAAAkw/9t8x7zKZnEA/s1600-h/uniform.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 285px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/Sr-fHRDQmoI/AAAAAAAAAkw/9t8x7zKZnEA/s400/uniform.png" alt="" id="BLOGGER_PHOTO_ID_5386198626543377026" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 12. &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Reconstruction of a uniform-noised image.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-fH3PdUNI/AAAAAAAAAk4/2Id7xj0Sscs/s1600-h/saltpepper.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 285px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Sr-fH3PdUNI/AAAAAAAAAk4/2Id7xj0Sscs/s400/saltpepper.png" alt="" id="BLOGGER_PHOTO_ID_5386198636795089106" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 13. &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Reconstruction of a &lt;/span&gt;&lt;span style="font-size:85%;"&gt;salt&amp;amp;pepper&lt;/span&gt;&lt;span style="font-size:85%;"&gt;-noised image.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for finishing it well.&lt;br /&gt;I thank Irene, Janno, Martin, Master, Cherry for the help.&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;[1] AP186 Activity 18 manual&lt;br /&gt;[2] http://en.wikipedia.org/wiki/Image_noise&lt;br /&gt;[3] http://bluecandy.typepad.com/.a/&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-3993509383807087141?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/3993509383807087141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-18-noise-model-and-basic-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3993509383807087141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3993509383807087141'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-18-noise-model-and-basic-image.html' title='Activity 18 - Noise model and basic image restoration'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_BnAGna7nCnA/Srugjh5UkiI/AAAAAAAAAig/Rf1YmuFPD-c/s72-c/noise.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-1940746471962400747</id><published>2009-09-08T01:00:00.002-07:00</published><updated>2009-09-12T09:36:27.461-07:00</updated><title type='text'>Activity 17 - Photometric Stereo</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;Objects appear different depending on where the light source illuminating it is located. Shadows form at different locations. In this activity, we demonstrate a shadow model and extract shape from the shadows. Models depend on the type light source (point source, line source, etc.) used and where the light source is located. One of the more simple model is when the light source is placed at infinity.&lt;/span&gt; In general, when the light source is nearby, the brightness of an object illuminated by it is given by:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;B&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;) = [&lt;span style="font-style: italic;"&gt;ρ&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;)&lt;span style="font-style: italic;"&gt;n&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;)•&lt;span style="font-style: italic;"&gt;S&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;)]/&lt;span style="font-style: italic;"&gt;R&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;)&lt;sup&gt;2&lt;/sup&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;where B(P) is the brightness of the object, S(P) is a vector from the light source and R(P) is the distance of the light source from the object.&lt;br /&gt;In an infinite light source, 1/r dependence of B(P) disappears and the vector S(P) becomes constant for every point in the object. Thus the equation becomes:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;B&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;ρ&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;)&lt;span style="font-style: italic;"&gt;n&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;P&lt;/span&gt;)•&lt;span style="font-style: italic;"&gt;S&lt;sub&gt;o&lt;/sub&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In capturing an image of an object, we assume that it is proportional to the brightness of the object:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;I&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;kB&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;k&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ρ&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;)&lt;span style="font-style: italic;"&gt;n&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;)•&lt;span style="font-style: italic;"&gt;S&lt;sub&gt;o&lt;/sub&gt;&lt;/span&gt; = &lt;span style="font-style: italic;"&gt;g&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;)•&lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub&gt;o&lt;/sub&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;where g(x,y) = &lt;span style="font-style: italic;"&gt;ρ&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;)&lt;span style="font-style: italic;"&gt;n&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) and &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub&gt;o=&lt;span style="font-style: italic;"&gt;k&lt;/span&gt;&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;S&lt;sub&gt;o.&lt;/sub&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;sub&gt;&lt;br /&gt;&lt;/sub&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;When an object is illuminated by light &lt;span style="font-style: italic;"&gt;N&lt;/span&gt; light sources, &lt;/span&gt;&lt;span style="font-style: italic;"&gt;V&lt;/span&gt;o&lt;span style="font-size:100%;"&gt; takes the form:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SqvD2rZFy-I/AAAAAAAAAh4/ThBhyJ7Bc_c/s1600-h/v.png"&gt;&lt;img style="cursor: pointer; width: 149px; height: 101px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SqvD2rZFy-I/AAAAAAAAAh4/ThBhyJ7Bc_c/s320/v.png" alt="" id="BLOGGER_PHOTO_ID_5380609523952503778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Each row represents the position (x,y,z) of the source in 3D space. Given an image with its intensity equal to its grayscale value, we can determine g(x,y) using the equation above. If we took a &lt;span style="font-style: italic;"&gt;N&lt;/span&gt; captures of the surface of object illuminated by &lt;span style="font-style: italic;"&gt;N&lt;/span&gt; light sources, then for each point (&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;):&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;I&lt;/span&gt;&lt;sub&gt;1&lt;/sub&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;11&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;1&lt;/sub&gt; + &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;12&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;2&lt;/sub&gt; + &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;13&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;3&lt;/sub&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;I&lt;/span&gt;&lt;sub&gt;2&lt;/sub&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;21&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;1&lt;/sub&gt; + &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;22&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;2&lt;/sub&gt; + &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;23&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;3&lt;/sub&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;I&lt;/span&gt;&lt;sub&gt;N&lt;/sub&gt;(&lt;span style="font-style: italic;"&gt;x,y&lt;/span&gt;) = &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;N1&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;1&lt;/sub&gt; + &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;N2&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;2&lt;/sub&gt; + &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;N3&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;g&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;3&lt;/sub&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;or in matrix form:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;I = gV&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;Since we know I and V, we can calculate g using:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;g = (V&lt;/span&gt;&lt;sup style="font-weight: bold;"&gt;T&lt;/sup&gt;&lt;span style="font-weight: bold;"&gt;V)&lt;/span&gt;&lt;sup style="font-weight: bold;"&gt;-1&lt;/sup&gt;&lt;span style="font-weight: bold;"&gt;VI&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;The normal vector can be solved by:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SqvIbZmTR2I/AAAAAAAAAiA/jeH_V0skU3E/s1600-h/nhat.png"&gt;&lt;img style="cursor: pointer; width: 48px; height: 47px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SqvIbZmTR2I/AAAAAAAAAiA/jeH_V0skU3E/s320/nhat.png" alt="" id="BLOGGER_PHOTO_ID_5380614552877746018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;To get the surface elevation of point (u,v) on the surface, we use:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SqvJL7mShNI/AAAAAAAAAiI/l5kpoaigFMU/s1600-h/surfelv.png"&gt;&lt;img style="cursor: pointer; width: 197px; height: 46px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SqvJL7mShNI/AAAAAAAAAiI/l5kpoaigFMU/s320/surfelv.png" alt="" id="BLOGGER_PHOTO_ID_5380615386638222546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;where&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SqvJzGPFsRI/AAAAAAAAAiQ/WcepkKaLdHo/s1600-h/df.png"&gt;&lt;img style="cursor: pointer; width: 155px; height: 46px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SqvJzGPFsRI/AAAAAAAAAiQ/WcepkKaLdHo/s320/df.png" alt="" id="BLOGGER_PHOTO_ID_5380616059508601106" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;In this activity, we captured four images of a hemisphere illuminated by a far away light source located at four positions &lt;span style="font-style: italic;"&gt;V&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;(0.085832,   0.17365,   0.98106)&lt;br /&gt;(0.085832,  -0.17365,   0.98106)&lt;br /&gt;      (0.173650,             0.0,  0.98481)&lt;br /&gt;(0.163180,   -0.34202, 0.92542)&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Below are the images taken for each light source locations.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SqhZbb7xpxI/AAAAAAAAAhw/Lq0QchCyarM/s1600-h/aall.png"&gt;&lt;img style="cursor: pointer; width: 206px; height: 207px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SqhZbb7xpxI/AAAAAAAAAhw/Lq0QchCyarM/s320/aall.png" alt="" id="BLOGGER_PHOTO_ID_5379648082783872786" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;Figure 1. Images of a hemispheres illuminated by a light source located at different positions&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Using the procedure above, we obtained a 3D image of the surface shown in Fig.2.&lt;br /&gt;&lt;/div&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SqYSfm65e2I/AAAAAAAAAho/V_QD-MEOWLk/s1600-h/3dreconstruction.png"&gt;&lt;img style="cursor: pointer; width: 360px; height: 240px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SqYSfm65e2I/AAAAAAAAAho/V_QD-MEOWLk/s320/3dreconstruction.png" alt="" id="BLOGGER_PHOTO_ID_5379007139173464930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. 3D reconstruction of the hemisphere&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Here, we have successfully reconstructed the image. The reconstruction, however, is not smooth. Some parts do not follow the contour of a hemisphere.&lt;br /&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for a successful reconstruction of the surface.&lt;br /&gt;&lt;br /&gt;I thank Irene, Alva, Orly for very very useful help. :)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-1940746471962400747?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/1940746471962400747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-17-photometric-stereo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/1940746471962400747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/1940746471962400747'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-17-photometric-stereo.html' title='Activity 17 - Photometric Stereo'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_BnAGna7nCnA/SqvD2rZFy-I/AAAAAAAAAh4/ThBhyJ7Bc_c/s72-c/v.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-2965774817119883652</id><published>2009-09-08T01:00:00.001-07:00</published><updated>2009-10-11T09:13:15.413-07:00</updated><title type='text'>Activity 16 - Neural Networks</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;In the previous activities, we have used Euclidean distance and LDA as classifiers for pattern recognition. In this activity, we tried the neural networks. A neural network is a computational model of how neurons in the brain works. Basically, just as the brain does pattern recognition, the neural network is fed with features of known patterns; in which case, it "learns" the rules for classification from the input it receives.&lt;br /&gt;Just as the neurons pass electrical signals to other neurons, this model (McCoulloch, Pitts 1943) essentially works the same way. With input signals &lt;span style="font-style: italic;"&gt;x&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;, (see Fig.1) a neuron receives weighted inputs(&lt;span style="font-style: italic;"&gt;w&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;span style="font-style: italic;"&gt;*x&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;) and lets the sum of all the signal it receives act on an activation function &lt;span style="font-style: italic;"&gt;g&lt;/span&gt;. The resulting signal &lt;span style="font-style: italic;"&gt;z&lt;/span&gt; is then passed to other neurons[1].&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/StHMGkqpSqI/AAAAAAAAAnc/W9jzfzIavXs/s1600-h/modelneural.png"&gt;&lt;img style="cursor: pointer; width: 205px; height: 106px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/StHMGkqpSqI/AAAAAAAAAnc/W9jzfzIavXs/s400/modelneural.png" alt="" id="BLOGGER_PHOTO_ID_5391314642233019042" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. Artificial neuron&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The same process takes place as the signal is passed from neuron to neuron. This network of neurons is called the neural network.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/StHMG2IEaPI/AAAAAAAAAnk/WkjB2Qb2vtA/s1600-h/layers.png"&gt;&lt;img style="cursor: pointer; width: 222px; height: 176px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/StHMG2IEaPI/AAAAAAAAAnk/WkjB2Qb2vtA/s400/layers.png" alt="" id="BLOGGER_PHOTO_ID_5391314646919833842" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Neural Network&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The neural network is composed of an input layer, a hidden layer, and the output layer. The input layer receives the signal (features) which is passed onto the hidden layer. The hidden layer then passes it to the output layer[1].&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class=" on" style="display: block;" id="formatbar_JustifyFull" title="Justify Full" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 13);ButtonMouseDown(this);"&gt;&lt;img src="http://www.blogger.com/img/blank.gif" alt="Justify Full" class="gl_align_full" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Results&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Using a code originally written by J. Tugaff [2], we use neural network to classify objects as 1-peso coin, 25-cents coin, long leaf, short leaf or flower using r-g chromaticity and dimension ratio (length/width) as features. (Code needs modification depending on the number of classes and features used.)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;Learning process&lt;/span&gt;&lt;br /&gt;As training , we used the features of 5 samples/class as inputs to the neural network. It is trained such that it outputs: [1 0 0 0 0] for 1-peso coin, [0 1 0 0 0] for 25-cents coin and so on.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/StH4J-1_HeI/AAAAAAAAAns/RrAIesyKZ_s/s1600-h/accuracy+vs+learning+rate.png"&gt;&lt;img style="cursor: pointer; width: 208px; height: 171px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/StH4J-1_HeI/AAAAAAAAAns/RrAIesyKZ_s/s400/accuracy+vs+learning+rate.png" alt="" id="BLOGGER_PHOTO_ID_5391363079311138274" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/StH9JfOZOfI/AAAAAAAAAn0/0w-redkaR-I/s1600-h/accuracy+vs+T.png"&gt;&lt;img style="cursor: pointer; width: 201px; height: 171px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/StH9JfOZOfI/AAAAAAAAAn0/0w-redkaR-I/s400/accuracy+vs+T.png" alt="" id="BLOGGER_PHOTO_ID_5391368568381716978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 3. Plot of the distinguishing capability of the neural network with (left) learning rate and (right) training cycles &lt;span style="font-style: italic;"&gt;T&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Before the classification, we checked the distinguishing capability (the ability to properly separate classification from other classes)of the neural network as a function of the learning rate and &lt;span&gt;training cycles&lt;/span&gt;&lt;span style="font-style: italic;"&gt; T&lt;/span&gt;. We checked it by using the training set as our test set. We took the average value of the "supposedly 1" outputs. Fig.3(left) shows the average against learning rate. An increasing trend is observed. As learning rate increases, the output approaches to 1 thus the network is able to classify the objects properly. We also observed an increasing trend when &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; increases. High &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; improves learning process resulting to better classification.&lt;br /&gt;Based on these results, it is quite a good idea to choose learning rate and &lt;span style="font-style: italic;"&gt;T &lt;/span&gt;as high as possible. However, this is very time-consuming to do. This will slow down the learning process which  makes it impractical.&lt;sup&gt;1&lt;/sup&gt; For our case, we use &lt;span style="font-style: italic;"&gt;T&lt;/span&gt; = 5000 and learning rate = 1 for training.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;After training, we tested the training set to verify that the network has "learned". The result of classification is summarized on the table below.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Table 1. Classification of the training set used in the learning process of the neural network.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/StG_Vh0KXyI/AAAAAAAAAm0/BCHGUAd6MMk/s1600-h/training.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 399px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/StG_Vh0KXyI/AAAAAAAAAm0/BCHGUAd6MMk/s400/training.png" alt="" id="BLOGGER_PHOTO_ID_5391300605514506018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Here we see that the network is able to identify properly identified the training set hence the network has already learned, we can now use it to classify our test objects.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Classification of test objects&lt;/span&gt;&lt;br /&gt;In the table below, we show the result of classification of the test objects. Here, we have achieved a 96% correct classification.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Table 2. Classification of test objects using the neural network&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/StHChX6NZ1I/AAAAAAAAAnU/VdVJYEgOPDI/s1600-h/test.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 396px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/StHChX6NZ1I/AAAAAAAAAnU/VdVJYEgOPDI/s400/test.png" alt="" id="BLOGGER_PHOTO_ID_5391304107548829522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;sup&gt;1&lt;/sup&gt; If one, on the other hand, is willing to wait for better results, he might as well choose higher learning rate and&lt;/span&gt;&lt;span style="font-style: italic;font-size:85%;" &gt; T&lt;/span&gt;&lt;span style="font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I thank Master, Kaye and Thirdy and Irene for very useful help.&lt;br /&gt;&lt;br /&gt;I give myself a grade of 10 for doing a good job.&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;[1] Applied Physics 186 Activity 16 manual&lt;br /&gt;[2] http://cole-ap186.blogspot.com/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-2965774817119883652?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/2965774817119883652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-16-probabilistic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/2965774817119883652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/2965774817119883652'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-16-probabilistic.html' title='Activity 16 - Neural Networks'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_BnAGna7nCnA/StHMGkqpSqI/AAAAAAAAAnc/W9jzfzIavXs/s72-c/modelneural.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-1794553959035926231</id><published>2009-09-07T07:13:00.000-07:00</published><updated>2009-09-12T13:12:07.295-07:00</updated><title type='text'>Activity 15 - Probabilistic Classification</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In the previous activity, we tried to classify objects into classes based on a set of features that describe the objects. Particularly, we used the Euclidean distance as a classifier for our dataset. In this activity, on the other hand, we use another classifier called the Linear Discriminant Analysis (LDA). Discriminant analysis is a statistical approach in pattern recognition. LDA assumes that the classes of objects are linearly separable (as the term linear applies)-- meaning, the classes of objects can be separated by linear combination of features that describe the object[1]. The LDA formula is given by:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;f&lt;/span&gt;&lt;sub style="font-style: italic; font-weight: bold;"&gt;i&lt;/sub&gt;&lt;span style="font-weight: bold;"&gt; = u&lt;/span&gt;&lt;sub style="font-style: italic; font-weight: bold;"&gt;i&lt;/sub&gt;&lt;span style="font-weight: bold;"&gt;C&lt;/span&gt;&lt;sup style="font-style: italic; font-weight: bold;"&gt;-1&lt;/sup&gt;&lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub style="font-style: italic; font-weight: bold;"&gt;k&lt;/sub&gt;&lt;sup style="font-style: italic; font-weight: bold;"&gt;T&lt;/sup&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt; -&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; 1/2u&lt;/span&gt;&lt;sub style="font-style: italic; font-weight: bold;"&gt;i&lt;/sub&gt;&lt;span style="font-weight: bold;"&gt;C&lt;/span&gt;&lt;sup style="font-weight: bold;"&gt;-1&lt;/sup&gt;&lt;span style="font-weight: bold;"&gt;u&lt;/span&gt;&lt;sub style="font-style: italic; font-weight: bold;"&gt;i&lt;/sub&gt;&lt;sup style="font-style: italic; font-weight: bold;"&gt;T&lt;/sup&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;+ ln(&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;p&lt;/span&gt;&lt;sub style="font-style: italic; font-weight: bold;"&gt;i&lt;/sub&gt;&lt;span style="font-weight: bold;"&gt;) .&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;where u&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt; is the mean features of the class &lt;span style="font-style: italic;"&gt;i&lt;/span&gt;, C is the covariance matrix obtained from the training set, x&lt;sub style="font-style: italic;"&gt;k&lt;/sub&gt; is the features of test &lt;span style="font-style: italic;"&gt;k&lt;/span&gt;&lt;sup style="font-style: italic;"&gt;th&lt;/sup&gt; test object, and &lt;span style="font-style: italic;"&gt;p&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt; is the prior probability of a class &lt;span style="font-style: italic;"&gt;i&lt;/span&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Mean Features of a Class&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Given features of a set of test objects of the classes 1 and 2, (in this case, we have 3 test objects and 2 features for class 1)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub&gt;1&lt;/sub&gt; = [a&lt;sub&gt;o&lt;/sub&gt; b&lt;sub&gt;o&lt;/sub&gt;; a&lt;sub&gt;1&lt;/sub&gt; b&lt;sub&gt;1&lt;/sub&gt;; a&lt;sub&gt;2&lt;/sub&gt; b&lt;sub&gt;2&lt;/sub&gt;] and &lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub&gt;2&lt;/sub&gt; = [c&lt;sub&gt;o&lt;/sub&gt; d&lt;sub&gt;o&lt;/sub&gt;; c&lt;sub&gt;1&lt;/sub&gt; d&lt;sub&gt;1&lt;/sub&gt;]&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;mean feature of class 1 is calculated as:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;u&lt;/span&gt;&lt;sub&gt;1&lt;/sub&gt; = [mean(a&lt;sub&gt;o&lt;/sub&gt;,a&lt;sub&gt;1&lt;/sub&gt;,a&lt;sub&gt;2&lt;/sub&gt;) mean(b&lt;sub&gt;o&lt;/sub&gt;,b&lt;sub&gt;1&lt;/sub&gt;,b&lt;sub&gt;2&lt;/sub&gt;)]&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Covariance Matrix&lt;/span&gt;&lt;br /&gt;From the features of the whole training set (contains all training samples of all classes), one can calculate the global mean vector. This is essentially the mean features of the whole training set.&lt;br /&gt;For example, given a data set&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;x&lt;/span&gt; = [a&lt;sub&gt;o&lt;/sub&gt; b&lt;sub&gt;o&lt;/sub&gt;; a&lt;sub&gt;1&lt;/sub&gt; b&lt;sub&gt;1&lt;/sub&gt;; a&lt;sub&gt;2&lt;/sub&gt; b&lt;sub&gt;2&lt;/sub&gt;; c&lt;sub&gt;o&lt;/sub&gt; d&lt;sub&gt;o&lt;/sub&gt;; c&lt;sub&gt;1&lt;/sub&gt; d&lt;sub&gt;2&lt;/sub&gt;] ,&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;the global mean vector is given by&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;u&lt;/span&gt; = [mean(a&lt;sub&gt;o&lt;/sub&gt;,a&lt;sub&gt;1&lt;/sub&gt;,a&lt;sub&gt;2&lt;/sub&gt;,c&lt;sub&gt;o&lt;/sub&gt;,c&lt;sub&gt;1&lt;/sub&gt;) mean(b&lt;sub&gt;o&lt;/sub&gt;,b&lt;sub&gt;1&lt;/sub&gt;,b&lt;sub&gt;2&lt;/sub&gt;,d&lt;sub&gt;o&lt;/sub&gt;,d&lt;sub&gt;1&lt;/sub&gt;)]&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;From the &lt;span style="font-weight: bold;"&gt;u&lt;/span&gt;, we can solve the mean corrected data &lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;sup style="font-style: italic;"&gt;o&lt;/sup&gt; for each class &lt;span style="font-style: italic;"&gt;i&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;sup style="font-style: italic;"&gt;o &lt;/sup&gt;= &lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt; -&lt;span style="font-weight: bold;"&gt;u&lt;/span&gt; .&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The covariance matrix of a class&lt;span style="font-style: italic;"&gt; i&lt;/span&gt; is:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;c&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt; = [(&lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;sup style="font-style: italic;"&gt;o&lt;/sup&gt;)&lt;span style="font-size:100%;"&gt;&lt;sup&gt;T&lt;/sup&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;x&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;sup style="font-style: italic;"&gt;o&lt;/sup&gt;]/&lt;span style="font-style: italic;"&gt;n&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;where &lt;span style="font-style: italic;"&gt;n&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt; is the number of test samples used for class &lt;span style="font-style: italic;"&gt;i&lt;/span&gt;.&lt;br /&gt;The covariance matrix of the whole test set is then solved using:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;C&lt;/span&gt; = 1/&lt;span style="font-style: italic;"&gt;n&lt;/span&gt; &lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:180%;"&gt;Σ&lt;/span&gt; &lt;span style="font-style: italic;"&gt;n&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;⋅&lt;span style="font-style: italic;"&gt;c&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;where &lt;span style="font-style: italic;"&gt;n&lt;/span&gt; is the number of samples in the whole data set.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Prior Probability&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;The prior probability of class &lt;span style="font-style: italic;"&gt;i&lt;/span&gt; is given by:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;p&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;span style="font-style: italic;"&gt; = n&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;/&lt;span style="font-style: italic;"&gt;n .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt;Results&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We used the LDA formula in classifying objects in our data set. The object &lt;span style="font-style: italic;"&gt;k&lt;/span&gt; is classified as belonging to class &lt;span style="font-style: italic;"&gt;i&lt;/span&gt; if it resulted the highest &lt;span style="font-style: italic;"&gt;f&lt;/span&gt; at &lt;span style="font-style: italic;"&gt;i&lt;/span&gt;. Below is the result of our classification. Highlighted values are the maximum &lt;span style="font-style: italic;"&gt;f&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt; obtained per sample. Samples are classified according to &lt;span style="font-style: italic;"&gt;i &lt;/span&gt;where highlighted values occur.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Table 1. LDA results of 5 test samples of 1-peso coins,25-cent coins, long leaves, short leaves and flowers. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SqUXvUzQ_QI/AAAAAAAAAhg/_yD-4a1ySlw/s1600-h/LDA.png"&gt;&lt;img style="cursor: pointer; width: 370px; height: 405px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SqUXvUzQ_QI/AAAAAAAAAhg/_yD-4a1ySlw/s320/LDA.png" alt="" id="BLOGGER_PHOTO_ID_5378731431768947970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Based on the table, we were able to get a 92% classification of objects.&lt;br /&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for understanding ang implementing properly LDA.&lt;br /&gt;&lt;br /&gt;I thank Mark Jayson and Luis for happy conversations while doing the activity in the IPL lab.&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;[1]http://people.revoledu.com/kardi/tutorial/LDA/Numerical%20Example.html&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-1794553959035926231?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/1794553959035926231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-15-probabilistic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/1794553959035926231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/1794553959035926231'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/09/activity-15-probabilistic.html' title='Activity 15 - Probabilistic Classification'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_BnAGna7nCnA/SqUXvUzQ_QI/AAAAAAAAAhg/_yD-4a1ySlw/s72-c/LDA.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-6641268050896899889</id><published>2009-08-31T06:46:00.000-07:00</published><updated>2009-09-07T07:12:29.964-07:00</updated><title type='text'>Activity 14 - Pattern recognition</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The human brain has the capacity to discriminate from one object to another. From the stigma it receives from the eyes (-or from other sensory organs), one of the things that human does is to find significant features unique to the objects and draw,as well, overlapping features between different objects that will allow to recognize things. The aim of computer vision is to approximate the pattern recognition capabilities of the human brain. Various features can be found in a certain object or pattern -- color, size, shape, area, etc. We use such features to identify an object as a member of a set that has the same properties (this set is called a class).&lt;br /&gt;In this activity, we are tasked to classify objects according to their classes using their physical features. We should be able to (1) find the correct features that will effectively separate the classes and (2) create a classifier (or an algorithm) that is suitable for the task.&lt;br /&gt;&lt;br /&gt;In Task 1, we determine the useful features and train a representative set of objects of known class and calculate the feature values (for example, area). An average value per feature is taken from the whole class.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SqTLl4O4yCI/AAAAAAAAAhY/xGaj0EnFTqI/s1600-h/mean.png"&gt;&lt;img style="cursor: pointer; width: 97px; height: 45px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SqTLl4O4yCI/AAAAAAAAAhY/xGaj0EnFTqI/s320/mean.png" alt="" id="BLOGGER_PHOTO_ID_5378647706597640226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;where &lt;span style="font-style: italic;"&gt;m&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;j&lt;/sub&gt; is the average for all feature &lt;span style="font-style: italic;"&gt;x&lt;sub&gt;j&lt;/sub&gt;&lt;/span&gt; of class &lt;span style="font-style: italic;"&gt;w&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;j&lt;/sub&gt;. It is a 1x&lt;span style="font-style: italic;"&gt;n&lt;/span&gt; matrix for all features &lt;span style="font-style: italic;"&gt;n&lt;/span&gt;. These average values will be used as the basis for classification. In our case, we used the r-g chromaticity (discussed in Activity 12)and dimension ratio (length/width) as features for the set of classes we gathered (image is shown below).&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SqTJr5d8jUI/AAAAAAAAAhQ/KGXXJ2cuSBo/s1600-h/DSC00814.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 204px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SqTJr5d8jUI/AAAAAAAAAhQ/KGXXJ2cuSBo/s320/DSC00814.JPG" alt="" id="BLOGGER_PHOTO_ID_5378645610985196866" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. Dataset of classes used that contains a set of short and long leaves, flowers, and 25-cent and 1-peso coins.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Once the &lt;span style="font-style: italic; font-weight: bold;"&gt;m&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;j&lt;/sub&gt; for all the classes are done, we are now ready to classify a test object based on its features. We extract all the needed features &lt;span style="font-style: italic; font-weight: bold;"&gt;x&lt;/span&gt; and determine what class it belongs to. For Task 2, we used the Euclidean distance as a classifier for our test objects. It is given by:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-size:130%;" &gt;d&lt;sub&gt;j&lt;/sub&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;(&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-size:130%;"&gt;) = &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;sup style="font-style: italic;"&gt;T&lt;/sup&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:130%;" &gt;m&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;sub style="font-style: italic;"&gt;j&lt;/sub&gt; - 1/2 &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:130%;" &gt;m&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;sub style="font-style: italic;"&gt;j&lt;/sub&gt;&lt;sup style="font-style: italic;"&gt;T&lt;/sup&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-size:130%;" &gt;m&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;sub style="font-style: italic;"&gt;j&lt;/sub&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This determines how close the features &lt;span style="font-style: italic; font-weight: bold;"&gt;x&lt;/span&gt; of an object to the features of class &lt;span style="font-style: italic;"&gt;j&lt;/span&gt;. The object will be classified as belonging to a class which yields the largest &lt;span style="font-style: italic;"&gt;d&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;j&lt;/sub&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Results&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Below is 3D plot of features extracted from the objects in our dataset. We readily see an obvious separation of class clusters of the leaves (short and long) and of the flowers. One reason is that the color of the flower is different from the color of the leaves. The difference in the dimension ratio of the short leaves and long leaves has also separated the two leaf types. However, class clusters of the coins were not well separated. Based on the criteria used, the dimension ratio cannot possibly separate the two since both are circular (dimention ratio ~ 1). Only the color determined by the r-g chromaticities will be able to separate them.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SqS7XXzotcI/AAAAAAAAAg4/6s8BT3vr6tA/s1600-h/%23Dcorrect.png"&gt;&lt;img style="cursor: pointer; width: 382px; height: 241px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SqS7XXzotcI/AAAAAAAAAg4/6s8BT3vr6tA/s320/%23Dcorrect.png" alt="" id="BLOGGER_PHOTO_ID_5378629865189193154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Separation of class clusters using the r, g and dimension ratio as features&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We take a look at the distribution of points using only the r-g chromaticities -- Fig.1 as viewed from the above. Here, we see that there is an overlap between the clusters of 1-peso and 25-cent coins. In r-g chromaticity diagram (see Fig. 3 in Activity 12), the color yellow and white, which are the colors of the 25-cents and 1-peso, respectively, lie close to each other. It is thus expected that the clusters be consequently close. The overlap is caused by the highly reflective surface of the coins. In our case, a 25-cent coin is misidentified as a 1-peso coin. Highly reflective 25-cents (the new ones) will appear as though it is a 1-peso coin.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SqS7XpzAWLI/AAAAAAAAAhA/a5SRhFcYqQc/s1600-h/rg-correct.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 250px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SqS7XpzAWLI/AAAAAAAAAhA/a5SRhFcYqQc/s320/rg-correct.png" alt="" id="BLOGGER_PHOTO_ID_5378629870018386098" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Figure 3. r-g chromaticities of the samples. A single data point overlap of the between two  clouds of data points -- cloud of peso coins (inverted triangle) and 25 centavo coins (filled diamonds) is seen indicating that the r-g chromaticity wrongly classifies a 25-cent as a 1-peso coin.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From the plots, we can already observe whether the features we used is capable of classifying objects. However, this can only be handy when dealing with at most 3 features. More than this will be very hard to visualize. The advantage of a classifier such as the Euclidean distance is that it essentially decomposes all the features into one number, thereby resulting to easier classification of objects. Below is a table of test objects and there classification using the algorithm.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Table 1. List of Euclidean distances of the samples from the training set&lt;/span&gt;. &lt;span style="font-size:85%;"&gt;Sample x -&lt;span style="font-style: italic;"&gt; i&lt;/span&gt; are samples taken from a set of samples &lt;span style="font-style: italic;"&gt;i&lt;/span&gt; where &lt;span style="font-style: italic;"&gt;i&lt;/span&gt; = {peso, 25 cents, long leaf, short leaf, flower}&lt;/span&gt;.&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SqS9EgbuNfI/AAAAAAAAAhI/tY72f6xsnBw/s1600-h/eucledian.png"&gt;&lt;img style="cursor: pointer; width: 343px; height: 389px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SqS9EgbuNfI/AAAAAAAAAhI/tY72f6xsnBw/s320/eucledian.png" alt="" id="BLOGGER_PHOTO_ID_5378631740110550514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Spx8PWMEzvI/AAAAAAAAAgA/i3f_HkKwB9k/s1600-h/rawplot.png"&gt;&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class="on" style="display: block;" id="formatbar_JustifyCenter" title="Align Center" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 11);ButtonMouseDown(this);"&gt;&lt;img src="http://www.blogger.com/img/blank.gif" alt="Align Center" class="gl_align_center" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Values highlighted with yellow belong to the column where the samples are classified. For example, Sample 1-1 resulted the highest value at &lt;span style="font-style: italic;"&gt;d&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;peso&lt;/sub&gt; hence classified as a 1-peso coin. All the classifications were correct except for one sample. This is a 25-cent coin wrongly classified as a 1-peso coin. The features used are 96% accurate in classification.&lt;br /&gt;Note that the features used are not enough to completely separate the classes of coins. One can use the area as a feature to be able to do such.&lt;br /&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for doing the job well.&lt;br /&gt;&lt;br /&gt;I thank Luis, Mark Jayson and Irene for useful discussions. Especial thanks to Mark Jayson, Irene and Kaye for lending the dataset.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-6641268050896899889?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/6641268050896899889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-14-pattern-recognition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/6641268050896899889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/6641268050896899889'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-14-pattern-recognition.html' title='Activity 14 - Pattern recognition'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_BnAGna7nCnA/SqTLl4O4yCI/AAAAAAAAAhY/xGaj0EnFTqI/s72-c/mean.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-3363342759837914608</id><published>2009-08-31T04:15:00.000-07:00</published><updated>2009-09-07T00:25:37.670-07:00</updated><title type='text'>Activity 13 - Correcting Geometric Distortion</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;Digital images captured by cameras, most of the time, are different from the one we see with our eyes -- although some are unrecongnizable. The color for example is altered by the spectral sensitivity and white balance settings of the camera. Another factor that contributes to these differences is the distortion it adds to the captured image due to its lens configuration. Pincushion and barrel distortions are observed in spherical lenses. In pincushion distortion, the image seems pinched in the middle and expanded in the boundaries. In barrel distortion, the image seems bloated in the middle and pinched at the sides *[1]. Below are images that demonstrates the two distortions.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Spu3bt29LgI/AAAAAAAAAfQ/NeviEqu34G0/s1600-h/barrel-pincushion.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 143px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Spu3bt29LgI/AAAAAAAAAfQ/NeviEqu34G0/s320/barrel-pincushion.png" alt="" id="BLOGGER_PHOTO_ID_5376092266991267330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Figure 1. (left) Pincushion and (right) barrel distortion of a square grid&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;Cameras using compound lenses have considerably minimized these effects. Single lens cameras render a much more obvious distortion.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;In this activity, we are tasked to correct distorted image. We download an image from the net with distorted grid patterns. The idea is to perform an image processing technique to make straight lines look straight.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Steps in correcting a distorted image&lt;/span&gt;:&lt;br /&gt;1. Find the image coordinates the four corners of a square where the effect of the distortion is small. Usually, this can be found at the center of the image or at the optical axis of the camera.&lt;br /&gt;&lt;br /&gt;2. Create an ideal grid from the obtained coordinates. (The grid only contains corner points.)&lt;br /&gt;&lt;br /&gt;3. Calculate c's from the corner points using the equation below to be able to transfer distorted image coordinate to the ideal image coordinates.(c's are unique to a specific square)&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SpvGqWQWZoI/AAAAAAAAAfg/CItzkkVXNPg/s1600-h/c%27s2.png"&gt;&lt;img style="cursor: pointer; width: 352px; height: 98px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SpvGqWQWZoI/AAAAAAAAAfg/CItzkkVXNPg/s320/c%27s2.png" alt="" id="BLOGGER_PHOTO_ID_5376109011027781250" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;(x,y) is from the ideal image coordinates, (x,y) is from the distorted image coordinates. The c's allow us to determine the location of a pixel from the ideal image to the distorted image.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;4. Transfer grayscale values.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Nearest neighbor technique&lt;/span&gt;: In determining the distorted image coordinates that correspond to the ideal image coordinates (using the c's), cases may occur that the calculations would yield non-integer coordinates. In the simplistic case, one can round the coordinates, then the grayscale value of the that pixel will be transferred to the ideal image. The advantage of this is that it is fast, although the reconstruction is pixelated and jagged.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Bilinear interpolation&lt;/span&gt;: If the location of the pixel from the ideal image corresponds to &lt;span style="font-style: italic;"&gt;integer&lt;/span&gt; distorted image coordinates, pixel values from the distorted image can be directly transferred to the ideal image. If not, we use the equation below:&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SpvH91Z7K-I/AAAAAAAAAfo/BCTUWNeO1Ps/s1600-h/grayscale.png"&gt;&lt;img style="cursor: pointer; width: 181px; height: 28px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SpvH91Z7K-I/AAAAAAAAAfo/BCTUWNeO1Ps/s320/grayscale.png" alt="" id="BLOGGER_PHOTO_ID_5376110445318581218" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;a, b, c and d can be calculated using the surrounding pixels of the pixel with non-integer coordinates.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Results&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this work, we demonstrate the two techniques used in the correcting distorted images as well as the other application of the techniques.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SqSbzw9yokI/AAAAAAAAAgw/H6xUZPnxitw/s1600-h/barrelandrecon.png"&gt;&lt;img style="cursor: pointer; width: 267px; height: 421px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SqSbzw9yokI/AAAAAAAAAgw/H6xUZPnxitw/s320/barrelandrecon.png" alt="" id="BLOGGER_PHOTO_ID_5378595168606921282" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Distorted grid (above) and the corrected image (below)&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The above figure consist of the distorted grid and the corrected grid. In this particular example, the nearest neighbor technique was used. We can see that this technique can fairly reconstruct the image. The 'jagged' effect of the technique is less manifested because of the thick lines of the grids.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Note&lt;/span&gt;: In this work, the distorted image coordinates of the corner points were determined using the &lt;span style="font-style: italic;"&gt;locate&lt;/span&gt; function in Scilab. Given a very large grid, this procedure is very tedious and time-consuming. Alternatively, one can perform image processing techniques to determine the coordinates. However, when given a real distorted image as in Fig.3, locate is much more convenient to use since it would be harder to separate the grid lines.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;The procedure can also be applied to distort an image. Here's how it's done.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;We have a very good, undistorted image. We overlay a distorted grid to the image. Then we perform the same procedure as done previously. In this particular case, we use the bother technique, bilinear interpolation to reconstruct the image.Below is the image and its distortion.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/Spux_yCCAwI/AAAAAAAAAfI/XWsAR_YLReI/s1600-h/reconandorig.png"&gt;&lt;img style="cursor: pointer; width: 309px; height: 441px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/Spux_yCCAwI/AAAAAAAAAfI/XWsAR_YLReI/s320/reconandorig.png" alt="" id="BLOGGER_PHOTO_ID_5376086289516987138" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 3. (above) image and (below) its distortion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Here, we observe the success of the procedure. We have straightened the straight lines and were able to distort the image. Image distortion will be highly appreciated if the pixels from the ROI is contained in obviously distorted grids.&lt;br /&gt;&lt;br /&gt;I give myself a grade of 10 fro exploring to the two techniques and the possible application of the procedure.&lt;br /&gt;&lt;br /&gt;I thank Mark Jayson, Luis and Orly for useful discussions.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;this&gt;&lt;br /&gt;&lt;/this&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;References:&lt;br /&gt;[1] Activity 13 manual&lt;br /&gt;[2]http://upload.wikimedia.org/wikipedia/en/9/97/Pincushion-distortion.jpg&lt;br /&gt;[3]http://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Barrel_distortion.svg/600px-Barrel_distortion.svg.png&lt;br /&gt;*Sentences are stated vervatim.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-3363342759837914608?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/3363342759837914608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-13-correcting-geometric.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3363342759837914608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3363342759837914608'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-13-correcting-geometric.html' title='Activity 13 - Correcting Geometric Distortion'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_BnAGna7nCnA/Spu3bt29LgI/AAAAAAAAAfQ/NeviEqu34G0/s72-c/barrel-pincushion.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-8347964354512419828</id><published>2009-08-05T11:46:00.001-07:00</published><updated>2009-08-06T12:26:36.627-07:00</updated><title type='text'>Activity 12 - Color Image Segmentation</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;From the previous activities, we find that thresholding is indeed a powerful way in separating our region of interest with the rest of the image. This technique, however, has its limitations. Thresholding can only be applied to images with single-value pixels such as grayscale images. When dealing with colored images (where each pixel has 3 values -- RGB), one has to reduce it first to grayscale before thresholding. Upon reduction, different colors may appear the same in grayscale. As such, separation of the ROI may not be possible just by thresholding. In this activity, we perform another technique for ROI separation in colored images -- color image segmentation.&lt;br /&gt;&lt;/div&gt;Colored images may have different shades (or brightness) of colors inherent to it. Thus, it is better represent the image into brightness and chromaticity information. This is called the normalized chromaticity coordinates (NCC).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Transforming RGB to NCC&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Per pixel, we add up the RGB values &lt;span style="font-style: italic;"&gt;I = R+G+B. &lt;/span&gt;The NCC is then:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;r = R/I&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;g = G/I&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;b = B/I&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Note that&lt;span style="font-style: italic;"&gt; b&lt;/span&gt; is also equal to &lt;span style="font-style: italic;"&gt;1-r-g &lt;/span&gt;hence only the r and g values are needed to represent the chromaticities &lt;span style="font-style: italic;"&gt;r,g &lt;/span&gt;and&lt;span style="font-style: italic;"&gt; b. &lt;/span&gt;We essentially have transformed RGB to rgI values where I accounts for the brightness of the pixel.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Two techniques will be used in this activity - parametric and non-parametric segmentation.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Parametric segmentation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In parametric segmentaion, we crop a portion of the ROI and take the mean and standard deviation for the chromaticities &lt;span style="font-style: italic;"&gt;r&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;g&lt;/span&gt;. To check whether a pixel belongs to the ROI, we check its probability of belonging to the ROI. Since pixel has two chromaticities, we calculate the effective probability&lt;br /&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;p = p(r)*p(g)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;where&lt;span style="font-style: italic;"&gt; p(r) &lt;/span&gt;and&lt;span style="font-style: italic;"&gt; p(g) &lt;/span&gt;are the probabilities of a pixel with chromaticities&lt;span style="font-style: italic;"&gt; r&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;g&lt;/span&gt;, respectively belongs to the ROI. We now assume a Gaussian function using the calculated mean and standard deviation for each chromaticity such that the probabilities &lt;span style="font-style: italic;"&gt;p(r) &lt;/span&gt;and &lt;span style="font-style: italic;"&gt;p(g) &lt;/span&gt;takes the form:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnpEm7cE9aI/AAAAAAAAAcg/YPCC-xPA-08/s1600-h/equation.PNG"&gt;&lt;img style="cursor: pointer; width: 211px; height: 45px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnpEm7cE9aI/AAAAAAAAAcg/YPCC-xPA-08/s320/equation.PNG" alt="" id="BLOGGER_PHOTO_ID_5366677341546542498" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;where &lt;span style="font-style: italic;"&gt;x&lt;/span&gt; is the r-g chromaticity of the pixel.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The result of the whole process is a martix of &lt;span style="font-style: italic;"&gt;p&lt;/span&gt; values the same size as the image. High values of &lt;span style="font-style: italic;"&gt;p&lt;/span&gt; will only occur at ROI and thus we effectively separated the ROI from the rest of the image. Below are examples of the results using this method.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SnpId4LW_qI/AAAAAAAAAco/9Grjh4DYEps/s1600-h/ryball.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 241px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SnpId4LW_qI/AAAAAAAAAco/9Grjh4DYEps/s320/ryball.png" alt="" id="BLOGGER_PHOTO_ID_5366681584098803362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Fig.1 (upper left) the raw image and (rest) the segmented images of red, yellow and blue patches.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnpMHoXVA7I/AAAAAAAAAcw/A1H9w_sVAYE/s1600-h/flower.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 150px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnpMHoXVA7I/AAAAAAAAAcw/A1H9w_sVAYE/s320/flower.png" alt="" id="BLOGGER_PHOTO_ID_5366685599943426994" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Fig.2. (left) the raw image ang (right) the segmented image using parametric segmentation&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;Here we see a complete segmentation of the ROI.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Non-parametric segmentation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This technique does not assume any form of function unlike the previous one. What is need is just the 2D chromaticity histogram of a portion of the ROI. (Note that the axes are the &lt;span style="font-style: italic;"&gt;r &lt;/span&gt;and&lt;span style="font-style: italic;"&gt; g &lt;/span&gt;chromaticities in different levels). In creating the histogram, binning is important because it will determine the quality of the segmentation. If bin sizes are small the details of the ROI is preserved but the toleration of the technique in terms of chromaticity would be very low which results to dark regions in the ROI. If on the other hand, the bin sizes are large, the toleration becomes high such that most of the pixels in the ROI is bright but we compromise its details. Our choice of bins depends on what we want. In this particular case, we used a bin size equal to 256, 32 and 10 to demonstrate their reconstuction differences. Once the histogram is created, we now back-project the chromaticity values of each pixel in the image to the histogram. Steps of backprojection is shown below.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Snsrb-gvfDI/AAAAAAAAAeo/iCwGJkk8wms/s1600-h/Untitled.jpg"&gt;&lt;img style="cursor: pointer; width: 275px; height: 249px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Snsrb-gvfDI/AAAAAAAAAeo/iCwGJkk8wms/s320/Untitled.jpg" alt="" id="BLOGGER_PHOTO_ID_5366931140578868274" border="0" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;/div&gt; &lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SnssgxJOtnI/AAAAAAAAAew/T5i9ve_Z9No/s1600-h/hist.jpg"&gt;&lt;img style="cursor: pointer; width: 261px; height: 261px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SnssgxJOtnI/AAAAAAAAAew/T5i9ve_Z9No/s320/hist.jpg" alt="" id="BLOGGER_PHOTO_ID_5366932322401564274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 3. Verification of the histogram&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;Before the backprojection, we first verify if the peak of the histogram corresponds to its color in the chromaticity space. The patch used is yellow. We observe that the peak coincides to the yellow region.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Histogram backprojection&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Obtain the chromaticity (&lt;span style="font-style: italic;"&gt;r,g&lt;/span&gt;) values of each pixel in the image.&lt;/li&gt;&lt;li&gt;For each pixel, find its position (&lt;span style="font-style: italic;"&gt;r,g&lt;/span&gt;) on the histogram and find its value.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The value at the pixel location is changed to the histogram value found.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Snsrb-gvfDI/AAAAAAAAAeo/iCwGJkk8wms/s1600-h/Untitled.jpg"&gt; &lt;/a&gt;&lt;div style="text-align: justify;"&gt;In this technique, we can infer that high values will be obtained when the (r,g) values of the pixel in the image corresponds to the (r,g) where high values occurred in the histogram. Shown in Fig.3 is the result of this technique.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SnpvIFXCmbI/AAAAAAAAAdA/DbUf7CaK12Y/s1600-h/allflower.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 302px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SnpvIFXCmbI/AAAAAAAAAdA/DbUf7CaK12Y/s320/allflower.png" alt="" id="BLOGGER_PHOTO_ID_5366724090633820594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Figure 4. (clockwise from upperleft): the raw image and the sementated images using (1) 256 bins, (2) 10 bins and (3) 32 bins in the histogram. (Note that large bins correspond to small bin sizes).&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;In Fig.4, we indeed see that the segmentation quality differs at different bin sizes. This technique is much better than the previous one since it does not any assumptions. The only challenge is that one should be able to find the proper bin sizes depending on what he wants.&lt;br /&gt;&lt;br /&gt;In this activity, I give myself a grade of 9/10 for doing a good job.&lt;br /&gt;&lt;br /&gt;I thank Ma'am Jing for helping me get through some problems encountered in this activity.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-8347964354512419828?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/8347964354512419828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-12-color-image-segmentation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/8347964354512419828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/8347964354512419828'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-12-color-image-segmentation.html' title='Activity 12 - Color Image Segmentation'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_BnAGna7nCnA/SnpEm7cE9aI/AAAAAAAAAcg/YPCC-xPA-08/s72-c/equation.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-4654072701223695785</id><published>2009-08-05T11:39:00.000-07:00</published><updated>2009-08-06T11:41:59.496-07:00</updated><title type='text'>Activity 11 - Color Image Processing</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;Objects have their innate color reflectance. The amount and color of light, however, does not depend on reflectance alone. Light reflected also depends on the spectrum of the light source that illuminates the object. Moreover, the device used to capture effective reflectance also comes into play.  Cameras are one of these devices. Cameras have their own spectral sensitivities like the eye and thus render colors they detect depending on such sensitivities.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;Images are rendered in different modes -one of which is in RGB mode represented in the following equations.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnrIQUiq8wI/AAAAAAAAAdY/sHeAa8tx05o/s1600-h/RGB.jpg"&gt;&lt;img style="cursor: pointer; width: 187px; height: 97px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnrIQUiq8wI/AAAAAAAAAdY/sHeAa8tx05o/s320/RGB.jpg" alt="" id="BLOGGER_PHOTO_ID_5366822088682959618" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-style: italic;"&gt;ρ&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;λ&lt;/span&gt;) and &lt;span style="font-style: italic;"&gt;S&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;λ&lt;/span&gt;) are the  reflectance and light source, respectively and, &lt;span style="font-style: italic;"&gt;η&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;λ&lt;/span&gt;) are the spectral sensitivities of the camera (subscripts indicate the channel sensitivity - red, green and blue). &lt;span style="font-style: italic;"&gt;K&lt;/span&gt;&lt;sub style="font-style: italic;"&gt;i&lt;/sub&gt;&lt;/span&gt; are called the white balancing constants of the form:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SnrIQow3xdI/AAAAAAAAAdg/IKwnEOXXlb0/s1600-h/WB.jpg"&gt;&lt;img style="cursor: pointer; width: 149px; height: 52px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SnrIQow3xdI/AAAAAAAAAdg/IKwnEOXXlb0/s320/WB.jpg" alt="" id="BLOGGER_PHOTO_ID_5366822094111229394" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt; These constants are important so that the camera renders the correct reflectance of an object. Digital cameras have this option to change their white balance depending on the current source that illuminates on the object i.e. cloudy, sunny, fluorescent, etc. When the white balance of the camera does not match the light source, what happens is that the reflectance of the object is rendered incorrectly by the camera. In such case, we say that the camera is improperly white balanced. We can readily see this if, for example, we see a known white object as a non-white (bluish probably). When faced with such images, image processing techniques has to be done to correct them.&lt;br /&gt;&lt;br /&gt;In this activity, we explore two of the white balancing algorithms used for such images -- the White Patch algorithm and the Gray World algorithm.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Algorithms&lt;/span&gt;&lt;br /&gt;White Patch (WP) algorithm is implemented by first finding a patch of a known "white" object in the image. The average RGB values (Rw Gw and Bw) of the entire patch is calculated. All 3 channels in the image is normalized using those average values. Essentially, we force the "white patch" to be white. As such, all the other pixels are affected also.&lt;br /&gt;Gray World (GW) algorithm, on the other hand, has the same implementation as the WP algorithm only that the image is normalized by the average RGB values of the entire image. The algorithm , given an image with a sufficient amount of color variations [1], assumes that the average color of the world is gray - a family of white. In this case, we force the image to have a common gray value. As a result, the effect of the illuminant on the image is removed. The image then becomes white-balanced.&lt;br /&gt;&lt;br /&gt;Below are images of  a scene under constant lighting environment captured by a Motorola W156 camera phone with different white balancing (WB) settings. Both algorithms were performed in each image.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SnsMpjhrL_I/AAAAAAAAAeI/6VsTaRBzoeI/s1600-h/all.png"&gt;&lt;img style="cursor: pointer; width: 360px; height: 367px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SnsMpjhrL_I/AAAAAAAAAeI/6VsTaRBzoeI/s320/all.png" alt="" id="BLOGGER_PHOTO_ID_5366897288992731122" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Fig1. (left column)Images containing different colors under different WB settings of the camera and, white-balanced images using (middle) WP and (right) GW algorithms.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Comparing the raw images from the reconstructed images using either of the algorithms, we see that we have successfully implemented the techniques. The background (which is in actual white) in the raw images initially does not appear white. For example, the background of the image using indoor WB camera settings appears blue but now appears white upon white balancing.&lt;br /&gt;Also, we observe that the both algorithms produces different results - which is expected since they have different implementation. It can be seen that the images produces using GW algorithm is much brighter than that of the WP algorithm. In this case, we can infer that after the GW implementation, a lot of pixel values saturated which means that these pixel values exceed the supposedly maximum value of 1. This is not what we want. Here we see the disadvantages of the the GW algorithm. One is that, the image must satisfy a condition (that it must contain a sufficient amount of color variations) for the GW algorithm to work. Another is that since the algorithm normalizes the image using the average RGB values of the image it is expected that saturation of RGB values will occur.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;In this part we now use the two algorithms onto monochromatic images.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SnsPXvnhA-I/AAAAAAAAAeY/w3VcoifEfhQ/s1600-h/green.png"&gt;&lt;img style="cursor: pointer; width: 381px; height: 303px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SnsPXvnhA-I/AAAAAAAAAeY/w3VcoifEfhQ/s320/green.png" alt="" id="BLOGGER_PHOTO_ID_5366900281535693794" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Monochromatic images capture using different WB camera settings and the reconstructed images using the two algorithms.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;From the figure above, we see that the reconstruction of the images using the WP algorithm is way better than the GW algorithm. Again, we go back to the first condition an image must satisfy for the GW to work. Since the images are monochromatic; that is, they do not contain a variety of colors, GW is not appropriate to use.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Strengths and Weaknesses of Each Algorithm.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From the results obtained, we can pretty much gauge the strengths and weaknesses of each algorithm. The GW algorithm does not need any white patch to reconstruct the image hence it is useful when one does not know anything about the image.&lt;br /&gt;Based on the results, we can infer that WP algorithm can work whether the images are monochromatic or colorful. And algorithm can be generically used for white balancing images. However, this will only work if one knows a "white" object in the image.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;In general, GW algorithm is more convenient to use than WP. It is easier to implement since we do not need to find white patches in the image and very handy when dealing with colorful images.&lt;br /&gt;&lt;br /&gt;I give myself a grade of 9/10 in this activity since I was able to explain the strengths and limitations of the algorithms.&lt;br /&gt;&lt;br /&gt;I thank Orly, Thirdy and Master for useful discussions.&lt;br /&gt;References:&lt;br /&gt;[1]http://scien.stanford.edu/class/psych221/projects/00/trek/GWimages.html&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-4654072701223695785?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/4654072701223695785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-11-color-image-processing.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/4654072701223695785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/4654072701223695785'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-11-color-image-processing.html' title='Activity 11 - Color Image Processing'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_BnAGna7nCnA/SnrIQUiq8wI/AAAAAAAAAdY/sHeAa8tx05o/s72-c/RGB.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-5306221511251709701</id><published>2009-08-01T08:24:00.000-07:00</published><updated>2009-08-05T11:37:53.204-07:00</updated><title type='text'>Activity 10: Pre-processing Text</title><content type='html'>&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;In an image, most often than not we only need a certain part or a certain element -- the region of interest(ROI). It may be an object or a text. Either of the two, we need to perform image processing techniques to extract what we need. In this activity, we exploit these techniques particularly in text retrieval. One of its applications is in handwriting recognition.&lt;br /&gt;In this case, we used a scanned image with texts shown in Fig.1(left) as our raw image.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/Snco2HwkgFI/AAAAAAAAAZw/yJsi3oYuN74/s1600-h/orig+image.png"&gt;&lt;img style="cursor: pointer; width: 373px; height: 212px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/Snco2HwkgFI/AAAAAAAAAZw/yJsi3oYuN74/s320/orig+image.png" alt="" id="BLOGGER_PHOTO_ID_5365802391296049234" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. Raw image used in pre-processing text. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We cropped a portion from Fig.1.(left) to be cleaned. Initially the image is rotated so we have to rotate it back so that image processing will be easier. This was done by taking the Fourier transform(FT)  of the cropped image in Fig.1(upper right). The frequencies of rotated horizontal lines manifest as a tilted vertical line in the Fourier space. The angle of the tilt was measured using MSPaint. This angle was used to rotate the image back using &lt;span style="font-style: italic;"&gt;mogrify&lt;/span&gt; command in Scilab. Alternatively, one can measure the tilt angle using Fig.1(upper left) immediately without performing FT.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Sncqjv752aI/AAAAAAAAAaY/GK3dIUt11Lo/s1600-h/rec_image.png"&gt;&lt;img style="cursor: pointer; width: 374px; height: 198px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Sncqjv752aI/AAAAAAAAAaY/GK3dIUt11Lo/s320/rec_image.png" alt="" id="BLOGGER_PHOTO_ID_5365804274686744994" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Removal of horizontal lines on the selected portion of Fig.1(left).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Now that  the image is rotated back, the next step in cleaning the image is to remove the horizontal lines. To do this, we get the FT of the image then remove the frequencies of the horizontal lines and take FT again to obtain the reconstructed image.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Removal of frequencies&lt;/span&gt;: Horizontal lines as explained earlier will manifest its frequencies along the vertical axis of the Fourier domain. Blocking out these frequencies will effectively remove the horizontal lines. We do this by multiplying the FT (Fig.2 upper right) to a mask (Fig. 2 lower left) that will completely block out the frequencies along the vertical axis (excluding the center so as not darken the image).&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;After the multiplication, we now take its FT to obtain a partially cleaned image (without the horizontal lines). The image is shown in Fig.2(lower right). Using this image, we are now ready to separate the region of interest (the text) and the background.&lt;br /&gt;&lt;br /&gt;We use a simple technique for the separation process -- thresholding. Below is a comparison  between  Fig.2(lower right) and the thresholded image.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SnhOGthiwAI/AAAAAAAAAag/CFvdXzzxhCQ/s1600-h/bin_orig.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 84px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SnhOGthiwAI/AAAAAAAAAag/CFvdXzzxhCQ/s320/bin_orig.png" alt="" id="BLOGGER_PHOTO_ID_5366124833218412546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 3. (left) the pre-cleaned image and (right) a thresholded image of the left.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Here we see a separation of the text and the background. Notice, however, we observe a black line dashing through most of the text due to the horizontal line removal previously done. What we need to do next is to remove this black lines. We then preform a closing of the image using a vertical structuring element. In this case, since the texts in the image  are tilted, a 4x2 diagonal was used as a structuring element.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnmpTgNmGfI/AAAAAAAAAaw/9Zm-6eA-NwU/s1600-h/se.bmp"&gt;&lt;img style="cursor: pointer; width: 85px; height: 130px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnmpTgNmGfI/AAAAAAAAAaw/9Zm-6eA-NwU/s320/se.bmp" alt="" id="BLOGGER_PHOTO_ID_5366506583518222834" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/Snm3AGjfNBI/AAAAAAAAAbY/nmBQiHUjLGY/s1600-h/cable.png"&gt;&lt;img style="cursor: pointer; width: 239px; height: 126px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/Snm3AGjfNBI/AAAAAAAAAbY/nmBQiHUjLGY/s320/cable.png" alt="" id="BLOGGER_PHOTO_ID_5366521643375997970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 4. The structuring element used and the resulting image after closing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Here we see that that most of the black lines were removed. This is very promising to see. We have used a proper structuring element for the morphological operation. Also, we see that some letters are distinguishable. In Fig.4, we have labeled the blobs found in the image (indicated by a different gray level) and we indeed see some single-letter blobs.  It is also interesting to note that the word'"cable"  (encircled) is fairly readable although some words are not like the word "power" which we can blame to the quality of the handwriting i.e. some pen strokes are faint that it disappeared upon thresholding.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;One of the problems encountered  is that it is hard to reduce the letters into 1 pixel thick. To do this, a erosion process must be done using a 1x2 structuring element. However, some strokes on the letters are thin enough such that they are removed upon erosion which we do not want. Hence this operation was not done. Also, it can be observed that the previous "DESCRIPTION" is now almost unreadable. This has been the trade-off of the operation. Since the "DESCRIPTION" did not have the same problem as the rest of the text (dashed by black lines), performing of the close operation made it worse.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Now, we explore if we can find instances of the word "DESCRIPTION" from the whole image. We do this using the following steps:&lt;br /&gt;&lt;br /&gt;Step1: Rotate the image&lt;br /&gt;Step2: Binarize the image&lt;br /&gt;Step3: Create a "DESCRIPTION" pattern with the same font and size as in Fig.1(bottom right).&lt;br /&gt;Step4: Correlate the FT of the binarized image with the FT of the produced pattern.&lt;br /&gt;Step5: FT the result in Step 4.&lt;br /&gt;&lt;br /&gt;Below are images as a result of Steps 1-3.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SnnMWX4lOzI/AAAAAAAAAbg/gdU2Fu8Pvu8/s1600-h/ro2th.jpg"&gt;&lt;img style="cursor: pointer; width: 176px; height: 218px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SnnMWX4lOzI/AAAAAAAAAbg/gdU2Fu8Pvu8/s320/ro2th.jpg" alt="" id="BLOGGER_PHOTO_ID_5366545115729181490" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SnnMWhWsCgI/AAAAAAAAAbo/_SI5IQXxRv8/s1600-h/mask2.PNG"&gt;&lt;img style="cursor: pointer; width: 175px; height: 218px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SnnMWhWsCgI/AAAAAAAAAbo/_SI5IQXxRv8/s320/mask2.PNG" alt="" id="BLOGGER_PHOTO_ID_5366545118271375874" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 5.  (left) binarized rotated image of Fig.1(left); and (right) the pattern used for word&lt;br /&gt;detection. The pattern has font italized Arial Black with fontsize 9.&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;We then proceed with Step 4 and 5. Patterns that are the same with Fig.5(right) will have a produce a peak at their location - an indication of high value correlation. Below is the image as a result of Step 4 and 5.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnnM-vOmjUI/AAAAAAAAAb4/7pV1NaTcjlQ/s1600-h/descpeaks.png"&gt;&lt;img style="cursor: pointer; width: 258px; height: 320px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnnM-vOmjUI/AAAAAAAAAb4/7pV1NaTcjlQ/s320/descpeaks.png" alt="" id="BLOGGER_PHOTO_ID_5366545809190325570" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 6. Image as a result of correlation&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;We observed three peaks in the image which correspond to the word "DESCRIPTION". This can be readily verified in &lt;a href="http://2.bp.blogspot.com/_BnAGna7nCnA/Snco2HwkgFI/AAAAAAAAAZw/yJsi3oYuN74/s1600-h/orig+image.png"&gt;Fig.1 (left)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In this activity, I give myself of 10 for doing the job well.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-5306221511251709701?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/5306221511251709701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-10-pre-processing-text.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/5306221511251709701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/5306221511251709701'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/08/activity-10-pre-processing-text.html' title='Activity 10: Pre-processing Text'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_BnAGna7nCnA/Snco2HwkgFI/AAAAAAAAAZw/yJsi3oYuN74/s72-c/orig+image.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-3824423178674041636</id><published>2009-07-29T08:17:00.000-07:00</published><updated>2009-08-01T08:24:45.202-07:00</updated><title type='text'>Activity 9: Binary Operations</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;In image processing, especially if one is dealing with a region of interest (ROI) in an image, it is necessary to separate the ROI from the background. Thresholding is one way to effectively separate the two. This will reduce the image into a binary one. However, this requires an optimum threshold but this optimum threshold does not guarantee us a perfect separation of the ROI and the background. Instances that would sacrifice some of the ROI to zero out the background and vise-versa may be encountered. Hence, a threshold somewhere in between must be chosen that would leave some white pixels in the background and holes on the ROI.&lt;br /&gt;&lt;br /&gt;In such cases (which happens more often), morphological operations must be performed for two basic reasons: (1) to remove the small white pixels on the background and holes on the ROI and (2) to separate touching blobs in the image. Blob separation is very important for accurate determination of cell sizes, etc. Here,we use the closing and opening operators to serve our purpose. Closing is just a dilation of the image followed by an erosion. Opening is the opposite.&lt;br /&gt;&lt;br /&gt;Using the image below, we segment this into 256x256 sub-images. Threshold is applied to binarize each sub-image. Morphological operations is then performed per binarized sub-image. The area of each blob (in pixels) is calculated per sub-image. A histogram of blob areas is then obtained from all the sub-images. The thresholded is shown in Fig.2.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnByIFHJZXI/AAAAAAAAAXE/NyTI6l4vRWM/s1600-h/Circles001.jpg"&gt;&lt;img style="cursor: pointer; width: 220px; height: 183px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnByIFHJZXI/AAAAAAAAAXE/NyTI6l4vRWM/s320/Circles001.jpg" alt="" id="BLOGGER_PHOTO_ID_5363912639334933874" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Figure 1. Grayscale image of ''cells''&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SnRZFKY8e2I/AAAAAAAAAX4/bWgo-q0y6eo/s1600-h/bin-all.png"&gt;&lt;img style="cursor: pointer; width: 329px; height: 246px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SnRZFKY8e2I/AAAAAAAAAX4/bWgo-q0y6eo/s320/bin-all.png" alt="" id="BLOGGER_PHOTO_ID_5365011001328302946" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Figure2. Thresholded sub-images in Fig.1&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Before the process of opening and closing, choice of the structuring element (SE) is needed. In choosing, we have to take into account that the SE should not be large enough that upon dilation will not cause originally separated blobs to connect. As such, performing an erosion operation will not be able to separate them again. If, on the other hand, the SE is small enough, closure of relatively large holes will not be effective. Even repetitive closing would be futile. A balance between the two must be chosen.&lt;br /&gt;Here, a 3x3 cross was chosen as the SE, since there are no large holes in the binary images obtained. One of the advantage of this SE is that this will not join blobs upon closing thus we can accurately determine the cell sizes.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnRUq8ia26I/AAAAAAAAAXw/GN7iTU76JfI/s1600-h/SE.jpg"&gt;&lt;img style="cursor: pointer; width: 81px; height: 57px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnRUq8ia26I/AAAAAAAAAXw/GN7iTU76JfI/s320/SE.jpg" alt="" id="BLOGGER_PHOTO_ID_5365006152886836130" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 3. Structuring element used for morphological operations&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Using thus SE, we perform three opening to effectively remove the white pixels in the background and one closing to close the holes in the ROI. Then we use the &lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;bwlabel&lt;/span&gt;&lt;/span&gt; to label the blobs in each sub-image and calculate their areas in pixels. A figure below shows all the blobs obtained from all sub-images. Each blob are shaded differently.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SnBo4JrhUwI/AAAAAAAAAW8/LpXxIm57OXI/s1600-h/all.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 239px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SnBo4JrhUwI/AAAAAAAAAW8/LpXxIm57OXI/s320/all.png" alt="" id="BLOGGER_PHOTO_ID_5363902470078681858" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Figure 4. Cleaned images from Fig.2.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;From the areas computed, we plot the its histogram to approximate the sizes of the cells. In Fig.4, we can see that most blobs are composed only of one cell. Judging from this, we can pretty much predict that the peak of the histogram would occur at area of single-cell blobs. Below is the histogram obtained.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SnRaz8gVJGI/AAAAAAAAAYA/WwWoLFhKjTI/s1600-h/histogram.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 246px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SnRaz8gVJGI/AAAAAAAAAYA/WwWoLFhKjTI/s320/histogram.png" alt="" id="BLOGGER_PHOTO_ID_5365012904566662242" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Figure 5. Histogram of areas in pixels&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The peak corresponds to the approximate size of the cells. Examining Fig.5, we can infer that the cell size is approximately &lt;span style="font-weight: bold;"&gt;550&lt;/span&gt; pixels.&lt;br /&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for doing the job well. I acknowledge Orly, Mark Jayson and Thirdy for useful discussions and laughter.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-3824423178674041636?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/3824423178674041636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-9-binary-operations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3824423178674041636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3824423178674041636'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-9-binary-operations.html' title='Activity 9: Binary Operations'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_BnAGna7nCnA/SnByIFHJZXI/AAAAAAAAAXE/NyTI6l4vRWM/s72-c/Circles001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-2468304909253061194</id><published>2009-07-22T20:57:00.000-07:00</published><updated>2009-07-31T22:29:26.320-07:00</updated><title type='text'>Activity 8 - Morphological Operations</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;br /&gt;In this activity, we were tasked to study dilation and erosion -- two of the morpholigical operation techniques applied in image processing. These operations (usually done in binary images) are used to enhance the image for better extraction of information. Morphological techniques have different effects on the image.&lt;br /&gt;Let's take a look a dilation first. Using a structuring element; the dilation of an image is all the translation of the center of the element in the image such that their intersection is non-zero. Dilation, in effect, enlarges the image. The figure below demonstrates dilation of various images using different structuring elements.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt; &lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhM9FpZfCI/AAAAAAAAAWM/N5X9Bz8a-yc/s1600-h/labels.png"&gt;&lt;img style="cursor: pointer; width: 344px; height: 19px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhM9FpZfCI/AAAAAAAAAWM/N5X9Bz8a-yc/s320/labels.png" alt="" id="BLOGGER_PHOTO_ID_5361619968756120610" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;/div&gt; &lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmfhpcEJv2I/AAAAAAAAAV0/5kyCxL9XiGY/s1600-h/untitled.bmp"&gt;&lt;img style="cursor: pointer; width: 342px; height: 339px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmfhpcEJv2I/AAAAAAAAAV0/5kyCxL9XiGY/s320/untitled.bmp" alt="" id="BLOGGER_PHOTO_ID_5361501983432359778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. Dilation using different structuring elements&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Dilation of images can be done by hand. We just have to know the structuring element that would reshape the image. Before the simulation was done, the images as a result of dilation were first predicted. All my predictions were correct in comparison to the images obtained in Fig. 1.&lt;br /&gt;&lt;br /&gt;Erosion, on the other hand, shrinks the image. One of the application of erosion is to remove unnecessary pixel on the image. Erosion takes all the translations of a structuring element such that all its pixels are on the image. Erosion can also be predicted by hand. The figure below demonstrates erosion of different images using different structuring elements.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: center;"&gt; &lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhM9FpZfCI/AAAAAAAAAWM/N5X9Bz8a-yc/s1600-h/labels.png"&gt;&lt;img style="cursor: pointer; width: 344px; height: 19px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhM9FpZfCI/AAAAAAAAAWM/N5X9Bz8a-yc/s320/labels.png" alt="" id="BLOGGER_PHOTO_ID_5361619968756120610" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;/div&gt;&lt;/div&gt;  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhFpfZ0o1I/AAAAAAAAAV8/9inObKwBjNc/s1600-h/erode.png"&gt;&lt;img style="cursor: pointer; width: 342px; height: 342px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhFpfZ0o1I/AAAAAAAAAV8/9inObKwBjNc/s320/erode.png" alt="" id="BLOGGER_PHOTO_ID_5361611935491334994" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Erosion of images using different structuring elements.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;All my predictions were correct compared to images above.&lt;br /&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for predicting properly the images as a result of dilation and erosion and also for properly creating the images above.&lt;br /&gt;&lt;br /&gt;I thank Orly Tarun for uselful help.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-2468304909253061194?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/2468304909253061194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-8-morphological-operations.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/2468304909253061194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/2468304909253061194'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-8-morphological-operations.html' title='Activity 8 - Morphological Operations'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_BnAGna7nCnA/SmhM9FpZfCI/AAAAAAAAAWM/N5X9Bz8a-yc/s72-c/labels.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-845896459671104100</id><published>2009-07-20T07:48:00.000-07:00</published><updated>2009-08-06T02:57:24.330-07:00</updated><title type='text'>Activity 7: Enhancement in the Frequency Domain</title><content type='html'>&lt;span style="font-style: italic;"&gt;7A. Convolution Theorem&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;In this part, we were tasked to observe the changes in the modulus of the FT of the images as the size of the apertures are increased.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSht31BDGI/AAAAAAAAAUc/N0GL6NcBvkA/s1600-h/all.png"&gt;&lt;img style="cursor: pointer; width: 407px; height: 204px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSht31BDGI/AAAAAAAAAUc/N0GL6NcBvkA/s320/all.png" alt="" id="BLOGGER_PHOTO_ID_5360587265930234978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure1. 2-dot images and their FTs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Using two one-pixel dots, Fig.1(upper left), a grating-like FT was observed. As the radii of the dots increase, the FT becomes circle with decreasing radius located at the center of the two dots. this is expected since the FT is in inverse space.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSc5ZUbOFI/AAAAAAAAAUE/Vf9UdNMtOHo/s1600-h/all.png"&gt;&lt;img style="cursor: pointer; width: 415px; height: 204px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSc5ZUbOFI/AAAAAAAAAUE/Vf9UdNMtOHo/s320/all.png" alt="" id="BLOGGER_PHOTO_ID_5360581966340765778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. square images and their FTs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Same was observed using squares. As the width of the squares increases, the width of their FTs decreases. Again, this is expected.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Also, for Gaussian dots, same was observed in Fig.1. As the variance of the Gaussian is increased - which results to an increase on the width of the Gaussian dots, their corresponding FTs is decreased.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSeSofO8BI/AAAAAAAAAUU/Cbh_E3p3XE8/s1600-h/all.png"&gt;&lt;img style="cursor: pointer; width: 407px; height: 200px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSeSofO8BI/AAAAAAAAAUU/Cbh_E3p3XE8/s320/all.png" alt="" id="BLOGGER_PHOTO_ID_5360583499420987410" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure3. Guassian dot images at different variances and their FTs&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We also take a look on how the FT of these Gaussian dot images differ from that of the inverted images (max becomes min; min becomes max).  Here we plot in Fig.4 the images of the real part and imaginary part of the original and inverse Gaussian dots for comparison.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SnqnqFs4L0I/AAAAAAAAAdQ/RSs8JKoPF4o/s1600-h/comp.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 320px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SnqnqFs4L0I/AAAAAAAAAdQ/RSs8JKoPF4o/s320/comp.png" alt="" id="BLOGGER_PHOTO_ID_5366786247492120386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 4. (upper row) images for the real part of original and inverse of 2 Gaussian dots; (lower row) images for the imaginary part of the original and inverse of 2 Gaussian dots.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;We observe from the figure that only the real part changed upon inversion. The imaginary part remained the same.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;7B. Fingerprints: Ridge Enhancements&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this part of the activity, we are to remove the blotches present in the image. Here we use the FT, we use a mask to remove the frequencies that result to the blotches and retain the information needed. We then take the inverse FT, we obtain a better image.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SmhOoplQsNI/AAAAAAAAAWU/WOvWcQ7PJio/s1600-h/fingerprint_1.jpg"&gt;&lt;img style="cursor: pointer; width: 174px; height: 174px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SmhOoplQsNI/AAAAAAAAAWU/WOvWcQ7PJio/s320/fingerprint_1.jpg" alt="" id="BLOGGER_PHOTO_ID_5361621816648446162" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhOpaIwmCI/AAAAAAAAAWk/TB0LvCvPSk0/s1600-h/fingerF.jpg"&gt;&lt;img style="cursor: pointer; width: 174px; height: 174px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhOpaIwmCI/AAAAAAAAAWk/TB0LvCvPSk0/s320/fingerF.jpg" alt="" id="BLOGGER_PHOTO_ID_5361621829682239522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhOpjhjQ9I/AAAAAAAAAWs/Uw7f9PyTNYM/s1600-h/fingerF2.jpg"&gt;&lt;img style="cursor: pointer; width: 174px; height: 174px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhOpjhjQ9I/AAAAAAAAAWs/Uw7f9PyTNYM/s320/fingerF2.jpg" alt="" id="BLOGGER_PHOTO_ID_5361621832202142674" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhOpHmtDCI/AAAAAAAAAWc/N0s35zGQcxM/s1600-h/Rec_finger.jpg"&gt;&lt;img style="cursor: pointer; width: 176px; height: 174px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmhOpHmtDCI/AAAAAAAAAWc/N0s35zGQcxM/s320/Rec_finger.jpg" alt="" id="BLOGGER_PHOTO_ID_5361621824707562530" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Figure 5. Removal of blotches present in the image in top left. A mask in bottom left was multiplied to the FT of the image (top right) to obtain a reconstructed image in bottom right.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;As observed in the reconstructed image in Fig. 5 (bottom right), we essentially remove the blotches from the original image. Although the area surrounding the blotches darkened. This can be further improved if a better mask is used.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;7C. Lunar Landing scanned Picture: Line removal&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this part of the activity, we were tasked to remove the vertical lines present in image below. Here, we use the Fourier transform to take information of the image in the frequency domain. We remove the frequencies that cause the vertical lines. From the previous exercise, we have learned that the frequencies of vertical lines are contained on the horizontal axis of the FT. Therefore, removal of frequencies lying on the horizontal axis removes the vertical lines.&lt;br /&gt;&lt;span style="font-size:78%;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SmSkKfxUPqI/AAAAAAAAAUs/LlAERDavUXc/s1600-h/hi_res_vertical_lgray.gif"&gt;&lt;img style="cursor: pointer; width: 192px; height: 146px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SmSkKfxUPqI/AAAAAAAAAUs/LlAERDavUXc/s320/hi_res_vertical_lgray.gif" alt="" id="BLOGGER_PHOTO_ID_5360589956711726754" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SmSmmUwheUI/AAAAAAAAAU0/w9hsWJsxMq8/s1600-h/highres.png"&gt;&lt;img style="cursor: pointer; width: 196px; height: 146px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SmSmmUwheUI/AAAAAAAAAU0/w9hsWJsxMq8/s320/highres.png" alt="" id="BLOGGER_PHOTO_ID_5360592633815202114" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SmSmm3Y_E7I/AAAAAAAAAU8/gLaW87WPy1o/s1600-h/highresedit.jpg"&gt;&lt;img style="cursor: pointer; width: 193px; height: 146px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SmSmm3Y_E7I/AAAAAAAAAU8/gLaW87WPy1o/s320/highresedit.jpg" alt="" id="BLOGGER_PHOTO_ID_5360592643111719858" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSoZF_YeEI/AAAAAAAAAVE/LeJ97buMIcA/s1600-h/rechighres.png"&gt;&lt;img style="cursor: pointer; width: 195px; height: 146px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSoZF_YeEI/AAAAAAAAAVE/LeJ97buMIcA/s320/rechighres.png" alt="" id="BLOGGER_PHOTO_ID_5360594605535950914" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 6. Steps  done (from upper left to lower right) to remove the vertical lines in the image.&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;From the FT in Fig.6(upper right), a mask was created Fig.6lower left) that will remove certain frequencies on the FT. The mask was then multiplied to the FT. Its FT was taken to recover the better image. In Fig.5, we see that the vertical lines were removed by removing the corresponding frequencies. Using FT, we were able to obtain a better image. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;7D. Canvas Weave Modeling and Removal&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In this part, we use again the technique demonstrated in 7C to remove the weave cross-hatches on the image in Fig.6(upper left). Since, we are dealing with cross-hatches (intertwined vertical and horizontal lines), we must take the frequencies on the horizontal and vertical axis of the FT domain. We might also consider that the cross-hatches are a result of the product of sinusoids (which has also been observed in Activity 3 Fig.5) and hence we also remove that constitute these sinusoids.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSraDrspsI/AAAAAAAAAVM/UtrAkB_iQ7s/s1600-h/canvasweavegray.JPG"&gt;&lt;img style="cursor: pointer; width: 191px; height: 137px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSraDrspsI/AAAAAAAAAVM/UtrAkB_iQ7s/s320/canvasweavegray.JPG" alt="" id="BLOGGER_PHOTO_ID_5360597920631269058" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSraZxrJiI/AAAAAAAAAVU/hmCRjMvolMM/s1600-h/canvasF.jpg"&gt;&lt;img style="cursor: pointer; width: 191px; height: 137px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSraZxrJiI/AAAAAAAAAVU/hmCRjMvolMM/s320/canvasF.jpg" alt="" id="BLOGGER_PHOTO_ID_5360597926561916450" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SmSraxxwI9I/AAAAAAAAAVk/J1g8Stz4UUY/s1600-h/canvasF10.jpg"&gt;&lt;img style="cursor: pointer; width: 188px; height: 135px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SmSraxxwI9I/AAAAAAAAAVk/J1g8Stz4UUY/s320/canvasF10.jpg" alt="" id="BLOGGER_PHOTO_ID_5360597933004694482" border="0" /&gt; &lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSryzXtMFI/AAAAAAAAAVs/Gwv0b1ZR-Os/s1600-h/canvasweave10.JPG"&gt;&lt;img style="cursor: pointer; width: 194px; height: 140px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SmSryzXtMFI/AAAAAAAAAVs/Gwv0b1ZR-Os/s320/canvasweave10.JPG" alt="" id="BLOGGER_PHOTO_ID_5360598345749180498" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Figure 7. Steps of weave cross-hatches removal&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Using the mask in Fig.7(lower left), a reconstructed image in Fig.7(lower right) was obtained. Here we see a decrease of cross-hatch visibility.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SmhYEJ6e4KI/AAAAAAAAAW0/eZYOjRKlzS0/s1600-h/weave.png"&gt;&lt;img style="cursor: pointer; width: 211px; height: 153px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SmhYEJ6e4KI/AAAAAAAAAW0/eZYOjRKlzS0/s320/weave.png" alt="" id="BLOGGER_PHOTO_ID_5361632184788508834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 8. Weave pattern extracted from the image.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Furthermore, we can see in Fig. 8 a weave pattern extracted from the image. This was done by inverting the mask and multiplying it to the FT of the image and taking the inverse FT.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;Although the technique produced promising results, our limit on reconstructing the image (or in other words our limit in creating better reconstructions) is dependent on the visibility of the peaks seen in the frequency domain. We can only block the frequencies that we see.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In this activity, I give myself a grade of 10 for doing a good job.&lt;br /&gt;&lt;br /&gt;I thank Cindy Esporlas very much for helping me to create a Gaussian dot. I thank also Master and Thirdy for their help.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-845896459671104100?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/845896459671104100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-7-enhancement-in-frequency.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/845896459671104100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/845896459671104100'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-7-enhancement-in-frequency.html' title='Activity 7: Enhancement in the Frequency Domain'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_BnAGna7nCnA/SmSht31BDGI/AAAAAAAAAUc/N0GL6NcBvkA/s72-c/all.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-7563694174568616283</id><published>2009-07-08T19:56:00.000-07:00</published><updated>2009-07-09T06:49:13.976-07:00</updated><title type='text'>Activity 6 - Properties of the 2D Fourier Transform</title><content type='html'>6.A&lt;span style="font-style: italic;"&gt; - Familiarization with FT of different 2D patterns&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In this part of the activity, Fourier transforms (FT) of different apertures were investigated. Here, we familiarize on the patterns formed by this images upon applying FT.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlVlVJ38MLI/AAAAAAAAANk/P20hoZrfYdc/s1600-h/square.png"&gt;&lt;img style="cursor: pointer; width: 80px; height: 80px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlVlVJ38MLI/AAAAAAAAANk/P20hoZrfYdc/s320/square.png" alt="" id="BLOGGER_PHOTO_ID_5356298745929281714" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlVjiG_LRgI/AAAAAAAAAM8/Uuwb5BNVvJQ/s1600-h/annulus2.png"&gt;&lt;img style="cursor: pointer; width: 80px; height: 80px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlVjiG_LRgI/AAAAAAAAAM8/Uuwb5BNVvJQ/s320/annulus2.png" alt="" id="BLOGGER_PHOTO_ID_5356296769469367810" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlVjh2kkjTI/AAAAAAAAAM0/vZijRFjEjmI/s1600-h/square+annulus2.png"&gt;&lt;img style="cursor: pointer; width: 80px; height: 80px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlVjh2kkjTI/AAAAAAAAAM0/vZijRFjEjmI/s320/square+annulus2.png" alt="" id="BLOGGER_PHOTO_ID_5356296765062810930" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXUQMBpnZI/AAAAAAAAASs/dxuwXBrzEiw/s1600-h/2dots2.png"&gt;&lt;img style="cursor: pointer; width: 80px; height: 80px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXUQMBpnZI/AAAAAAAAASs/dxuwXBrzEiw/s320/2dots2.png" alt="" id="BLOGGER_PHOTO_ID_5356420706398215570" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW3rp_HYjI/AAAAAAAAANs/hW23QC_rhnk/s1600-h/slits.png"&gt;&lt;img style="cursor: pointer; width: 93px; height: 80px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW3rp_HYjI/AAAAAAAAANs/hW23QC_rhnk/s320/slits.png" alt="" id="BLOGGER_PHOTO_ID_5356389292459909682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlVlU49pPRI/AAAAAAAAANc/edy1wedtTYc/s1600-h/square.png"&gt;&lt;img style="cursor: pointer; width: 78px; height: 75px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlVlU49pPRI/AAAAAAAAANc/edy1wedtTYc/s320/square.png" alt="" id="BLOGGER_PHOTO_ID_5356298741389802770" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlVkcK3-4nI/AAAAAAAAANU/YijDXv4jzZM/s1600-h/annulus2.png"&gt;&lt;img style="cursor: pointer; width: 81px; height: 75px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlVkcK3-4nI/AAAAAAAAANU/YijDXv4jzZM/s320/annulus2.png" alt="" id="BLOGGER_PHOTO_ID_5356297766945350258" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlVkbwMNfpI/AAAAAAAAANM/ZYbMl-9KQGU/s1600-h/square+annulus2.png"&gt;&lt;img style="cursor: pointer; width: 82px; height: 75px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlVkbwMNfpI/AAAAAAAAANM/ZYbMl-9KQGU/s320/square+annulus2.png" alt="" id="BLOGGER_PHOTO_ID_5356297759782436498" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXUPy9m28I/AAAAAAAAASk/4-KoO9ah6PQ/s1600-h/2dots2.png"&gt;&lt;img style="cursor: pointer; width: 81px; height: 75px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXUPy9m28I/AAAAAAAAASk/4-KoO9ah6PQ/s320/2dots2.png" alt="" id="BLOGGER_PHOTO_ID_5356420699670371266" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW3ryO8KkI/AAAAAAAAAN0/KgP1YyjfbWA/s1600-h/FT+slits.png"&gt;&lt;img style="cursor: pointer; width: 90px; height: 75px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW3ryO8KkI/AAAAAAAAAN0/KgP1YyjfbWA/s320/FT+slits.png" alt="" id="BLOGGER_PHOTO_ID_5356389294673766978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. (lower row) FTs of the images on the upper row.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;The figure above shows the patterns obtained as a result of taking the FT of images of different apertures (Fig.1 upper row). We see here interesting patterns. For example, the FT of a square is a sinc function along the x and y-axis. Many other shapes can be applied with FT and may observe other patterns as well.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;6.B. &lt;span style="font-style: italic;"&gt;Anamorphic property of the Fourier transform&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlXMjhAqPRI/AAAAAAAAARU/-gPqDAoPRIQ/s1600-h/at+1.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlXMjhAqPRI/AAAAAAAAARU/-gPqDAoPRIQ/s320/at+1.png" alt="" id="BLOGGER_PHOTO_ID_5356412242355698962" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXNXETNvTI/AAAAAAAAARc/rj95xipXavk/s1600-h/at+4.png"&gt;&lt;img style="cursor: pointer; width: 114px; height: 112px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXNXETNvTI/AAAAAAAAARc/rj95xipXavk/s320/at+4.png" alt="" id="BLOGGER_PHOTO_ID_5356413128002092338" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlXNiqlaZMI/AAAAAAAAARk/xPlisSzGTZk/s1600-h/at+10.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlXNiqlaZMI/AAAAAAAAARk/xPlisSzGTZk/s320/at+10.png" alt="" id="BLOGGER_PHOTO_ID_5356413327257527490" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW47qt5ynI/AAAAAAAAAN8/44yceyjn5is/s1600-h/FT+sinusoid+1.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW47qt5ynI/AAAAAAAAAN8/44yceyjn5is/s320/FT+sinusoid+1.png" alt="" id="BLOGGER_PHOTO_ID_5356390667045685874" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW48f7Uv1I/AAAAAAAAAOU/ioAQIVRf8a8/s1600-h/FT+sinusoid+4.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW48f7Uv1I/AAAAAAAAAOU/ioAQIVRf8a8/s320/FT+sinusoid+4.png" alt="" id="BLOGGER_PHOTO_ID_5356390681329057618" border="0" /&gt; &lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW5TYp64_I/AAAAAAAAAOc/9OUOqnZ41nA/s1600-h/FT+sinusoid+10.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW5TYp64_I/AAAAAAAAAOc/9OUOqnZ41nA/s320/FT+sinusoid+10.png" alt="" id="BLOGGER_PHOTO_ID_5356391074514002930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. (below) FT of (above)sinusoid images of different frequencies (left) 1Hz (middle) 4 Hz and (right) 10 Hz)&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The two points in the FT of the images are the frequencies (&lt;span style="font-style: italic;"&gt;f&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;-f&lt;/span&gt;) of the sinusoid used (0 Hz is located between the two points). As the frequency of the sinusoid increases, the distance between the two points also increases. The points get farther away from the center as the frequency is increased.&lt;br /&gt;Usual images don't have negative pixel values -- in other words the image is biased. The problem now arises, since the image is biased, is how to determine correctly the frequencies contained in the image. This is one of the powerful uses of Fourier transformation.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlXStBCi1rI/AAAAAAAAASc/cO3r9i4crNg/s1600-h/cons+bias+at+10.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlXStBCi1rI/AAAAAAAAASc/cO3r9i4crNg/s320/cons+bias+at+10.png" alt="" id="BLOGGER_PHOTO_ID_5356419002642126514" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlXSshSyQ8I/AAAAAAAAASU/bO7IDRZ-eCA/s1600-h/at+10+with+bias+at+1.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlXSshSyQ8I/AAAAAAAAASU/bO7IDRZ-eCA/s320/at+10+with+bias+at+1.png" alt="" id="BLOGGER_PHOTO_ID_5356418994120311746" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW6T-zO98I/AAAAAAAAAPM/h53LmvFLEwM/s1600-h/FT+sinusoid+10-con.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW6T-zO98I/AAAAAAAAAPM/h53LmvFLEwM/s320/FT+sinusoid+10-con.png" alt="" id="BLOGGER_PHOTO_ID_5356392184265242562" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlW6essmMqI/AAAAAAAAAPc/-UOFcudCLLU/s1600-h/FT+sinusoid+10-1.png"&gt;&lt;img style="cursor: pointer; width: 112px; height: 112px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlW6essmMqI/AAAAAAAAAPc/-UOFcudCLLU/s320/FT+sinusoid+10-1.png" alt="" id="BLOGGER_PHOTO_ID_5356392368384127650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 3. FT of 10 Hz-sinusoid images with (upper left)constant bias and (upper right)sinusoidal bias with 1 Hz frequency &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The figure above shows the a biased sinusoid image with their FTs. Fig.3(upper left) is constant-biased and the Fig.3(upper right) is sinusoid-biased. As seen, the FT of the constant-biased image has three points -- the peripheral points are the frequencies (&lt;span style="font-style: italic;"&gt;f&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;-f&lt;/span&gt;)of the image and the point at the center (at 0 Hz) accounts for the bias. The frequency of the image can now be correctly determined ignoring the bias.&lt;br /&gt;What if the image has a sinusoidal bias? These biases include noise, etc. Usually, in signals and images, non-constant biases are of low frequencies. If the frequencies contained in the image is sufficiently high, we can separate easily separate the low from the high frequencies using the FT. An example is demonstrated in Fig. 3 (right). Fig.3(upper right) is a 10 Hz-sinusoid with a 1 Hz-sinusoid bias. using FT, 2 distinct frequencies were observed: (1) the one closer to the center and (2) farther away the center. The frequency closer to the center (meaning of low frequency) accounts for the bias and the farther accounts for the frequency of the image. The low-frequency can be disregard and we are able to find the frequencies contained in the image.&lt;br /&gt;The obtained FT can also be multiplied with a function that to remove low frequencies. We can take its inverse FT to retrieve a better image. Note, however, that this technique cannot always serve its purpose right. Once the frequency contained in the image is close to the frequency of the bias, doing such might destroy the image.&lt;br /&gt;&lt;br /&gt;In this part, we rotate the image the image and look into how the FTs change with the rotation.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXP4UsQN6I/AAAAAAAAARs/T1c4G-BYtBw/s1600-h/at+4+30+degree+rot.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXP4UsQN6I/AAAAAAAAARs/T1c4G-BYtBw/s320/at+4+30+degree+rot.png" alt="" id="BLOGGER_PHOTO_ID_5356415898361018274" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlXP4a-ONnI/AAAAAAAAAR0/NyQkHNN_b-M/s1600-h/at+4+40+degree+rot.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlXP4a-ONnI/AAAAAAAAAR0/NyQkHNN_b-M/s320/at+4+40+degree+rot.png" alt="" id="BLOGGER_PHOTO_ID_5356415900046997106" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlXP4-ub4FI/AAAAAAAAAR8/txTsKJELQ6U/s1600-h/at+4+50+degree+rot.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlXP4-ub4FI/AAAAAAAAAR8/txTsKJELQ6U/s320/at+4+50+degree+rot.png" alt="" id="BLOGGER_PHOTO_ID_5356415909644460114" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW6x5YEIpI/AAAAAAAAAPs/39W5I6WwKos/s1600-h/FT+sinusoid+4-rot30.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW6x5YEIpI/AAAAAAAAAPs/39W5I6WwKos/s320/FT+sinusoid+4-rot30.png" alt="" id="BLOGGER_PHOTO_ID_5356392698205184658" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlW7D8E_VFI/AAAAAAAAAP8/X3DRTImlDhM/s1600-h/FT+sinusoid+4-rot40.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlW7D8E_VFI/AAAAAAAAAP8/X3DRTImlDhM/s320/FT+sinusoid+4-rot40.png" alt="" id="BLOGGER_PHOTO_ID_5356393008168129618" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlW7OMBCM6I/AAAAAAAAAQM/IWZrjocWxNM/s1600-h/FT+sinusoid+4-rot50.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlW7OMBCM6I/AAAAAAAAAQM/IWZrjocWxNM/s320/FT+sinusoid+4-rot50.png" alt="" id="BLOGGER_PHOTO_ID_5356393184245199778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 4. (below) FTs of the (above) rotated images at : (left) 30&lt;sup&gt;o&lt;/sup&gt; (mid) 40&lt;sup&gt;o&lt;/sup&gt; and (right) 50&lt;sup&gt;o&lt;/sup&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;We can observe in Fig. 2 and 3, that the axis of the dots of the FT is perpendicular to the bands of the image. This observation is the same even when the image is rotated. The FTs rotate as the image is rotated. This is another property of the Fourier transformation. The axis of the FTs are just rotated and same frequencies were obtained.&lt;br /&gt;&lt;br /&gt;Images may contain different frequencies (assuming the image has no biases). It can be a combination of sinusoids of  with these frequencies (i.e summation or multiplication of sinusoids). Below are images of sinusoidal combinations and their FTs.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlXQyC8PG_I/AAAAAAAAASE/VqELaLYbL3Y/s1600-h/combination%28plus%29.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlXQyC8PG_I/AAAAAAAAASE/VqELaLYbL3Y/s320/combination%28plus%29.png" alt="" id="BLOGGER_PHOTO_ID_5356416890028628978" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXQyZJwwXI/AAAAAAAAASM/ndLeJWZluvo/s1600-h/combination%28mult%29.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlXQyZJwwXI/AAAAAAAAASM/ndLeJWZluvo/s320/combination%28mult%29.png" alt="" id="BLOGGER_PHOTO_ID_5356416895990940018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW7zqdf6RI/AAAAAAAAAQc/tN5yfXpCq0Q/s1600-h/FT+add.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW7zqdf6RI/AAAAAAAAAQc/tN5yfXpCq0Q/s320/FT+add.png" alt="" id="BLOGGER_PHOTO_ID_5356393828072810770" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW8BWqiibI/AAAAAAAAAQs/4iTjKwO7rug/s1600-h/FT+mult.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW8BWqiibI/AAAAAAAAAQs/4iTjKwO7rug/s320/FT+mult.png" alt="" id="BLOGGER_PHOTO_ID_5356394063276968370" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 5. (upper row) Images formed from sinusoidal combinations and (lower row) their FTs. (upper left) z = sin(2*pi*f*X)+ sin(2*pi*f*Y) ; (upper right) z = sin(2*pi*f*X)sin(2*pi*f*Y)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;The FT of the sum of 2 sinusoids (Fig. 5(lower left)) is just the sum of the FT of each sinusoid:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;F&lt;sub&gt;t&lt;/sub&gt; =F{&lt;span style="font-size:85%;"&gt;sin(2*pi*f*X)&lt;/span&gt;} + F{&lt;span style="font-size:85%;"&gt;sin(2*pi*f*Y)&lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;This is another property of FT -- linearity. The FT of sum is the sum of FT.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This property holds regardless of the number of additions to the orignal pattern. This is illustrated in the figure below.&lt;br /&gt;For the product combination,&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;z&lt;/span&gt; = &lt;span style="font-style: italic;"&gt;sin&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;aX&lt;/span&gt;)&lt;span style="font-style: italic;"&gt;sin&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;bY&lt;/span&gt;),&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;the expression can be expanded into sum of cosines given below:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-style: italic;"&gt;                                         z&lt;/span&gt; = [&lt;span style="font-style: italic;"&gt;cos&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;aX - bY&lt;/span&gt;) - &lt;span style="font-style: italic;"&gt;cos&lt;/span&gt;(&lt;span style="font-style: italic;"&gt;aX + bY)&lt;/span&gt;]/2 or&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-style: italic;"&gt;z&lt;/span&gt;  = [sin(&lt;span style="font-style: italic;"&gt;aX - bY + pi&lt;/span&gt;/2) - sin(&lt;span style="font-style: italic;"&gt;aX + bY + pi&lt;/span&gt;/2)]/2&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;This is just sum of rotated sines at opposite directions (due difference in signs of &lt;span style="font-style: italic;"&gt;bY&lt;/span&gt;). This results to a pattern in Fig.5(lower right).&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW9VGwrLjI/AAAAAAAAAQ8/fMvz7dcus5E/s1600-h/FT+last-2.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlW9VGwrLjI/AAAAAAAAAQ8/fMvz7dcus5E/s320/FT+last-2.png" alt="" id="BLOGGER_PHOTO_ID_5356395502116744754" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlW9VTl5DdI/AAAAAAAAARE/0l0k_SaHqBY/s1600-h/FT+last-3.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlW9VTl5DdI/AAAAAAAAARE/0l0k_SaHqBY/s320/FT+last-3.png" alt="" id="BLOGGER_PHOTO_ID_5356395505561177554" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW9Vo6rOcI/AAAAAAAAARM/YLCuxXBmdRc/s1600-h/FT+last-4.png"&gt;&lt;img style="cursor: pointer; width: 122px; height: 122px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlW9Vo6rOcI/AAAAAAAAARM/YLCuxXBmdRc/s320/FT+last-4.png" alt="" id="BLOGGER_PHOTO_ID_5356395511285496258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 6. Product combination of 2 sinusoids as in Fig. 5(upper right) with additional two rotated sinusoids with frequencies 10 Hz and 25 Hz. The 10 Hz signal is rotated at &lt;/span&gt;&lt;span style="font-size:85%;"&gt;30&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;sup&gt;o&lt;/sup&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;. The 25 Hz-sinusoid is rotated from 30&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;sup&gt;o&lt;/sup&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;, 60&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;sup&gt;o&lt;/sup&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; and 90&lt;sup&gt;o&lt;/sup&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Using the pattern in Fig.5 (upper right) plus additional rotated patterns, since FT is a linear transform, an expected pattern is:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: center;"&gt;F&lt;sub&gt;overall&lt;/sub&gt; = F{pattern1} + F{pattern2} + F{pattern3}&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Indeed, the prediction is right. The FT of the product combination is retained, the FT of the rotated 10 Hz sinusoid (as in Fig.4(lower left)), and the FT of the 25 Hz sinusoid at different rotation angles.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;In this activity, I give myself a grade of 10.&lt;br /&gt;&lt;br /&gt;I thank Jica Monsanto, Miguel Sison, Orly Tarun, and Jayson Villangca for useful discussions. Special thanks to Sison for making me realize that some of my images were wrong.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-7563694174568616283?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/7563694174568616283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-6-properties-of-2d-fourier.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/7563694174568616283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/7563694174568616283'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-6-properties-of-2d-fourier.html' title='Activity 6 - Properties of the 2D Fourier Transform'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_BnAGna7nCnA/SlVlVJ38MLI/AAAAAAAAANk/P20hoZrfYdc/s72-c/square.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-325320336277693408</id><published>2009-07-06T19:40:00.000-07:00</published><updated>2009-07-07T03:29:30.653-07:00</updated><title type='text'>Activity 5 - Fourier Transform Model of Image Formation</title><content type='html'>&lt;span&gt;Activity 5.A - &lt;span style="font-style: italic;"&gt;Familiarization with discrete FFT&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In this part of the activity, we are to familiarize how the FT works. We apply the FFT algorithm to images. We also the effect of fftshift() in the FT of the image and the results of double FFT.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlK8iq0hfCI/AAAAAAAAAGY/NU0XEpinPho/s1600-h/circle_small.bmp"&gt;&lt;img style="cursor: pointer; width: 110px; height: 110px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlK8iq0hfCI/AAAAAAAAAGY/NU0XEpinPho/s320/circle_small.bmp" alt="" id="BLOGGER_PHOTO_ID_5355550210693102626" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK8i-vNikI/AAAAAAAAAGg/SxtSahnH-0k/s1600-h/single+fft_circle.GIF"&gt;&lt;img style="cursor: pointer; width: 122px; height: 110px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK8i-vNikI/AAAAAAAAAGg/SxtSahnH-0k/s320/single+fft_circle.GIF" alt="" id="BLOGGER_PHOTO_ID_5355550216039533122" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlK8jBhj1CI/AAAAAAAAAGo/vxs6kIcMt6o/s1600-h/fft2twice_circle.bmp"&gt;&lt;img style="cursor: pointer; width: 143px; height: 110px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlK8jBhj1CI/AAAAAAAAAGo/vxs6kIcMt6o/s320/fft2twice_circle.bmp" alt="" id="BLOGGER_PHOTO_ID_5355550216787579938" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. (middle)Fourier transform and (right) double Fourier transform of the (left)image.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;In 3D space, the circle (left) can be imagined as a cylinder. It can further be imagined as rectangles rotated about its center. A rectangular signal has a sinc transform. Now, a sinc rotated at its center produces an airy disk as observed in Fig.1 (middle). Also, the diameter of the center of the airy disk is small which is the inverse of the diameter of the circle which is a property of FT - changing to inverse space.&lt;br /&gt;Fftshift() was already used on Fig.1(middle). Without using fftshift(), the FT looks like below:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlMK-8OQW5I/AAAAAAAAAI4/LFLGNR18iyQ/s1600-h/circlewofftshift.gif"&gt;&lt;img style="cursor: pointer; width: 142px; height: 142px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlMK-8OQW5I/AAAAAAAAAI4/LFLGNR18iyQ/s320/circlewofftshift.gif" alt="" id="BLOGGER_PHOTO_ID_5355636458307738514" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK8i-vNikI/AAAAAAAAAGg/SxtSahnH-0k/s1600-h/single+fft_circle.GIF"&gt;&lt;img style="cursor: pointer; width: 157px; height: 141px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK8i-vNikI/AAAAAAAAAGg/SxtSahnH-0k/s320/single+fft_circle.GIF" alt="" id="BLOGGER_PHOTO_ID_5355550216039533122" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. FT (left)with and (wihtout) using fftshift&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As observed, the center of the airy disc are separated to the four corners of the image. This is an effect of the FT. The diagonal quadrants of the FT are interchanged. fftshift() interchanges the quadrants back resulting to Fig. 1(right).&lt;br /&gt;&lt;br /&gt;Using a different image, as in Fig. 3(left), images alongside with it were obtained.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK9PgDPj2I/AAAAAAAAAGw/v6A3AzPs_mI/s1600-h/A.bmp"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK9PgDPj2I/AAAAAAAAAGw/v6A3AzPs_mI/s320/A.bmp" alt="" id="BLOGGER_PHOTO_ID_5355550980896165730" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlK9P-Us0uI/AAAAAAAAAG4/qhFGxysUV0k/s1600-h/fft_A.GIF"&gt;&lt;img style="cursor: pointer; width: 116px; height: 128px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlK9P-Us0uI/AAAAAAAAAG4/qhFGxysUV0k/s320/fft_A.GIF" alt="" id="BLOGGER_PHOTO_ID_5355550989022450402" border="0" /&gt; &lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlK9QdCltOI/AAAAAAAAAHA/gOwZ9ZDJ0gM/s1600-h/ff2twice_A.GIF"&gt;&lt;img style="cursor: pointer; width: 120px; height: 128px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlK9QdCltOI/AAAAAAAAAHA/gOwZ9ZDJ0gM/s320/ff2twice_A.GIF" alt="" id="BLOGGER_PHOTO_ID_5355550997267985634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 3. (middle) FT and (right) double FT of the (left) image.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Notice that Fig.3(right) is an inverted image of Fig.3(left). The same happened in Fig.1 - although not obvious since a circle is symmetric.&lt;br /&gt;This should be expected since:&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:78%;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;F{F{&lt;span style="font-style: italic;"&gt;f(x)&lt;/span&gt;}} = &lt;span style="font-style: italic;"&gt;f(-x)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;leading to an inversion of the image.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Activity 5.B - &lt;span style="font-style: italic;"&gt;Simulation of an Imaging Device&lt;/span&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;In this part of the activity, images formed in an imaging system were simulated. Particularly, we have an object &lt;span style="font-style: italic;"&gt;f &lt;/span&gt;(Fig.4) and an aperture &lt;span style="font-style: italic;"&gt;g&lt;/span&gt; in Fig.5(upper) and simulate how image produced looks like using Convolution theorem. The algorithm is that the FT of &lt;span style="font-style: italic;"&gt;f&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;g&lt;/span&gt; are multiplied and then inverse FT is done. This results to an image that looks like &lt;span style="font-style: italic;"&gt;f&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;g&lt;/span&gt;. This is the image formed by &lt;span style="font-style: italic;"&gt;g&lt;/span&gt;.&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:78%;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlLA72X7DuI/AAAAAAAAAH4/mzW7sQjLXE8/s1600-h/VIP.bmp"&gt;&lt;img style="cursor: pointer; width: 118px; height: 118px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlLA72X7DuI/AAAAAAAAAH4/mzW7sQjLXE8/s320/VIP.bmp" alt="" id="BLOGGER_PHOTO_ID_5355555041337609954" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 4. Object used in the simulation&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK-pxumM9I/AAAAAAAAAHQ/LjhWkE8C5A8/s1600-h/circle.bmp"&gt;&lt;img style="cursor: pointer; width: 118px; height: 118px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK-pxumM9I/AAAAAAAAAHQ/LjhWkE8C5A8/s320/circle.bmp" alt="" id="BLOGGER_PHOTO_ID_5355552531829634002" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlK_M8D_SLI/AAAAAAAAAHY/Os1KYtzFoLo/s1600-h/circle_small.bmp"&gt;&lt;img style="cursor: pointer; width: 118px; height: 118px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlK_M8D_SLI/AAAAAAAAAHY/Os1KYtzFoLo/s320/circle_small.bmp" alt="" id="BLOGGER_PHOTO_ID_5355553135899134130" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK_Nz1NOGI/AAAAAAAAAHw/4pFZePcq4v0/s1600-h/circle_smallest.bmp"&gt;&lt;img style="cursor: pointer; width: 118px; height: 118px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK_Nz1NOGI/AAAAAAAAAHw/4pFZePcq4v0/s320/circle_smallest.bmp" alt="" id="BLOGGER_PHOTO_ID_5355553150869518434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK-p_g-2sI/AAAAAAAAAHI/wSiyVOXRm9k/s1600-h/conv_VIP_circle.GIF"&gt;&lt;img style="cursor: pointer; width: 118px; height: 117px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK-p_g-2sI/AAAAAAAAAHI/wSiyVOXRm9k/s320/conv_VIP_circle.GIF" alt="" id="BLOGGER_PHOTO_ID_5355552535530625730" border="0" /&gt; &lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK_NINUhzI/AAAAAAAAAHg/SfKwpnpqPeI/s1600-h/conv_VIP_circle_small.GIF"&gt;&lt;img style="cursor: pointer; width: 118px; height: 117px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlK_NINUhzI/AAAAAAAAAHg/SfKwpnpqPeI/s320/conv_VIP_circle_small.GIF" alt="" id="BLOGGER_PHOTO_ID_5355553139159500594" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK_NtOb-7I/AAAAAAAAAHo/3QdNUve5neM/s1600-h/conv_VIP_circle_smallest.GIF"&gt;&lt;img style="cursor: pointer; width: 118px; height: 118px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK_NtOb-7I/AAAAAAAAAHo/3QdNUve5neM/s320/conv_VIP_circle_smallest.GIF" alt="" id="BLOGGER_PHOTO_ID_5355553149096295346" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Figure 5. Images formed using different sizes of circular apertures.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;It can be observed from the figure that the readability of the image decreases (the image becomes blurry).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Activity 5C. &lt;span style="font-style: italic;"&gt;Template matching using correlation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Correlation is a measure of how the a certain function is similar to another function, how similar an image to another image when talking about 2D arrays. One of its application is in pattern detection. Correlation values of highly similar functions is high as well. In this activity, we were tasked to find the letter A's contained in a text "The rain in Spain stays mainly in the plain."&lt;br /&gt;&lt;br /&gt;Correlation is done using the equation below:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;p = f&lt;/span&gt;⊙&lt;span style="font-style: italic;"&gt;g = f(-x,-y)* g(x,y)&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;where (*) represents the complex conjugate of the function.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlLA8SrhPaI/AAAAAAAAAIA/haTfrunBRnQ/s1600-h/the+rain.bmp"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlLA8SrhPaI/AAAAAAAAAIA/haTfrunBRnQ/s320/the+rain.bmp" alt="" id="BLOGGER_PHOTO_ID_5355555048935996834" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlLA8dKcXcI/AAAAAAAAAII/id-EQJdJbwE/s1600-h/a_same_onrain.bmp"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlLA8dKcXcI/AAAAAAAAAII/id-EQJdJbwE/s320/a_same_onrain.bmp" alt="" id="BLOGGER_PHOTO_ID_5355555051750055362" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlLA8pByXAI/AAAAAAAAAIQ/DvnjUwkI4-s/s1600-h/correlation_the+rain.GIF"&gt;&lt;img style="cursor: pointer; width: 146px; height: 128px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlLA8pByXAI/AAAAAAAAAIQ/DvnjUwkI4-s/s320/correlation_the+rain.GIF" alt="" id="BLOGGER_PHOTO_ID_5355555054934973442" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 6. (left) the text used; (middle) the letter to be detected and (right) the image as a result of correlation&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Upon applying correlation, Fig.6(right) was obtained. Bright spots on the image are high correlation values indicating an "A" pattern.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Activity 5D. &lt;span style="font-style: italic;"&gt;Edge detection using convolution integral&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In this part, using the image in Fig.4, we again exploit convolution to detect edges in the image. The idea is to convolve a desired pattern to find with the image being edge-detected. In other words, we find the certain pattern on the image.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlMBOrfi9UI/AAAAAAAAAIY/F74KAcBmQbo/s1600-h/VIP_convolve_1.gif"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlMBOrfi9UI/AAAAAAAAAIY/F74KAcBmQbo/s320/VIP_convolve_1.gif" alt="" id="BLOGGER_PHOTO_ID_5355625733578487106" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlMBO-hcxII/AAAAAAAAAIg/AoyN60CdaRI/s1600-h/VIP_convolve_2.gif"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlMBO-hcxII/AAAAAAAAAIg/AoyN60CdaRI/s320/VIP_convolve_2.gif" alt="" id="BLOGGER_PHOTO_ID_5355625738686743682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlMBPEHZJAI/AAAAAAAAAIw/7SXImq6e9PE/s1600-h/VIP_convolve_5.gif"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlMBPEHZJAI/AAAAAAAAAIw/7SXImq6e9PE/s320/VIP_convolve_5.gif" alt="" id="BLOGGER_PHOTO_ID_5355625740188066818" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlMBPIhsd_I/AAAAAAAAAIo/EMacOglBDaU/s1600-h/VIP_convolve_4.gif"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlMBPIhsd_I/AAAAAAAAAIo/EMacOglBDaU/s320/VIP_convolve_4.gif" alt="" id="BLOGGER_PHOTO_ID_5355625741372127218" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Figure 7. Images upon application of edge-detection using (upper left) horizontal pattern; (upper right) vertical pattern; (lower left) diagonal pattern; and (lower right) a point.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;/span&gt;&lt;/span&gt;We can see from the images that image detection algorithm allowed us to detect patterns on the image teh same as the desired pattern used(i.e, horizontal lines appear on Fig.7(upper right) since the image was convolved with a horizontal pattern). it is also interesting to note that using a point pattern allows us to detect all edges of the image.&lt;br /&gt;&lt;br /&gt;In this activity I give myself a grade of 10 for doing the activity right. =)&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlK_NtOb-7I/AAAAAAAAAHo/3QdNUve5neM/s1600-h/conv_VIP_circle_smallest.GIF"&gt;&lt;br /&gt;&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-325320336277693408?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/325320336277693408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-5-fourier-transform-model-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/325320336277693408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/325320336277693408'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/07/activity-5-fourier-transform-model-of.html' title='Activity 5 - Fourier Transform Model of Image Formation'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_BnAGna7nCnA/SlK8iq0hfCI/AAAAAAAAAGY/NU0XEpinPho/s72-c/circle_small.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-3082540672082931972</id><published>2009-06-30T06:38:00.000-07:00</published><updated>2009-07-02T03:35:41.007-07:00</updated><title type='text'>Activity 4: Enhancement by Histogram Manipulation</title><content type='html'>&lt;div style="text-align: justify;"&gt;      In this activity, we were tasked to get a poor-contrast grayscale image from the web. Using the histogram manipulation technique, the goal is to make a high-contrast image out of the original image.&lt;br /&gt;In histogram manipulation, the first step is to take a histogram of the pixel values in the image (histogram is plotted with pixel values on the x-axis and frequency of occurrence of the pixel value on the y-axis. The histogram gives an idea of how many of a pixel value is contained in the image. Once the histogram is made, a cumulative distribution function (CDF) can be plotted. CDF is just the cumulative sum of the values on the y-axis plotted with pixel values. (It is better to work with CDF than histogram as we would see later.)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To start with, below is the graysacle image taken from the web.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SkoYclBoRSI/AAAAAAAAADg/DAiAglugDLw/s1600-h/wom1.jpg"&gt;&lt;img style="cursor: pointer; width: 202px; height: 202px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SkoYclBoRSI/AAAAAAAAADg/DAiAglugDLw/s320/wom1.jpg" alt="" id="BLOGGER_PHOTO_ID_5353117986337604898" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 1. Grayscale image taken from http://homepages.inf.ed.ac.uk/rbf/HIPR2/images/wom1.gif. The figure is then converted to a jpeg file.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Using Scilab, the histogram, as well as the CDF as shown below, of the image in Fig.1 was obtained.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SkocwpkTvXI/AAAAAAAAAD4/m6QInHZqu-k/s1600-h/histogram+orig+image.png"&gt;&lt;img style="cursor: pointer; width: 282px; height: 214px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SkocwpkTvXI/AAAAAAAAAD4/m6QInHZqu-k/s320/histogram+orig+image.png" alt="" id="BLOGGER_PHOTO_ID_5353122729200696690" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SkodEbhqwBI/AAAAAAAAAEA/W4XPYOLOnNs/s1600-h/cdf+orig+image.png"&gt;&lt;img style="cursor: pointer; width: 283px; height: 213px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SkodEbhqwBI/AAAAAAAAAEA/W4XPYOLOnNs/s320/cdf+orig+image.png" alt="" id="BLOGGER_PHOTO_ID_5353123069028909074" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 2. (above) Histogram and (below) CDF of the image in Fig. 1.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As observed from the plots in Fig.2, the CDF is cleaner to see than the histogram. Having the advantage, CDF is easier to manipulate than the histogram.&lt;br /&gt;In histogram manipulation, a desired CDF is needed. This will be used to alter the pixel values contained in the original image. The method is illustrated below.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Skolu6Rcf7I/AAAAAAAAAEI/ElTswQlNflQ/s1600-h/PROCEDURE.png"&gt;&lt;img style="cursor: pointer; width: 420px; height: 163px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Skolu6Rcf7I/AAAAAAAAAEI/ElTswQlNflQ/s320/PROCEDURE.png" alt="" id="BLOGGER_PHOTO_ID_5353132594929893298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 3. Data manipulation procedure&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;The desired CDF is of a uniform distribution.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Data manipulation procedure done in the following:&lt;br /&gt;(Step 1) Take a pixel value from the CDF of the image in Fig.1&lt;br /&gt;(Step 2) Obtain the value on the y-axis corresponding to the pixel value&lt;br /&gt;(Step 3) Project the y-axis value onto the desired CDF&lt;br /&gt;(Step 4) Take the pixel value from the desired CDF corresponding to the y-axis value.&lt;br /&gt;The pixel value in the image is then replaced by the pixel value from the desired CDF.&lt;br /&gt;&lt;br /&gt;The code implementation for a linear desired CDF is written below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;h1 = zeros(256,256);&lt;br /&gt;for i=0:255&lt;br /&gt;new = m(i+1)*255;&lt;br /&gt;h1 = h1 + (im == i)*new;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;Performing this procedure for all pixel values (0-255), a reconstructed image shown below was obtained.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SkoYclBoRSI/AAAAAAAAADg/DAiAglugDLw/s1600-h/wom1.jpg"&gt;&lt;img style="cursor: pointer; width: 171px; height: 171px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SkoYclBoRSI/AAAAAAAAADg/DAiAglugDLw/s320/wom1.jpg" alt="" id="BLOGGER_PHOTO_ID_5353117986337604898" border="0" /&gt;&lt;/a&gt;  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SkyL3yxNswI/AAAAAAAAAF4/KxG0HSH7AzQ/s1600-h/reconstructed+image_linear.jpg"&gt;&lt;img style="cursor: pointer; width: 172px; height: 172px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SkyL3yxNswI/AAAAAAAAAF4/KxG0HSH7AzQ/s320/reconstructed+image_linear.jpg" alt="" id="BLOGGER_PHOTO_ID_5353807847673934594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 4. Reconstructed image&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SkyL3yxNswI/AAAAAAAAAF4/KxG0HSH7AzQ/s1600-h/reconstructed+image_linear.jpg"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div style="text-align: justify;"&gt;As seen, the image highly contrasted compared to the previous image as a result of the procedure. We also characterize the image by taking its pixel histogram and CDF.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SkyLxBuH7cI/AAAAAAAAAFg/FM1rJk622Q8/s1600-h/histogram+method+2.gif"&gt;&lt;img style="cursor: pointer; width: 282px; height: 214px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SkyLxBuH7cI/AAAAAAAAAFg/FM1rJk622Q8/s320/histogram+method+2.gif" alt="" id="BLOGGER_PHOTO_ID_5353807731428421058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SkyLw2K1eeI/AAAAAAAAAFQ/d0qYLrjj1FM/s1600-h/CDF+method+2.gif"&gt;&lt;img style="cursor: pointer; width: 282px; height: 216px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SkyLw2K1eeI/AAAAAAAAAFQ/d0qYLrjj1FM/s320/CDF+method+2.gif" alt="" id="BLOGGER_PHOTO_ID_5353807728327621090" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 5. (above) Histogram and (below) CDF of the reconstructed image.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The histogram of the reconstructed image is different from the original image. It is also interesting to note that the spread of the histogram of the reconstructed image is larger than that of the original image indicative of the high contrast of the reconstructed image. Moreover, looking at the CDF of the reconstructed image, it resembles a straight line closer to the desired CDF.&lt;br /&gt;To further explore the technique, a desired CDF that mimics the nonlinear response of the human eye was used. Below is the desired CDF used in reconstructing the image.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Skui3wicL4I/AAAAAAAAAE4/yO1qBL0Dkyw/s1600-h/desired+CDF+nonlinear.bmp"&gt;&lt;img style="cursor: pointer; width: 282px; height: 221px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Skui3wicL4I/AAAAAAAAAE4/yO1qBL0Dkyw/s320/desired+CDF+nonlinear.bmp" alt="" id="BLOGGER_PHOTO_ID_5353551660865826690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 6. Exponential CDF used in reconstructing the image&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The same procedure was done as before and a reconstructed image shown below was obtained.&lt;br /&gt;&lt;br /&gt;The code implementation for a nonlinear desired CDF is written below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;h1 = zeros(256,256);&lt;br /&gt;for i=0:255&lt;br /&gt;new = int(50*log(m(i+1)*(exp(255/50)-1)+1));&lt;br /&gt;h1 = h1 + (im == i)*new;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SkoYclBoRSI/AAAAAAAAADg/DAiAglugDLw/s1600-h/wom1.jpg"&gt;&lt;img style="cursor: pointer; width: 171px; height: 171px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SkoYclBoRSI/AAAAAAAAADg/DAiAglugDLw/s320/wom1.jpg" alt="" id="BLOGGER_PHOTO_ID_5353117986337604898" border="0" /&gt;&lt;/a&gt;  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SkyLx3t0LXI/AAAAAAAAAFw/wlzTNIa6fL0/s1600-h/new+image+nonlinear.gif"&gt;&lt;img style="cursor: pointer; width: 170px; height: 170px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SkyLx3t0LXI/AAAAAAAAAFw/wlzTNIa6fL0/s320/new+image+nonlinear.gif" alt="" id="BLOGGER_PHOTO_ID_5353807745922641266" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 7. Reconstructed image using a nonlinear desired CDF&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;Compared to the previous reconstruction, the image in Fig.1 is brighter (many of the pixel have high values). we can readily attribute this to the desired CDF used. The latter favors high-valued pixels. As a result, a bright reconstructed image was obtained.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SkyLxRm7kDI/AAAAAAAAAFo/qeXgLopYCHo/s1600-h/histogram+nonlinear.gif"&gt;&lt;img style="cursor: pointer; width: 282px; height: 212px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SkyLxRm7kDI/AAAAAAAAAFo/qeXgLopYCHo/s320/histogram+nonlinear.gif" alt="" id="BLOGGER_PHOTO_ID_5353807735693217842" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SkyLxK6n9cI/AAAAAAAAAFY/QfJp4LVqIag/s1600-h/CDF+nonlinear.gif"&gt;&lt;img style="cursor: pointer; width: 282px; height: 214px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SkyLxK6n9cI/AAAAAAAAAFY/QfJp4LVqIag/s320/CDF+nonlinear.gif" alt="" id="BLOGGER_PHOTO_ID_5353807733896771010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 8. (above) Histogram and (below) CDF of the reconstructed image using nonlinear desired CDF&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;It can also be seen from Fig. 8 that the histogram of the constructed image has high amplitudes on high-value pixels which indicates a bright image. &lt;/span&gt;Also the CDF of the reconstructed image followed the desired CDF.&lt;br /&gt;&lt;br /&gt;In this work, i will give myself a grade of 10 for doing it right. Good job for myself.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-3082540672082931972?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/3082540672082931972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/activity-4-enhancement-by-histogram.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3082540672082931972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/3082540672082931972'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/activity-4-enhancement-by-histogram.html' title='Activity 4: Enhancement by Histogram Manipulation'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_BnAGna7nCnA/SkoYclBoRSI/AAAAAAAAADg/DAiAglugDLw/s72-c/wom1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-5482003860208136551</id><published>2009-06-23T09:36:00.001-07:00</published><updated>2009-06-29T05:49:02.464-07:00</updated><title type='text'>Activity 2: Area Estimation for Images with Defined Edges</title><content type='html'>In this activity, we were tasked to draw shapes on MSPaint. The images are binary. The image themselves have pixel value of '1'. The background having '0'. The images drawn are shown below. &lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SkLNf1NexvI/AAAAAAAAACw/mKtKAmX1dFU/s1600-h/circle.bmp"&gt;&lt;img style="cursor: pointer; width: 177px; height: 177px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SkLNf1NexvI/AAAAAAAAACw/mKtKAmX1dFU/s320/circle.bmp" alt="" id="BLOGGER_PHOTO_ID_5351065254012831474" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Figure 1. Circle (Area = )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SkLN1cLqjfI/AAAAAAAAAC4/3xtkuP-41Ls/s1600-h/retangle+%28252by140%29.bmp"&gt;&lt;img style="cursor: pointer; width: 305px; height: 218px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SkLN1cLqjfI/AAAAAAAAAC4/3xtkuP-41Ls/s320/retangle+%28252by140%29.bmp" alt="" id="BLOGGER_PHOTO_ID_5351065625251450354" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Figure 2. Rectangle (Area = 252x140 sq.px)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SkLuacECaCI/AAAAAAAAADA/EZMP_1sS1n8/s1600-h/triangle.bmp"&gt;&lt;img style="cursor: pointer; width: 233px; height: 216px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SkLuacECaCI/AAAAAAAAADA/EZMP_1sS1n8/s320/triangle.bmp" alt="" id="BLOGGER_PHOTO_ID_5351101445246707746" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Figure 3. Triangle&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SkLu3b6IlqI/AAAAAAAAADI/JDmMkACaK4M/s1600-h/irregular+shape.bmp"&gt;&lt;img style="cursor: pointer; width: 252px; height: 198px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SkLu3b6IlqI/AAAAAAAAADI/JDmMkACaK4M/s320/irregular+shape.bmp" alt="" id="BLOGGER_PHOTO_ID_5351101943421376162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Figure 4. Irregular shapes&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The main goal of the task is to take the area of the images comparing the measured area by just counting the 1's and by using Green's theorem given below.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/Ski1vwoFIvI/AAAAAAAAADY/gSOW1VH7uP4/s1600-h/formula.bmp"&gt;&lt;img style="cursor: pointer; width: 185px; height: 56px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/Ski1vwoFIvI/AAAAAAAAADY/gSOW1VH7uP4/s320/formula.bmp" alt="" id="BLOGGER_PHOTO_ID_5352727989241324274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The summation is over the contour of the image.&lt;br /&gt;The results are shown below.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="file:///C:/DOCUME%7E1/JAYSAM%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg" alt="" /&gt;&lt;br /&gt;                            Table 1. Area calculations using pixel counting and Green's formula&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Ski0A6tfHzI/AAAAAAAAADQ/FzbEQ_rDKLU/s1600-h/untitled.bmp"&gt;&lt;img style="cursor: pointer; width: 388px; height: 100px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Ski0A6tfHzI/AAAAAAAAADQ/FzbEQ_rDKLU/s320/untitled.bmp" alt="" id="BLOGGER_PHOTO_ID_5352726084982873906" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;Here, we can see that the Green's formula is accurately able to determine the actual area of the figure. Even when the shape is irregular as in Fig 4. as long as the contour is well-defined, the Green's theorem can correctly calculate the area enclosed by the contour.&lt;br /&gt;&lt;br /&gt;In this activity, i will give myself a grade of 10 because i was able to correctly determine the area using Green's theorem.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-5482003860208136551?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/5482003860208136551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/activity-2-area.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/5482003860208136551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/5482003860208136551'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/activity-2-area.html' title='Activity 2: Area Estimation for Images with Defined Edges'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_BnAGna7nCnA/SkLNf1NexvI/AAAAAAAAACw/mKtKAmX1dFU/s72-c/circle.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-6204974440641180521</id><published>2009-06-22T20:14:00.000-07:00</published><updated>2009-07-09T09:09:53.952-07:00</updated><title type='text'>Activity 3: Basic Types and Basic image enhancements</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;In first part of this activity, we are tasked  to find different modes of images,&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;Figure&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BnAGna7nCnA/SlYQnORNE_I/AAAAAAAAATU/MYsCevuXQiI/s1600-h/fruit.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 275px; height: 213px;" src="http://2.bp.blogspot.com/_BnAGna7nCnA/SlYQnORNE_I/AAAAAAAAATU/MYsCevuXQiI/s320/fruit.jpg" alt="" id="BLOGGER_PHOTO_ID_5356487072834982898" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt; 1. True color image&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;Dimensions: 504 x 390&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Width: 504&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Height: 390&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Horizontal Resolution: 72 dpi&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Vertical Resolution: 72 dpi&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Bit Depth: 24&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlYRSXSCguI/AAAAAAAAATc/AFu3iXQEUko/s1600-h/cat-grayscale.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 254px; height: 169px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlYRSXSCguI/AAAAAAAAATc/AFu3iXQEUko/s320/cat-grayscale.jpg" alt="" id="BLOGGER_PHOTO_ID_5356487813988778722" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SkEAcmMa-7I/AAAAAAAAACg/77Vm41cynE8/s1600-h/cat-grayscale.jpg"&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;Figure 2. Grayscale image&lt;br /&gt;&lt;br /&gt;Dimensions: 600 x 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Width: 600&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Height: 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Horizontal Resolution: 230 dpi&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Vertical Resolution: 230 dpi&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Bit Depth: 8&lt;br /&gt;Resolution Unit: 2&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYU6DHqo5I/AAAAAAAAATs/Uz6reedtpeE/s1600-h/Gingerbread-house.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 275px; height: 187px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYU6DHqo5I/AAAAAAAAATs/Uz6reedtpeE/s320/Gingerbread-house.gif" alt="" id="BLOGGER_PHOTO_ID_5356491794306212754" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;    &lt;br /&gt;Figure 3. Indexed image&lt;br /&gt;&lt;br /&gt;Dimensions: 600 x 410&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Width: 600&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Height: 410&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Bit Depth: 8&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlYSlYsLc0I/AAAAAAAAATk/RUZFaxJYmEs/s1600-h/Mask.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 276px; height: 221px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlYSlYsLc0I/AAAAAAAAATk/RUZFaxJYmEs/s320/Mask.png" alt="" id="BLOGGER_PHOTO_ID_5356489240295994178" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Figure 4. Binary image&lt;br /&gt;&lt;br /&gt;Dimensions: 600 x 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Width: 600&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Height: 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Bit Depth: 1&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The images were taken from the following sources:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;1(left): http://www.thesunblog.com/gourmetgal/fruit.jpg&lt;br /&gt;1(right): http://www.alexmorais.com/Blog%20images/cat-grayscale.jpg&lt;br /&gt;2(left):http://www.gingerbreadartgallery.com/images/archi/large/Gingerbread-house.gif&lt;br /&gt;2(right): http://www.codeproject.com/KB/GDI-plus/AnnotatedImageV2/Mask.png&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The binary image was really hard to find.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;For the second part of the activity, a scanned image was used. Here we are tasked to apply thresholding to the image to:&lt;br /&gt;(1) enhance the contrast of the image and&lt;br /&gt;(2) to remove unnecessary pixel values on the region of interest (ROI).&lt;br /&gt;&lt;br /&gt;In the figure below, the ROI is the name "JAYA".&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlTBJ6m_NlI/AAAAAAAAAKY/reuQmWhNWq8/s1600-h/jaya_ruler_removed.png"&gt;&lt;img style="cursor: pointer; width: 198px; height: 140px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlTBJ6m_NlI/AAAAAAAAAKY/reuQmWhNWq8/s320/jaya_ruler_removed.png" alt="" id="BLOGGER_PHOTO_ID_5356118232946128466" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlTBJj7n-VI/AAAAAAAAAKQ/aaEJyyfyk9o/s1600-h/histogram.jpg"&gt;&lt;img style="cursor: pointer; width: 204px; height: 140px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlTBJj7n-VI/AAAAAAAAAKQ/aaEJyyfyk9o/s320/histogram.jpg" alt="" id="BLOGGER_PHOTO_ID_5356118226858670418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 5. (left) Scanned image and (right)pixel histogram of the image&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Scanned images are usually in RGB mode. In this figure, the mode of the image was changed to grayscale using GIMP. The histogram in Fig.5(left) shows the pixel value distribution on the image (from 0 -255 pixel values). Here we can see the distinct separation between the high value pixels (white) and the low value pixels (black). As such, our ROI is sufficiently separated from the background.&lt;br /&gt;&lt;br /&gt;One can also use Scilab to plot the histogram of the image using this code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;g = imread('(path of the image)');&lt;br /&gt;g = int(255*im2gray(g));&lt;br /&gt;[x,y] = size(g);&lt;br /&gt;b = 0:255;&lt;br /&gt;a =[];&lt;br /&gt;for i = 0:255,&lt;br /&gt;a(i+1) = sum((g == i)*1);&lt;br /&gt;end;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;plot(b,a/(x*y));&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using this we obtain:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/SlYOBzTg7II/AAAAAAAAATM/aW6VDMuU5Bk/s1600-h/histogram.png"&gt;&lt;img style="cursor: pointer; width: 251px; height: 189px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/SlYOBzTg7II/AAAAAAAAATM/aW6VDMuU5Bk/s320/histogram.png" alt="" id="BLOGGER_PHOTO_ID_5356484230918499458" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 6. Pixel histogram of image in Fig.5(left) using Scilab&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Now, we apply GIMP to threshold the image. In thresholding, we set a certain value (threshold) such that any value less than the threshold will be discarded (pixel value is set to zero when dealing with images) and anything above will be retained or set to a certain value depending on the purpose.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/SlTBJ6m_NlI/AAAAAAAAAKY/reuQmWhNWq8/s1600-h/jaya_ruler_removed.png"&gt;&lt;img style="cursor: pointer; width: 185px; height: 132px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/SlTBJ6m_NlI/AAAAAAAAAKY/reuQmWhNWq8/s320/jaya_ruler_removed.png" alt="" id="BLOGGER_PHOTO_ID_5356118232946128466" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlTGu2nlmWI/AAAAAAAAAKo/RiJf__KKN1M/s1600-h/jaya_ruler_removed_binary.png"&gt;&lt;img style="cursor: pointer; width: 187px; height: 132px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlTGu2nlmWI/AAAAAAAAAKo/RiJf__KKN1M/s320/jaya_ruler_removed_binary.png" alt="" id="BLOGGER_PHOTO_ID_5356124365088201058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Figure 7. (left) Raw image and (right)the thresholded image&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Using a threshold, we are now able to completely separate the ROI from the background.&lt;br /&gt;We can area calculations learned in Activity 2 to Fig.7(right).&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYG9w__PdI/AAAAAAAAAS8/VSMmh_767Zs/s1600-h/pixel+area.png"&gt;&lt;img style="cursor: pointer; width: 351px; height: 38px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYG9w__PdI/AAAAAAAAAS8/VSMmh_767Zs/s320/pixel+area.png" alt="" id="BLOGGER_PHOTO_ID_5356476464998858194" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;We have calculated the area of the ROI in pixels using Green's theorem and pixel counting. Below is the same image with an attached ruler alongside with it. Using this ruler, we can calibrate the pixel-mm ratio which allows us to determine the actual area of the ROI.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYCLKYWZVI/AAAAAAAAAS0/gjMn2W5ppfA/s1600-h/jaya.png"&gt;&lt;img style="cursor: pointer; width: 224px; height: 147px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYCLKYWZVI/AAAAAAAAAS0/gjMn2W5ppfA/s320/jaya.png" alt="" id="BLOGGER_PHOTO_ID_5356471197592085842" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Figure 8. Original image with attached ruler&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Using MS Paint, the pixel-mm ratio was calculated.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;pixel-cm ratio = 313 pixels:(262 mm - 156mm)&lt;br /&gt;= 1 pixel : 0.339 mm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Hence, the length of a pixel is equal to 0.35 cm. The area of a pixel is then:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;A = (0.35 mm)&lt;sup&gt;2&lt;/sup&gt; = 0.115 mm&lt;sup&gt;2&lt;/sup&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Using the pixel counts earlier, we obtain these actual areas.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYJNeHBR1I/AAAAAAAAATE/NQkHK-vUpbE/s1600-h/actual+area.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 49px;" src="http://3.bp.blogspot.com/_BnAGna7nCnA/SlYJNeHBR1I/AAAAAAAAATE/NQkHK-vUpbE/s320/actual+area.png" alt="" id="BLOGGER_PHOTO_ID_5356478933829240658" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;In this activity, I will give myself a grade of 8 for finishing this blog late.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-6204974440641180521?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/6204974440641180521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/fssfsfsfs.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/6204974440641180521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/6204974440641180521'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/fssfsfsfs.html' title='Activity 3: Basic Types and Basic image enhancements'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_BnAGna7nCnA/SlYQnORNE_I/AAAAAAAAATU/MYsCevuXQiI/s72-c/fruit.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-2793043147132738879</id><published>2009-06-17T19:50:00.000-07:00</published><updated>2009-06-23T09:34:44.735-07:00</updated><title type='text'>Activity 1 - Digital Scanning</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_BnAGna7nCnA/Sjmt7ERNoNI/AAAAAAAAABI/J_DS8TEXsIc/s1600-h/jaysam_croppedpic.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 218px;" src="http://1.bp.blogspot.com/_BnAGna7nCnA/Sjmt7ERNoNI/AAAAAAAAABI/J_DS8TEXsIc/s320/jaysam_croppedpic.bmp" alt="" id="BLOGGER_PHOTO_ID_5348497262748999890" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Figure 1. Graph taken from Introduction to Physiological Chemistry by Meyer Bodansky, 1930.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In this activity, from the graph (Fig. 1) we found last meeting, we are to replicate it using Paint and Spreadsheet. From the pixel locations (x,y) of the points on the plot, we record it to the spreadsheet and perform scaling operations to the values to replicate the physical values found in the graph.&lt;br /&gt;&lt;br /&gt;To scale the axis:&lt;br /&gt;1. Take the x-pixel locations (x- if scaling the x axis, y- if scaling the y-axis) of the smallest value and largest value on the respective axis of the graph (i.e. 4.7 and 12.2).&lt;br /&gt;2. Solve for the the average number of pixels in between grids:&lt;br /&gt;pbg = (pixel location of max value on the axis - pixel location of min value on the axis)/[(max value -min value)/value increments]&lt;br /&gt;&lt;br /&gt;For scaling on the x- axis:&lt;br /&gt;  physical value = min x value + x-pixel location* 0.5/pbg&lt;br /&gt;&lt;br /&gt;For scaling on the y-axis:&lt;br /&gt;  physical value = max y value - y-pixel value*1/pbg&lt;br /&gt;(Scaling on the y- axis is different from the x-axis since the origin (0,0) of the image is different from the origin of the Cartesian coordinate system.)&lt;br /&gt;&lt;br /&gt;The numerical values on the above equations accounts for the physical value spacing between grids. Also note that pbg on x and y axis are not necessarily the same. The graph below is the superimpose plot of the original figure and the digitally scanned figure.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_BnAGna7nCnA/Sjm0eSqnzUI/AAAAAAAAABQ/KE0AcVtS32o/s1600-h/superimposed.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 463px; height: 326px;" src="http://4.bp.blogspot.com/_BnAGna7nCnA/Sjm0eSqnzUI/AAAAAAAAABQ/KE0AcVtS32o/s320/superimposed.bmp" alt="" id="BLOGGER_PHOTO_ID_5348504464978857282" border="0" /&gt;&lt;/a&gt;Figure 2. Superimposed plot of the original figure and the digitally scanned figure. It can be observed that the scanned figure fits the original one.&lt;br /&gt;&lt;br /&gt;Th colored dots represent the digitally scanned points from the original graph. We can see that the points coincide with original one. I give myself 10 for doing a good job!&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-2793043147132738879?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/2793043147132738879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/activity-1-digital-scanning.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/2793043147132738879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/2793043147132738879'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/activity-1-digital-scanning.html' title='Activity 1 - Digital Scanning'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_BnAGna7nCnA/Sjmt7ERNoNI/AAAAAAAAABI/J_DS8TEXsIc/s72-c/jaysam_croppedpic.bmp' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4368583600769835334.post-7793485904852324347</id><published>2009-06-15T19:41:00.000-07:00</published><updated>2009-06-15T19:47:57.038-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Plot'/><title type='text'>The search for the oldest plot...</title><content type='html'>Today, we were tasked to find the oldest plot we can get. Preferably a hand written one. I got a year-1930 plot. I found it in a chemistry book entitled Introduction to Physiological Chemistry by Meyer Bodansky PhD.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4368583600769835334-7793485904852324347?l=jaysamuel-ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaysamuel-ap186.blogspot.com/feeds/7793485904852324347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/search-for-oldest-plot.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/7793485904852324347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4368583600769835334/posts/default/7793485904852324347'/><link rel='alternate' type='text/html' href='http://jaysamuel-ap186.blogspot.com/2009/06/search-for-oldest-plot.html' title='The search for the oldest plot...'/><author><name>jaysamuel-ap186</name><uri>http://www.blogger.com/profile/05666869259127527428</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_BnAGna7nCnA/SlVcN5UuTBI/AAAAAAAAAK0/RzW15eZDYuI/S220/Kung-Fu-Panda-Wii-01.thumb.jpg'/></author><thr:total>4</thr:total></entry></feed>
