<?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-8940726446323633872</id><updated>2011-08-01T10:35:38.896-07:00</updated><title type='text'>here, here and here...</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-6659369035499163057</id><published>2009-10-12T02:44:00.002-07:00</published><updated>2009-10-12T07:14:55.558-07:00</updated><title type='text'>ACTIVITY 19 - Restoration of Blurred Image</title><content type='html'>&lt;p style="text-align: justify;" class="MsoNormal"&gt;This activity is a demonstration on how to restore an image which is corrupted with a known degradation function such as motion blur and additive noise.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;The image degradation and restoration process can be modeled by the diagram shown below.&lt;/p&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StL6-WCDlkI/AAAAAAAAAXg/wxseLf1b2uw/s1600-h/degrade+restore.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 112px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StL6-WCDlkI/AAAAAAAAAXg/wxseLf1b2uw/s320/degrade+restore.bmp" alt="" id="BLOGGER_PHOTO_ID_5391647652888942146" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;A degradation function &lt;i style=""&gt;H&lt;/i&gt; along with an additive noise terms, &lt;span style="font-style: italic;"&gt;n(x,y)&lt;/span&gt;&lt;i style=""&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:formulas&gt;  &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;  &lt;o:lock ext="edit" aspectratio="t"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1025" type="#_x0000_t75" style="'width:32.25pt;"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\User\LOCALS~1\Temp\msohtml1\01\clip_image001.emz" title=""&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/i&gt;&lt;span style=""&gt; &lt;/span&gt;operates on an input image &lt;i style=""&gt;f(x,y) &lt;/i&gt;producing a degraded image &lt;i style=""&gt;g(x,y). &lt;/i&gt;With the given g(x,y) and some knowledge about the degradation function &lt;i style=""&gt;H&lt;/i&gt; and additive noise terms &lt;span style="font-style: italic;"&gt;n(x,y)&lt;/span&gt;&lt;i style=""&gt;&lt;!--[endif]--&gt;, &lt;/i&gt;we can obtain an estimate restoration &lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1027" type="#_x0000_t75" style="'width:38.25pt;height:18.75pt'"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\User\LOCALS~1\Temp\msohtml1\01\clip_image003.emz" title=""&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;span style="font-style: italic;"&gt;f'(x,y)&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=""&gt; &lt;/span&gt;of the original image.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;br /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=""&gt;                       &lt;/span&gt;The degraded image is given in the spatial domain&lt;/p&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StL7ZfUS0AI/AAAAAAAAAXo/1fGPtEoG3t4/s1600-h/spatial+degrade.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 184px; height: 21px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StL7ZfUS0AI/AAAAAAAAAXo/1fGPtEoG3t4/s320/spatial+degrade.bmp" alt="" id="BLOGGER_PHOTO_ID_5391648119237824514" border="0" /&gt;&lt;br /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;/p&gt;&lt;/a&gt;&lt;span style=";font-family:&amp;quot;;font-size:12pt;"  &gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;Thus, it can be written in an equivalent frequency domain by getting the Fourier transforms of the corresponding terms.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StL8GMUvX8I/AAAAAAAAAXw/g09xR15sTXQ/s1600-h/frequency+degrade.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 177px; height: 21px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StL8GMUvX8I/AAAAAAAAAXw/g09xR15sTXQ/s320/frequency+degrade.bmp" alt="" id="BLOGGER_PHOTO_ID_5391648887233535938" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;So we need to have our original image to be transformed in the frequency domain. Now, we will start the degradation of an original image by having our degradation function that will cause the original image to blur. &lt;i style=""&gt;H(u,v) &lt;/i&gt;is the Fourier transform of the degradation function given by&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StL8XOPFlqI/AAAAAAAAAX4/nZfcjhLzFac/s1600-h/blur+function.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 246px; height: 40px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StL8XOPFlqI/AAAAAAAAAX4/nZfcjhLzFac/s320/blur+function.bmp" alt="" id="BLOGGER_PHOTO_ID_5391649179804472994" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;where a and b is the total distance for which the image has been displaced in the x- and y- direction, correspondingly and T is the duration of the exposure from the opening and closing of the shutter in the imaging process. We will use a = b = 0.1 and &lt;i style=""&gt;T &lt;/i&gt;= 1 and investigate also on other values for these parameters.&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=""&gt;            &lt;/span&gt;The additive noise terms will also be transformed in frequency domain.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;To restore these corrupted images, we will apply the Weiner filter expressed by&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StL-XoI26TI/AAAAAAAAAY4/gHaJ9IY1dbw/s1600-h/weiner+filter.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 254px; height: 90px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StL-XoI26TI/AAAAAAAAAY4/gHaJ9IY1dbw/s320/weiner+filter.bmp" alt="" id="BLOGGER_PHOTO_ID_5391651385780922674" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal"&gt;This expression is also commonly referred to as the &lt;i style=""&gt;minimum mean square error filt&lt;/i&gt;er or the &lt;i style=""&gt;least square error filter&lt;/i&gt;. The terms on the expression are as follows:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StL-oak_xwI/AAAAAAAAAZA/n7LyRg_q0b0/s1600-h/1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 78px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StL-oak_xwI/AAAAAAAAAZA/n7LyRg_q0b0/s320/1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391651674198624002" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;!--[if !mso]&gt; &lt;style&gt; v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;This expression is very useful when the power spectrum of the noise and the original image are known. Things can be more simplified when we are dealing with spectral white noise (the power spectrum of the noise is constant). However, the power spectrum of the original image is not often known wherein another approach can be used with the expression&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StL_FNNLPVI/AAAAAAAAAZI/YNt5DupDAPY/s1600-h/weiner+filter+K.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 221px; height: 56px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StL_FNNLPVI/AAAAAAAAAZI/YNt5DupDAPY/s320/weiner+filter+K.bmp" alt="" id="BLOGGER_PHOTO_ID_5391652168825257298" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;where &lt;i style=""&gt;K&lt;/i&gt; is a specified constant&lt;span style=";font-family:&amp;quot;;font-size:100%;"  &gt;.&lt;/span&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt; &lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;This expression yields the frequency-domain estimate. The restored image must be in the spatial domain which will be obtain by taking the inverse Fourier transform of estimation.  &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;The image utilized for this activity is shown below&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StL-EW8pR9I/AAAAAAAAAYw/eX1TGNJSYv0/s1600-h/FF7.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StL-EW8pR9I/AAAAAAAAAYw/eX1TGNJSYv0/s320/FF7.bmp" alt="" id="BLOGGER_PHOTO_ID_5391651054748780498" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;**Taken from: http://www.background-wallpapers.com/games-wallpapers/final-fantasy/final-fantasy-vii.html&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;The following images show the degradation of the original image with the corresponding parameters used. The first set of images has &lt;span style="font-style: italic;"&gt;T &lt;/span&gt;= 1 and &lt;span style="font-style: italic;"&gt;a &lt;/span&gt;= &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; = 0.001, 0.01, and 0.1.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StL9GJFSnWI/AAAAAAAAAYA/VW8TEfKx5Tc/s1600-h/NBi_a001b001T1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StL9GJFSnWI/AAAAAAAAAYA/VW8TEfKx5Tc/s320/NBi_a001b001T1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391649985875058018" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StL9GpLZUdI/AAAAAAAAAYI/D9a010yg6zw/s1600-h/NBi_a01b01T1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StL9GpLZUdI/AAAAAAAAAYI/D9a010yg6zw/s320/NBi_a01b01T1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391649994490597842" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StL9G37-OII/AAAAAAAAAYQ/rI7V1RvpOdg/s1600-h/NBi_a1b1T1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StL9G37-OII/AAAAAAAAAYQ/rI7V1RvpOdg/s320/NBi_a1b1T1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391649998452439170" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;Their corresponding restored images are also obtained and shown below.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StL9u6Npm0I/AAAAAAAAAYY/CfUxlwQtiFA/s1600-h/Resi_NBi_a001b001T1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StL9u6Npm0I/AAAAAAAAAYY/CfUxlwQtiFA/s320/Resi_NBi_a001b001T1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391650686258223938" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StL9vTEDTQI/AAAAAAAAAYg/1sfsdKlq1-0/s1600-h/Resi_NBi_a01b01T1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StL9vTEDTQI/AAAAAAAAAYg/1sfsdKlq1-0/s320/Resi_NBi_a01b01T1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391650692928851202" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StL9vgrZomI/AAAAAAAAAYo/eBKXTMJWa2k/s1600-h/Resi_NBi_a1b1T1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StL9vgrZomI/AAAAAAAAAYo/eBKXTMJWa2k/s320/Resi_NBi_a1b1T1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391650696583553634" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;We observed that by having small 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;, we are putting less blur on the image. Thus, its corresponding Weiner filtered image yields better image.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;By keeping &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; constant, &lt;span style="font-style: italic;"&gt;T &lt;/span&gt;was varied. (T = 0.01, 0.1, 10, and 100 )&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMAK3M1eaI/AAAAAAAAAZg/jN2rds8iSWI/s1600-h/NBi_a01b01Tpt01.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMAK3M1eaI/AAAAAAAAAZg/jN2rds8iSWI/s320/NBi_a01b01Tpt01.bmp" alt="" id="BLOGGER_PHOTO_ID_5391653365509093794" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMALawz93I/AAAAAAAAAZo/1tHF9-cVRMY/s1600-h/NBi_a01b01Tpt1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMALawz93I/AAAAAAAAAZo/1tHF9-cVRMY/s320/NBi_a01b01Tpt1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391653375055230834" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StMAKZUWe3I/AAAAAAAAAZQ/QrZvhq-b1gk/s1600-h/NBi_a01b01T10.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StMAKZUWe3I/AAAAAAAAAZQ/QrZvhq-b1gk/s320/NBi_a01b01T10.bmp" alt="" id="BLOGGER_PHOTO_ID_5391653357487553394" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMAKgm81JI/AAAAAAAAAZY/bB4rB69uN3U/s1600-h/NBi_a01b01T100.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMAKgm81JI/AAAAAAAAAZY/bB4rB69uN3U/s320/NBi_a01b01T100.bmp" alt="" id="BLOGGER_PHOTO_ID_5391653359444612242" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;Their respective restored image was shown below.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMCMSDx89I/AAAAAAAAAZ4/4GamISNjt3A/s1600-h/Resi_NBi_a01b01Tpt1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMCMSDx89I/AAAAAAAAAZ4/4GamISNjt3A/s320/Resi_NBi_a01b01Tpt1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391655588921996242" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMCLzEOg-I/AAAAAAAAAZw/rpRbbELpGw8/s1600-h/Resi_NBi_a01b01Tpt01.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StMCLzEOg-I/AAAAAAAAAZw/rpRbbELpGw8/s320/Resi_NBi_a01b01Tpt01.bmp" alt="" id="BLOGGER_PHOTO_ID_5391655580602368994" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMCM6RjhJI/AAAAAAAAAaA/_kwmoH_7f28/s1600-h/Resi_NBi_a01b01T10.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMCM6RjhJI/AAAAAAAAAaA/_kwmoH_7f28/s320/Resi_NBi_a01b01T10.bmp" alt="" id="BLOGGER_PHOTO_ID_5391655599717188754" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StMCNDePO6I/AAAAAAAAAaI/CPJ-le4G43U/s1600-h/Resi_NBi_a01b01T100.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StMCNDePO6I/AAAAAAAAAaI/CPJ-le4G43U/s320/Resi_NBi_a01b01T100.bmp" alt="" id="BLOGGER_PHOTO_ID_5391655602186304418" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;As observed, lesser exposure time makes the noise more obvious with constant 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;. On the contrary, greater exposure time will make the blur more visible. The Weiner filter, which works on the blur applied on the original image restores the image with higher exposure time much better.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;For cases with unknown power spectrum of the original image, the constant K was varied with &lt;span style="font-style: italic;"&gt;a &lt;/span&gt;= &lt;span style="font-style: italic;"&gt;b &lt;/span&gt;= 0.01 and &lt;span style="font-style: italic;"&gt;T &lt;/span&gt;= 1 . (&lt;span style="font-style: italic;"&gt;K&lt;/span&gt; = 0.001, 0.01, 0.1 and 1, respectively)&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMFTXacRNI/AAAAAAAAAaQ/Fk27W-_aHpA/s1600-h/Resi_NBi_a01b01T1_Kpt001.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StMFTXacRNI/AAAAAAAAAaQ/Fk27W-_aHpA/s320/Resi_NBi_a01b01T1_Kpt001.bmp" alt="" id="BLOGGER_PHOTO_ID_5391659009153189074" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMT2GkdpkI/AAAAAAAAAaY/g_4jgW1_Ll8/s1600-h/Resi_NBi_a01b01T1_Kpt01.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StMT2GkdpkI/AAAAAAAAAaY/g_4jgW1_Ll8/s320/Resi_NBi_a01b01T1_Kpt01.bmp" alt="" id="BLOGGER_PHOTO_ID_5391674999090030146" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMT2hFgggI/AAAAAAAAAag/2w8ipZBBYC8/s1600-h/Resi_NBi_a01b01T1_Kpt1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMT2hFgggI/AAAAAAAAAag/2w8ipZBBYC8/s320/Resi_NBi_a01b01T1_Kpt1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391675006207951362" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMT2_DnhOI/AAAAAAAAAao/vknrSpjlUkQ/s1600-h/Resi_NBi_a01b01T1_K1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMT2_DnhOI/AAAAAAAAAao/vknrSpjlUkQ/s320/Resi_NBi_a01b01T1_K1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391675014253085922" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;Using a constant value of K shows a significant deviation on the restoration of the degraded image. It shows that knowing the power spectrum of the ungraded image as well as the power spectrum of the added noise is crucial in filtering blurred images. However, in instances that the two parameters are unknown, choosing a good value of K will yield a more enhanced image.&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;I will grade myself 9/10 for this activity. I was able to understand the activity and obtain the needed output given a short working time. However, I know that there are still so much to learn from this activity. I acknowledged Gilbert for helping me finish this activity.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;The code below was use in implementing the Weiner filter on the degraded images.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;image = gray_imread('FF7.bmp');&lt;br /&gt;noise = grand(size(image,1), size(image,2), 'nor', 0.02, 0.02);&lt;br /&gt;&lt;br /&gt;a = 0.01;&lt;br /&gt;b = 0.01;&lt;br /&gt;T = 1;&lt;br /&gt;&lt;br /&gt;H = [];&lt;br /&gt;for i = 1:size(image,1)&lt;br /&gt;for j = 1:size(image,2)&lt;br /&gt;H(i, j) = (T/(%pi*(i*a + j*b)))*(sin(%pi*(i*a + j*b)))*exp(-%i*%pi*(i*a + j*b));&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;F = fft2(image);&lt;br /&gt;N = fft2(noise);&lt;br /&gt;&lt;br /&gt;G = H.*F + N;&lt;br /&gt;noisyblurredimage = abs(ifft(G));&lt;br /&gt;&lt;br /&gt;scf(1);&lt;br /&gt;imshow(noisyblurredimage, []);&lt;br /&gt;imwrite(normal(noisyblurredimage), 'filename.bmp');&lt;br /&gt;&lt;br /&gt;// Weiner filtering&lt;br /&gt;&lt;br /&gt;Sn = N.*conj(N);&lt;br /&gt;Sf = F.*conj(F);&lt;br /&gt;K = Sn./Sf;&lt;br /&gt;W = H.*conj(H);&lt;br /&gt;&lt;br /&gt;Fres = ((1)./H).*((W)./(W+K)).*G;&lt;br /&gt;Fres = abs(ifft(Fres));&lt;br /&gt;scf(2);&lt;br /&gt;imshow(Fres, []);&lt;br /&gt;imwrite(normal(Fres), 'filename.bmp');&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8940726446323633872-6659369035499163057?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/6659369035499163057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/6659369035499163057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/6659369035499163057'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/10/activity-19-restoration-of-blurred.html' title='ACTIVITY 19 - Restoration of Blurred Image'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_mPdMIzolbt8/StL6-WCDlkI/AAAAAAAAAXg/wxseLf1b2uw/s72-c/degrade+restore.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-8755314424639794243</id><published>2009-10-12T02:44:00.001-07:00</published><updated>2009-10-12T06:50:35.726-07:00</updated><title type='text'>ACTIVITY 18 - Noise Models and Basic Image Restoration</title><content type='html'>&lt;div style="text-align: justify;"&gt;This activity aims to be able to be familiar with different noise models by applying them on an image and then restore the degraded image by implementing various spatial filters.&lt;br /&gt;&lt;br /&gt;Noise are random variables that are characterized by a probability density function or PDF. In this activity, different noise models were applied on an ungraded image.&lt;br /&gt;&lt;br /&gt;First is the Gaussian noise which is also known as normal noise model. The PDF of a Gaussian random variable, &lt;span style="font-style: italic;"&gt;z&lt;/span&gt;, is given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMtsVufccI/AAAAAAAAAcY/frdimOVK6Sc/s1600-h/gaus.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 230px; height: 80px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMtsVufccI/AAAAAAAAAcY/frdimOVK6Sc/s320/gaus.bmp" alt="" id="BLOGGER_PHOTO_ID_5391703418662252994" border="0" /&gt;&lt;/a&gt;where &lt;span style="font-style: italic;"&gt;z&lt;/span&gt; represents gray level, &lt;span style="font-style: italic;"&gt;myu &lt;/span&gt;is the average value of &lt;span style="font-style: italic;"&gt;z &lt;/span&gt;and sigma is its standard deviation.&lt;br /&gt;&lt;br /&gt;Next is the Erlang or Gamma noise which is given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMuLm_P8TI/AAAAAAAAAcg/xCxqQMxgPDs/s1600-h/gamma.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 296px; height: 139px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StMuLm_P8TI/AAAAAAAAAcg/xCxqQMxgPDs/s320/gamma.bmp" alt="" id="BLOGGER_PHOTO_ID_5391703955871887666" border="0" /&gt;&lt;/a&gt;The mean and variance of this density are given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMucQsLZGI/AAAAAAAAAco/EF8gNQCar9A/s1600-h/meanv.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 122px; height: 137px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMucQsLZGI/AAAAAAAAAco/EF8gNQCar9A/s320/meanv.bmp" alt="" id="BLOGGER_PHOTO_ID_5391704241944093794" border="0" /&gt;&lt;/a&gt;, respectively.&lt;br /&gt;&lt;br /&gt;The Exponential noise has the PDF given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMuvaAv8tI/AAAAAAAAAcw/vXSBfa6fFpQ/s1600-h/exp.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 232px; height: 98px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMuvaAv8tI/AAAAAAAAAcw/vXSBfa6fFpQ/s320/exp.bmp" alt="" id="BLOGGER_PHOTO_ID_5391704570863809234" border="0" /&gt;&lt;/a&gt;and has the mean and variance given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMu7HBQTvI/AAAAAAAAAc4/F-F77fqyu7Q/s1600-h/mean+v+2+exp.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 106px; height: 145px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMu7HBQTvI/AAAAAAAAAc4/F-F77fqyu7Q/s320/mean+v+2+exp.bmp" alt="" id="BLOGGER_PHOTO_ID_5391704771924086514" border="0" /&gt;&lt;/a&gt;Then we have the Uniform noise with PDF given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMvLdQj9gI/AAAAAAAAAdA/Il7AbESaJ6U/s1600-h/uni.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 262px; height: 121px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMvLdQj9gI/AAAAAAAAAdA/Il7AbESaJ6U/s320/uni.bmp" alt="" id="BLOGGER_PHOTO_ID_5391705052771776002" border="0" /&gt;&lt;/a&gt;and has mean and variance given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMvZWcEUeI/AAAAAAAAAdI/Cmvd77fLG0s/s1600-h/mean+uni.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 160px; height: 146px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StMvZWcEUeI/AAAAAAAAAdI/Cmvd77fLG0s/s320/mean+uni.bmp" alt="" id="BLOGGER_PHOTO_ID_5391705291459154402" border="0" /&gt;&lt;/a&gt;The Impulse or Salt-and-Pepper noise has PDF given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMvoK5CLYI/AAAAAAAAAdQ/wEffVeLbYrc/s1600-h/sp.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 248px; height: 111px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMvoK5CLYI/AAAAAAAAAdQ/wEffVeLbYrc/s320/sp.bmp" alt="" id="BLOGGER_PHOTO_ID_5391705546057461122" border="0" /&gt;&lt;/a&gt;Finally, we have the Rayleigh noise which has the PDF given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StMv88lU1vI/AAAAAAAAAdY/9VimgFoISKs/s1600-h/ray.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 111px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StMv88lU1vI/AAAAAAAAAdY/9VimgFoISKs/s320/ray.bmp" alt="" id="BLOGGER_PHOTO_ID_5391705902993954546" border="0" /&gt;&lt;/a&gt;The mean and variance of the Rayleigh noise is given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMwOWCU3qI/AAAAAAAAAdg/tRu0EQ7WUUw/s1600-h/mean+ray.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 166px; height: 126px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StMwOWCU3qI/AAAAAAAAAdg/tRu0EQ7WUUw/s320/mean+ray.bmp" alt="" id="BLOGGER_PHOTO_ID_5391706201884253858" border="0" /&gt;&lt;/a&gt;These noises were created using the built-in function &lt;span style="font-style: italic;"&gt;grand &lt;/span&gt;in &lt;span style="font-style: italic;"&gt;Scilab&lt;/span&gt; and then applied on an ungraded image.&lt;br /&gt;&lt;br /&gt;The corrupted images were then restored using different filters. First is the Arithmetic mean filter.  represent the set of coordinates in a rectangular subimage window of size &lt;span style="font-style: italic;"&gt;m x n&lt;/span&gt;, which has center at point &lt;span style="font-style: italic;"&gt;(x,y)&lt;/span&gt;. The arithmetic mean filtering process computes the average value of the corrupted image &lt;span style="font-style: italic;"&gt;g(x,y)&lt;/span&gt; in the are defined by &lt;span style="font-style: italic;"&gt;S sub xy. &lt;/span&gt;The value of the restored image &lt;span style="font-style: italic;"&gt;f &lt;/span&gt;at point &lt;span style="font-style: italic;"&gt;(x,y)&lt;/span&gt; is simply the mean computed using the pixels int he region defined by &lt;span style="font-style: italic;"&gt;S sub xy.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMx0YuzqUI/AAAAAAAAAdo/dKt2H-3T5RM/s1600-h/arithm.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 221px; height: 62px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMx0YuzqUI/AAAAAAAAAdo/dKt2H-3T5RM/s320/arithm.bmp" alt="" id="BLOGGER_PHOTO_ID_5391707954954348866" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The Geometric mean filter will restore an image with the use of the equation below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMyGhJE8QI/AAAAAAAAAdw/mqhWMVShzH8/s1600-h/geom.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 225px; height: 107px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMyGhJE8QI/AAAAAAAAAdw/mqhWMVShzH8/s320/geom.bmp" alt="" id="BLOGGER_PHOTO_ID_5391708266449662210" border="0" /&gt;&lt;/a&gt;The Harmonic mean filtering operations is given by the expression&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StMyZgNJgtI/AAAAAAAAAd4/tHy7a9t-Th8/s1600-h/harm.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 229px; height: 117px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StMyZgNJgtI/AAAAAAAAAd4/tHy7a9t-Th8/s320/harm.bmp" alt="" id="BLOGGER_PHOTO_ID_5391708592615817938" border="0" /&gt;&lt;/a&gt;This filter works better for salt noise than the pepper noise.&lt;br /&gt;&lt;br /&gt;The Contraharmonic mean filtering operations yields a restored image based on the expression&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StMyxgUdfGI/AAAAAAAAAeA/Oxlf8vXgNCI/s1600-h/cm.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 213px; height: 117px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StMyxgUdfGI/AAAAAAAAAeA/Oxlf8vXgNCI/s320/cm.bmp" alt="" id="BLOGGER_PHOTO_ID_5391709004963347554" border="0" /&gt;&lt;/a&gt;where Q is the order of the filter. This filter is suited in treating salt-and-pepper noise. Positive values of Q will eliminate pepper noise while negative values omits salt noise. Thus, it cannot remove both noise simultaneously.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I was able to finish this activity and obtained MANY images.  All files were deleted after the CSRC reset our computers. Unfortunately, I didn't have backup of my files. I guess, 5/10 is enough for me since I don't have pictures to show that I have finished this activity.  :-(&lt;br /&gt;Anyway, I want to thank Gilbert for guiding me in this activity.&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/8940726446323633872-8755314424639794243?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/8755314424639794243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/10/activity-18-noise-models-and-basic.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/8755314424639794243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/8755314424639794243'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/10/activity-18-noise-models-and-basic.html' title='ACTIVITY 18 - Noise Models and Basic Image Restoration'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_mPdMIzolbt8/StMtsVufccI/AAAAAAAAAcY/frdimOVK6Sc/s72-c/gaus.bmp' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-182243737383701953</id><published>2009-09-09T19:03:00.002-07:00</published><updated>2009-09-09T20:01:46.935-07:00</updated><title type='text'>ACTIVITY 17 - Photometric Stereo</title><content type='html'>In this activity, we estimated and then extracted the shape of an object from shadow with the use of different sources and shading models.&lt;br /&gt;&lt;br /&gt;First, we utilized the images of of synthetic spherical surfaces that are illuminated by a far away point source.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SqhiIuVLE5I/AAAAAAAAAWY/X8IIVsU8uM4/s1600-h/intensity.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 78px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SqhiIuVLE5I/AAAAAAAAAWY/X8IIVsU8uM4/s320/intensity.bmp" alt="" id="BLOGGER_PHOTO_ID_5379657656909370258" border="0" /&gt;&lt;/a&gt;It looks like there are no significant difference among the pictures above but the shading of the images tells much information about the surface of the object. It gives the intensity captured by the camera at point (x,y). These images are captured from the surface of the object with the sources located respectively at&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhjVL7sk-I/AAAAAAAAAWg/dpUcVa0Vw5c/s1600-h/V.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 315px; height: 131px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhjVL7sk-I/AAAAAAAAAWg/dpUcVa0Vw5c/s320/V.bmp" alt="" id="BLOGGER_PHOTO_ID_5379658970525635554" border="0" /&gt;&lt;/a&gt;This numbers were put into matrix form where each row is a source and each column is the x,y, and z component of the source.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/Sqhr44IEwII/AAAAAAAAAXY/rFAfdrxZ9zg/s1600-h/V.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 101px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/Sqhr44IEwII/AAAAAAAAAXY/rFAfdrxZ9zg/s320/V.bmp" alt="" id="BLOGGER_PHOTO_ID_5379668379777155202" border="0" /&gt;&lt;/a&gt;Now we are given with I and V which is related by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SqhlF1qgrKI/AAAAAAAAAWo/DRe2SdHvfzU/s1600-h/ivg.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 68px; height: 23px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SqhlF1qgrKI/AAAAAAAAAWo/DRe2SdHvfzU/s320/ivg.bmp" alt="" id="BLOGGER_PHOTO_ID_5379660905873190050" border="0" /&gt;&lt;/a&gt;We can solve for the surface normal vector by first getting &lt;span style="font-weight: bold;"&gt;g&lt;/span&gt; with the use of the equation&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhlrvXuMZI/AAAAAAAAAWw/7E3bj96xXrg/s1600-h/g.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 137px; height: 33px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhlrvXuMZI/AAAAAAAAAWw/7E3bj96xXrg/s320/g.bmp" alt="" id="BLOGGER_PHOTO_ID_5379661557018800530" border="0" /&gt;&lt;/a&gt;This is the reflectance of the of the object at the point normal to the surface. The surface normal vector is obtained from &lt;span style="font-weight: bold;"&gt;g&lt;/span&gt; divided by its magnitude&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SqhmXlv7dhI/AAAAAAAAAW4/yUouvKcvmvA/s1600-h/n.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 66px; height: 41px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SqhmXlv7dhI/AAAAAAAAAW4/yUouvKcvmvA/s320/n.bmp" alt="" id="BLOGGER_PHOTO_ID_5379662310350222866" border="0" /&gt;&lt;/a&gt;From the surface normals, we computed the elevation z = &lt;span style="font-style: italic;"&gt;f(u,v) &lt;/span&gt;and the 3D plot of the shape of the object was displayed.&lt;br /&gt;&lt;br /&gt;The surface normals (&lt;span style="font-style: italic;"&gt;nx&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;ny&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;nz&lt;/span&gt;) obtained using photometric stereo are related to the partial derivative of &lt;span style="font-style: italic;"&gt;f(x,y)&lt;/span&gt; as&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhnnPdcAoI/AAAAAAAAAXA/ceMe3ZQKibU/s1600-h/df.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 179px; height: 48px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhnnPdcAoI/AAAAAAAAAXA/ceMe3ZQKibU/s320/df.bmp" alt="" id="BLOGGER_PHOTO_ID_5379663678756618882" border="0" /&gt;&lt;/a&gt;Then, the surface elevation z at point (u,v) which is given by &lt;span style="font-style: italic;"&gt;f(u,v)&lt;/span&gt; is evaluated by a line integral&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhoFWA36LI/AAAAAAAAAXI/ZlW_srqmpH4/s1600-h/int.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 256px; height: 50px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhoFWA36LI/AAAAAAAAAXI/ZlW_srqmpH4/s320/int.bmp" alt="" id="BLOGGER_PHOTO_ID_5379664195911936178" border="0" /&gt;&lt;/a&gt;Finally, the 3D plot of the shape of the object was displayed.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhoWVM3ToI/AAAAAAAAAXQ/PSK71VQ2IEM/s1600-h/plot3d.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 242px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SqhoWVM3ToI/AAAAAAAAAXQ/PSK71VQ2IEM/s320/plot3d.bmp" alt="" id="BLOGGER_PHOTO_ID_5379664487751569026" border="0" /&gt;&lt;/a&gt;The shape of the object with spherical surfaces was successfully extracted and displayed.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style: italic;"&gt;Scilab &lt;/span&gt;code used in this activity was shown below. I want to acknowledge the help of Gilbert in working on this activity.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;loadmatfile('Photos.mat');&lt;br /&gt;&lt;br /&gt;// intensity captured by camera at point (x,y)&lt;br /&gt;I1 = matrix(I1, 1, size(I1, 1)*size(I1, 2));&lt;br /&gt;I2 = matrix(I2, 1, size(I2, 1)*size(I2, 2));&lt;br /&gt;I3 = matrix(I3, 1, size(I3, 1)*size(I3, 2));&lt;br /&gt;I4 = matrix(I4, 1, size(I4, 1)*size(I4, 2));&lt;br /&gt;I = [I1; I2; I3; I4];&lt;br /&gt;&lt;br /&gt;// location of the point sources&lt;br /&gt;V1 = [0.085832, 0.17365, 0.98106];&lt;br /&gt;V2 = [0.085832, -0.17365, 0.98106];&lt;br /&gt;V3 = [0.17365, 0, 0.98481];&lt;br /&gt;V4 = [0.16318, -0.34202, 0.92542];&lt;br /&gt;V = [V1; V2; V3; V4];&lt;br /&gt;&lt;br /&gt;// calculation of surface normal vector&lt;br /&gt;g = inv(V'*V)*V'*I;&lt;br /&gt;magnitude = sqrt((g(1,:).^2) + (g(2,:).^2) + (g(3,:).^2))+.0001;&lt;br /&gt;n = [];&lt;br /&gt;for i = 1:3&lt;br /&gt;n(i,:) = g(i,:)./magnitude;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;// computation for the elevation z = f(x,y)&lt;br /&gt;nx = n(1,:);&lt;br /&gt;ny = n(2,:);&lt;br /&gt;nz = n(3,:) + 0.0001;&lt;br /&gt;dfx = -nx./nz;&lt;br /&gt;dfy = -ny./nz;&lt;br /&gt;z1 = matrix(dfx,128,128);&lt;br /&gt;z2 = matrix(dfy,128,128);&lt;br /&gt;Z1 = cumsum(z1,2); // integration from 0 to u&lt;br /&gt;Z2 = cumsum(z2,1); // integration from 0 to v&lt;br /&gt;z = Z1 + Z2;&lt;br /&gt;scf(0);&lt;br /&gt;plot3d(1:128, 1:128, z);&lt;/span&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/8940726446323633872-182243737383701953?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/182243737383701953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/182243737383701953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/182243737383701953'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/09/activity-17-photometric-stereo.html' title='ACTIVITY 17 - Photometric Stereo'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_mPdMIzolbt8/SqhiIuVLE5I/AAAAAAAAAWY/X8IIVsU8uM4/s72-c/intensity.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-8776909004130393264</id><published>2009-09-09T19:03:00.001-07:00</published><updated>2009-10-12T07:10:44.830-07:00</updated><title type='text'>ACTIVITY 16 - Neural Networks</title><content type='html'>&lt;div style="text-align: justify;"&gt;This activity is again related from the two previous activities, Activity 14 and 15. The purpose of this activity is to classify objects from their corresponding class using neural networks. The features of of the samples from the two classes used in Activity 15 was also used in this activity. The &lt;span style="font-style: italic;"&gt;Clorets &lt;/span&gt;mint candy was tagged  with the value of 0 while the &lt;span style="font-style: italic;"&gt;Pillows &lt;/span&gt;chocolate snack was tagged with the value of 1.&lt;br /&gt;&lt;br /&gt;The code below was made to implement the Artificial Neural Network algorithm.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;clorets_train = fscanfMat('clorets_train.txt');&lt;br /&gt;pillows_train = fscanfMat('pillows_train.txt');&lt;br /&gt;clorets_test = fscanfMat('clorets_test.txt');&lt;br /&gt;pillows_test = fscanfMat('pillows_test.txt');&lt;br /&gt;&lt;br /&gt;cp_train = [clorets_train; pillows_train];&lt;br /&gt;cp_train(:,1) = cp_train(:,1)/max(cp_train(:,1));&lt;br /&gt;cp_train = cp_train';&lt;br /&gt;cp_test = [clorets_test; pillows_test];&lt;br /&gt;cp_test(:,1) = cp_test(:,1)/max(cp_test(:,1));&lt;br /&gt;cp_test = cp_test';&lt;br /&gt;&lt;br /&gt;rand('seed', 0);&lt;br /&gt;&lt;br /&gt;network = [4, 4, 1];&lt;br /&gt;groupings = [0 0 0 0 0 1 1 1 1 1];&lt;br /&gt;learning_rate = [1, 0];&lt;br /&gt;training_cycle = 1000;&lt;br /&gt;&lt;br /&gt;training_weight = ann_FF_init(network);&lt;br /&gt;weight = ann_FF_Std_online(cp_train, groupings, network, training_weight, learning_rate, training_cycle);&lt;br /&gt;class = ann_FF_run(cp_test, network, weight);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;** the source code was from Cole Fabro's work&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The training parameters, learning rate and training cycle were tuned. It was observe that for a given training cycle, the recognition is more accurate with large learning rate. On the other hand, with the learning rate being constant, the recognition is also more accurate.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StM2KpcYz8I/AAAAAAAAAew/Jo_FBOCuMd0/s1600-h/500+tcycles.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 183px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StM2KpcYz8I/AAAAAAAAAew/Jo_FBOCuMd0/s400/500+tcycles.bmp" alt="" id="BLOGGER_PHOTO_ID_5391712735444127682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StM2LXhjK-I/AAAAAAAAAe4/sxS52c7rXRc/s1600-h/1000tcycles.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 183px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StM2LXhjK-I/AAAAAAAAAe4/sxS52c7rXRc/s400/1000tcycles.bmp" alt="" id="BLOGGER_PHOTO_ID_5391712747813809122" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I will give myself a grade of 10/10 for this activity. Although the code was already given, I fully understand the effect of tuning the training parameters on the accuracy of the recognition. I thank Gilbert for helping me on this activity.&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/8940726446323633872-8776909004130393264?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/8776909004130393264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/09/activity-16-neural-networks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/8776909004130393264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/8776909004130393264'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/09/activity-16-neural-networks.html' title='ACTIVITY 16 - Neural Networks'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_mPdMIzolbt8/StM2KpcYz8I/AAAAAAAAAew/Jo_FBOCuMd0/s72-c/500+tcycles.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-6209468115554924376</id><published>2009-09-09T19:01:00.003-07:00</published><updated>2009-10-12T06:12:15.023-07:00</updated><title type='text'>ACTIVITY 15 - Probabilistic Classification</title><content type='html'>&lt;div style="text-align: justify;"&gt;This activity is related from the previous activity, Activity 14. Two classes from the pattern recognition activity was chose to be used in this activity. The Clorets and the Pillows classes will be the classified by applying the Linear Discriminant Analysis or LDA.&lt;br /&gt;&lt;br /&gt;Like the Pattern Recognition, the purpose of LDA is to classify objects into groups according on a set of features that describe the object. Again, we need a training set with their features which will represent the predetermined groups.&lt;br /&gt;&lt;br /&gt;The LDA process was comprehensively explained on &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMnm2rKp_I/AAAAAAAAAcA/NIqmxAeeGec/s1600-h/image+1+act+15.bmp"&gt;http://people.revoledu.com/kardi/tutorial/LDA&lt;/a&gt; . The procedure can be explained also by the code made for this activity.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;clorets_train = fscanfMat('clorets_train.txt');&lt;br /&gt;clorets_test = fscanfMat('clorets_test.txt');&lt;br /&gt;pillows_train = fscanfMat('pillows_train.txt');&lt;br /&gt;pillows_test = fscanfMat('pillows_test.txt');&lt;br /&gt;&lt;br /&gt;train = [clorets_train; pillows_train];&lt;br /&gt;test = [clorets_test; pillows_test];&lt;br /&gt;&lt;br /&gt;u1 = [mean(clorets_train(:,1)), mean(clorets_train(:,2)), mean(clorets_train(:,3)), mean(clorets_train(:,4))];&lt;br /&gt;u2 = [mean(pillows_train(:,1)), mean(pillows_train(:,2)), mean(pillows_train(:,3)), mean(pillows_train(:,4))];&lt;br /&gt;&lt;br /&gt;u = [mean(train(:,1)), mean(train(:,2)), mean(train(:,3)), mean(train(:,4))];&lt;br /&gt;&lt;br /&gt;x01 = [clorets_train(1,:) - u; clorets_train(2,:) - u; clorets_train(3,:) - u; clorets_train(4,:) - u; clorets_train(5,:) - u];&lt;br /&gt;x02 = [pillows_train(1,:) - u; pillows_train(2,:) - u; pillows_train(3,:) - u; pillows_train(4,:) - u; pillows_train(5,:) - u];&lt;br /&gt;&lt;br /&gt;n1 = 5;&lt;br /&gt;n2 = 5;&lt;br /&gt;&lt;br /&gt;c1 = (x01'*x01)/n1;&lt;br /&gt;c2 = (x02'*x02)/n2;&lt;br /&gt;&lt;br /&gt;for r = 1:4&lt;br /&gt;for s = 1:4&lt;br /&gt;C(r, s) = (n1/(n1 + n2))*(c1(r, s) + c2(r, s));&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;invC = inv(C);&lt;br /&gt;&lt;br /&gt;P1 = n1/(n1 + n2);&lt;br /&gt;P2 = n2/(n1 + n2);&lt;br /&gt;P = [P1; P2];&lt;br /&gt;&lt;br /&gt;for k = 1:(n1 + n2)&lt;br /&gt;f1(k) = u1*invC*test(k,:)' - (1/2)*u1*invC*u1' + log(P(1));&lt;br /&gt;f2(k) = u2*invC*test(k,:)' - (1/2)*u2*invC*u2' + log(P(2));&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;f = [f1, f2];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The object with maximum f1 will be assigned to class of &lt;span style="font-style: italic;"&gt;Clorets &lt;/span&gt;while the object with maximum f2 will be assigned to class &lt;span style="font-style: italic;"&gt;Pillows&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The table below shows the corresponding feature vector of each sample from each class. The calculated mean feature for each class and the global mean vector was shown in the table.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/StMnm2rKp_I/AAAAAAAAAcA/NIqmxAeeGec/s1600-h/image+1+act+15.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 170px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/StMnm2rKp_I/AAAAAAAAAcA/NIqmxAeeGec/s320/image+1+act+15.bmp" alt="" id="BLOGGER_PHOTO_ID_5391696727357695986" border="0" /&gt;&lt;/a&gt;The table below shows the results.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StMnnaYKD_I/AAAAAAAAAcI/BwYeuy08hdw/s1600-h/image+2+act+15.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 93px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StMnnaYKD_I/AAAAAAAAAcI/BwYeuy08hdw/s320/image+2+act+15.bmp" alt="" id="BLOGGER_PHOTO_ID_5391696736941641714" border="0" /&gt;&lt;/a&gt;The values of the discriminant function obtained are very large. This is due to the large discrepancy between the pixel area and the normalized chromaticity values which were used as featured vector. However, it can be observed that the difference between the two discriminant function were so small.&lt;br /&gt;&lt;br /&gt;I will grade myself 10/10 for completing this activity. I was able to implement the Linear Discriminant Analysis thus I was able to classify objects to their expected class. I want to acknowledged Gilbert for helping me finish this activity.&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/8940726446323633872-6209468115554924376?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/6209468115554924376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/6209468115554924376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/6209468115554924376'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/09/activity-15-probabilistic.html' title='ACTIVITY 15 - Probabilistic Classification'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_mPdMIzolbt8/StMnm2rKp_I/AAAAAAAAAcA/NIqmxAeeGec/s72-c/image+1+act+15.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-2769060770191947794</id><published>2009-09-09T19:01:00.001-07:00</published><updated>2009-10-12T07:14:41.854-07:00</updated><title type='text'>ACTIVITY 14 - Pattern Recognition</title><content type='html'>&lt;div style="text-align: justify;"&gt;This activity was done to be able to qualify different objects through their various characteristics such as shape, size and color by pattern recognition. A set of features of the objects will be used as pattern. We aim to identify from where class an unknown object belongs.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;First, three sets of  objects were assembled. Each set represent a class composing of 10 samples. This activity utilized &lt;span style="font-style: italic;"&gt;Clorets &lt;/span&gt;mint candy, &lt;span style="font-style: italic;"&gt;Pillows &lt;/span&gt;chocolate snack and &lt;span style="font-style: italic;"&gt;Potchi &lt;/span&gt;gummy candy. The picture of the objects obtained was shown below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/StMbanhhweI/AAAAAAAAAa4/iLdbnnNGOc8/s1600-h/main+image.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 253px; height: 320px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/StMbanhhweI/AAAAAAAAAa4/iLdbnnNGOc8/s320/main+image.bmp" alt="" id="BLOGGER_PHOTO_ID_5391683322992771554" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Each of the three class was divided into two sets. The first five samples will be the training set while the remaining five will serve as the test set. The pixel area, the average normalized chromaticity values in red, green and blue will be used as features for pattern recognition. These features were obtained using the techniques that have been learned in previous activities. The pixel area was determined by thresholding, inverting and counting the number of pixels of the black and white image of the set objects. On the other hand, the chromaticity values were obtained by  using the non-parametric segmentation technique. After obtaining each feature, they are arranged into matrix form producing the feature vector. The training feature vectors were separated from the test feature vectors. From the training feature vectors, the mean feature vector was determined from the expression&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMeBWqB-aI/AAAAAAAAAbA/Z9FuXFC_G7I/s1600-h/mean+f+vector.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 170px; height: 73px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMeBWqB-aI/AAAAAAAAAbA/Z9FuXFC_G7I/s320/mean+f+vector.bmp" alt="" id="BLOGGER_PHOTO_ID_5391686187503188386" border="0" /&gt;&lt;/a&gt;Here, &lt;span style="font-style: italic;"&gt;N &lt;/span&gt;is the total number of samples in the class &lt;span style="font-style: italic;"&gt;wj&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;xj &lt;/span&gt;is feature vector in the training set of the corresponding class. Basically, this is just the mean of the pixel area and the normalized chromaticity values for red, green and blue from 5 samples comprising the training set. Each sample from the test set will be compared to the mean feature vector, which is a 1 x 4 matrix. This will be done through minimum distance classification where the Euclidean distance is applicable given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMgDJiIhVI/AAAAAAAAAbQ/k4L89CYFX0Q/s1600-h/eucle.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 277px; height: 34px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMgDJiIhVI/AAAAAAAAAbQ/k4L89CYFX0Q/s320/eucle.bmp" alt="" id="BLOGGER_PHOTO_ID_5391688417363395922" border="0" /&gt;&lt;/a&gt;where x is the feature vector of the test set and j is the number of classes which in this case is 3.&lt;br /&gt;&lt;br /&gt;The feature vector of every sample on each set and their corresponding mean feature vector is shown in the table below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/StMgyRMVa9I/AAAAAAAAAbg/HseL7Hpt1Ys/s1600-h/activity+14+image1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 168px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/StMgyRMVa9I/AAAAAAAAAbg/HseL7Hpt1Ys/s400/activity+14+image1.bmp" alt="" id="BLOGGER_PHOTO_ID_5391689226873301970" border="0" /&gt;&lt;/a&gt;The resulting mean distance and the classification of the samples from the test set was shown in another table below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/StMh3iDG-bI/AAAAAAAAAbw/u7cTKvJCC68/s1600-h/activity+14+image2.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 168px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/StMh3iDG-bI/AAAAAAAAAbw/u7cTKvJCC68/s400/activity+14+image2.bmp" alt="" id="BLOGGER_PHOTO_ID_5391690416808982962" border="0" /&gt;&lt;/a&gt;As have been observed, the calculated mean distance, &lt;span style="font-style: italic;"&gt;D&lt;/span&gt; is relatively larger when the test sample does not belong to the class. Relatively small mean distance tells that the test sample belongs to the class. However, there is a deviation between the &lt;span style="font-style: italic;"&gt;Clorets &lt;/span&gt;and &lt;span style="font-style: italic;"&gt;Potchi &lt;/span&gt;sample. Some &lt;span style="font-style: italic;"&gt;Clorets&lt;/span&gt; test samples were classified as &lt;span style="font-style: italic;"&gt;Potchi &lt;/span&gt;while some &lt;span style="font-style: italic;"&gt;Potchi &lt;/span&gt;samples were classified as &lt;span style="font-style: italic;"&gt;Clorets&lt;/span&gt;. We can say that the deviation was brought by the shape of both sample. Overall, the technique was useful in classifying objects of different characteristics.&lt;br /&gt;&lt;br /&gt;I will give myself a grade of 10/10 in this activity. I was able to understand how to use the characteristics of objects as pattern in classifying them through pattern recognition. I had a hard time capturing pictures of the samples that can be threshold correctly in order to use the &lt;span style="font-style: italic;"&gt;bwlabel &lt;/span&gt;function of &lt;span style="font-style: italic;"&gt;Scilab &lt;/span&gt;in getting the pixel area. After obtaining the picture, acquiring the data was made easy with the help of Gilbert.&lt;br /&gt;&lt;br /&gt;The code below was utilized in this activity.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;image1 = 1-gray_imread('bwclorets1.bmp');&lt;br /&gt;&lt;br /&gt;// Area computation for training set&lt;br /&gt;[L, n] = bwlabel(image1);&lt;br /&gt;area = [];&lt;br /&gt;for i = 1:n&lt;br /&gt;area(i) = sum(i==L);&lt;br /&gt;end&lt;br /&gt;mean_area = mean(area(1:5));&lt;br /&gt;&lt;br /&gt;for i=1:10&lt;br /&gt;image =imread('clorets'+string(i)+'.bmp');&lt;br /&gt;patch = imread('patchclorets.bmp');&lt;br /&gt;&lt;br /&gt;r = image(:,:,1);&lt;br /&gt;g = image(:,:,2);&lt;br /&gt;b = image(:,:,3);&lt;br /&gt;&lt;br /&gt;rp = patch(:,:,1);&lt;br /&gt;gp = patch(:,:,2);&lt;br /&gt;bp = patch(:,:,3);&lt;br /&gt;&lt;br /&gt;R = r./(r+g+b);&lt;br /&gt;G = g./(r+g+b);&lt;br /&gt;B = b./(r+g+b);&lt;br /&gt;&lt;br /&gt;Rp = rp./(rp+gp+bp);&lt;br /&gt;Gp = gp./(rp+gp+bp);&lt;br /&gt;Bp = bp./(rp+gp+bp);&lt;br /&gt;&lt;br /&gt;Rmu = mean(Rp);&lt;br /&gt;Gmu = mean(Gp);&lt;br /&gt;Rsigma = stdev(Rp);&lt;br /&gt;Gsigma = stdev(Gp);&lt;br /&gt;&lt;br /&gt;// Non-parametric Segmentation&lt;br /&gt;BINS = 256;&lt;br /&gt;rint = round( Rp*(BINS-1) + 1);&lt;br /&gt;gint = round (Gp*(BINS-1) + 1);&lt;br /&gt;colors = gint(:) + (rint(:)-1)*BINS;&lt;br /&gt;hist = zeros(BINS,BINS);&lt;br /&gt;for row = 1:BINS&lt;br /&gt;for col = 1:(BINS-row+1)&lt;br /&gt;hist(row,col) = length( find(colors==( ((col + (row-1)*BINS)))));&lt;br /&gt;end;&lt;br /&gt;end;&lt;br /&gt;&lt;br /&gt;rib = R*255;&lt;br /&gt;gib = G*255;&lt;br /&gt;&lt;br /&gt;[a, b] = size(image);&lt;br /&gt;np = zeros(a, b);&lt;br /&gt;&lt;br /&gt;for r = 1:a&lt;br /&gt;for s = 1:b&lt;br /&gt;c = round(rib(r, s)) + 1;&lt;br /&gt;d = round(gib(r, s)) + 1;&lt;br /&gt;np(r,s) = hist(c, d);&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;// Mean color per channel&lt;br /&gt;imageR = [];&lt;br /&gt;imageG = [];&lt;br /&gt;imageB = [];&lt;br /&gt;&lt;br /&gt;[x , y] = find(np ~= 0);&lt;br /&gt;for j=1:length(y)&lt;br /&gt;imageR = [imageR, R(x(j),y(j))];&lt;br /&gt;imageG = [imageG, G(x(j),y(j))];&lt;br /&gt;imageB = [imageB, B(x(j),y(j))];&lt;br /&gt;end&lt;br /&gt;mean_imageR(i,:) = mean(imageR);&lt;br /&gt;mean_imageG(i,:) = mean(imageG);&lt;br /&gt;mean_imageB(i,:) = mean(imageB);&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;mean_imageR_training = mean(mean_imageR(1:5));&lt;br /&gt;mean_imageG_training = mean(mean_imageG(1:5));&lt;br /&gt;mean_imageB_training = mean(mean_imageB(1:5));&lt;br /&gt;&lt;br /&gt;M=[mean_area,mean_imageR_training,mean_imageG_training,mean_imageB_training];&lt;br /&gt;&lt;br /&gt;// Area computation for test set&lt;br /&gt;image2 = 1-gray_imread('bwclorets2.bmp');&lt;br /&gt;[L, m] = bwlabel(image2);&lt;br /&gt;area2 = [];&lt;br /&gt;for i = 1:m&lt;br /&gt;area2(i) = sum(i==L);&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;// Mean Distance&lt;br /&gt;D = [];&lt;br /&gt;X = [];&lt;br /&gt;for i=6:10&lt;br /&gt;X=[area(i-5),mean_imageR(i),mean_imageG(i),mean_imageB(i)];&lt;br /&gt;&lt;br /&gt;d = X-M;&lt;br /&gt;D = [D, sqrt(d*d')];&lt;br /&gt;&lt;br /&gt;end&lt;/span&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/8940726446323633872-2769060770191947794?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/2769060770191947794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/09/activity-14-pattern-recognition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/2769060770191947794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/2769060770191947794'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/09/activity-14-pattern-recognition.html' title='ACTIVITY 14 - Pattern Recognition'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_mPdMIzolbt8/StMbanhhweI/AAAAAAAAAa4/iLdbnnNGOc8/s72-c/main+image.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-6293526433432194742</id><published>2009-08-07T03:40:00.000-07:00</published><updated>2009-08-07T05:51:29.841-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, grayscale images will be enhanced by manipulating their histogram which is the graylevel probabilit function or PDF when normalized. Histogram can be modified by having the cumulative distribution function (CDF) of the image and a desired CDF. The image was modified by backprojecting the grayscale values of the desired CDF.&lt;br /&gt;&lt;br /&gt;A grayscale image with poor contrast was downloaded from the internet. Then the grayscale histogram of the image was obtained using &lt;span style="font-style: italic;"&gt;Scilab&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;grays = gray_ imread('gray_image.jpg'); //read from grayscale file&lt;br /&gt;&lt;br /&gt;//compute and plot the histogram&lt;br /&gt;j=1;&lt;br /&gt;pix = [];&lt;br /&gt;for i = 0:255&lt;br /&gt;[x,y]=find(grays==i);&lt;br /&gt;pix(j)=length(x);&lt;br /&gt;j=j+1;&lt;br /&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnwG0KEWdZI/AAAAAAAAAT4/2G1iJkfEAao/s1600-h/gray.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 240px; height: 291px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnwG0KEWdZI/AAAAAAAAAT4/2G1iJkfEAao/s320/gray.bmp" alt="" id="BLOGGER_PHOTO_ID_5367172349044356498" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnwHe1Dsr5I/AAAAAAAAAUA/ykC1-8_xkZM/s1600-h/grayhistogram.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 242px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnwHe1Dsr5I/AAAAAAAAAUA/ykC1-8_xkZM/s320/grayhistogram.jpg" alt="" id="BLOGGER_PHOTO_ID_5367173082138849170" border="0" /&gt;&lt;/a&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;&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;The grayscale image was show above along with its grayscale histogram.  We then determine the CDF of the image from its PDF. The CDF is given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnwIetO1fhI/AAAAAAAAAUI/geYhEzb4NUU/s1600-h/eq.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 163px; height: 63px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnwIetO1fhI/AAAAAAAAAUI/geYhEzb4NUU/s320/eq.jpg" alt="" id="BLOGGER_PHOTO_ID_5367174179549707794" border="0" /&gt;&lt;/a&gt;where &lt;span style="font-style: italic;"&gt;p1(r)&lt;/span&gt; is the PDF of the image. The CDF of the grayscale image above was shown at the left side below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnwKln9LMEI/AAAAAAAAAUg/XvCRVd0MlJ4/s1600-h/cdfgray.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 290px; height: 220px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnwKln9LMEI/AAAAAAAAAUg/XvCRVd0MlJ4/s320/cdfgray.jpg" alt="" id="BLOGGER_PHOTO_ID_5367176497415794754" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnwKvS12mCI/AAAAAAAAAUo/n1lNPhfPcIQ/s1600-h/straight+lineplot.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 283px; height: 214px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnwKvS12mCI/AAAAAAAAAUo/n1lNPhfPcIQ/s320/straight+lineplot.jpg" alt="" id="BLOGGER_PHOTO_ID_5367176663546632226" border="0" /&gt;&lt;/a&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;We are going to remap the grayscales of the image in a way that the resulting CDF of the reconstructed image will look like our desired CDF. The CDF of a uniform distribution is a straight increasing line. If we wanted our image to have a uniform distribution of gray values, we will use a straight line, shown above right as our desired CDF.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The process of backprojection was illustrated below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnwLb6IDR7I/AAAAAAAAAUw/PTkYZp5oddM/s1600-h/cdfg.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 133px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnwLb6IDR7I/AAAAAAAAAUw/PTkYZp5oddM/s320/cdfg.jpg" alt="" id="BLOGGER_PHOTO_ID_5367177430006187954" border="0" /&gt;&lt;/a&gt;Each pixel value has a CDF value. This value was traced in the desired CDF. The pixel value will then be replaced by the new pixel value in the desired CDF.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;b = pix;&lt;br /&gt;c = cumsum(b);&lt;br /&gt;f = c/max(c);&lt;br /&gt;x = 0:255;&lt;br /&gt;&lt;br /&gt;imsize = size(grays);&lt;br /&gt;dCDF = x;&lt;br /&gt;&lt;br /&gt;for i = 1:imsize(1)&lt;br /&gt;for j = 1:imsize(2)&lt;br /&gt;ind= find(x == grays(i, j));&lt;br /&gt;grays(i, j) = f(index);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The resulting image was shown below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwN_shS1TI/AAAAAAAAAU4/xL5VGf9H_IY/s1600-h/linerecon.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 240px; height: 291px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwN_shS1TI/AAAAAAAAAU4/xL5VGf9H_IY/s320/linerecon.bmp" alt="" id="BLOGGER_PHOTO_ID_5367180243852514610" border="0" /&gt;&lt;/a&gt;The transformed image shows a significant increase in contrast. This image is now called a histogram equalized image.To have more idea about the image, we displayed its grayscale histogram and its CDF.&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwOec-vXHI/AAAAAAAAAVQ/EHGjcjG1fWs/s1600-h/linerecon+histo.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 290px; height: 220px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwOec-vXHI/AAAAAAAAAVQ/EHGjcjG1fWs/s320/linerecon+histo.jpg" alt="" id="BLOGGER_PHOTO_ID_5367180772256996466" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwOZMM40uI/AAAAAAAAAVI/krZGN8yVCGc/s1600-h/linereconcdf.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 285px; height: 216px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwOZMM40uI/AAAAAAAAAVI/krZGN8yVCGc/s320/linereconcdf.jpg" alt="" id="BLOGGER_PHOTO_ID_5367180681853588194" border="0" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Compared with the original histogram, the histogram of the transformed image showed a more uniform distribution of grayvalues. As with our goal, the CDF of transformed image looked like just the same as the desired CDF.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;We have manipulated the histogram of a grayscale image with the use of a linear desired CDF. However, the human eye has a nonlinear reponse. So we can mimic the human eye response by using a nonlinear CDF. We can use a &lt;span style="font-style: italic;"&gt;tanh &lt;/span&gt;function as our desired CDF which is nonlinear. Its plot was shown below.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;x = 0:255;&lt;br /&gt;tanhf = tanh(16.*(x-128)./255);&lt;br /&gt;tanhf = (tanhf - min(tanh))./2;&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwQGN3IkAI/AAAAAAAAAVY/9o2wZpaW4cA/s1600-h/tanchplot.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 242px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwQGN3IkAI/AAAAAAAAAVY/9o2wZpaW4cA/s320/tanchplot.jpg" alt="" id="BLOGGER_PHOTO_ID_5367182554904956930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Again, the backprojection was done. The CDF value of the pixel value was traced along the CDF value of the desired CDF. The pixel value in the desired CDF will be the new pixel value.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;b = pix;&lt;br /&gt;c = cumsum(b);&lt;br /&gt;f = c/max(c);&lt;br /&gt;x = 0:255;&lt;br /&gt;&lt;br /&gt;imsize = size(grays);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;for i = 1:imsize(1)&lt;br /&gt;for j = 1:imsize(2)&lt;br /&gt;ind = find(x == grays(i, j));&lt;br /&gt;pixel1 = f(index);&lt;br /&gt;pixel2 = find(tanhf&lt;= pixel1); grays(i, j) = (pixel2(max(pixel2)));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The transformed image using a non-linear CDF was shown below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwRetReSiI/AAAAAAAAAVg/p0LmjSpdH1I/s1600-h/tanchrecon.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 240px; height: 291px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwRetReSiI/AAAAAAAAAVg/p0LmjSpdH1I/s320/tanchrecon.bmp" alt="" id="BLOGGER_PHOTO_ID_5367184075165420066" border="0" /&gt;&lt;/a&gt;Clearly, the transformed image is not as good as the image transformed using linear CDF. The image becomes darker with very poor contrast. We display its grayscale histogram and its CDF.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnwR_O-dyNI/AAAAAAAAAVw/82mAixHK1kI/s1600-h/cdftanh.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 286px; height: 216px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnwR_O-dyNI/AAAAAAAAAVw/82mAixHK1kI/s320/cdftanh.jpg" alt="" id="BLOGGER_PHOTO_ID_5367184633968314578" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwR3mMOrAI/AAAAAAAAAVo/NpeDgDvtkfk/s1600-h/histotanh.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 290px; height: 220px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwR3mMOrAI/AAAAAAAAAVo/NpeDgDvtkfk/s320/histotanh.jpg" alt="" id="BLOGGER_PHOTO_ID_5367184502761106434" border="0" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We can see from the grayscale histogram the distribution of gray values at a certain region at the center. The CDF shows that we were able to transformed the grayscale image base from the desired CDF. However, we were not able to enhance the contrast of the gray image.&lt;br /&gt;&lt;br /&gt;I give myself a grade of 9 for this activity. I was able to easily understand the backprojection of pixels however, I had a hard time implementing it in a code. Also, I was able to show the effect of having a linear and non-linear CDF desirable for transforming a grayscale image. In this activity, I learned how to qualify an image with just looking on its grayscale histogram. The more uniform the distribution of the grayscale values, the better the contrast of the grayscale image. I acknowledged the help of Gilbert, who tirelessly helped me debug my code and waited for me until I gathered all my results.&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/8940726446323633872-6293526433432194742?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/6293526433432194742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-4-enhancement-by-histogram.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/6293526433432194742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/6293526433432194742'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-4-enhancement-by-histogram.html' title='ACTIVITY 4 - Enhancement by Histogram Manipulation'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_mPdMIzolbt8/SnwG0KEWdZI/AAAAAAAAAT4/2G1iJkfEAao/s72-c/gray.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-9222838348796378239</id><published>2009-08-06T02:19:00.007-07:00</published><updated>2009-08-07T05:54:01.288-07:00</updated><title type='text'>ACTIVITY 12 - Color Image Segmentation</title><content type='html'>&lt;div style="text-align: justify;"&gt;In this activity, we are going to pick out a region of interest from the rest of the image through image segmentation.&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;A digital image of 3D objects, shown below, was utilized in this activity. Different brightly colored candies are shown in the image.&lt;/div&gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvCNrzMc7I/AAAAAAAAAQw/2i4Tz1XGJ30/s320/candy.jpg" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" alt="" id="BLOGGER_PHOTO_ID_5367096921293616050" border="0" /&gt;&lt;div style="text-align: justify;"&gt;We cropped a monochromatic region of interest in the scene. In this case, we wanted the blue candies to be our region of interest.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvCSLcIpzI/AAAAAAAAAQ4/nDYEfqQJ5qA/s320/patch.JPG" alt="" id="BLOGGER_PHOTO_ID_5367096998506309426" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 34px; height: 14px;" border="0" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;We notice that these objects found in the image, as well as the cropped image have shading variations which is inherent in 3D objects. To separate brightness and chromaticity (pure color) information, it is better to represent the color space by the &lt;b&gt;&lt;i&gt;normalized chromaticity coordinates&lt;/i&gt;&lt;/b&gt; or &lt;b&gt;NCC&lt;/b&gt;. The normalized chromaticity coordinates can be obtained by dividing each pixel from each channel by the summation of the pixel corresponding on each channel.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);font-family:Georgia;" &gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvFWgj4Y5I/AAAAAAAAARA/a5KwhxdQgrg/s320/eq.bmp" alt="" id="BLOGGER_PHOTO_ID_5367100371430302610" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 315px; height: 63px;" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;This was implemented by the code below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;image =imread('candy.jpg');&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;patch = imread('patch.jpg');&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;r = image(:,:,1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;g = image(:,:,2);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;b = image(:,:,3);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;rp = patch(:,:,1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;gp = patch(:,:,2);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;bp = patch(:,:,3);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;R = r./(r+g+b);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;G = g./(r+g+b); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;B = b./(r+g+b);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;Rp = rp./(rp+gp+bp);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;Gp = gp./(rp+gp+bp);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;Bp = bp./(rp+gp+bp);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Parametric Segmentation&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The Gaussian PDF in the r  values was derived using the equation&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvIDJ_IBVI/AAAAAAAAARI/-KRx2s9P_LI/s320/eq1.bmp" alt="" id="BLOGGER_PHOTO_ID_5367103337487926610" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 258px; height: 78px;" border="0" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;where &lt;i&gt;sigma &lt;/i&gt;is the standard deviation and &lt;i&gt;mu &lt;/i&gt;is the average of the normalized chromaticity coordinate in red of the patch image. The same equation was used for g values.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;Rmu = mean(Rp);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;Gmu = mean(Gp);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;Rsigma = stdev(Rp);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;Gsigma = stdev(Gp);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;pr = (1/(Rsigma*sqrt(2*%pi)))*exp(-((r-Rmu).^2)/(2*(Rsigma)^2));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;pg = (1/(Gsigma*sqrt(2*%pi)))*exp(-((g-Gmu).^2)/(2*(Gsigma)^2));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Then, the joint probability was taken as the product of &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;rho(r)&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; and &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;rho(g)&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;product = round(pr.*pg);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The resulting image was shown below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvJ3wXmSjI/AAAAAAAAARQ/LXALAQOeu_A/s320/parametric.bmp" alt="" id="BLOGGER_PHOTO_ID_5367105340655946290" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" border="0" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Non-Parametric Segmentation&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The 2D histogram of the ROI was obtained using the give code below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;BINS = 256;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;rint = round( Rp*(BINS-1) + 1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;gint = round (Gp*(BINS-1) + 1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;colors = gint(:) + (rint(:)-1)*BINS;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;hist = zeros(BINS,BINS);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;for row = 1:BINS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;  for col = 1:(BINS-row+1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;hist(row,col) = length( find(colors==( ((col + (row-1)*BINS)))));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;  end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;scf(1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;mesh(hist);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;div style="text-align: center; text-decoration: underline;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);font-size:16px;" &gt;&lt;img src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvLBJi0V8I/AAAAAAAAARg/-RqOhXRd0hU/s320/mesh.bmp" alt="" id="BLOGGER_PHOTO_ID_5367106601544341442" style="margin: 0px 10px 10px 0px; float: left; cursor: pointer; width: 320px; height: 242px;" border="0" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;img src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvLIDozrVI/AAAAAAAAARo/Z48KP-8GvlA/s320/chrome.bmp" alt="" id="BLOGGER_PHOTO_ID_5367106720217935186" style="margin: 0px 0px 10px 10px; float: right; cursor: pointer; width: 238px; height: 207px;" border="0" /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvJ3wXmSjI/AAAAAAAAARQ/LXALAQOeu_A/s1600-h/parametric.bmp"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);font-size:16px;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;br /&gt;To test the correctness of the histogram, we compare the location of the peaks with the rg chromaticity diagram (at the right). Clearly, we can see that the histogram of the ROI peaks at the are corresponds to the blue color in the rg chromaticity diagram. This histogram willl be important in segmenting the image using histogram bakcprojection.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This histogram backprojection is similar to what has done in Activity 4 excepth that in this case, the histogram is in 2D. Backprojection was done by replacing the value of the pixel location by its histogram value in chromaticity space. This was implemented by the code below.&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 class="Apple-style-span"  style="font-size:85%;"&gt;rib = R*255;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;gib = G*255;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;[a, b] = size(image);&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;np = zeros(a, b);&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;for i = 1:a&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;for j = 1:b&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;c = round(rib(i, j)) + 1;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;d = round(gib(i, j)) + 1;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;np(i, j) = hist(c, d);&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;scf(2);&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;imshow(np);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The resulting image was shown below.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvNDUpkcfI/AAAAAAAAARw/fFfNkG1gW0I/s320/non-parametric.bmp" alt="" id="BLOGGER_PHOTO_ID_5367108837908443634" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" border="0" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;By implementing two different segmentation techniques, different parts of the region of interest was segmented. Parametric segmentation enables us to segment the outer part of the blue candies while non-parametric segmentation enables us to segment the inner body of the blue candies. The non-parametric segmentation favors in segmenting the region of interest although not all ROI were segmented.&lt;br /&gt;&lt;br /&gt;I give myself a grade of 10 for finishing this activity. I was able to implement the parametric and non-parametric segmentation on an image composed of an ensemble of colored objects.&lt;br /&gt;&lt;br /&gt;I would not have finished my blogs without the overwhelming help of Gilbert and Rommel. Gilbert was the one who patiently discussed every activity with me. He help me a lot in understanding previous activities. Rommel, after finishing his blog was able to lend me his laptop. It was a big help considering that I did not work on my blog in a computer shop for almost 4 hours.&lt;br /&gt;&lt;br /&gt;:-) I acknowledged all my classmates who made me feel their concerns for me.  I want to extend my deepest gratitude for all of you guys.&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/8940726446323633872-9222838348796378239?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/9222838348796378239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/9222838348796378239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/9222838348796378239'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-12-color-image-segmentation.html' title='ACTIVITY 12 - Color Image Segmentation'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_mPdMIzolbt8/SnvCNrzMc7I/AAAAAAAAAQw/2i4Tz1XGJ30/s72-c/candy.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-9056848356499964138</id><published>2009-08-06T02:19:00.005-07:00</published><updated>2009-08-07T05:52:09.181-07:00</updated><title type='text'>ACTIVITY 11 - Color Image Processing</title><content type='html'>&lt;div style="text-align: justify;"&gt;Primarily, the objective of this activity is to be able to enhanced an image that is wrongly white-balanced. Images of an ensemble of colorful objects were captured using a digital camera with different white balance settings.&lt;br /&gt;&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/_mPdMIzolbt8/SnukQEep_vI/AAAAAAAAAPY/xghEFDfGSCg/s1600-h/DSCF3116.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnukQEep_vI/AAAAAAAAAPY/xghEFDfGSCg/s320/DSCF3116.JPG" alt="" id="BLOGGER_PHOTO_ID_5367063976929263346" border="0" /&gt;&lt;/a&gt;White Balancing Setting: &lt;span style="font-style: italic;"&gt;Fire&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnukgxQszPI/AAAAAAAAAPg/rbIeF463SIE/s1600-h/DSCF3117.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnukgxQszPI/AAAAAAAAAPg/rbIeF463SIE/s320/DSCF3117.JPG" alt="" id="BLOGGER_PHOTO_ID_5367064263828229362" border="0" /&gt;&lt;/a&gt;White Balancing Setting: &lt;span style="font-style: italic;"&gt;Shade&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnukpoSwhBI/AAAAAAAAAPo/WOIQKzrjiZ0/s1600-h/DSCF3118.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnukpoSwhBI/AAAAAAAAAPo/WOIQKzrjiZ0/s320/DSCF3118.JPG" alt="" id="BLOGGER_PHOTO_ID_5367064416039765010" border="0" /&gt;&lt;/a&gt;White Balancing Setting: &lt;span style="font-style: italic;"&gt;Fluorescent-1&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnukwuKI9cI/AAAAAAAAAPw/5Lajbj2pKWI/s1600-h/DSCF3119.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnukwuKI9cI/AAAAAAAAAPw/5Lajbj2pKWI/s320/DSCF3119.JPG" alt="" id="BLOGGER_PHOTO_ID_5367064537873315266" border="0" /&gt;&lt;/a&gt;White Balancing Setting: &lt;span style="font-style: italic;"&gt;Fluorescent-2&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/Snuk2m3Bq7I/AAAAAAAAAP4/FlCbVr7QX3E/s1600-h/DSCF3120.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/Snuk2m3Bq7I/AAAAAAAAAP4/FlCbVr7QX3E/s320/DSCF3120.JPG" alt="" id="BLOGGER_PHOTO_ID_5367064638993312690" border="0" /&gt;&lt;/a&gt;White Balancing Setting: &lt;span style="font-style: italic;"&gt;Fluorescent-3&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/Snuk8q98FdI/AAAAAAAAAQA/Xb0IDTeyrqo/s1600-h/DSCF3121.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/Snuk8q98FdI/AAAAAAAAAQA/Xb0IDTeyrqo/s320/DSCF3121.JPG" alt="" id="BLOGGER_PHOTO_ID_5367064743175263698" border="0" /&gt;&lt;/a&gt;White Balancing Setting: &lt;span style="font-style: italic;"&gt;Incandescent&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Different white balancing settings resulted to different qualities of images. The &lt;span style="font-style: italic;"&gt;Fire &lt;/span&gt;and &lt;span style="font-style: italic;"&gt;Shade&lt;/span&gt; are almost the same resulting to a slightly darker image than what was taken. &lt;span style="font-style: italic;"&gt;Fluorescent-1&lt;/span&gt; settings resulted to a brownish image. &lt;span style="font-style: italic;"&gt;Fluorescent-2 &lt;/span&gt;and &lt;span style="font-style: italic;"&gt;Fluorescent-3&lt;/span&gt; produced shades of blue images. The &lt;span style="font-style: italic;"&gt;Incandescent&lt;/span&gt; setting produced a more bluish image. Obviously, this image is wrongly balanced.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;White Patch Algorithm&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Using the image captured by the camera in &lt;span style="font-style: italic;"&gt;Incandescent&lt;/span&gt; setting, the White Patch algorithm was implemented. First, a patch of an white object in real world which appears differently in the image was cropped.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnurYAHMgfI/AAAAAAAAAQY/figF2kWNeos/s1600-h/wpatch.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 22px; height: 45px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnurYAHMgfI/AAAAAAAAAQY/figF2kWNeos/s320/wpatch.JPG" alt="" id="BLOGGER_PHOTO_ID_5367071809777467890" border="0" /&gt;&lt;/a&gt;The RGB values of pixels belonging to this white object: Rw, Gw, and Bw was taken. And then, all pixels in the red layer, green layer and blue layer of the image was divided by their corresponding Rw, Gw and Bw. This was implemented with the code below.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;image = imread('filename.jpg');&lt;br /&gt;w = imread('wpatch.jpg');&lt;br /&gt;&lt;br /&gt;rw = sum(w(:,:,1))/length(w(:,:,1));&lt;br /&gt;gw = sum(w(:,:,2))/length(w(:,:,2));&lt;br /&gt;bw = sum(w(:,:,3))/length(w(:,:,3));&lt;br /&gt;&lt;br /&gt;nr = image(:,:,1)/rw;&lt;br /&gt;ng = image(:,:,2)/gw;&lt;br /&gt;nb = image(:,:,3)/bw;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The resulting image was then displayed as shown below.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnupNFuBROI/AAAAAAAAAQI/qO7U4IjCYec/s1600-h/reconincan.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 268px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnupNFuBROI/AAAAAAAAAQI/qO7U4IjCYec/s320/reconincan.bmp" alt="" id="BLOGGER_PHOTO_ID_5367069423280669922" border="0" /&gt;&lt;/a&gt;Compared with the wrongly white balanced image, the resulting image is less brighter as the bluish color decreases. White hues that appear bluish in the wrongly balanced image now appear more white. The White Patch algorithm assumes that the maximum response of the image is caused by the white patch. Thus, by dividing each channels of the image with the constants determined from the white patch we are essentially bringing back true colors of the image.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Gray World Algorithm&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The Gray World algorithm was also implemented on the image captured using &lt;span style="font-style: italic;"&gt;Incandescent&lt;/span&gt; setting. For this algorithm, the R, G and B layers of the unbalanced image were averaged and let to be Rw, Gw, and Bw, respectively. Then the original R, G and B layer values were divided by their corresponding constant.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;image = imread('filename.jpg');&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;rw = sum(image(:,:,1))/length(image(:,:,1));&lt;br /&gt;gw = sum(image(:,:,2))/length(image(:,:,2));&lt;br /&gt;bw = sum(image(:,:,3))/length(image(:,:,3));&lt;br /&gt;&lt;br /&gt;nr = image(:,:,1)/rw;&lt;br /&gt;ng = image(:,:,2)/gw;&lt;br /&gt;nb = image(:,:,3)/bw;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The resulting image was displayed below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/Snurt_s8RKI/AAAAAAAAAQo/K75a7cVDWqA/s1600-h/reconincangray.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 268px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/Snurt_s8RKI/AAAAAAAAAQo/K75a7cVDWqA/s320/reconincangray.bmp" alt="" id="BLOGGER_PHOTO_ID_5367072187624473762" border="0" /&gt;&lt;/a&gt;The image looks old after the implementation of Gray World algorithm. The blue hues also lessen and the white hues look grayish. The Gray World algorithm assumes that the average of the colors on each channels of the image taken in normal light is gray. Using the &lt;span style="font-style: italic;"&gt;Incandescent&lt;/span&gt; setting in capturing the image, we have disrupted the Gray World assumptions. We force the Gray World assumption again by dividing each channel by their average. Thus, we are reaquiring the true color of the image in real world.&lt;br /&gt;&lt;br /&gt;Doing both algorithm with the other images will result to the same image as shown above for white patch and gray world algorithm. Implementing both algorithms is reacquiring the true colors of the image based on certain assumptions. However, it turns out that the White Patch is better than the Gray World algorithm.&lt;br /&gt;------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/div&gt;In this part of the activity, the white patch and gray world algorithm were implemented on an image of objects with the same hue (in this case, green).&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnwWoaaFLnI/AAAAAAAAAV4/svfIvWmSOFU/s1600-h/greens.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnwWoaaFLnI/AAAAAAAAAV4/svfIvWmSOFU/s320/greens.JPG" alt="" id="BLOGGER_PHOTO_ID_5367189739458080370" border="0" /&gt;&lt;/a&gt;The image above was obviously wrongly white balanced. After implementing the two algorithm as in above procedure, the resulting images were 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://3.bp.blogspot.com/_mPdMIzolbt8/SnwW26HJqWI/AAAAAAAAAWI/_ppEac-6qKw/s1600-h/recongreen.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwW26HJqWI/AAAAAAAAAWI/_ppEac-6qKw/s320/recongreen.jpg" alt="" id="BLOGGER_PHOTO_ID_5367189988486785378" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;White Patch Algorithm&lt;/span&gt;&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/_mPdMIzolbt8/SnwW2wKBgnI/AAAAAAAAAWA/qEe-KWyY0zY/s1600-h/recongreengray.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnwW2wKBgnI/AAAAAAAAAWA/qEe-KWyY0zY/s320/recongreengray.jpg" alt="" id="BLOGGER_PHOTO_ID_5367189985814479474" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;Gray World Algorithm&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The white patch algorithm uses the white wall at the background of the image. Clearly, the original color was reacquired using white patch algorithm. Gray world algorithm allows the removal of the bluish hue in the image. However, the image becomes slightly reddish. This is because the unbalanced image mainly composed of green hues.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;For this activity, I will get 10/10. By producing images from each algorithm, I was able to understand how the white patch and gray world algorithm assumes the color of the real world. Applying these algorithm on an image captured with colored lighting (&lt;span style="font-style: italic;"&gt;i.e. Incandescent &lt;/span&gt;white balancing setting ) will reacquire the true colors of the image. However, after finishing the activity, it turns out that for the images used, the White Patch algorithm assumes a better color of the real world. I acknowledged Gilbert for discussing the activity with my and for lending me pictures he captured.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&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/8940726446323633872-9056848356499964138?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/9056848356499964138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/9056848356499964138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/9056848356499964138'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-11-color-image-processing.html' title='ACTIVITY 11 - Color Image Processing'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_mPdMIzolbt8/SnukQEep_vI/AAAAAAAAAPY/xghEFDfGSCg/s72-c/DSCF3116.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-7808054281662169741</id><published>2009-08-06T02:19:00.003-07:00</published><updated>2009-08-07T05:57:23.319-07:00</updated><title type='text'>ACTIVITY 10 - Processing Text</title><content type='html'>&lt;div style="text-align: justify;"&gt;This activity aims to extract handwritten text from an imaged document with lines. In order for the handwriting to be recognized, individual letters must be extracted. We will again use all the image processing techniques we have learned.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The image below will be utilized for this activity.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuHYOws7NI/AAAAAAAAAJg/VF3eAWJGqek/s1600-h/Untitled_0001.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 258px; height: 320px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuHYOws7NI/AAAAAAAAAJg/VF3eAWJGqek/s320/Untitled_0001.jpg" alt="" id="BLOGGER_PHOTO_ID_5367032231291055314" border="0" /&gt;&lt;/a&gt;A portion of the image was cropped with handwritten text together with lines in the form.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuHrMr2GAI/AAAAAAAAAJo/NCjo7yQXIss/s1600-h/text.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 222px; height: 87px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuHrMr2GAI/AAAAAAAAAJo/NCjo7yQXIss/s320/text.bmp" alt="" id="BLOGGER_PHOTO_ID_5367032557151328258" border="0" /&gt;&lt;/a&gt;We can see from the horizontal lines that the image is tilted. With the use of &lt;span style="font-style: italic;"&gt;mogrify &lt;/span&gt;function which is built-in function is &lt;span style="font-style: italic;"&gt;Scilab&lt;/span&gt;, the image was rotated. The image below shows the rotated image.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuIGZLr9rI/AAAAAAAAAJw/_3k2Tgyf6mc/s1600-h/rot.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 223px; height: 91px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuIGZLr9rI/AAAAAAAAAJw/_3k2Tgyf6mc/s320/rot.bmp" alt="" id="BLOGGER_PHOTO_ID_5367033024362575538" border="0" /&gt;&lt;/a&gt;Now that we have rotated the image, we will have to remove the horizontal lines from the form using image processing techniques. First we have to display the FT of the image in logarithmic form. In doing this we will have the idea where the frequencies of the horizontal lines lie, just like in the previous activities. We will design the filtering mask by blocking the frequencies the correspond to the unwanted horizontal pattern.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuIrASpbcI/AAAAAAAAAJ4/IjaFoDBjuOM/s1600-h/filtertxt.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 223px; height: 91px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuIrASpbcI/AAAAAAAAAJ4/IjaFoDBjuOM/s320/filtertxt.bmp" alt="" id="BLOGGER_PHOTO_ID_5367033653336042946" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuIvkTiuoI/AAAAAAAAAKA/V2DHXyQqFwc/s1600-h/filterq.bmp"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 223px; height: 91px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuIvkTiuoI/AAAAAAAAAKA/V2DHXyQqFwc/s320/filterq.bmp" alt="" id="BLOGGER_PHOTO_ID_5367033731722951298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;The image at the left is the FT of the image in logarithmic form and the image at the right shows the filtering image. We can see on the filter how we are able to block the frequencies of the horizontal line. The resulting image is shown below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuJpv1Rz6I/AAAAAAAAAKI/q4iers3byjc/s1600-h/recon.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 223px; height: 91px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuJpv1Rz6I/AAAAAAAAAKI/q4iers3byjc/s320/recon.bmp" alt="" id="BLOGGER_PHOTO_ID_5367034731249651618" border="0" /&gt;&lt;/a&gt;This image resulted from the filtering technique applied to the cropped portion of the original image. After the removal of the horizontal lines, the image was then inverted. We notice that the background becomes black and the texts become white. This was done in able for us to use the morphological operations we have learned. We recall that these operations applies only to the "white" portion of the image which is our object.&lt;br /&gt;&lt;br /&gt;But before implementing morphological operation, we have to binarize the image first. We look for the best threshold such that the object is well separated with the background. And then, the &lt;span style="font-style: italic;"&gt;dilate&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;erode&lt;/span&gt; functions were used. The combination of the two operations were done until the best extraction of the texts was produced.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuMIFKTQ_I/AAAAAAAAAKQ/T6P4hIMKLC4/s1600-h/reconfinal.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 223px; height: 91px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuMIFKTQ_I/AAAAAAAAAKQ/T6P4hIMKLC4/s320/reconfinal.bmp" alt="" id="BLOGGER_PHOTO_ID_5367037451394302962" border="0" /&gt;&lt;/a&gt;The image above shows the final extraction of the text image. From this image, we can see the significant separation of each text in the word &lt;span style="font-style: italic;"&gt;"remote control"&lt;/span&gt;. The rest of the words, although the letters are being separated from each other somehow, are still unrecognizable. From the beginning, we have a very poor image. We can compare the separation of the letters by counting the number of blobs produced using the &lt;span style="font-style: italic;"&gt;bwlabel &lt;/span&gt;function. Supposedly, there are &lt;span style="font-weight: bold;"&gt;46 &lt;/span&gt;letters in the cropped portion of the image. The number of blobs produced after doing image processing techniques was found to be &lt;span style="font-weight: bold;"&gt;31&lt;/span&gt;. Thus, the image processing techniques applied to the image has a significant effects on the separation of each text.&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;In this part, we will use the template matching technique we have learned in Activity 6.C to find the instances of the word "&lt;span style="font-style: italic;font-family:arial;" &gt;DESCRIPTION&lt;/span&gt;" in the whole image.&lt;br /&gt;&lt;br /&gt;First, we binarize the whole image and find the best threshold. Then we cropped the word &lt;span style="font-style: italic;font-family:arial;" &gt;DESCRIPTION&lt;/span&gt; from the image and pasted it on a black background with the same size as the image which will be our template.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuPYE09qoI/AAAAAAAAAKY/95wxo62ZOhE/s1600-h/bwtext.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 258px; height: 320px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuPYE09qoI/AAAAAAAAAKY/95wxo62ZOhE/s320/bwtext.bmp" alt="" id="BLOGGER_PHOTO_ID_5367041024717597314" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuPzPAiNjI/AAAAAAAAAKg/4RpXXZt8Hqw/s1600-h/descriptiontxt.bmp"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 258px; height: 320px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuPzPAiNjI/AAAAAAAAAKg/4RpXXZt8Hqw/s320/descriptiontxt.bmp" alt="" id="BLOGGER_PHOTO_ID_5367041491306952242" border="0" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And then the correlation technique was applied. The FT of the template was multiplied with the conjugate of the FT of the image. Then the &lt;span style="font-style: italic;"&gt;fftshift &lt;/span&gt;of the product was taken.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuQZUgxuAI/AAAAAAAAAKo/s0MHAAyMsFw/s1600-h/jologs1.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 258px; height: 320px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuQZUgxuAI/AAAAAAAAAKo/s0MHAAyMsFw/s320/jologs1.bmp" alt="" id="BLOGGER_PHOTO_ID_5367042145619392514" border="0" /&gt;&lt;/a&gt;The image above shows three instances of the word &lt;span style="font-style: italic;font-family:arial;" &gt;DESCRIPTION&lt;/span&gt; in the image which is what we have expected. We can see these instances from the bright spots where the correlation is high.&lt;br /&gt;&lt;br /&gt;I want to give myself a grade of 9 in this activity. Although I have used the image processing techniques I have learned, I was not able to come up with a more enhanced text image. Again, Gilbert was acknowledged for this activity.&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/8940726446323633872-7808054281662169741?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/7808054281662169741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-10-processing-text.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/7808054281662169741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/7808054281662169741'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-10-processing-text.html' title='ACTIVITY 10 - Processing Text'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_mPdMIzolbt8/SnuHYOws7NI/AAAAAAAAAJg/VF3eAWJGqek/s72-c/Untitled_0001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-5877317861299978590</id><published>2009-08-06T02:19:00.001-07:00</published><updated>2009-08-07T05:44:22.386-07:00</updated><title type='text'>ACTIVITY 9 - Binary Operations</title><content type='html'>&lt;div style="text-align: justify;"&gt;This activity is an integration of everything we have learned to determine the best estimate area in pixel count of simulated "cells". In addition, we are going to use more morphological operators such as the closing and opening operator for enhancing and analyzing binarized images.&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuRmeIMelI/AAAAAAAAAKw/f4p6C8f5xoM/s1600-h/Circles001.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 264px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuRmeIMelI/AAAAAAAAAKw/f4p6C8f5xoM/s320/Circles001.jpg" alt="" id="BLOGGER_PHOTO_ID_5367043471050570322" border="0"&gt;&lt;/a&gt;&lt;div style="text-align: justify;"&gt;The image above which is an image of scattered punched paper digitized using a flatbed scanner was utilized in this activity. We imagine that the circles are imaged cells on a slide. Our primary goal: estimate the area of &lt;font style="font-weight: bold;"&gt;ONE &lt;/font&gt;"cell".&lt;br /&gt;&lt;br /&gt;We begin the task by dividing the whole image into 256 x 256 subimages. Each subimage was opened in grayscale. A sample subimage was shown below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuR40kk4mI/AAAAAAAAAK4/EtsHUMZso4M/s1600-h/C1_02.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 256px; height: 256px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuR40kk4mI/AAAAAAAAAK4/EtsHUMZso4M/s320/C1_02.bmp" alt="" id="BLOGGER_PHOTO_ID_5367043786312835682" border="0"&gt;&lt;/a&gt;The threshold of the subimage was obtained from its histogram. The threshold is important in order to separate the background from the cell, which is our region of interest (ROI). Then the subimage was binarize using the &lt;font style="font-style: italic;"&gt;Scilab &lt;/font&gt;function &lt;font style="font-style: italic;"&gt;im2bw&lt;/font&gt;.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuTBKQcI0I/AAAAAAAAALI/d8OFGQHlJmQ/s1600-h/threshold.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 164px; height: 165px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuTBKQcI0I/AAAAAAAAALI/d8OFGQHlJmQ/s320/threshold.bmp" alt="" id="BLOGGER_PHOTO_ID_5367045029084537666" border="0"&gt;&lt;/a&gt;In order to emphasize the separation of ROI from the background, we implemented opening and closing operator using the &lt;font style="font-style: italic;"&gt;dilate &lt;/font&gt;and &lt;font style="font-style: italic;"&gt;erode &lt;/font&gt;functions which are built-in functions in &lt;font style="font-style: italic;"&gt;Scilab&lt;/font&gt;.&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;//opening&lt;br /&gt;image1 = erode(dilate(image));&lt;br /&gt;&lt;/font&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuTUolyKHI/AAAAAAAAALQ/O9vNUIlH_Rc/s1600-h/opening.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 165px; height: 164px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuTUolyKHI/AAAAAAAAALQ/O9vNUIlH_Rc/s320/opening.bmp" alt="" id="BLOGGER_PHOTO_ID_5367045363644639346" border="0"&gt;&lt;/a&gt;Opening operator removes small objects inside the cell.&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;//closing&lt;br /&gt;image2 = dilate(erode(image1));&lt;/font&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuTZqBQ1TI/AAAAAAAAALY/Z5X8LZeW2JU/s1600-h/closing.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 169px; height: 165px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnuTZqBQ1TI/AAAAAAAAALY/Z5X8LZeW2JU/s320/closing.bmp" alt="" id="BLOGGER_PHOTO_ID_5367045449927677234" border="0"&gt;&lt;/a&gt;While closing operator removes small holes on the background.&lt;br /&gt;&lt;br /&gt;After doing morphological operations, we have now a cleaner image of the cells. Then, contiguous blobs are formed within each subimage. The &lt;font style="font-style: italic;"&gt;bwlabel&lt;/font&gt; function was used to label each blob on the subimage. The area or the number of pixels of each blob was measured from each subimage and then tallied.&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;//area computation&lt;br /&gt;[L, n] = bwlabel(image2);&lt;br /&gt;area = [];&lt;br /&gt;for i = 1:n&lt;br /&gt;area(i) = sum(i==L);&lt;br /&gt;end&lt;/font&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuT2GflDiI/AAAAAAAAALg/OQNnKoY2v58/s1600-h/histoplot.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 242px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuT2GflDiI/AAAAAAAAALg/OQNnKoY2v58/s320/histoplot.bmp" alt="" id="BLOGGER_PHOTO_ID_5367045938607361570" border="0"&gt;&lt;/a&gt;From the histogram of the areas, the average of the area was taken  from the range of areas with high occurrences. The calculated mean area was found to be &lt;font style="font-weight: bold;"&gt;526 &lt;/font&gt;pixels with a standard deviation of &lt;font style="font-weight: bold;"&gt;24.67&lt;/font&gt;. In order to verify this calculation, a single "cell" was taken from the whole image, binarized and then summed in order to get the area in pixel.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuUf-f00oI/AAAAAAAAALo/n1382UiRq2o/s1600-h/calibss.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 101px; height: 46px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuUf-f00oI/AAAAAAAAALo/n1382UiRq2o/s320/calibss.jpg" alt="" id="BLOGGER_PHOTO_ID_5367046658015416962" border="0"&gt;&lt;/a&gt;The area of a single cell was measured to be &lt;font style="font-weight: bold;"&gt;535 &lt;/font&gt;pixels. In comparison to the calculated area, a &lt;font style="font-weight: bold;"&gt;1.76%&lt;/font&gt; error was obtained.&lt;br /&gt;&lt;br /&gt;I will give myself a grade of 10/10 for finishing this activity. Aside from obtaining a small percentage error, I understand most part of the activity. I was able to apply image processing and area calculation techniques I have learned in previous activity. I think  that using &lt;span style="font-style: italic;"&gt;bwlabel&lt;/span&gt; function in calculating the area of each blob in a subimage was a clever idea. As always, I want to acknowledged Gilbert in helping me understand the activity.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8940726446323633872-5877317861299978590?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/5877317861299978590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-9-binary-operations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/5877317861299978590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/5877317861299978590'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-9-binary-operations.html' title='ACTIVITY 9 - Binary Operations'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_mPdMIzolbt8/SnuRmeIMelI/AAAAAAAAAKw/f4p6C8f5xoM/s72-c/Circles001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-7319280917986590001</id><published>2009-08-06T02:18:00.003-07:00</published><updated>2009-08-07T05:44:22.389-07:00</updated><title type='text'>ACTIVITY 8 - Morphological Operations</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvZk0rQlLI/AAAAAAAAATw/VP0y7ZyYMT0/s1600-h/allThin.jpg"&gt;&lt;/a&gt;&lt;div style="text-align: justify;"&gt;The goal of this activity is to verify the effect of morphological operations, &lt;b&gt;dilate &lt;/b&gt;and &lt;b&gt;erode &lt;/b&gt;in different shapes using varying structuring element.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Binary image of square (50 x 50), a triangle (base = 50, height = 30), a circle (r = 25), a hollow square (60 x 60, edges are 4 pixels thick) and a plus sign (8 pixels thick and 50 pixels long for each line) were created in &lt;i&gt;MS Paint&lt;/i&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;font class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvWYsts6HI/AAAAAAAAASQ/4nS7Y3saakE/s320/orig_samples.jpg" alt="" id="BLOGGER_PHOTO_ID_5367119100750129266" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 47px;" border="0"&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;To be able to used the dilate and erode, structuring elements are needed. The following structuring elements were utilized for each images created.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;    &lt;b&gt;1&lt;/b&gt;. 4 x 4 ones&lt;/div&gt;&lt;div style="text-align: justify;"&gt;    &lt;b&gt;2&lt;/b&gt;. 2 x 4 ones&lt;/div&gt;&lt;div style="text-align: justify;"&gt;    &lt;b&gt;3&lt;/b&gt;. 4 x 2 ones&lt;/div&gt;&lt;div style="text-align: justify;"&gt;    &lt;b&gt;4&lt;/b&gt;. cross, 5 pixels long and one pixel thick&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The morphological operations were implemented with the use of the built-in function &lt;i&gt;dilate &lt;/i&gt;and &lt;i&gt;erode &lt;/i&gt;in &lt;i&gt;Scilab&lt;/i&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;font class="Apple-style-span" size="small"&gt;A = dilate(image, a);&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The dilation of A by B is denoted by&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;font class="Apple-style-span" size="7"&gt;&lt;font class="Apple-style-span" size="48px"&gt;&lt;font class="Apple-style-span" style="color: rgb(0, 0, 238);" size="16px"&gt;&lt;img src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvTFfR4k4I/AAAAAAAAAR4/xgf1KfVSpYA/s320/eq1.bmp" alt="" id="BLOGGER_PHOTO_ID_5367115472191394690" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 310px; height: 34px;" border="0"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Thus, dilation will result to the expansion or elongation of the image according to the shape of the structuring element.&lt;br /&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;font class="Apple-style-span" size="small"&gt;A1 = erode(image, a);&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The erosion of A by B is denoted by&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;font class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvT7LhhRwI/AAAAAAAAASA/ylxD9qUbmO0/s320/eq1.bmp" alt="" id="BLOGGER_PHOTO_ID_5367116394601203458" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 227px; height: 36px;" border="0"&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Using erosion will reduce the image according to the shape of the structuring element.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;font class="Apple-style-span" size="medium"&gt;B&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;u&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;t&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt; &lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;b&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;e&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;f&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;o&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;r&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;e&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt; &lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;r&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;u&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;n&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;n&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;i&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;n&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt;g&lt;/font&gt;&lt;font class="Apple-style-span" size="medium"&gt; the code, a prediction on what will be the resulting image was done. The following images show the resulting image after the implementation of morphological operations. The resulting images are shown according to the structuring element used (4x4, 2x4, 4x2, cross).&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Square (50 x 50)&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;img src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvWwlkrKeI/AAAAAAAAASY/ToMZjtIxwXA/s320/squareDilate.jpg" alt="" id="BLOGGER_PHOTO_ID_5367119511150078434" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 59px;" border="0"&gt;&lt;div style="text-align: center;"&gt;Dilated&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvWxLuKZKI/AAAAAAAAASg/FQkpIL20BWw/s1600-h/squareErode.jpg"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvWxLuKZKI/AAAAAAAAASg/FQkpIL20BWw/s1600-h/squareErode.jpg" style="text-decoration: none;"&gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvWxLuKZKI/AAAAAAAAASg/FQkpIL20BWw/s320/squareErode.jpg" alt="" id="BLOGGER_PHOTO_ID_5367119521390421154" style="margin: 0px auto 10px; text-align: justify; display: block; cursor: pointer; width: 320px; height: 58px;" border="0"&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;Eroded&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Triangle (base = 50, height = 30)&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvXSsGFVYI/AAAAAAAAASw/Ni61Z38WLMs/s1600-h/triDilate.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvXSsGFVYI/AAAAAAAAASw/Ni61Z38WLMs/s320/triDilate.jpg" alt="" id="BLOGGER_PHOTO_ID_5367120097016370562" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 55px;" border="0"&gt;&lt;/a&gt;Dilated&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvXSYT3ElI/AAAAAAAAASo/vQdPkeKe9Bs/s1600-h/triErode.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvXSYT3ElI/AAAAAAAAASo/vQdPkeKe9Bs/s320/triErode.jpg" alt="" id="BLOGGER_PHOTO_ID_5367120091705446994" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 57px;" border="0"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Eroded&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Circle (r = 25)&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvXfHCaBWI/AAAAAAAAATA/E1JkCtltYm0/s1600-h/circDilate.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvXfHCaBWI/AAAAAAAAATA/E1JkCtltYm0/s320/circDilate.jpg" alt="" id="BLOGGER_PHOTO_ID_5367120310407136610" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 57px;" border="0"&gt;&lt;/a&gt;Dilated&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvXek24H8I/AAAAAAAAAS4/YFlPSTaxkHQ/s1600-h/circErode.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvXek24H8I/AAAAAAAAAS4/YFlPSTaxkHQ/s320/circErode.jpg" alt="" id="BLOGGER_PHOTO_ID_5367120301231972290" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 57px;" border="0"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Eroded&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Hollow Square (60 x60, edges are 4 pixels thick)&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvXwWJf0PI/AAAAAAAAATQ/4uGNIW90S3w/s1600-h/hsquareDilate.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvXwWJf0PI/AAAAAAAAATQ/4uGNIW90S3w/s320/hsquareDilate.jpg" alt="" id="BLOGGER_PHOTO_ID_5367120606521184498" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 57px;" border="0"&gt;&lt;/a&gt;Dilated&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvXwUe-YfI/AAAAAAAAATI/Hs0odTW9uWs/s1600-h/hsqErode.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvXwUe-YfI/AAAAAAAAATI/Hs0odTW9uWs/s320/hsqErode.jpg" alt="" id="BLOGGER_PHOTO_ID_5367120606074397170" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 54px;" border="0"&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Eroded&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Plus Sign (8 pixels thick and 50 pixels long for each line)&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvYHnd6IQI/AAAAAAAAATg/9Mbw0H4ikq4/s1600-h/crossErode.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnvYHnd6IQI/AAAAAAAAATg/9Mbw0H4ikq4/s320/crossErode.jpg" alt="" id="BLOGGER_PHOTO_ID_5367121006307188994" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 58px;" border="0"&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;Dilated&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvYHXRYCEI/AAAAAAAAATY/2jvnyRd6T94/s1600-h/crossErode.jpg"&gt;&lt;img src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnvYHXRYCEI/AAAAAAAAATY/2jvnyRd6T94/s320/crossErode.jpg" alt="" id="BLOGGER_PHOTO_ID_5367121001959655490" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 58px;" border="0"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Eroded&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;From the images, dilation indeed expands the image while erosion reduces the image depending on the structuring element.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;-------------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Other morphological operations, &lt;b&gt;thin &lt;/b&gt;and &lt;b&gt;skel &lt;/b&gt;were explored using &lt;i&gt;Scilab. &lt;/i&gt;The following images resulted after the implementation of these operations on the shapes created in the previous part.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;font class="Apple-style-span" size="small"&gt;&lt;br /&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;font class="Apple-style-span" size="small"&gt;A = thin(image1);&lt;/font&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;font class="Apple-style-span" size="small"&gt;A1 = skel(image1);&lt;/font&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;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvZk0rQlLI/AAAAAAAAATw/VP0y7ZyYMT0/s1600-h/allThin.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnvZk0rQlLI/AAAAAAAAATw/VP0y7ZyYMT0/s320/allThin.jpg" alt="" id="BLOGGER_PHOTO_ID_5367122607580681394" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 46px;" border="0"&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;Thin&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvZko3MWaI/AAAAAAAAATo/qlu_Wkh433A/s1600-h/allSkel.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnvZko3MWaI/AAAAAAAAATo/qlu_Wkh433A/s320/allSkel.jpg" alt="" id="BLOGGER_PHOTO_ID_5367122604409510306" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 50px;" border="0"&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;Skel&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Applying &lt;i&gt;thin &lt;/i&gt;function resulted to thinning of the shapes while skel resulted to random patterns along the shape.&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;br /&gt;I give myself an 8 for this activity. It was Gilbert who taught me how the dilate and erode functions work. I had a hard time predicting on the outcomes of each morphological operation although I made the code with an ease. As I noticed, dilation expanded the image while erosion reduced the image depending on the structuring element being used. The &lt;span style="font-style: italic;"&gt;thin &lt;/span&gt;and &lt;span style="font-style: italic;"&gt;skel&lt;/span&gt; are just other morphological operations that can be used for further image processing techniques.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&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/8940726446323633872-7319280917986590001?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/7319280917986590001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-8-morphological-operations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/7319280917986590001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/7319280917986590001'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-8-morphological-operations.html' title='ACTIVITY 8 - Morphological Operations'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_mPdMIzolbt8/SnvWYsts6HI/AAAAAAAAASQ/4nS7Y3saakE/s72-c/orig_samples.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-4328627245602136200</id><published>2009-08-06T02:18:00.001-07:00</published><updated>2009-08-07T05:56:50.173-07:00</updated><title type='text'>ACTIVITY 7 - Enhancement in the Frequency Domain</title><content type='html'>&lt;div style="text-align: justify;"&gt;The goals of this activity is to be able to remove unwanted repetitive patterns by creating filter masks to block frequencies of the unwanted patterns in the Fourier domain. In doing so, the desired frequencies of the image may be enhanced thus, enhancing the quality of the image at the same time.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Activity 7.A Convolution Theorem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;An binary image of an aperture consisting of two dots (one pixel each) was created using &lt;span style="font-style: italic;"&gt;MS Paint&lt;/span&gt;. Its FT was taken and then displayed.&lt;br /&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://1.bp.blogspot.com/_mPdMIzolbt8/SnuXKuORUrI/AAAAAAAAALw/EuRkwG5rzmA/s1600-h/2dots.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 125px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuXKuORUrI/AAAAAAAAALw/EuRkwG5rzmA/s320/2dots.jpg" alt="" id="BLOGGER_PHOTO_ID_5367049591404450482" border="0" /&gt;&lt;/a&gt;&lt;div style="text-align: justify;"&gt;The FT modulus resulted a sine function along an axis which is symmetric about the center, which is expected. As we know, the FT of a sine function will result to two dirac deltas which will peak at the frequency of the sine function. Conversely, if we take the FT of two dirac deltas represented by two one-pixel point symmetric at the center, a sine function will be obtained with frequency related to the separation of the points.&lt;br /&gt;&lt;br /&gt;Next, the dots were replaced with circles of some varying radius.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuX5KJIK0I/AAAAAAAAAL4/nmfV6U2ee5k/s1600-h/circle.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 126px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuX5KJIK0I/AAAAAAAAAL4/nmfV6U2ee5k/s320/circle.jpg" alt="" id="BLOGGER_PHOTO_ID_5367050389173054274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuX5UBCQ7I/AAAAAAAAAMA/DdW9weQ4Ja8/s1600-h/circle1.5.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 126px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuX5UBCQ7I/AAAAAAAAAMA/DdW9weQ4Ja8/s320/circle1.5.jpg" alt="" id="BLOGGER_PHOTO_ID_5367050391823467442" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuX5m6jgfI/AAAAAAAAAMI/PY9zl99ZzPQ/s1600-h/circle2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 124px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuX5m6jgfI/AAAAAAAAAMI/PY9zl99ZzPQ/s320/circle2.jpg" alt="" id="BLOGGER_PHOTO_ID_5367050396896559602" border="0" /&gt;&lt;/a&gt;When the two dots were replaced with two circles with certain radius, the FT resulted into an airy disk pattern with embedded alternating parallel lines. This was due to the convolution of the circular aperture with the dirac deltas. The convolution theorem states that the FT of a convolution of two functions in space is the product of the two functions' FT. When the circular aperture and the two points were convolved, its FT came from the product of each function's FT, which is an airy disk pattern and a sine function, correspondingly. We can also observe that as the radius of the circles increases, the resulting radius of the airy disk pattern decreases.&lt;br /&gt;&lt;br /&gt;After with circles, squares of some varying width were utilized.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuY0x_ZR-I/AAAAAAAAAMQ/s6Xw8QO7Z80/s1600-h/square.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 123px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnuY0x_ZR-I/AAAAAAAAAMQ/s6Xw8QO7Z80/s320/square.jpg" alt="" id="BLOGGER_PHOTO_ID_5367051413481932770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;images of="" squares="" with="" diff="" radius=""&gt;&lt;/images&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuY01HecfI/AAAAAAAAAMY/DDYn2ZAcMjs/s1600-h/square2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 125px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuY01HecfI/AAAAAAAAAMY/DDYn2ZAcMjs/s320/square2.jpg" alt="" id="BLOGGER_PHOTO_ID_5367051414321132018" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuY1GQ9ilI/AAAAAAAAAMg/UlkKnqCqTKg/s1600-h/square3.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 124px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuY1GQ9ilI/AAAAAAAAAMg/UlkKnqCqTKg/s320/square3.jpg" alt="" id="BLOGGER_PHOTO_ID_5367051418924321362" border="0" /&gt;&lt;/a&gt;Again, this is a convolution of two function, the square aperture and the two dirac deltas with FT resulting from the product of FT of each function. The FT of a square aperture is a sync function and the FT of the two dots is a sine function. The FT modulus came from the product of the two FTs. As with the varying radius of the circles, the as the width of the square increases, the width of the FT images decreases.&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;Lastly, the dots were replaced with Gaussians with the form &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuZ208407I/AAAAAAAAAMo/c87ioVVuKxg/s1600-h/eq.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 137px; height: 73px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnuZ208407I/AAAAAAAAAMo/c87ioVVuKxg/s320/eq.jpg" alt="" id="BLOGGER_PHOTO_ID_5367052548148089778" border="0" /&gt;&lt;/a&gt;Gaussians with varying variance (&lt;span style="font-style: italic;"&gt;sigma squared&lt;/span&gt;) were created. The peak location of these Gaussians are located at ±&lt;span style="font-style: italic;"&gt;mu&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/Snua16S90GI/AAAAAAAAAMw/V6ACLIMQP3g/s1600-h/var.1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 130px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/Snua16S90GI/AAAAAAAAAMw/V6ACLIMQP3g/s320/var.1.jpg" alt="" id="BLOGGER_PHOTO_ID_5367053631914627170" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/Snua2IJvvWI/AAAAAAAAAM4/tOVd2AmfuXQ/s1600-h/var.2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 130px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/Snua2IJvvWI/AAAAAAAAAM4/tOVd2AmfuXQ/s320/var.2.jpg" alt="" id="BLOGGER_PHOTO_ID_5367053635634052450" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/Snua2fVwHWI/AAAAAAAAANA/AeUcWEJxkq0/s1600-h/var.4.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 130px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/Snua2fVwHWI/AAAAAAAAANA/AeUcWEJxkq0/s320/var.4.jpg" alt="" id="BLOGGER_PHOTO_ID_5367053641858424162" border="0" /&gt;&lt;/a&gt;The figures above shows the Gaussians with increasing variance (&lt;span style="font-style: italic;"&gt;sigma squared&lt;/span&gt;) alongside with its FT modulus. For a better view, the images below showed it in 3D.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnucFksy7FI/AAAAAAAAANY/X1lfSrHeeQ0/s1600-h/3dFTvar.1.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 242px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnucFksy7FI/AAAAAAAAANY/X1lfSrHeeQ0/s320/3dFTvar.1.jpg" alt="" id="BLOGGER_PHOTO_ID_5367055000506920018" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnucA_1lOUI/AAAAAAAAANQ/fC0dT2zk4tM/s1600-h/3dgvar.1.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 242px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnucA_1lOUI/AAAAAAAAANQ/fC0dT2zk4tM/s320/3dgvar.1.jpg" alt="" id="BLOGGER_PHOTO_ID_5367054921892182338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;gaussians images=""&gt;&lt;/gaussians&gt;&lt;/span&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;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnucSg859FI/AAAAAAAAANo/ryvHHV8JKaI/s1600-h/3dFTvar.2.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 242px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnucSg859FI/AAAAAAAAANo/ryvHHV8JKaI/s320/3dFTvar.2.jpg" alt="" id="BLOGGER_PHOTO_ID_5367055222839047250" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnucO_8pIHI/AAAAAAAAANg/QNGHvvpBhBo/s1600-h/3dgvar.2.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 242px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnucO_8pIHI/AAAAAAAAANg/QNGHvvpBhBo/s320/3dgvar.2.jpg" alt="" id="BLOGGER_PHOTO_ID_5367055162439966834" border="0" /&gt;&lt;/a&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;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SnucgUKuH6I/AAAAAAAAANw/2V-47a2Xm-E/s1600-h/3dgvar.4.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 242px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SnucgUKuH6I/AAAAAAAAANw/2V-47a2Xm-E/s320/3dgvar.4.jpg" alt="" id="BLOGGER_PHOTO_ID_5367055459925499810" border="0" /&gt;&lt;/a&gt;&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/_mPdMIzolbt8/Snuclt7XVHI/AAAAAAAAAN4/jg9dbeSYjRE/s1600-h/3dFTvar.4.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 242px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/Snuclt7XVHI/AAAAAAAAAN4/jg9dbeSYjRE/s320/3dFTvar.4.jpg" alt="" id="BLOGGER_PHOTO_ID_5367055552739759218" border="0" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We can say that this is a convolution of the Gaussian function and the two dots (dirac deltas). Taking its FT will again result to the product of the FT of each function. The Fourier Transform of a Gaussian function is also a Gaussian function and the FT of the dirac deltas is a sine function. Therefore, the resulting FT modulus is a Gaussian function with alternating parallel lines. As the variance of each Gaussians was increased, the radius of the Gaussian in the frequency domain decreases.&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;&lt;images of="" square="" aperture="" with="" different="" radius=""&gt;&lt;/images&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Activity 7.B Fingerprints : Ridge Enhancement&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;In this part of the activity, we tried to enhance an image of a fingerprint which was downloaded from the internet. The enhancement includes emphasizing the ridges of the fingerprint and removing its blotches.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnudAwGxCCI/AAAAAAAAAOA/5WpI48I_Khw/s1600-h/fp.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 287px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnudAwGxCCI/AAAAAAAAAOA/5WpI48I_Khw/s320/fp.bmp" alt="" id="BLOGGER_PHOTO_ID_5367056017180919842" border="0" /&gt;&lt;/a&gt;The image was then opened in &lt;span style="font-style: italic;"&gt;Scilab&lt;/span&gt; as grayscale image. Its FT was obtained by the procedure done in the previous activities. Then the FT was displayed in logarithmic scale in order for us to visualize where the frequencies of the fingerprint ridges lie. This will give us the idea on how to design the filter mask that will enhance the appearance of the ridges and at the same time remove the blotches.&lt;br /&gt;&lt;br /&gt;I designed the filter mask below. The white blobs corresponds to the frequencies that will be enhanced relatively with the black areas which are frequencies that will be lowered/omitted.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/Snudb12X_gI/AAAAAAAAAOI/ieD6fn3RVRk/s1600-h/filterfp2.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 287px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/Snudb12X_gI/AAAAAAAAAOI/ieD6fn3RVRk/s320/filterfp2.bmp" alt="" id="BLOGGER_PHOTO_ID_5367056482579250690" border="0" /&gt;&lt;/a&gt;The filtering was done by taking the FT of the fingerprint image and multiplying it to the filter mask image which was shifted using &lt;span style="font-style: italic;"&gt;fftshift&lt;/span&gt; function. The product was then inversed and resulted to the enhanced image below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnudlIzu2dI/AAAAAAAAAOQ/zOwOrlotaNk/s1600-h/goodfp.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 290px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnudlIzu2dI/AAAAAAAAAOQ/zOwOrlotaNk/s320/goodfp.jpg" alt="" id="BLOGGER_PHOTO_ID_5367056642287262162" border="0" /&gt;&lt;/a&gt;From the enhanced image, we can see that the diagonal line is not as visible as with the original fingerprint. Although the ridges are not as sharp as with the original, we can notice that the blotches are removed.&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Activity 7.C Lunar Landing Scanned Pictures : Line removal&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;This part of the activity focuses on the removal of the frequencies that produces vertical lines in the image. An image of the moon's surface from a lunar landing was utilized in this part. Parallel vertical lines are visible through out the image.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SnueZSfjgKI/AAAAAAAAAOY/c3w2Ay3OmV4/s1600-h/moon.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SnueZSfjgKI/AAAAAAAAAOY/c3w2Ay3OmV4/s320/moon.bmp" alt="" id="BLOGGER_PHOTO_ID_5367057538240184482" border="0" /&gt;&lt;/a&gt;To remove these lines, we must know where the frequencies of the lines lie. We get the FT of the image and displayed it in logarithmic form. From this image, we have the idea that the frequencies correspond to the parallel lines lie in the bright region that forms the vertical line. As we know, the FT of two dots along horizontal is a sinusoidal function which corresponds to the parallel vertical lines. So in order to remove these lines, we block the bright horizontal line and have our filtering mask. We might as well block the bright vertical line so that some horizontal lines in the image may be removed. We must be careful not to block the center of the filter because there are so much information there that we needed. The image below was used as the filtering mask of the image.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SnugKaQ5WBI/AAAAAAAAAOo/1HPmnUjuAZU/s1600-h/filterv.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SnugKaQ5WBI/AAAAAAAAAOo/1HPmnUjuAZU/s320/filterv.jpg" alt="" id="BLOGGER_PHOTO_ID_5367059481651402770" border="0" /&gt;&lt;/a&gt;&lt;div style="text-align: justify;"&gt;As before, the enhanced image was obtained from inversed of the product of the FT of the image and the &lt;span style="font-style: italic;"&gt;fftshift&lt;/span&gt; of the filter mask.&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnugS2EaPwI/AAAAAAAAAOw/Nf8wcJEx5cA/s1600-h/moongood.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 238px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnugS2EaPwI/AAAAAAAAAOw/Nf8wcJEx5cA/s320/moongood.jpg" alt="" id="BLOGGER_PHOTO_ID_5367059626554179330" border="0" /&gt;&lt;/a&gt;From the enhanced image above, the removal of the parallel lines is visible. The quality of the image was enhanced as well.&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center; font-weight: bold;"&gt;Activity 7.D Canvas Weave Modeling and Removal&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: normal;"&gt;The last part of the activity utilizes a canvas painting. We will use what we have learned in image enhancement to remove the canvas weave visible in the painting.&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuhOY4o_zI/AAAAAAAAAPQ/5-VdarCNi9Q/s1600-h/cw.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 230px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnuhOY4o_zI/AAAAAAAAAPQ/5-VdarCNi9Q/s320/cw.bmp" alt="" id="BLOGGER_PHOTO_ID_5367060649512337202" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: normal;"&gt;We begin our filtering by first getting the FT of the painting in logarithmic form. This shows where the frequencies of the unwanted pattern can be found. From the image below, we notice the presence of some bright spots along the center. Compared from the previous part, the location of the frequencies that correspond to the combination of parallel vertical and horizontal lines is distinct. In order to remove these frequencies, we design the filtering image by blocking these bright spots. The image below shows the filtering mask used.&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/Snugr4IG1aI/AAAAAAAAAO4/hxcM50GrrCs/s1600-h/filtercw.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 230px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/Snugr4IG1aI/AAAAAAAAAO4/hxcM50GrrCs/s320/filtercw.bmp" alt="" id="BLOGGER_PHOTO_ID_5367060056603284898" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: normal;"&gt;The enhanced image was then obtained by from the inversed of the product of the FT of the image and &lt;span style="font-style: italic;"&gt;fftshift&lt;/span&gt; of the filter mask.&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnugsZmIPkI/AAAAAAAAAPA/5IDM1Um4CNw/s1600-h/paintingood.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 232px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnugsZmIPkI/AAAAAAAAAPA/5IDM1Um4CNw/s320/paintingood.jpg" alt="" id="BLOGGER_PHOTO_ID_5367060065587576386" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: normal;"&gt;Clearly from the image above, we can see the image was enhanced by the removal of the canvas weave pattern.&lt;br /&gt;&lt;br /&gt;To show that what we have blocked using the filter mask is really the weave pattern, we tried to generate the pattern from the filter. First the filter was inverted and the inverse FT was taken. The FT modulus is closely similar to the canvas weave as shown below.&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SnugslfXg-I/AAAAAAAAAPI/8FxMhzvhRpg/s1600-h/weave.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 212px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SnugslfXg-I/AAAAAAAAAPI/8FxMhzvhRpg/s320/weave.jpg" alt="" id="BLOGGER_PHOTO_ID_5367060068780442594" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;I grade myself a 10 out of 10 in finishing this activity. This activity shows me how the convolution of two functions affect their FT modulus. The FT of two convolved function will result to the superposition of the FT of each function. I was able to use this idea in removing unwanted patterns and enhancing an image. I acknowledged Gilbert who was always there discussing and working with me during class hours.&lt;br /&gt;&lt;/span&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 class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8940726446323633872-4328627245602136200?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/4328627245602136200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-7-enhancement-in-frequency.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/4328627245602136200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/4328627245602136200'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/08/activity-7-enhancement-in-frequency.html' title='ACTIVITY 7 - Enhancement in the Frequency Domain'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_mPdMIzolbt8/SnuXKuORUrI/AAAAAAAAALw/EuRkwG5rzmA/s72-c/2dots.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-3013063648806768585</id><published>2009-07-13T07:19:00.000-07:00</published><updated>2009-08-07T05:44:21.031-07:00</updated><title type='text'>ACTIVITY 6 - Properties of the 2D Fourier Transform</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Activity 6.A Familiarization with FT of Different 2D Patterns&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;This activity is similar to the previous one. We created different patterns, took their respective Fourier Transform and then display their FT modulus. This patterns were done with the aid of &lt;span style="font-style: italic;"&gt;MS&lt;/span&gt; &lt;span style="font-style: italic;"&gt;Paint &lt;/span&gt;and &lt;span style="font-style: italic;"&gt;Scilab &lt;/span&gt;made it possible to compute their Fourier Transform.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SltETmErp1I/AAAAAAAAAG4/gj0GW3jELUY/s1600-h/square.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 101px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SltETmErp1I/AAAAAAAAAG4/gj0GW3jELUY/s200/square.jpg" alt="" id="BLOGGER_PHOTO_ID_5357951285115725650" border="0" /&gt;&lt;/a&gt;The first pattern is a square aperture and beside it is its FT. The FT of a square aperture is similar to the FT of a circle (from Activity 5.A) but instead of an "airy disk" pattern, it has a central square maximum and maxima and minima intensities along its four sides. This pattern is know as the sinc function.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SltFiZALJSI/AAAAAAAAAHA/FoH0A9RWOhg/s1600-h/annulus.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 101px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SltFiZALJSI/AAAAAAAAAHA/FoH0A9RWOhg/s200/annulus.jpg" alt="" id="BLOGGER_PHOTO_ID_5357952638816822562" border="0" /&gt;&lt;/a&gt;The next pattern is an annular aperture. Again, this is similar to the pattern obtained from a circular aperture except that at some fringes are not present due to the circular blocking at the center.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SltGOoRqffI/AAAAAAAAAHI/r8nklUkhpKI/s1600-h/squarean.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 101px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SltGOoRqffI/AAAAAAAAAHI/r8nklUkhpKI/s200/squarean.jpg" alt="" id="BLOGGER_PHOTO_ID_5357953398830956018" border="0" /&gt;&lt;/a&gt;Then, a square annular aperture. This was analogous to the circular and annular aperture. The pattern obtained was almost the same with the square aperture and as expected, there are fringes missing. This is similar to a diffraction from a slit only that it is along x and y.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SltHgfzMSNI/AAAAAAAAAHQ/vZKLrVmHAxc/s1600-h/slits.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 101px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SltHgfzMSNI/AAAAAAAAAHQ/vZKLrVmHAxc/s200/slits.jpg" alt="" id="BLOGGER_PHOTO_ID_5357954805304936658" border="0" /&gt;&lt;/a&gt;Next is a two-slit pattern. Along its side is its FT which yields from the cancellation of the upper and lower sections from the aperture. Thus, we see a horizontal pattern which is due to the interference coming from two slits.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SltIreQRzRI/AAAAAAAAAHY/Dv0pcg_VroI/s1600-h/dots.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 101px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SltIreQRzRI/AAAAAAAAAHY/Dv0pcg_VroI/s200/dots.jpg" alt="" id="BLOGGER_PHOTO_ID_5357956093380250898" border="0" /&gt;&lt;/a&gt;The last pattern is a two-dot pattern or a double circular aperture. As has been said, the result looks like that of a circular aperture with maxima and minima intensities.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Activity 6.B Anamorphic Property of the Fourier Transform&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Using &lt;span style="font-style: italic;"&gt;Scilab&lt;/span&gt;, a 2D sinusoid in the x direction was created, with frequency that can be varied.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;nx = 100; ny = 100;&lt;br /&gt;x = linspace(-1,1,nx);&lt;br /&gt;y = linspace(-1,1,ny);&lt;br /&gt;[X,Y] = ndgrid(x,y);&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;f = 4 //frequency&lt;br /&gt;z = sin(2*%pi*f*X);&lt;br /&gt;imshow(z,[]);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And then, just like in previous part its Fourier Transform was taken and its FT modulus was displayed.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SltM2RyuZrI/AAAAAAAAAHo/8-lYYXxrEjI/s1600-h/freq.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 206px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SltM2RyuZrI/AAAAAAAAAHo/8-lYYXxrEjI/s320/freq.jpg" alt="" id="BLOGGER_PHOTO_ID_5357960677060142770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The figure above shows the source signal and its FT in 2D and 3D, respectively. The first figure shows a sinusoidal signal with frequency equals to 5 and below it is a signal with frequency 10. They corresponding FT shows that the peaks moves farther apart as the frequency increases. This is expected because the FT of a sinusoidal signal will have its peak on its frequency. Thus if you increase it, the peaks will farther along its axis.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Then, a real image was simulated by adding a constant bias to the sinusoid created earlier. Its FT was also taken.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;z = sin(2*%pi*20*X)+0.95&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mPdMIzolbt8/SltPHCLlzuI/AAAAAAAAAHw/tvFMcU1DrVA/s1600-h/constant.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 96px;" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SltPHCLlzuI/AAAAAAAAAHw/tvFMcU1DrVA/s320/constant.jpg" alt="" id="BLOGGER_PHOTO_ID_5357963163950501602" border="0" /&gt;&lt;/a&gt;The figure above shows the sinusoidal signal with constant bias and its FT in 2D and 3D. On the contrary with the previous result, the FT of a sinusoidal signal with constant bias has 3 peaks. The two peaks  with equal amplitude are from the frequency of the sinusoid and the peak at the center comes from the constant bias. We recall that the FT of a constant is a dirac delta. Also note that the sinusoid signal used has a frequency 20.&lt;br /&gt;--------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;If we suppose to have an image of an interferogram in a Young's Double Slit experiment, we can use this routine to extract its actual frequencies. We just have to find where the FT peaked. If a non-constant bias was added like those very low frequency sinusoids, we just neglect the peaks at low frequencies.&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;The sinusoid was then rotated.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;theta = 30;&lt;br /&gt;z = sin(2*%pi*f*(Y*sin(theta) + X*cos(theta)));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SltR58LBBtI/AAAAAAAAAH4/HdqYVUZWw4Y/s1600-h/rot.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 102px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SltR58LBBtI/AAAAAAAAAH4/HdqYVUZWw4Y/s320/rot.jpg" alt="" id="BLOGGER_PHOTO_ID_5357966237534062290" border="0" /&gt;&lt;/a&gt;As expected, the peaks of its FT are also rotated.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Then a combination of sinusoids along x and y are investigated.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;z = sin(2*%pi*4*X).*sin(2*%pi*4*Y);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SltTnIki5PI/AAAAAAAAAII/aQWKF2IXFOo/s1600-h/prod.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 134px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SltTnIki5PI/AAAAAAAAAII/aQWKF2IXFOo/s320/prod.jpg" alt="" id="BLOGGER_PHOTO_ID_5357968113468105970" border="0" /&gt;&lt;/a&gt;Again, we expect this results, a four-peak plot. The first two peaks are due to the sinusoid along x and the last two are due to the sinusoid along y.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Aside from a combination of sinusoids, we added rotated sinusoid to the signal.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;z = sin(2*%pi*f*X).*cos(2*%pi*f*Y)+sin(2*%pi*f*(Y*sin(30) + X*cos(30)));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Before calculating and displaying its FT, I had a prediction that the rotated FT of the additional signal will add up to the four-peak FR of the two-sinusoid combination.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/SltVDBr6QVI/AAAAAAAAAIQ/OLbKEK7zr7w/s1600-h/prodrot.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 108px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/SltVDBr6QVI/AAAAAAAAAIQ/OLbKEK7zr7w/s320/prodrot.jpg" alt="" id="BLOGGER_PHOTO_ID_5357969692167913810" border="0" /&gt;&lt;/a&gt;As I predicted, six peaks appear on the FT.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;I will give myself a grade of 8/10 for finishing the blog late. Although I was able to finish the activity during class hours, I'm having hard time doing blog because I have no access to the internet at home. Thanks again to Raffy and Gilbert for always answering my questions and for always having a good discussions.&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/8940726446323633872-3013063648806768585?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/3013063648806768585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/3013063648806768585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/3013063648806768585'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/07/activity-6-properties-of-2d-fourier.html' title='ACTIVITY 6 - Properties of the 2D Fourier Transform'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_mPdMIzolbt8/SltETmErp1I/AAAAAAAAAG4/gj0GW3jELUY/s72-c/square.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-5375833877026430835</id><published>2009-07-06T18:27:00.000-07:00</published><updated>2009-07-08T09:04:48.737-07:00</updated><title type='text'>ACTIVITY 5 - Fourier Transform Model of Image Formation</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Activity 5.A - Familiarization with Discrete FFT&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The function &lt;span style="font-style: italic;"&gt;fft2()&lt;/span&gt; was demonstrated by utilizing a 128x128 images. This FFT was used for an image of a 'circle' which was created with the given code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;x = [-1:0.01:1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;[X,Y] = meshgrid(x);&lt;br /&gt;r = sqrt(X.^2 + Y.^2);&lt;br /&gt;circle = zeros(size(X,1), size(X,2));&lt;br /&gt;circle(find (r &lt;=0.5)) = 1.0; imshow(circle,[]);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Because of being complex, the &lt;span style="font-style: italic;"&gt;abs()&lt;/span&gt; function was used for the output of the FFT to be able to view the intensity values. The first image shows the output of &lt;span style="font-style: italic;"&gt;fft2()&lt;/span&gt; which has interchanged quadrants along the diagonal.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;image = imread('imagefilename');&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;gray = im2gray(image);&lt;br /&gt;FT = fft2(gray);&lt;br /&gt;a = abs(FT);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To compensate, the function &lt;span style="font-style: italic;"&gt;fftshift() &lt;/span&gt;was used to bring the interchanged quadrants back which is show in the second figure. With a closer look, this image is consistent to the analytical fourier transform of a circle which is an airy disk pattern.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;b = fftshift(abs(FT));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then, &lt;span style="font-style: italic;"&gt;fft2()&lt;/span&gt; was again applied and the intensity of the image was displayed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;c = abs(fft2(FT)&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SlNYD9Y4ubI/AAAAAAAAAGQ/qIj5fdiLglM/s1600-h/6circles.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 74px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SlNYD9Y4ubI/AAAAAAAAAGQ/qIj5fdiLglM/s320/6circles.bmp" alt="" id="BLOGGER_PHOTO_ID_5355721206915447218" border="0" /&gt;&lt;/a&gt;This procedure was also done for an image of letter 'A'.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SlNYbVM_s_I/AAAAAAAAAGY/xq7Thy6nM-M/s1600-h/6As.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 75px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SlNYbVM_s_I/AAAAAAAAAGY/xq7Thy6nM-M/s320/6As.bmp" alt="" id="BLOGGER_PHOTO_ID_5355721608445015026" border="0" /&gt;&lt;/a&gt;The inversion of the image after FFT being applied was clearly seen from this sample than the image of a circle. Thus, applying FFT twice will make the image inverted.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center; font-weight: bold;"&gt;Activity 6.B - Simulation of an Imaging Device&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;A 128X128 image of the letters "VIP" which represents an object and an image of a white circle against black background which represents the "aperture" of a circular lens were created using &lt;span style="font-style: italic;"&gt;MS Paint&lt;/span&gt;. The images were opened as grayscale in &lt;span style="font-style: italic;"&gt;Scilab&lt;/span&gt;, taking the 2D FFT of the "VIP" image using &lt;span style="font-style: italic;"&gt;fft2()&lt;/span&gt; function and using &lt;span style="font-style: italic;"&gt;fftshift() &lt;/span&gt;function for the aperture image (the aperture is already in Fourier space).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;object = gray_imread('vip.jpg');&lt;br /&gt;aperture = gray_imread('circle.jpg');&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;offt = fft2(object);&lt;br /&gt;afftshift = fftshift(aperture);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The product their FFT was inversed to get the convolved image.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;FOA = offt.*(afftshift);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;IOA = fft2(FOA);&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SlNY8R_X3-I/AAAAAAAAAGw/jJOpBbB12tU/s1600-h/6vips.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 76px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SlNY8R_X3-I/AAAAAAAAAGw/jJOpBbB12tU/s320/6vips.bmp" alt="" id="BLOGGER_PHOTO_ID_5355722174518255586" border="0" /&gt;&lt;/a&gt;The images above show the results for different radii of white circles. From left to right, the radius of white circle decreases. Thus, for the largest circle resulted for the sharpest image and for the smallest circle resulted for the blurriest image. This shows that the system acts just like a microscope.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Activity 6.C Template Matching Using Correlation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;A 128X128 image&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;with the text "THE RAIN IN SPAIN STAYS MAINLY IN THE PLAIN" on it was created in &lt;span style="font-style: italic;"&gt;MS Paint&lt;/span&gt;. Then another 128X128 image with letter "A" at the center was also created with the same type of font as the first image. These images were opened as grayscale in &lt;span style="font-style: italic;"&gt;Scilab&lt;/span&gt; and then got their 2D FFT.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;text = gray_imread('text.bmp');&lt;br /&gt;A = gray_imread('atext.bmp');&lt;br /&gt;TFFT = fft2(text);&lt;br /&gt;TA = fft2(A);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then the Fourier transform of the image with letter "A" was multiplied element per element to the conjugate of the Fourier transform of the text image. Lastly, the inverse FFT of the product was computed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;P = TA.*(conj(TFFT));&lt;br /&gt;R = fftshift((fft2(P)));&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/SlNY8PGcw-I/AAAAAAAAAGo/NtXGkqfmeQ8/s1600-h/6rain.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 277px; height: 125px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SlNY8PGcw-I/AAAAAAAAAGo/NtXGkqfmeQ8/s320/6rain.bmp" alt="" id="BLOGGER_PHOTO_ID_5355722173742629858" border="0" /&gt;&lt;/a&gt;The picture above shows the output image besides the original image. It noticeable that the output image shows hazy counterpart of each letter on the original image. There is a significant peaks (white dots) on the letter "A" counterpart. This template matching technique recognizes the pattern (letter "A") from the template (text image). However, this can be problematic when the pattern looks like any part of each letter on the text. Take for example, when we use letter "I" as our pattern the output image will shows peaks on parts of each letters with straight vertical line just like the pattern.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center; font-weight: bold;"&gt;Activity 6.D Edge Detection Using the Convolution Integral&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: normal;"&gt;Using &lt;/span&gt;&lt;span style="font-style: italic; font-weight: normal;"&gt;Scilab&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;, a 3X3 matrix pattern of an edge which has a total sum of zero was created&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;. Three&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;&lt;span style="font-weight: normal;"&gt;variants of this pattern were created.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;horizontal:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;font-size:85%;" &gt;template = [-1 -1 -1; 2 2 2; -1 -1 -1];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;vertical:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;font-size:85%;" &gt;template = [-1 2 -1; -1 2 -1; -1 2 -1];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;spot:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;font-size:85%;" &gt;template = [-1 -1 -1; -1 8 -1; -1 -1 -1];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;This pattern was convolve with a "VIP" image using the function &lt;/span&gt;&lt;span style="font-style: normal; font-weight: normal;"&gt;&lt;span style="font-style: italic;"&gt;imcorrcoef()&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: normal;"&gt;C = imcorrcoef(vip, template);&lt;/span&gt;&lt;/span&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/_mPdMIzolbt8/SlNY8D6YPXI/AAAAAAAAAGg/irPAbvApdmQ/s1600-h/6vipgray.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 95px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SlNY8D6YPXI/AAAAAAAAAGg/irPAbvApdmQ/s320/6vipgray.bmp" alt="" id="BLOGGER_PHOTO_ID_5355722170739211634" border="0" /&gt;&lt;/a&gt;The image above shows the results. We can see there are sharp edges on the output image depending on the pattern used. The pattern was detected along the edge of the template.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;It felt good that I finished this activity during class hours. However, I was not able to finish the blog right away because of lack of time. I will give myself 10/10 for this activity because I was able to produce expected output although I have published the blog late. Thanks again for the help of Gilbert and Raffy in discussing the activity.&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/8940726446323633872-5375833877026430835?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/5375833877026430835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/5375833877026430835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/5375833877026430835'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/07/activity-5-fourier-transform-model-of.html' title='ACTIVITY 5 - Fourier Transform Model of Image Formation'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_mPdMIzolbt8/SlNYD9Y4ubI/AAAAAAAAAGQ/qIj5fdiLglM/s72-c/6circles.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-4783418206886259102</id><published>2009-06-28T00:48:00.000-07:00</published><updated>2009-07-06T05:00:46.021-07:00</updated><title type='text'>ACTIVITY 2 - Area Estimation of Images with Defined Edges</title><content type='html'>In this activity, our goal is to be able to compute for the area of images with the use of  Green's Theorem. First, we created images (with black background and white as the object) using &lt;span style="font-style: italic;"&gt;MS Paint&lt;/span&gt;.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/Skl7k-CGG-I/AAAAAAAAADg/v0rfKu8BN5I/s1600-h/sq+10100.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 202px; height: 174px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/Skl7k-CGG-I/AAAAAAAAADg/v0rfKu8BN5I/s320/sq+10100.JPG" alt="" id="BLOGGER_PHOTO_ID_5352945507163839458" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/Skl7fHaBbYI/AAAAAAAAADY/ir5KQ_1HO-4/s1600-h/tri+4900.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 202px; height: 174px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/Skl7fHaBbYI/AAAAAAAAADY/ir5KQ_1HO-4/s320/tri+4900.JPG" alt="" id="BLOGGER_PHOTO_ID_5352945406600899970" border="0" /&gt;&lt;/a&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&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;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/Skl72b8lF6I/AAAAAAAAADo/h-aBTHe-tKk/s1600-h/circ+7693.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 202px; height: 174px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/Skl72b8lF6I/AAAAAAAAADo/h-aBTHe-tKk/s320/circ+7693.JPG" alt="" id="BLOGGER_PHOTO_ID_5352945807251543970" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_mPdMIzolbt8/Skl8BxW7cyI/AAAAAAAAADw/A5v-TkRX6gM/s1600-h/mickey.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 202px; height: 177px;" src="http://2.bp.blogspot.com/_mPdMIzolbt8/Skl8BxW7cyI/AAAAAAAAADw/A5v-TkRX6gM/s320/mickey.JPG" alt="" id="BLOGGER_PHOTO_ID_5352946001977766690" border="0" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;Then, the areas of the object on each image were calculated using Green's equation given by&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mPdMIzolbt8/Skl9DY9P_sI/AAAAAAAAAD4/DmlLsythx-s/s1600-h/untitled.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 217px; height: 62px;" src="http://4.bp.blogspot.com/_mPdMIzolbt8/Skl9DY9P_sI/AAAAAAAAAD4/DmlLsythx-s/s320/untitled.bmp" alt="" id="BLOGGER_PHOTO_ID_5352947129298976450" border="0" /&gt;&lt;/a&gt;I create a code using &lt;span style="font-style: italic;"&gt;scilab&lt;/span&gt; that computes for the area of the object in a black and white image. This code utilizes Green's equation. The computed area was then compared to the area obtained by summing up all 1's in the image (white object).&lt;br /&gt;&lt;br /&gt;SOURCE CODE:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;image = imread('tri 4900.JPG');//read&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt; image from file&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;bin = im2bw(image, 0.5);//convert image to black and white&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;[x,y] = follow(bin);//follow the co&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;ntour of the object&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;plot2d(x,y);//plot of the contour&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;//Green's Theorem&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;area=[];&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;for i = 1:(length(y)-1)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;  area(i) = x(i)*y(i+1)-y(i)*x(i+1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;areatot =((sum(area))/2)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;//pixel area&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;pixarea = sum(bin)-length(y)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);font-family:courier new;" &gt;//percentage error&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;%err = abs((areatot-pixarea)/pixarea)*100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family:georgia;"&gt;By using the syntax &lt;span style="font-style: italic;"&gt;'follow'&lt;/span&gt;, Greens's equation disregards the contour in computing for the area. In order to compensate the pixel area, w&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;e have to subtract the perimeter of the contour in the sum of the pixel area. The table below shows the computed areas and corresponding p&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;ercent error. &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SkmGIXY4heI/AAAAAAAAAEI/HrR-yln3570/s1600-h/untitled.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 70px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SkmGIXY4heI/AAAAAAAAAEI/HrR-yln3570/s320/untitled.bmp" alt="" id="BLOGGER_PHOTO_ID_5352957110382003682" border="0" /&gt;&lt;/a&gt;I give myself a 10/10 in this activity. I understand well the objective of the activity and thus being able to create a code. I acknowledged Raffy and Gilbert for agreeing with me about the fact that &lt;span style="font-style: italic;"&gt;'follow' &lt;/span&gt;disregard the number of pixels of the contour using Green's equation.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&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/8940726446323633872-4783418206886259102?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/4783418206886259102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/06/activity-2-area-estimation-of-images.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/4783418206886259102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/4783418206886259102'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/06/activity-2-area-estimation-of-images.html' title='ACTIVITY 2 - Area Estimation of Images with Defined Edges'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_mPdMIzolbt8/Skl7k-CGG-I/AAAAAAAAADg/v0rfKu8BN5I/s72-c/sq+10100.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-4330098698109280175</id><published>2009-06-27T22:20:00.000-07:00</published><updated>2009-07-07T07:19:46.897-07:00</updated><title type='text'>ACTIVITY 3 - Images Types and Basic Image Enhancement</title><content type='html'>In this activity, we collected digitized images from the web and classified them into four types: binary images, grayscale images, indexed images and truecolor images. Using the &lt;em&gt;imfinfo&lt;/em&gt; of &lt;em&gt;Scilab-4.1.2, &lt;/em&gt;the properties of each image were determined. &lt;div align="center"&gt;&lt;strong&gt;BINARY IMAGE&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_mPdMIzolbt8/SkcnC_laHdI/AAAAAAAAACw/pPDf1s1G91g/s1600-h/true-binary.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5352289614534680018" style="margin: 0px 10px 10px 0px; float: left; width: 248px; height: 205px;" alt="" src="http://3.bp.blogspot.com/_mPdMIzolbt8/SkcnC_laHdI/AAAAAAAAACw/pPDf1s1G91g/s320/true-binary.png" border="0" /&gt;&lt;/a&gt; FileSize: 344&lt;br /&gt;Format: PNG&lt;br /&gt;Width: 248&lt;br /&gt;Height: 248&lt;br /&gt;Depth: 8&lt;br /&gt;StorageType: indexed&lt;br /&gt;NumberOfColors: 2&lt;br /&gt;ResolutionUnit: centimeter&lt;br /&gt;XResolution: 72.000000&lt;br /&gt;yResolution: 72.000000&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="left"&gt;&lt;span style="color: rgb(153, 153, 153);"&gt;***&lt;/span&gt;&lt;a href="http://www.true-binary.com/true-binary.png"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;http://www.true-binary.com/true-binary.png&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;strong&gt;GRAYSCALE IMAGE&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_mPdMIzolbt8/SkcoBRL3nXI/AAAAAAAAADA/rVEhmMDiHqI/s1600-h/tiger-Q300.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5352290684411288946" style="margin: 0px 0px 10px 10px; float: right; width: 249px; height: 198px;" alt="" src="http://2.bp.blogspot.com/_mPdMIzolbt8/SkcoBRL3nXI/AAAAAAAAADA/rVEhmMDiHqI/s320/tiger-Q300.png" border="0" /&gt;&lt;/a&gt;FileSize: 28244&lt;br /&gt;Format: PNG&lt;br /&gt;Width: 290&lt;br /&gt;Height: 300&lt;br /&gt;Depth: 8&lt;br /&gt;StorageType: indexed&lt;br /&gt;NumberOfColors: 256&lt;br /&gt;ResolutionUnit: centimeter&lt;br /&gt;XResolution: 14.960000&lt;br /&gt;YResolution: 14.960000&lt;br /&gt;&lt;p&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;***&lt;/span&gt;&lt;/em&gt;&lt;a href="http://peps.redprince.net/peps/tiger-Q300.png"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;http://peps.redprince.net/peps/tiger-Q300.png&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="text-align: center;"&gt;&lt;strong&gt;INDEXED IMAGE&lt;/strong&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;a href="http://2.bp.blogspot.com/_mPdMIzolbt8/Skco8Ces9RI/AAAAAAAAADI/ysT-tXe9Xl8/s1600-h/tigerindex.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5352291694076032274" style="margin: 0px 10px 10px 0px; float: left; width: 320px; height: 218px;" alt="" src="http://2.bp.blogspot.com/_mPdMIzolbt8/Skco8Ces9RI/AAAAAAAAADI/ysT-tXe9Xl8/s320/tigerindex.gif" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="left"&gt;FileSize: 6989&lt;br /&gt;Format: GIF&lt;br /&gt;Width: 491&lt;br /&gt;Height: 334&lt;br /&gt;Depth: 8&lt;br /&gt;StorageType:  indexed&lt;br /&gt;NumberOfColors: 4&lt;br /&gt;ResolutionUnit: centimeter&lt;br /&gt;XResolution: 72.000000&lt;br /&gt;YResolution: 72.000000&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;**&lt;/span&gt;&lt;/em&gt;&lt;a href="http://www.springboardmagazine.com/SpringImages/tiger.gif"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;http://www.springboardmagazine.com/SpringI&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;a href="http://www.springboardmagazine.com/SpringImages/tiger.gif"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;mage&lt;/span&gt;&lt;/em&gt;&lt;/a&gt; &lt;a href="http://www.springboardmagazine.com/SpringImages/tiger.gif"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;s/tiger.gif&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;strong&gt;TRUE COLOR IMAGE&lt;/strong&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;a href="http://1.bp.blogspot.com/_mPdMIzolbt8/SkcpyX0aujI/AAAAAAAAADQ/kMemER_lyCA/s1600-h/tiger-picture.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5352292627517192754" style="margin: 0px 0px 10px 10px; float: right; width: 320px; height: 230px;" alt="" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SkcpyX0aujI/AAAAAAAAADQ/kMemER_lyCA/s320/tiger-picture.jpg" border="0" /&gt;&lt;/a&gt; FileSize: 31029&lt;br /&gt;Format: JPEG&lt;br /&gt;Width: 625&lt;br /&gt;Height: 450 &lt;div align="left"&gt;Depth: 8&lt;br /&gt;StorageType: truecolor&lt;br /&gt;NumberOfColors: 0&lt;br /&gt;ResolutionUnit: centimeter&lt;br /&gt;XResolution: 100.000000&lt;br /&gt;YResolution: 100.000000&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;***&lt;/span&gt;&lt;/em&gt;&lt;a href="http://animal.discovery.com/mammals/tiger/pictures/tiger-picture.jpg"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;http://animal.discovery.com/mammals/tiger/pictures/&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;a href="http://animal.discovery.com/mammals/tiger/pictures/tiger-picture.jpg"&gt;&lt;em&gt;&lt;span style="color: rgb(153, 153, 153);font-family:trebuchet ms;" &gt;tiger-picture.jpg&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHe6XRgZLI/AAAAAAAAAEQ/brOpTsOa0Zs/s1600-h/diskette.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 304px; height: 320px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHe6XRgZLI/AAAAAAAAAEQ/brOpTsOa0Zs/s320/diskette.JPG" alt="" id="BLOGGER_PHOTO_ID_5355306526181450930" border="0" /&gt;&lt;/a&gt;I looked for a 3 1/2 diskette and had it scanned. Then I got its properties using &lt;span style="font-style: italic;"&gt;imfinfo.&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHkDBYxZ6I/AAAAAAAAAFA/mtLTLsQvEEo/s1600-h/gray_image.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 304px; height: 320px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHkDBYxZ6I/AAAAAAAAAFA/mtLTLsQvEEo/s320/gray_image.jpg" alt="" id="BLOGGER_PHOTO_ID_5355312172483307426" border="0" /&gt;&lt;/a&gt;The image was then converted into grayscale. I created a code that will compute and plot the histogram of the scanned image. It is clearly shown from the histogram that the region of interest (ROI) is well separated from the background which is expected.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHklg0jCSI/AAAAAAAAAFI/ij0BjxuSgos/s1600-h/plot.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 253px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHklg0jCSI/AAAAAAAAAFI/ij0BjxuSgos/s320/plot.JPG" alt="" id="BLOGGER_PHOTO_ID_5355312765036857634" border="0" /&gt;&lt;/a&gt;With the use of &lt;span style="font-style: italic;"&gt;im2bw, &lt;/span&gt;the image was converted into black and white using the best threshold (for this case, 0.5). For a nicer image, I used &lt;span style="font-style: italic;"&gt;MS Paint&lt;/span&gt;. To get the area of the image, I applied the area calculation program I made for Activity 2. With this procedure, I got a 0.33 % error from the area calculated.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHk1azY2YI/AAAAAAAAAFQ/Gn9D9qXbfbs/s1600-h/black_image.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 304px; height: 320px;" src="http://1.bp.blogspot.com/_mPdMIzolbt8/SlHk1azY2YI/AAAAAAAAAFQ/Gn9D9qXbfbs/s320/black_image.jpg" alt="" id="BLOGGER_PHOTO_ID_5355313038299289986" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;I will give myself a grade of 9/10 for this activity. I finished this activity late because I had a hard time looking for an object to be scanned. I thought that any little object I could think of might have already done by my classmates. I acknowledged again the help of Gilbert and Raffy for answering all questions I had in mind.&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/8940726446323633872-4330098698109280175?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/4330098698109280175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.blogspot.com/2009/06/activity-3-images-types-and-basic-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/4330098698109280175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/4330098698109280175'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/06/activity-3-images-types-and-basic-image.html' title='ACTIVITY 3 - Images Types and Basic Image Enhancement'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_mPdMIzolbt8/SkcnC_laHdI/AAAAAAAAACw/pPDf1s1G91g/s72-c/true-binary.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8940726446323633872.post-2095964859727085413</id><published>2009-06-17T19:47:00.000-07:00</published><updated>2009-06-22T17:36:28.332-07:00</updated><title type='text'>ACTIVITY 1 - Digital Scanning</title><content type='html'>&lt;div style="text-align: justify;"&gt;Primarily, this activity aims to find the numerical values of a digitally scanned hand-drawn plot with the use of ratio and proportion.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;First, I&lt;/span&gt;&lt;span&gt; looked for a ha&lt;/span&gt;&lt;span&gt;nd-drawn graph from an old journal and I found this plot from &lt;span&gt;Annals of Chemistry, 1940&lt;/span&gt;.&lt;/span&gt;&lt;/div&gt;&lt;img src="http://4.bp.blogspot.com/_mPdMIzolbt8/Sj9FBtsIVbI/AAAAAAAAABA/a0oNsqOUNCI/s320/original+plot.jpg" style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 239px;" alt="" id="BLOGGER_PHOTO_ID_5350070778086315442" border="0" /&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;This graph relates the carbon dioxide output from washed potato tubers under aerobic and anaerobic conditions.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;I started noting down the &lt;/span&gt;&lt;span&gt;pix&lt;/span&gt;&lt;span&gt;el &lt;/span&gt;&lt;span&gt;values of each data point by first having a conversion factor which relates the number of pixels to a certain number of physical value along both x and y axis.&lt;/span&gt;&lt;/div&gt;&lt;/span&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;span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;For the x-axis, the ratio is 222:1 pixels and for the y-axis, there is 1440:1 pixels ratio. With these ratios in hand, I was able to tabulate the number of p&lt;/span&gt;&lt;span&gt;ixels of each data points an&lt;span&gt;d their equivalent physica&lt;/span&gt;&lt;span&gt;l values on each axis.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="http://1.bp.blogspot.com/_mPdMIzolbt8/Sj9FaD3nAOI/AAAAAAAAABI/VbE7KA_qaeQ/s320/table.bmp" style="margin: 0px auto 10px; text-align: justify; display: block; cursor: pointer; width: 311px; height: 320px;" alt="" id="BLOGGER_PHOTO_ID_5350071196356903138" border="0" /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;Finally, a reconstruction of the graph was done in OpenOffice.org Calc.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;img src="http://3.bp.blogspot.com/_mPdMIzolbt8/Sj9GTSSEN9I/AAAAAAAAABY/jstaAfGAPR0/s320/reconstruction+plot.bmp" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 193px;" alt="" id="BLOGGER_PHOTO_ID_5350072179478509522" border="0" /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The plot above shows a decent reconstruction of the original graph. With the original graph being placed at the background of the reconstructed graph, we can see the correspondence among each data points with insignificant deviations. The trendline imposed on the reconstructed graph also fits the trendline of the original graph. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I evaluate myself with a grade of 10/10 from being able to find the numerical values of a hand-written graph by utilizing the ratio of  number of pixels to number of physical value. I exerted enough effort to finish this activity on time. I also acknowledge the help of Raffy, Gilbert and Kaye in discussing the way on how to begin with the activity.&lt;/div&gt;&lt;div style="text-align: left;"&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/8940726446323633872-2095964859727085413?l=ghacoeurei.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghacoeurei.blogspot.com/feeds/2095964859727085413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghacoeurei.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/8940726446323633872/posts/default/2095964859727085413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8940726446323633872/posts/default/2095964859727085413'/><link rel='alternate' type='text/html' href='http://ghacoeurei.blogspot.com/2009/06/activity-1-digital-scanning.html' title='ACTIVITY 1 - Digital Scanning'/><author><name>ghary</name><uri>http://www.blogger.com/profile/16146655584373593833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_mPdMIzolbt8/Sj9FBtsIVbI/AAAAAAAAABA/a0oNsqOUNCI/s72-c/original+plot.jpg' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
