<?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-7535750636146573043</id><updated>2012-02-16T20:15:21.060-08:00</updated><category term='L'/><category term='S'/><category term='A'/><category term='E'/><category term='G'/><category term='I'/><category term='X'/><category term='R'/><category term='K'/><title type='text'>Applied Physics 186</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-2680173333039498929</id><published>2011-10-14T02:34:00.001-07:00</published><updated>2011-10-14T02:34:13.114-07:00</updated><title type='text'>XVIII</title><content type='html'>&lt;div style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;This last experiment is about image processing using the frames of a video-captured scene. Videos are merely a string of still images captured at a certain frequency. This of course is still ruled by the Nyquist criterion to ensure a non-aliased signal (the video itself) in the perception of our eyes. This frequency is more known as the &lt;b&gt;frame rate&lt;/b&gt; or&lt;b&gt; frames-per-second &lt;/b&gt;(&lt;i&gt;fps&lt;/i&gt;) in digital electronics.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With those in mind, this activity taps to the capability of video for time-dependent phenomenon. Our experiment is a basic one: Capture a colored ball as it falls down the floor and using video analysis, experimentally determine&amp;nbsp;&lt;i&gt;g. &lt;/i&gt;To do this, we have first to be able to capture the individual still frames of an image. We use the Stoik Video Converter 2.0 to adjust the initial video (i.e. decrease the frame size, standardize the fps, remove audio) before chopping it to the still frames using VirtualDub 1.6.19.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Our selected time frame consisted of 14 still images.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Pq45HHp4C2c/Tpfdwdac5_I/AAAAAAAAAPs/fZEv8Kduk2g/s1600/seq4.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-Pq45HHp4C2c/Tpfdwdac5_I/AAAAAAAAAPs/fZEv8Kduk2g/s320/seq4.bmp" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. Sample of a still frame from our video&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Fig. 1 shows a sample image. We have used an orange ball against a white wall to facilitate an easier way for color segmentation later. The height used was ~1m.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, these 14 images were processed in Scilab 4.1.2 using the Non-Parametric segmentation method we used for Activity 14 - Color Segmentation. The colored ball was now identifiable and by averaging the coordinates we find the location of the approximate center of the ball (centroid).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-wjTNRz7WJFU/TpfiSUDLkXI/AAAAAAAAAP0/wP87tdW_RZs/s1600/final.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-wjTNRz7WJFU/TpfiSUDLkXI/AAAAAAAAAP0/wP87tdW_RZs/s320/final.bmp" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. Centroid locations extracted from the 14 images&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;Plotting this in a single image gives us Fig. 2. The distance between two points increases in time due to the gravitational acceleration. Converting the coordinates (specifically the &lt;i&gt;y&lt;/i&gt;) to the actual values through the method we have previously used in Activity 1, we can now plot the height vs. time plot of our experiment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-10vOqKUhjh8/TpfjjqbCOvI/AAAAAAAAAP8/_eG7W9jTr7o/s1600/Exptl.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="256" src="http://1.bp.blogspot.com/-10vOqKUhjh8/TpfjjqbCOvI/AAAAAAAAAP8/_eG7W9jTr7o/s400/Exptl.bmp" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 3.Height vs. Time plot of the experiment&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Fig. 3 shows the exponential trend of our data. The time interval between images is simply obtained from the fps of our video, which is 30 fps. This gives us 0.03s gap per frame. The trend line's coefficient 5.767 equals to &amp;nbsp;50% of our experimental&amp;nbsp;&lt;i&gt;g. &lt;/i&gt;This is by virtue of the simple kinematic equation:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-PU9YyaAIxRI/TpflDJnfWuI/AAAAAAAAAQE/LqqJc93GKkk/s1600/26fead5fbb1a5fd392b20d748c1794a5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-PU9YyaAIxRI/TpflDJnfWuI/AAAAAAAAAQE/LqqJc93GKkk/s1600/26fead5fbb1a5fd392b20d748c1794a5.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;Since we have no initial velocity applied to the ball, we end up with the 2nd term that relates the distance (s) and time (t) with the acceleration (a) of the system. The negative sign constitutes the downward movement. As such, the expected value is around 4.903. With our 5.767 experimental value, this yields a 17% experimental error.&lt;br /&gt;&lt;br /&gt;In summary, we have successfully used a video to extract still images and perform color segmentation. This enabled us to obtain the coordinates of our colored ball and experimentally measure &lt;i&gt;g&lt;/i&gt;&amp;nbsp;by converting these to actual length and using the frame rate of the video as time steps. The large error can be attributed to parallax in the recording. Also, the small distance (1m) could be a factor to the resolution of this experiment.&lt;br /&gt;&lt;br /&gt;Self-Assessment: 10/10&lt;/div&gt;&lt;div&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/7535750636146573043-2680173333039498929?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/2680173333039498929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/10/xviii_14.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/2680173333039498929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/2680173333039498929'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/10/xviii_14.html' title='XVIII'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-Pq45HHp4C2c/Tpfdwdac5_I/AAAAAAAAAPs/fZEv8Kduk2g/s72-c/seq4.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-4492785284974622</id><published>2011-10-14T01:03:00.000-07:00</published><updated>2011-10-14T02:36:33.997-07:00</updated><title type='text'>XVI</title><content type='html'>This activity deals with Probabilistic Classification. We use a derivative of the Bayes Theorem, which is the Linear Discriminant Analysis (LDA) formula:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-LIpTbrVv30E/Tpf9BANM-II/AAAAAAAAAQM/3fGP5nVb3VA/s1600/eqn.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-LIpTbrVv30E/Tpf9BANM-II/AAAAAAAAAQM/3fGP5nVb3VA/s1600/eqn.png" /&gt;&lt;/a&gt;&lt;/div&gt;using the definitions given in&amp;nbsp;http://people.revoledu.com/kardi/tutorial/LDA/LDA.html, assignment of a test image is given to the class with a maximum &lt;i&gt;f.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;Using the images of Activity 15, I chose the set of sample and test images of &lt;u&gt;playing cards&lt;/u&gt; and &lt;u&gt;5 peso coins.&lt;/u&gt;&amp;nbsp;With 5 samples and also 5 test images, I employ LDA to the test images. The feature identified I chose is color, so that it would be easy to test.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Ruj9ZBBYPrw/Tpf_6r8th9I/AAAAAAAAAQU/pMEtrqIVTOg/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-Ruj9ZBBYPrw/Tpf_6r8th9I/AAAAAAAAAQU/pMEtrqIVTOg/s1600/2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 1. Result of Linear Discriminant Analysis&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Fig. 1 shows the results of LDA. The 1st set of &lt;i&gt;f&lt;/i&gt; corresponds to the cards, while the 2nd set corresponds to the 5-peso coins test images. The results showed a 100% rate in correctly identifying the test images. This may be due to my decision to use color as feature, because the five-peso coins are tarnished gold while the cards are &amp;nbsp;red.&lt;br /&gt;&lt;br /&gt;Self-Assesment: 10/10&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-4492785284974622?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/4492785284974622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/10/xvi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/4492785284974622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/4492785284974622'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/10/xvi.html' title='XVI'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-LIpTbrVv30E/Tpf9BANM-II/AAAAAAAAAQM/3fGP5nVb3VA/s72-c/eqn.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-3017993187613323805</id><published>2011-09-22T07:01:00.000-07:00</published><updated>2011-10-13T17:06:13.809-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='G'/><title type='text'>XIV</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: left;"&gt;In this activity, the use of Normalized Chromaticity Coordinates (NCC) gives us an advantage since it can separate brightness and chromaticity.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-jyFT-CQaeEc/TnsuNoMIddI/AAAAAAAAAPc/MSUvIeXOfAs/s1600/color1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-jyFT-CQaeEc/TnsuNoMIddI/AAAAAAAAAPc/MSUvIeXOfAs/s1600/color1.png" /&gt;&lt;/a&gt;&amp;nbsp;(1)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Eq. 1 shows the normalization where I is the sum of all channels. We can now write &lt;i&gt;b=1-r-g&lt;/i&gt;, and thus the mapping is reduced to 2 dimensions.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-FbLP1qlLhL8/TnsuNJnq2uI/AAAAAAAAAPY/FK18LcqyDQ0/s1600/color.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-FbLP1qlLhL8/TnsuNJnq2uI/AAAAAAAAAPY/FK18LcqyDQ0/s1600/color.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 2. NCC space, x is &lt;i&gt;r&lt;/i&gt; and y is &lt;i&gt;g&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Fig. 2 shows the reduced space. Notice that the blue is when &lt;i&gt;r&lt;/i&gt; and &lt;i&gt;g&lt;/i&gt; is zero.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-cM1VOgpJ9qg/TnsuMYWmrfI/AAAAAAAAAPQ/AjtnvcbFfW4/s1600/2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-cM1VOgpJ9qg/TnsuMYWmrfI/AAAAAAAAAPQ/AjtnvcbFfW4/s200/2.jpg" width="129" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-NfpqTsUUNjg/TnsuMpA-4RI/AAAAAAAAAPU/L6nAWvt0HTQ/s1600/3-roi.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-NfpqTsUUNjg/TnsuMpA-4RI/AAAAAAAAAPU/L6nAWvt0HTQ/s1600/3-roi.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 3. Top: Reference image. Bottom: &amp;nbsp;Region of Interest (ROI)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Fig. 3 shows the images that will be used in the next activities.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;u&gt;Parametric Probability Distribution Estimation&lt;/u&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This method uses the NCC of the image's ROI and then fits it in a Gaussian distribution to determine the probability that a pixel is indeed a part of the ROI.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-UL2NFK_Dpdg/TnsuOMomBxI/AAAAAAAAAPg/XAzaw-I3M08/s1600/color2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-UL2NFK_Dpdg/TnsuOMomBxI/AAAAAAAAAPg/XAzaw-I3M08/s1600/color2.png" /&gt;&lt;/a&gt;&amp;nbsp;(2)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The actual probability used is of course dependent for the 2 channels. This is called the joint probability, &lt;i&gt;p(r)*p(g)&lt;/i&gt;. Knowing this, we search for the pixels in the &lt;b&gt;whole&lt;/b&gt; image (not the ROI only) that is within the joint probability for the ROI.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-F4U1KeZc-cA/TnsuPp6cbPI/AAAAAAAAAPo/gSYK5lmzJRo/s1600/para+%25280pt5%2529.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-F4U1KeZc-cA/TnsuPp6cbPI/AAAAAAAAAPo/gSYK5lmzJRo/s320/para+%25280pt5%2529.bmp" width="207" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 3. Resulting image of the Parametric method&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;u&gt;Non-Parametric Probability Distribution Estimation&lt;/u&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This method involves backprojecting the known histogram of the ROI to the new estimated image. The algorithm is partly similar to the Parametric method but instead of using the joint probability, the method is reversed to associate pixels to a blank matrix from the known 2D histogram of the ROI.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-uMzYuoNh1pk/TnsuO6xMwEI/AAAAAAAAAPk/Ww78TYj-1Hw/s1600/non-para.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-uMzYuoNh1pk/TnsuO6xMwEI/AAAAAAAAAPk/Ww78TYj-1Hw/s320/non-para.bmp" width="207" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 4. Resulting image of the Non-Parametric method&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;From the Figs. 3 and 4, we notice that the Parametric method produced a more even and connected image since it has a Gaussian distribution for the PDF while the Non-Parametric method used only direct histogram to image (ROI to whole) backprojection to estimate the association of a certain pixel.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Self-Assessment: 9/10&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; 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/7535750636146573043-3017993187613323805?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/3017993187613323805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/09/xiv.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/3017993187613323805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/3017993187613323805'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/09/xiv.html' title='XIV'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-jyFT-CQaeEc/TnsuNoMIddI/AAAAAAAAAPc/MSUvIeXOfAs/s72-c/color1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-8375636566232184440</id><published>2011-09-22T04:05:00.000-07:00</published><updated>2011-10-13T17:06:01.309-07:00</updated><title type='text'>XIII</title><content type='html'>Image compression is a vital tool for getting a compromise between quality and file size of our images. This activity uses Principal Component Analysis results to represent images as a superposition of weighted eigenvectors.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-gbVU6Bm1Zq0/Tnrhs-98wtI/AAAAAAAAAPM/5bEvad1EK7A/s1600/orig.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-gbVU6Bm1Zq0/Tnrhs-98wtI/AAAAAAAAAPM/5bEvad1EK7A/s200/orig.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 1. Original Image&lt;/div&gt;&lt;br /&gt;Fig. 1 shows the original image that will be used for demonstrating image compression. To simplify things, I will use the grayscale version of the image to flatten the hypermatrix to a normal matrix.&lt;br /&gt;&lt;br /&gt;Now, the method works by cutting the image to 10x10 px segments and converting it to a single column, thus we end up with a 100 element column for every 10x10 segment. We do this again for all segments so we end up with a nxp matrix where n is the number of segments and p is the number of elements per block. After that, we now use the &lt;i&gt;pca()&lt;/i&gt;&amp;nbsp;function to this.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-4eUVtuXSYc0/Tnrhjd7PYgI/AAAAAAAAAO8/oBfqByVyqa8/s1600/correlations_circle.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="241" src="http://1.bp.blogspot.com/-4eUVtuXSYc0/Tnrhjd7PYgI/AAAAAAAAAO8/oBfqByVyqa8/s320/correlations_circle.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-YDsHlRci5CI/TnrhpV2KN2I/AAAAAAAAAPE/-hjnyJNC7kk/s1600/eigenvalues.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="241" src="http://1.bp.blogspot.com/-YDsHlRci5CI/TnrhpV2KN2I/AAAAAAAAAPE/-hjnyJNC7kk/s320/eigenvalues.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-65uOqeE1QiQ/TnrhlkmhpsI/AAAAAAAAAPA/J75A8GB-i9I/s1600/eigenimage.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-65uOqeE1QiQ/TnrhlkmhpsI/AAAAAAAAAPA/J75A8GB-i9I/s1600/eigenimage.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 2. Top-Bottom: Correlation Circle, Eigenvalue distribution and Eigenimages&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;The output of &lt;i&gt;pca() &lt;/i&gt;has eigenvectors and principal components. By adjusting the amount of elements that is multiplied (eigenvectors and principal components), we also vary the compression of the method. Then this is reassembled back to the matrix size of our image.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-u4ks5N2icYU/TnrhhU6LakI/AAAAAAAAAO4/AtKkQUbyjG4/s1600/collection.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://2.bp.blogspot.com/-u4ks5N2icYU/TnrhhU6LakI/AAAAAAAAAO4/AtKkQUbyjG4/s640/collection.jpg" width="252" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 3. Images &lt;i&gt;a-i&lt;/i&gt; corresponds to original then 2, 5, 10, 15, 20, 25, 50, and 70 Eigenvector &amp;amp; Principal Components pairs &amp;nbsp;&lt;/div&gt;&lt;br /&gt;Fig 3. shows the resulting quality of images from the compression technique that is used in this work. There is a total of 100 available eigenvectors that can be used so the original image is equal to a full 100 of those pairs used.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-sJOdRT1g96k/TnrhqJwAvYI/AAAAAAAAAPI/KP5epvIEFCE/s1600/graph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://3.bp.blogspot.com/-sJOdRT1g96k/TnrhqJwAvYI/AAAAAAAAAPI/KP5epvIEFCE/s320/graph.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 4. Graph of file size vs eigenvector-principal component pairs used&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Fig 4. illustrates that the maximum slope is at the 0-20 eigenvector region. This is then the most optimal setting, file size wise, in which there is a sharp decrease.&lt;br /&gt;&lt;br /&gt;Self-Assessment: 10/10&amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-8375636566232184440?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/8375636566232184440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/09/xiii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/8375636566232184440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/8375636566232184440'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/09/xiii.html' title='XIII'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-gbVU6Bm1Zq0/Tnrhs-98wtI/AAAAAAAAAPM/5bEvad1EK7A/s72-c/orig.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-8842899092566439629</id><published>2011-09-06T00:08:00.000-07:00</published><updated>2011-10-13T17:05:48.057-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='A'/><title type='text'>XII</title><content type='html'>Preprocessing text is one real-world application for the image processing techniques that we have previously learned. For this activity, I have binarized handwritten text and performed template matching to find words within the document.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-uNIDJgPVva0/TmW5Nj95ZBI/AAAAAAAAAOE/rzRm7NRdvyE/s1600/Untitled_0001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-uNIDJgPVva0/TmW5Nj95ZBI/AAAAAAAAAOE/rzRm7NRdvyE/s320/Untitled_0001.jpg" width="256" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 1. Original image&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-pZq_0APoFGg/TmW5RfGsu1I/AAAAAAAAAOI/xknpyaM2gs4/s1600/1+roi2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-pZq_0APoFGg/TmW5RfGsu1I/AAAAAAAAAOI/xknpyaM2gs4/s1600/1+roi2.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 2. Region of Interest&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-v_M8QfnndbY/TmW5SJYhmGI/AAAAAAAAAOM/VEyjFZgTB3I/s1600/2roi_fft2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-v_M8QfnndbY/TmW5SJYhmGI/AAAAAAAAAOM/VEyjFZgTB3I/s1600/2roi_fft2.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 3. 2D Fourier Transform of Fig. 2&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-794n2NkFXGk/TmW5Sy7Jx1I/AAAAAAAAAOU/vVn7y3ptXQs/s1600/4+linrmv_orig.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-794n2NkFXGk/TmW5Sy7Jx1I/AAAAAAAAAOU/vVn7y3ptXQs/s1600/4+linrmv_orig.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 4. Filtered Fourier Transform of Fig. 3&lt;/div&gt;&lt;br /&gt;Figs. 2-3 show my attempt in removing the lines from the image. Due to the low resolution and noise of the original image, filtering in the frequency domain did not fully remove the line in the image. For me to continue to the binarization of the text, I manually removed the remaining gray-ish parts.&lt;br /&gt;&lt;br /&gt;To facilitate the binarization, morphological transformation was implemented through the &lt;i&gt;close&lt;/i&gt;&amp;nbsp;and &lt;i&gt;skel&amp;nbsp;&lt;/i&gt;operations.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-R68HJpE2n0o/TmW5UE7AHqI/AAAAAAAAAOc/egpirEAh8OE/s1600/6+res1.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-R68HJpE2n0o/TmW5UE7AHqI/AAAAAAAAAOc/egpirEAh8OE/s1600/6+res1.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 4. After operating &lt;i&gt;close&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;&lt;a href="http://1.bp.blogspot.com/-4R13-pnF71U/TmW5WIZ95QI/AAAAAAAAAOk/k2lelwc905g/s1600/8+skel_crop.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-4R13-pnF71U/TmW5WIZ95QI/AAAAAAAAAOk/k2lelwc905g/s1600/8+skel_crop.bmp" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 5. &amp;nbsp;After operating &lt;i&gt;skel()&lt;/i&gt;&amp;nbsp;on Fig. 4&lt;/div&gt;&lt;br /&gt;Fig. 5 shows the final preprocessed image. The "M" and "O" cannot be identified properly, but the "D", "E" and the "III" are still good. The quality of binarization is of course dependent on the quality of the original handwritten text. Due to the thinning strokes, the letters "M" and "O" were damaged by the processing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-7Dd4asiMnOc/TmXEcUvBygI/AAAAAAAAAOo/-sHX7ZO6D38/s1600/3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-7Dd4asiMnOc/TmXEcUvBygI/AAAAAAAAAOo/-sHX7ZO6D38/s1600/3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 6. Template&lt;/div&gt;&lt;br /&gt;To end this, I finally do template correlation. Using &lt;i&gt;imcorrcoef()&lt;/i&gt;, I tried to find other instances of the word "DESCRIPTION" in the image (Fig. 1). However, I was only able to find the same spot where my template came from.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-rmmkGwWsFhQ/TmXGWkyJzmI/AAAAAAAAAOw/xRp7pbgvanc/s1600/6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-rmmkGwWsFhQ/TmXGWkyJzmI/AAAAAAAAAOw/xRp7pbgvanc/s320/6.jpg" width="257" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 7. &lt;i&gt;imcorrcoef()&lt;/i&gt; result.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Fig. 7 shows the result. Notice the white dot in the right side. This is the approximated location of the match of the used template from &lt;i&gt;imcorrcoef().&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&amp;nbsp; Self-Assessment: 7/10&amp;nbsp; &amp;nbsp;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-8842899092566439629?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/8842899092566439629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/09/xii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/8842899092566439629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/8842899092566439629'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/09/xii.html' title='XII'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-uNIDJgPVva0/TmW5Nj95ZBI/AAAAAAAAAOE/rzRm7NRdvyE/s72-c/Untitled_0001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-6605481510184326009</id><published>2011-08-25T04:47:00.000-07:00</published><updated>2011-10-13T17:05:38.962-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='L'/><title type='text'>XI</title><content type='html'>Let's be sonically active. This activity challenges our skills in culminating all the image processing tricks to convert an image of a sheet music to actual sound.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-N7bObhRMqEY/TlYIj3A8xuI/AAAAAAAAANo/yyGaGz4_apc/s1600/score.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="82" src="http://4.bp.blogspot.com/-N7bObhRMqEY/TlYIj3A8xuI/AAAAAAAAANo/yyGaGz4_apc/s640/score.bmp" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. First 2 measures of "London Bridge Is Falling Down"&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Fig. 1 shows the sheet excerpt that was used for this activity. These two bars contains 4 elements: the G-clef, the time signature symbol, the quarter notes, and quarter rests. We need not concern ourselves with the first two, since I will only be extracting a simple monotonic sound and not a full blown sound complete with timbre and accent. To have a distinction between the quarter notes and rests, I used template matching by correlation that we tackled in &lt;a href="http://ap186.blogspot.com/2011/07/vi.html"&gt;Activity 6.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-fVegdC6UbdI/TlYOLa6iAPI/AAAAAAAAAN8/uvlVjyItWJM/s1600/3.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="81" src="http://4.bp.blogspot.com/-fVegdC6UbdI/TlYOLa6iAPI/AAAAAAAAAN8/uvlVjyItWJM/s640/3.bmp" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. Thresholded image after correlation with a quarter note image&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-zZnOvuQJA2g/TlYOKoiHA5I/AAAAAAAAAN4/Tjvx-ivBUpg/s1600/2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;img border="0" height="82" src="http://2.bp.blogspot.com/-zZnOvuQJA2g/TlYOKoiHA5I/AAAAAAAAAN4/Tjvx-ivBUpg/s640/2.bmp" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 3. Thresholded image after correlation with a quarter rest image&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;a href="http://1.bp.blogspot.com/-MkIUXiQqNL0/TlYOKG9F0VI/AAAAAAAAAN0/Zo9tF-JGQG8/s1600/1.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="82" src="http://1.bp.blogspot.com/-MkIUXiQqNL0/TlYOKG9F0VI/AAAAAAAAAN0/Zo9tF-JGQG8/s640/1.bmp" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 4. Combined image of the quarter notes and rests positions&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;After the correlation, I thresholded the resulting images so that only the brightest spots remain. This means that I am selecting the region that is most correlated with my pattern image. Fig. 2 and 3 shows the result for the quarter notes and rests.&amp;nbsp;Fig. 4 shows the combined image for notes and rests. The sequence of Fig. 4 is in reverse, which means I have to rotate it by 180 degrees to acquaint it with Fig. 1. This is due to the &lt;i&gt;fftshift(). T&lt;/i&gt;hat fact is taken into account for all the sorting that I have done in this work.&lt;br /&gt;&lt;br /&gt;From this, I have properly identified the coordinates of the spots that correspond to quarter notes and quarter rests. This showcases the ability of the code to distinguish entities found in the music sheet. In&amp;nbsp;assigning the specific notes,&amp;nbsp;I do a&amp;nbsp;&lt;i&gt;for&lt;/i&gt;&amp;nbsp;loop for the various x ranges (height in the image) because this identifies the specific note value of our quarter notes. For the rests, the height range is not important since they don't have a frequency value, only a time value. This translates to a dependence for its L-R placement, but not the height placement, unlike the notes that needs both. To simulate a pause, I use 44 kHz since this is well beyond the range of human hearing. Sequencing the results finally generates the melody:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.4shared.com/audio/tYsuighx/london_bridge.html"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;sample.wav&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;It is now easy to improve this code since I have already generalized its identification capabilities. Further work is needed in automatizing the x range selection for the note values.&lt;br /&gt;&lt;br /&gt;Self-Assessment: 10/10&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-6605481510184326009?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/6605481510184326009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/08/xi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/6605481510184326009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/6605481510184326009'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/08/xi.html' title='XI'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-N7bObhRMqEY/TlYIj3A8xuI/AAAAAAAAANo/yyGaGz4_apc/s72-c/score.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-6734669974563713044</id><published>2011-08-13T10:05:00.000-07:00</published><updated>2011-10-13T17:05:30.334-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='R'/><title type='text'>X</title><content type='html'>Binary operations can be used for size estimation, due to it's independency on details. Regions of interest (ROI) are separated by edge detection methods and morphological operations were used to enhance the binarized image. This improves the information obtained from the data.&lt;br /&gt;&lt;br /&gt;This activity culminates various techniques that we have learned before for area estimation of "cells". This enables us to sort out possible "cancerous cells" via image manipulation.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-8WotrEaDLwY/TkN5mHyntBI/AAAAAAAAANM/FLjlTA6LDAg/s1600/1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/-8WotrEaDLwY/TkN5mHyntBI/AAAAAAAAANM/FLjlTA6LDAg/s400/1.jpg" width="317" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. Image of sample "cells"&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Fig. 1 shows our test image. This is a snapshot of paper cut to circles. The main idea is to binarize this using its histograms, and then perform &lt;i&gt;opening&lt;/i&gt; and &lt;i&gt;closing&lt;/i&gt; transforms.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-GEc4pY8MOA0/TkN7dX8hWmI/AAAAAAAAANU/JVGgEZ6Agaw/s1600/close.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-GEc4pY8MOA0/TkN7dX8hWmI/AAAAAAAAANU/JVGgEZ6Agaw/s1600/close.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: right;"&gt;(1)&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-M760J02I19w/TkN7fbXi5bI/AAAAAAAAANY/3zNtIo2x62w/s1600/open.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-M760J02I19w/TkN7fbXi5bI/AAAAAAAAANY/3zNtIo2x62w/s1600/open.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: right;"&gt;(2)&lt;/div&gt;&lt;i&gt;Closing&lt;/i&gt; (eq. 1)&lt;i&gt;&amp;nbsp;&lt;/i&gt;is done by erosion of matrix A with pattern B, then the resulting image is dilated with pattern B. Reversing the process constitutes to &lt;i&gt;opening&lt;/i&gt; (eq. 2).&lt;br /&gt;&lt;br /&gt;Operating these two methods on Fig. 1 yielded Fig. 2:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ADObZc6JVXg/TkN5m3CxCGI/AAAAAAAAANQ/udWWFhQ1OBQ/s1600/collection.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-ADObZc6JVXg/TkN5m3CxCGI/AAAAAAAAANQ/udWWFhQ1OBQ/s1600/collection.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. Result of performing &lt;i&gt;opening&lt;/i&gt; and &lt;i&gt;closing&lt;/i&gt;&amp;nbsp;of the image in Fig. 1.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Note that the image was divided to 7 segments to have different ROIs.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Fig. 2 was generated by using a circle (r=10px) as &lt;i&gt;erode()&lt;/i&gt;/&lt;i&gt;dilate()&lt;/i&gt; pattern. Fig. 2 shows that &lt;i&gt;opening &lt;/i&gt;is more viable for our image since we want to improve gap areas and to have a better view on the stacked cells. It also removed some deformed images, due to &lt;i&gt;erosion&lt;/i&gt; being the first operator for &lt;i&gt;open&lt;/i&gt;.&amp;nbsp;&lt;i&gt;Closing &lt;/i&gt;though&amp;nbsp;could possibly improve cut segments.&amp;nbsp;To find the average area of the cells, I have selected the Opened images row 1,3 and 4. These were the ones selected since the separation between the cells are, at most well, defined. Using &lt;i&gt;bwlabel()&lt;/i&gt; to separate closed clusters of &amp;nbsp;data, the averaged value is&amp;nbsp;&lt;b&gt;520px/cell.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;Finally, we tackle the 2nd image for this activity. This time, our image has 5 cells that are bigger than the rest. To separate these, we implement this process:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Convert image to black and white&lt;/li&gt;&lt;li&gt;Perform &lt;i&gt;opening&lt;/i&gt; transform&lt;/li&gt;&lt;li&gt;Using &lt;i&gt;bwlabel()&lt;/i&gt;, obtain the average cell size&lt;/li&gt;&lt;li&gt;Those clusters that exceed the average value are zeroed out.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;This method returns an image that has only the cancerous cells retained, thus easily identifying them based from the original image.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-tQyd5yrfYvM/TkZqfV2EUZI/AAAAAAAAANc/nJZ4Oxy9pxs/s1600/cancer_open_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="260" src="http://4.bp.blogspot.com/-tQyd5yrfYvM/TkZqfV2EUZI/AAAAAAAAANc/nJZ4Oxy9pxs/s640/cancer_open_1.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 3. Image a)after and b) before operating &lt;i&gt;open&lt;/i&gt;. The pattern was a circle with radius of 14px.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Fig. 3 shows the transformed image. The transformation actually cleaned the black and white converted image, because there were some remnant white blots due to the thresholding.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-QGepeAx_i6U/TkatFoLVEAI/AAAAAAAAANk/KeYtacqAk3A/s1600/collect2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="262" src="http://2.bp.blogspot.com/-QGepeAx_i6U/TkatFoLVEAI/AAAAAAAAANk/KeYtacqAk3A/s640/collect2.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 4. a) Before and b) after filtering the &lt;i&gt;open&lt;/i&gt;&lt;i&gt;ed&lt;/i&gt;&lt;i&gt; &lt;/i&gt;image.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Fig. 4 shows the result of the filtering. The colored blobs in Fig. 4a indicate those that are removed, as can be observed in Fig. 4b. The red ones are the supposed "cancerous" cells while the green ones are those that are removed due to overlapping. The filtering was a partial success because it was able to sort out all 5 of the target "big, cancerous" cells, however, the overlapping blobs were also removed. I suggest that in the future, edge detection can be used to discriminate indivual cells among a collection of overlapped ones.&lt;br /&gt;&lt;br /&gt;&amp;nbsp; Self-Assessment: 9/10&amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-6734669974563713044?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/6734669974563713044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/08/x.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/6734669974563713044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/6734669974563713044'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/08/x.html' title='X'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-8WotrEaDLwY/TkN5mHyntBI/AAAAAAAAANM/FLjlTA6LDAg/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-1831820844450536622</id><published>2011-07-30T00:49:00.000-07:00</published><updated>2011-10-13T17:05:17.858-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='A'/><title type='text'>IX</title><content type='html'>&lt;div siber__q92dpb7seovvtbh5__vptr="45685e0" sourceindex="4"&gt;Morphological operations uses Set Theory to manipulate matrices. Since we now know that images are just matrices of values with layers of channels, it is appropriate that certain algorithms can be devised to do morphological operations with pictures.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="4505a80" sourceindex="5"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="4505000" sourceindex="6" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="455e250" sourceindex="7"&gt;This activity deals primarily with some basic shape alteration and recognition. For basic operations, binary "flattened" versions of multi-chanelled images are used. To start off, let's examine how these 2 operations work.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="455e250" sourceindex="7"&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote siber__q92dpb7seovvtbh5__vptr="455e290" sourceindex="8"&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="452d440" sourceindex="9"&gt;Note:&amp;nbsp;Since the images are in their binary form, &lt;b siber__q92dpb7seovvtbh5__vptr="4505780" sourceindex="10"&gt;zeros are considered as background&lt;/b&gt; while &lt;b siber__q92dpb7seovvtbh5__vptr="4505200" sourceindex="11"&gt;ones are the object&lt;/b&gt;. Background is ignored by the operations, and is thus useful since the operations would only work if the matrices compared have the same dimensions.&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="45052d0" sourceindex="12"&gt;First, &lt;b siber__q92dpb7seovvtbh5__vptr="45053f0" sourceindex="13"&gt;matrix A (one containing the original pattern)&lt;/b&gt; is scanned with another&lt;b siber__q92dpb7seovvtbh5__vptr="453d790" sourceindex="14"&gt; matrix B (one containing the mask)&lt;/b&gt;.&amp;nbsp;Then, a new zero &lt;b siber__q92dpb7seovvtbh5__vptr="4505cf0" sourceindex="15"&gt;matrix C (transformed image)&lt;/b&gt; with the same dimensions as matrix A &amp;amp; B are mapped depending on the operation used:&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="4505600" sourceindex="16"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="4505a60" sourceindex="17" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="455e470" sourceindex="18"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="4505e70" sourceindex="19" /&gt;&lt;/div&gt;&lt;ul siber__q92dpb7seovvtbh5__vptr="4505900" sourceindex="20"&gt;&lt;li siber__q92dpb7seovvtbh5__vptr="f0b670" sourceindex="21"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="4505c80" sourceindex="22"&gt;erosion: &lt;/i&gt;All coordinates of the anchor point for when the mask is entirely enclosed by the object is set to one in matrix C.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="4505510" sourceindex="23"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="4505100" sourceindex="24" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="4505a50" sourceindex="25" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-XB5gTEf_F68/TjOQwH3XLpI/AAAAAAAAAMg/k3it0WWQD54/s1600/eq2.png" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="44f30e0" sourceindex="26" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="128" siber__q92dpb7seovvtbh5__vptr="44f3a80" sourceindex="27" src="http://2.bp.blogspot.com/-XB5gTEf_F68/TjOQwH3XLpI/AAAAAAAAAMg/k3it0WWQD54/s400/eq2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="4505680" sourceindex="28" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="45058c0" sourceindex="29" style="font-size: x-small;"&gt;Figure 1. Erosion. The anchor point is the center of matrix B.&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="45057a0" sourceindex="30"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45335f0" sourceindex="31" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0b210" sourceindex="32"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0b320" sourceindex="33" /&gt;&lt;/div&gt;&lt;ul siber__q92dpb7seovvtbh5__vptr="f0b6f0" sourceindex="34"&gt;&lt;li siber__q92dpb7seovvtbh5__vptr="4505aa0" sourceindex="35"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="f0b780" sourceindex="36"&gt;dilation&lt;/i&gt;:&amp;nbsp;All coordinates of the anchor point for when at least one element of the mask intersects with the object is set to one.&lt;/li&gt;&lt;/ul&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0be30" sourceindex="37"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0b250" sourceindex="38" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="f0b0f0" sourceindex="39" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-SthUq2xgJPQ/TjOQplO6peI/AAAAAAAAAMc/MBjiEzYcriQ/s1600/eq1.png" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="452d850" sourceindex="40" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="130" siber__q92dpb7seovvtbh5__vptr="452d100" sourceindex="41" src="http://1.bp.blogspot.com/-SthUq2xgJPQ/TjOQplO6peI/AAAAAAAAAMc/MBjiEzYcriQ/s400/eq1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="4505ff0" sourceindex="42" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="f0b220" sourceindex="43" style="font-size: x-small;"&gt;Figure 2. Dilation.&amp;nbsp;The anchor point is the center of matrix B.&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0b930" sourceindex="44"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="4505020" sourceindex="45" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0b2e0" sourceindex="46"&gt;Thus, the anchor element of the mask in matrix B determines how the transformed image will be shifted in matrix C with respect to matrix A.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0bef0" sourceindex="47"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0b3a0" sourceindex="48" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0bb10" sourceindex="49"&gt;Using&amp;nbsp;&lt;b siber__q92dpb7seovvtbh5__vptr="f0ba20" sourceindex="50"&gt;4 original patterns&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b siber__q92dpb7seovvtbh5__vptr="f0bf80" sourceindex="51"&gt;5 masks&lt;/b&gt;,&amp;nbsp;&lt;i siber__q92dpb7seovvtbh5__vptr="f0b710" sourceindex="52"&gt;erosion&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i siber__q92dpb7seovvtbh5__vptr="f0bb60" sourceindex="53"&gt;dilation&lt;/i&gt; are employed and their effects were observed. The anchor points for the masks are as follows:&lt;br /&gt;&lt;ol align="justify"&gt;&lt;li&gt;&lt;b&gt;2x2 square:&lt;/b&gt; Top-left pixel&lt;/li&gt;&lt;li&gt;&lt;b&gt;2x1: &lt;/b&gt;Top pixel&lt;/li&gt;&lt;li&gt;&lt;b&gt;1x3:&lt;/b&gt; Left pixel&lt;/li&gt;&lt;li&gt;&lt;b&gt;3x3 cross:&lt;/b&gt; Top-most pixel&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0b350" sourceindex="54"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0bae0" sourceindex="55" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0bf40" sourceindex="56"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0bbe0" sourceindex="57" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="f0bcd0" sourceindex="58" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-mn4FoseBsBw/TjOdkPcDvGI/AAAAAAAAAMo/ZT7aP5UCKIM/s1600/orig.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="f0b860" sourceindex="59" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="4505d70" sourceindex="60" src="http://2.bp.blogspot.com/-mn4FoseBsBw/TjOdkPcDvGI/AAAAAAAAAMo/ZT7aP5UCKIM/s1600/orig.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="f0bc90" sourceindex="61" style="clear: both; text-align: justify;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="f0bf90" sourceindex="62" style="font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Figure 3. Original Patterns: 5x5 square, 3x4 right triangle, 10x10 square annulus 2 pixels thick, 5x5 cross&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="f0b160" sourceindex="63" style="clear: both; text-align: justify;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="f0bb00" sourceindex="64" style="font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mask:&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="e2c9e0" sourceindex="65" style="font-size: x-small;"&gt;2x2 square, 2x1 , 1x2, 3x3 cross and a 2 pixel long diagonal.&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0bfd0" sourceindex="66"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0b1a0" sourceindex="67" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0bff0" sourceindex="68"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0bed0" sourceindex="69" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0b560" sourceindex="70"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0b470" sourceindex="71" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f0b0e0" sourceindex="72"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="e2c980" sourceindex="73" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="f0b150" sourceindex="74"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="e2ccc0" sourceindex="75"&gt;erode()&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="e2ce90" sourceindex="76" style="clear: both; text-align: center;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="f0bd70" sourceindex="77" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="f0b940" sourceindex="78" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-RF1AOdwBL0g/TjOdAMwWqpI/AAAAAAAAAMk/dTh56II6Cdk/s1600/collect_erode.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="e2c8e0" sourceindex="79" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="e2cfb0" sourceindex="80" src="http://2.bp.blogspot.com/-RF1AOdwBL0g/TjOdAMwWqpI/AAAAAAAAAMk/dTh56II6Cdk/s1600/collect_erode.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="e2c450" sourceindex="81" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="f0b3d0" sourceindex="82" style="font-size: x-small;"&gt;Figure 4. My hand drawn predictions for erosion.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="e2c690" sourceindex="83" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="f0b0d0" sourceindex="84" style="font-size: x-small;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="eb5500" sourceindex="85" /&gt; &lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="e2cd00" sourceindex="86"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="e2cb30" sourceindex="87" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="e2cf50" sourceindex="88"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="e2c950" sourceindex="89" /&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="e2ca40" sourceindex="90" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-ajXdLgvi0OE/TjOfowhz4qI/AAAAAAAAAMw/SWlVjxxFgPw/s1600/collect1_erode.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="e2c570" sourceindex="91" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="f0bc00" sourceindex="92" src="http://2.bp.blogspot.com/-ajXdLgvi0OE/TjOfowhz4qI/AAAAAAAAAMw/SWlVjxxFgPw/s1600/collect1_erode.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="e2ca30" sourceindex="93" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="e2c5d0" sourceindex="94" style="font-size: x-small;"&gt;Figure 5. scilab's &lt;i siber__q92dpb7seovvtbh5__vptr="f0ba30" sourceindex="95"&gt;erode() &lt;/i&gt;operator results.&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="eb5ba0" sourceindex="96"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="eb50a0" sourceindex="97" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="eb52f0" sourceindex="98"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="e2c960" sourceindex="99" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="e2c6d0" sourceindex="100"&gt;My prediction would've been perfect if not for my careless error on the diagonal mask of the square annulus. However, I now fully understand how erosion works. Since erosion "trims" by fitting the mask entirely, it is possible to have completely blank images. We can see this with the cross mask for the 3x4 triangle and the 2x2 mask for the 5x5 cross patterns.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="eb5470" sourceindex="101"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="eb5410" sourceindex="102" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="eb51e0" sourceindex="103"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="e2c620" sourceindex="104" /&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="eb5280" sourceindex="105"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="e2c780" sourceindex="106" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="eb52d0" sourceindex="107"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="eb5670" sourceindex="108"&gt;dilate()&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="e2cbd0" sourceindex="109" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-91nDhwQO0c8/TjOtOhtq_QI/AAAAAAAAAM0/F3120y36iQI/s1600/collect_dilate.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="e2ca10" sourceindex="110" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="eb5a20" sourceindex="111" src="http://1.bp.blogspot.com/-91nDhwQO0c8/TjOtOhtq_QI/AAAAAAAAAM0/F3120y36iQI/s1600/collect_dilate.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="eb5a30" sourceindex="112" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="eb53e0" sourceindex="113" style="font-size: x-small;"&gt;Figure 6. My hand drawn predictions for erosion.&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="eb56b0" sourceindex="114"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="eb56c0" sourceindex="115" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="eb5d10" sourceindex="116" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-BoxGjJYPO_s/TjOtPyHCBEI/AAAAAAAAAM4/zo4jp-DbGBg/s1600/collect1_dilate.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="ee1500" sourceindex="117" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="eb5780" sourceindex="118" src="http://3.bp.blogspot.com/-BoxGjJYPO_s/TjOtPyHCBEI/AAAAAAAAAM4/zo4jp-DbGBg/s1600/collect1_dilate.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="eb5b00" sourceindex="119" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="eb5dd0" sourceindex="120" style="font-size: x-small;"&gt;Figure 7. s&lt;/span&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="ee1de0" sourceindex="121" style="font-size: x-small;"&gt;cilab's &lt;i siber__q92dpb7seovvtbh5__vptr="eb59f0" sourceindex="122"&gt;dilat&lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="e2c660" sourceindex="123" style="font-size: x-small;"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="eb51c0" sourceindex="124"&gt;e()&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="eb5450" sourceindex="125" style="font-size: x-small;"&gt;operator results.&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="eb5720" sourceindex="126"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="e2cd30" sourceindex="127" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="ee15d0" sourceindex="128"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ee12c0" sourceindex="129" /&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ee18f0" sourceindex="130"&gt;Again, like with my erosion predictions, this would've been perfect if not for the 1x2 mask of the square annulus.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="eb5010" sourceindex="131"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="eb57b0" sourceindex="132" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="ee1980" sourceindex="133"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ee1680" sourceindex="134" /&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ee1180" sourceindex="135"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="ee12d0" sourceindex="136" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="ee11d0" sourceindex="137"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="eb5bd0" sourceindex="138" /&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ee15a0" sourceindex="139"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="ee11c0" sourceindex="140" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="ee1740" sourceindex="141"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="eb57f0" sourceindex="142"&gt;thin()&lt;/i&gt; &amp;amp; &lt;i siber__q92dpb7seovvtbh5__vptr="ee1190" sourceindex="143"&gt;skel()&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ee1010" sourceindex="144"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="eb5b60" sourceindex="145" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="ee1b00" sourceindex="146"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ee1390" sourceindex="147" /&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ee1170" sourceindex="148"&gt;Lastly, I examine the&lt;i siber__q92dpb7seovvtbh5__vptr="ebbab0" sourceindex="149"&gt; thin()&lt;/i&gt; and &lt;i siber__q92dpb7seovvtbh5__vptr="ee10c0" sourceindex="150"&gt;skel()&lt;/i&gt; operators of scilab. These are more complex than the &lt;i siber__q92dpb7seovvtbh5__vptr="ee1720" sourceindex="151"&gt;erode()&lt;/i&gt; and &lt;i siber__q92dpb7seovvtbh5__vptr="ee1640" sourceindex="152"&gt;dilate()&lt;/i&gt; operators. From the help file, the implementation of &lt;i siber__q92dpb7seovvtbh5__vptr="ebb440" sourceindex="153"&gt;thin()&lt;/i&gt; on an image of text produces:&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="ee18a0" sourceindex="154" style="clear: both; text-align: center;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="eb5d20" sourceindex="155" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="ee1510" sourceindex="156" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-HLSMXD6ycGE/TjOyf1rAWWI/AAAAAAAAANE/THHzNVWFy8U/s1600/collect2.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="ee1270" sourceindex="157" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="ee19a0" sourceindex="158" src="http://3.bp.blogspot.com/-HLSMXD6ycGE/TjOyf1rAWWI/AAAAAAAAANE/THHzNVWFy8U/s1600/collect2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="ee18e0" sourceindex="159" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="ebbbc0" sourceindex="160" style="font-size: x-small;"&gt;Figure 8. Above: Original image. Below:&amp;nbsp;&lt;i siber__q92dpb7seovvtbh5__vptr="ebb410" sourceindex="161"&gt;thin()&lt;/i&gt; results&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="ebbd50" sourceindex="162" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="ee1240" sourceindex="163" style="font-size: x-small;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ee1300" sourceindex="164" /&gt; &lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ebb710" sourceindex="165"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="ebb660" sourceindex="166"&gt;thin()&lt;/i&gt;&amp;nbsp;seems to trace lines and curves by "thinning" them until they are only one pixel wide. The deviations from straight lines came as a consequence of not using a perfectly binary image. The above image was just converted using &lt;i siber__q92dpb7seovvtbh5__vptr="ebb640" sourceindex="167"&gt;im2bw(), &lt;/i&gt;in which the conversion led to some unstraightened lines when &lt;i siber__q92dpb7seovvtbh5__vptr="ebb810" sourceindex="168"&gt;thin()&lt;/i&gt;&amp;nbsp;was used.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ebb6b0" sourceindex="169"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ee1110" sourceindex="170" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ebbb20" sourceindex="171"&gt;As we can see, this may be problematic when we have lots of line nodes in our image. For this, we use the more complex &lt;i siber__q92dpb7seovvtbh5__vptr="ebba20" sourceindex="172"&gt;skel().&amp;nbsp;&lt;/i&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ebbff0" sourceindex="173"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="ee19f0" sourceindex="174"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ebb110" sourceindex="175" /&gt; &lt;/i&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="ebbf90" sourceindex="176" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Qo7ccsCdf6w/TjO0YZiun6I/AAAAAAAAANI/UsiL2-8BhBU/s1600/collect3.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="ee11b0" sourceindex="177" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="184" siber__q92dpb7seovvtbh5__vptr="ebbda0" sourceindex="178" src="http://2.bp.blogspot.com/-Qo7ccsCdf6w/TjO0YZiun6I/AAAAAAAAANI/UsiL2-8BhBU/s640/collect3.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="ebbad0" sourceindex="179" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="ebbac0" sourceindex="180" style="font-size: x-small;"&gt;Figure 9. L-R: Original image, result of &lt;i siber__q92dpb7seovvtbh5__vptr="44f7510" sourceindex="181"&gt;skel()&lt;/i&gt; superimposed with the original and the distance transform.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="f04d70" sourceindex="182" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="ebb720" sourceindex="183" style="font-size: x-small;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ebb6f0" sourceindex="184" /&gt; &lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="f04d30" sourceindex="185"&gt;&lt;i siber__q92dpb7seovvtbh5__vptr="f046d0" sourceindex="186"&gt;skel()&lt;/i&gt;&amp;nbsp;successfully traced a quite rounded and thick image. These characteristics would have resulted to a poor trace, had we used &lt;i siber__q92dpb7seovvtbh5__vptr="ee1810" sourceindex="187"&gt;thin()&lt;/i&gt;&amp;nbsp;for the image. &lt;i siber__q92dpb7seovvtbh5__vptr="ebb150" sourceindex="188"&gt;skel() &lt;/i&gt;&amp;nbsp;seems to average the whole network of lines and deduce the "skeletal" frame of the image. As such, it also has a distance mapping output. This seems to be a pixel population distribution map of the image with respect to &lt;i siber__q92dpb7seovvtbh5__vptr="f04ac0" sourceindex="189"&gt;skel()&lt;/i&gt;'s traced path.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="ebb180" sourceindex="190"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="ebb550" sourceindex="191" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="44f7950" sourceindex="192"&gt;This was a good introductory activity for morphological transforms of images.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="44f7ae0" sourceindex="193"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="44f3020" sourceindex="194" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="44f32f0" sourceindex="195"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="44f3dd0" sourceindex="196" /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; Self-Assessment: 9/10&amp;nbsp; &amp;nbsp;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="44f3020" sourceindex="194" style="font-size: large;"&gt;&lt;b siber__q92dpb7seovvtbh5__vptr="44f32f0" sourceindex="195"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="44f3dd0" sourceindex="196" /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-1831820844450536622?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/1831820844450536622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/07/ix.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/1831820844450536622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/1831820844450536622'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/07/ix.html' title='IX'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-XB5gTEf_F68/TjOQwH3XLpI/AAAAAAAAAMg/k3it0WWQD54/s72-c/eq2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-5615326988497261781</id><published>2011-07-23T22:34:00.000-07:00</published><updated>2011-10-13T17:05:05.237-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='K'/><title type='text'>VIII</title><content type='html'>&lt;div siber__q92dpb7seovvtbh5__vptr="469be40" sourceindex="4"&gt;We can enhance or filter out unwanted frequencies of an image by removing them in the Fourier map and then reapplying the transform to obtain the final image.&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="45ee330" sourceindex="5"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee0b0" sourceindex="6" /&gt;&lt;/div&gt;&lt;blockquote siber__q92dpb7seovvtbh5__vptr="469bb70" sourceindex="7"&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="45ee350" sourceindex="8"&gt;Note: The reconstructed images are180 degrees rotated (with respect to the original) due to the FT.&lt;/div&gt;&lt;/blockquote&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="45ee560" sourceindex="9"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee410" sourceindex="10" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="4602000" sourceindex="11"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="45ee230" sourceindex="12" style="font-size: large;"&gt;&lt;b&gt;8A. Convolution Theorem&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="4602000" sourceindex="11"&gt;&lt;span class="Apple-style-span" siber__q92dpb7seovvtbh5__vptr="45ee230" sourceindex="12" style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee2c0" sourceindex="13" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-2qH2mX1dino/TiqmL16KqII/AAAAAAAAALI/7cNYVhAgfe8/s1600/8A1.bmp" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45ee430" sourceindex="14" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" siber__q92dpb7seovvtbh5__vptr="45ee100" sourceindex="15" src="http://1.bp.blogspot.com/-2qH2mX1dino/TiqmL16KqII/AAAAAAAAALI/7cNYVhAgfe8/s200/8A1.bmp" width="200" /&gt;&lt;/a&gt;&lt;a href="http://1.bp.blogspot.com/-qsouSXeDWyY/TiqmMWWhlgI/AAAAAAAAALM/iDppBKje_7U/s1600/8A1_FT.bmp" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45ee5c0" sourceindex="16" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" siber__q92dpb7seovvtbh5__vptr="45ee480" sourceindex="17" src="http://1.bp.blogspot.com/-qsouSXeDWyY/TiqmMWWhlgI/AAAAAAAAALM/iDppBKje_7U/s200/8A1_FT.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee240" sourceindex="18" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. L-R Two-dot binary image and it's FT.&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="45ee040" sourceindex="19"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee510" sourceindex="20" /&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="45ee380" sourceindex="21"&gt;Fig. 1 is an example of how the FT of a FT of an image would revert back to the original image. If we reverse the image labels (i.e. if we take the right image as the original one), one can remember that the 2 dots are representative of the quantitative value of the frequency on the original image.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee770" sourceindex="22" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee620" sourceindex="23" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee420" sourceindex="24" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee610" sourceindex="25" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee7c0" sourceindex="26" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="469bd60" sourceindex="27" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="469b9b0" sourceindex="28" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-R01OnADQNY4/TiqqcRo3w5I/AAAAAAAAALo/lGy0idl4I1o/s1600/collect.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45ee6f0" sourceindex="29" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="420" siber__q92dpb7seovvtbh5__vptr="45ee4b0" sourceindex="30" src="http://1.bp.blogspot.com/-R01OnADQNY4/TiqqcRo3w5I/AAAAAAAAALo/lGy0idl4I1o/s640/collect.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee080" sourceindex="31" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. R-L: Dots were replaced with circles of increasing radii. Top-Bottom: Original image and its FT.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee6c0" sourceindex="32" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee900" sourceindex="33" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee720" sourceindex="34" style="clear: both; text-align: -webkit-auto;"&gt;Fig. 2 shows that as the circles were increased, the overall size of its FT diminishes. Why? This is because of the now 2D nature of our image. As the circles increase in size, this is interpreted in a Fourier-sense that a more constant and non-repetitive image is being generated. We can note that the black lines in the FT are remnants of the 1D layout (the center of the circles are still on the x-axis) and the concentric light bands are the 2D components of the circles.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee2b0" sourceindex="35" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee8a0" sourceindex="36" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee840" sourceindex="37" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-bPgztDs3X9g/TiqxyZxT9mI/AAAAAAAAALs/EnphTzd4vBU/s1600/collect2.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45ee7f0" sourceindex="38" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="249" siber__q92dpb7seovvtbh5__vptr="45ee860" sourceindex="39" src="http://4.bp.blogspot.com/-bPgztDs3X9g/TiqxyZxT9mI/AAAAAAAAALs/EnphTzd4vBU/s640/collect2.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee980" sourceindex="40" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 3. R-L: Dots were replaced with squares of increasing areas. Top-Bottom: Original image and its FT.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee7a0" sourceindex="41" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee9e0" sourceindex="42" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eebe0" sourceindex="43" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eea90" sourceindex="44" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee970" sourceindex="45" style="clear: both; text-align: -webkit-auto;"&gt;Fig. 3 shows a similar behavior as Fig. 2. The shape of the squares are reflected in its FT.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee8f0" sourceindex="46" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eeb10" sourceindex="47" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee4f0" sourceindex="48" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-UTKrFajV2rc/Tiq3PYtbHII/AAAAAAAAALw/sCN0kOdwoUg/s1600/collect3.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45ee850" sourceindex="49" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="154" siber__q92dpb7seovvtbh5__vptr="45eeb50" sourceindex="50" src="http://4.bp.blogspot.com/-UTKrFajV2rc/Tiq3PYtbHII/AAAAAAAAALw/sCN0kOdwoUg/s640/collect3.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eea40" sourceindex="51" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 4. R-L: FT of circles with Gaussian intensity distribution (increasing variance)&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee5b0" sourceindex="52" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eeb90" sourceindex="53" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eed70" sourceindex="54" style="clear: both; text-align: -webkit-auto;"&gt;Just as with Fig. 2, as the size of the Gaussian circles increase, the radius of the resulting FT pattern decreases. However, due to the the distribution of the intensity, the resulting FT also has a less distinct concentricity.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eec20" sourceindex="55" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee930" sourceindex="56" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eec10" sourceindex="57" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-7xYYazAQRyI/Tiq4yq_eynI/AAAAAAAAAL0/eIWOX5p9gn8/s1600/8A6.bmp" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45eedc0" sourceindex="58" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="45ee950" sourceindex="59" src="http://4.bp.blogspot.com/-7xYYazAQRyI/Tiq4yq_eynI/AAAAAAAAAL0/eIWOX5p9gn8/s1600/8A6.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eeae0" sourceindex="60" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 5. Convolution of 10 randomly placed dots and a random 3x3 matrix&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eecf0" sourceindex="61" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45ee9f0" sourceindex="62" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eeaa0" sourceindex="63" style="clear: both; text-align: -webkit-auto;"&gt;Fig. 5 uses convolution. This image is not very different from the original image. The only difference is that the dots became broader. The 3x3 matrix appeared to have been transposed to the dot locations, as noticeable from the convolution of a function f(x) with a dirac-delta.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eecc0" sourceindex="64" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eef00" sourceindex="65" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eed20" sourceindex="66" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-z32LqgjCteY/Tiq9fS9ogBI/AAAAAAAAAL4/9Og9bwJz7pI/s1600/eq2.png" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45eebf0" sourceindex="67" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" siber__q92dpb7seovvtbh5__vptr="45eeea0" sourceindex="68" src="http://2.bp.blogspot.com/-z32LqgjCteY/Tiq9fS9ogBI/AAAAAAAAAL4/9Og9bwJz7pI/s1600/eq2.png" /&gt;&lt;/a&gt;&amp;nbsp;(1)&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eee40" sourceindex="69" style="clear: both; text-align: center;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eedf0" sourceindex="70" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eee60" sourceindex="71" style="clear: both; text-align: center;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eef80" sourceindex="72" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eeda0" sourceindex="73" style="clear: both; text-align: -webkit-auto;"&gt;Eq. 1 shows that as the convolution causes f(t) to appear on the previous location of the dirac-delta. Fig. 5 has white dots (1 pixel in size) that are considered dirac-deltas. So the result of imconv() reflects the 3x3 mask on the location of the 10 random dots.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eefe0" sourceindex="74" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d1e0" sourceindex="75" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d090" sourceindex="76" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Az8PvIrB8-E/TiuP11ZcdeI/AAAAAAAAAL8/cf7pSODQEmo/s1600/collect4.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45eef70" sourceindex="77" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="124" siber__q92dpb7seovvtbh5__vptr="45eeef0" sourceindex="78" src="http://3.bp.blogspot.com/-Az8PvIrB8-E/TiuP11ZcdeI/AAAAAAAAAL8/cf7pSODQEmo/s640/collect4.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d110" sourceindex="79" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 6. L-R: FT of equally spaced white pixels. (5, 10, 50, 100 &amp;amp; 200 pixel separation on both x and y axis, respectively)&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45ee730" sourceindex="80" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eee50" sourceindex="81" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d150" sourceindex="82" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d040" sourceindex="83" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="469b970" sourceindex="84" style="clear: both; text-align: -webkit-auto;"&gt;Fig. 6 further cements our first-hand experience that the FT is in frequency space. As the "wavelength" is increased, the frequency decreases, so the magnitude of the separation of the dots in the corresponding FT decreases, too.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d190" sourceindex="85" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d370" sourceindex="86" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d220" sourceindex="87" style="clear: both; text-align: -webkit-auto;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;8B. Ridge Enhancement&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eef30" sourceindex="88" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d210" sourceindex="89" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d3c0" sourceindex="90" style="clear: both; text-align: -webkit-auto;"&gt;This time, I will do a more practical application of Fourier map knowledge. Since fingerprints have a repetitive structure, filtering in the Fourier map may enhance their&amp;nbsp;images.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eef50" sourceindex="91" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-FAN4ZPjYLUk/TiuU7mODpCI/AAAAAAAAAMA/pYN0Pm_uEVQ/s1600/fp.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="540d0e0" sourceindex="92" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" siber__q92dpb7seovvtbh5__vptr="540d2f0" sourceindex="93" src="http://2.bp.blogspot.com/-FAN4ZPjYLUk/TiuU7mODpCI/AAAAAAAAAMA/pYN0Pm_uEVQ/s320/fp.jpg" width="186" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-Y_qoxYA56sM/TiuWf_eLFhI/AAAAAAAAAME/t0hNOd2jQbo/s1600/FT_orig_crop.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="45eeff0" sourceindex="94" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" siber__q92dpb7seovvtbh5__vptr="540d0a0" sourceindex="95" src="http://4.bp.blogspot.com/-Y_qoxYA56sM/TiuWf_eLFhI/AAAAAAAAAME/t0hNOd2jQbo/s320/FT_orig_crop.jpg" width="184" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d2c0" sourceindex="96" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 7. L-R: My own fingerprint and it's FT&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d500" sourceindex="97" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d320" sourceindex="98" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d1f0" sourceindex="99" style="clear: both; text-align: center;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d4a0" sourceindex="100" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d440" sourceindex="101" style="clear: both; text-align: -webkit-auto;"&gt;From Fig. 7, we can see that there are a lot of noise on the radial extreme of the FT. A prominent halo can be distinguished in the middle (with the DC term on the origin). I tried to blacken out the noisy parts and retain the middle parts, and this is what I got:&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d3f0" sourceindex="102" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://2.bp.blogspot.com/-bD_48ebgyvg/TiubUSTUJTI/AAAAAAAAAMI/PE-mUPF4iPs/s1600/collect1.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="540d460" sourceindex="103" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="416" siber__q92dpb7seovvtbh5__vptr="540d580" sourceindex="104" src="http://2.bp.blogspot.com/-bD_48ebgyvg/TiubUSTUJTI/AAAAAAAAAMI/PE-mUPF4iPs/s640/collect1.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d3a0" sourceindex="105" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 7. L-R: Filtered FT (top) and their respective reconstructed images (bottom)&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d5e0" sourceindex="106" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d7e0" sourceindex="107" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d690" sourceindex="108" style="clear: both; text-align: -webkit-auto;"&gt;Fig. 7 shows how the filtering of signal in the Fourier map affects the quality of the reconstructed image. When the mask covers the "halo" signal, the reconstructed image suffers a poor quality; the ridges become indistinguishable. The leftmost filter works well, however, the clarity could have been better had I removed the DC component (middle spot)&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d570" sourceindex="109" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d4f0" sourceindex="110" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d710" sourceindex="111" style="clear: both; text-align: -webkit-auto;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;8C. Line Removal&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="45eed30" sourceindex="112" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d450" sourceindex="113" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d750" sourceindex="114" style="clear: both; text-align: -webkit-auto;"&gt;Now, let's try some more basic filtering: line removal.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d640" sourceindex="115" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="45eea80" sourceindex="116" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d790" sourceindex="117" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-TB5hePYMUQk/Tiui_uQWlYI/AAAAAAAAAMM/ZI9VVdebtNY/s1600/collect.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="540d970" sourceindex="118" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="481" siber__q92dpb7seovvtbh5__vptr="540d820" sourceindex="119" src="http://1.bp.blogspot.com/-TB5hePYMUQk/Tiui_uQWlYI/AAAAAAAAAMM/ZI9VVdebtNY/s640/collect.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d530" sourceindex="120" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d810" sourceindex="121" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 7. Top: FTs of original image (left) and it's filtered &amp;nbsp;form (right) Bottom: Corresponding reconstructed images&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="540d9c0" sourceindex="122"&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="540d550" sourceindex="123"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d6e0" sourceindex="124" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="540d8f0" sourceindex="125"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d5f0" sourceindex="126" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d6a0" sourceindex="127" style="clear: both; text-align: -webkit-auto;"&gt;Fig. 7 shows the results of line removal. The lines ultimately became less accented. The position is based my previous work with FTs. If the pattern persists in a certain dimension, it would also be in the Fourier map. As such, the lines were along the image's x-axis, as such the FT had reflections on its x-axis, too.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d8c0" sourceindex="128" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540db00" sourceindex="129" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d920" sourceindex="130" style="clear: both; text-align: -webkit-auto;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;8D. Weave Removal&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d7f0" sourceindex="131" style="clear: both; text-align: center;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540daa0" sourceindex="132" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540da40" sourceindex="133" style="clear: both; text-align: -webkit-auto;"&gt;Finally, let's do masking for 2D signals.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d9f0" sourceindex="134" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540da60" sourceindex="135" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540db80" sourceindex="136" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d9a0" sourceindex="137" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540dbe0" sourceindex="138" style="clear: both; text-align: -webkit-auto;"&gt;&lt;a href="http://4.bp.blogspot.com/-mqw3WYRgFZs/TiurOkPh2tI/AAAAAAAAAMQ/QNBHYVBQs0g/s1600/collect.jpg" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="540dde0" sourceindex="139" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="466" siber__q92dpb7seovvtbh5__vptr="540dc90" sourceindex="140" src="http://4.bp.blogspot.com/-mqw3WYRgFZs/TiurOkPh2tI/AAAAAAAAAMQ/QNBHYVBQs0g/s640/collect.jpg" style="cursor: move;" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540db70" sourceindex="141" style="clear: both; text-align: -webkit-auto;"&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540daf0" sourceindex="142" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 8. Top: FTs of original image (left) and it's filtered &amp;nbsp;form (right) Bottom: Corresponding reconstructed images&lt;/span&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="540dd10" sourceindex="143"&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="540d330" sourceindex="144"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540da50" sourceindex="145" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div siber__q92dpb7seovvtbh5__vptr="540dd50" sourceindex="146"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540dc40" sourceindex="147" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540d080" sourceindex="148" style="clear: both; text-align: -webkit-auto;"&gt;Similar to Fig. 7, filtering removed the blotch patterns of the original image. Note that the presence of the peaks on the FT that has x &amp;amp; y components signify some angled patterns. These can be thought of the collection of the individual x &amp;amp; y patterns viewed at a certain angle. Comparing this with Fig. 7, we see that since the weave pattern has is 2D repetitive, there are bright spots on the x &amp;amp; y axis of the FT image. Thus, blocking these signals and those that has has both x &amp;amp; y components improves our reconstructed image.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540dd90" sourceindex="149" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540df70" sourceindex="150" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540de20" sourceindex="151" style="clear: both; text-align: -webkit-auto;"&gt;To further illustrate that these are indeed the FT components of the weave pattern, I have reconstructed the mask using FT:&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540db30" sourceindex="152" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540de10" sourceindex="153" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540dfc0" sourceindex="154" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-FobWG3aWa28/TiutcMsK2AI/AAAAAAAAAMU/pdjEC-b6y3Y/s1600/maskinv.bmp" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="540db50" sourceindex="155" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="228" siber__q92dpb7seovvtbh5__vptr="540dce0" sourceindex="156" src="http://1.bp.blogspot.com/-FobWG3aWa28/TiutcMsK2AI/AAAAAAAAAMU/pdjEC-b6y3Y/s320/maskinv.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540def0" sourceindex="157" style="clear: both; text-align: center;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540dbf0" sourceindex="158" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540dca0" sourceindex="159" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-_ivzoYpt4dQ/Tiutd6o3tcI/AAAAAAAAAMY/9BZxk8U6UCQ/s1600/mask_FT.bmp" imageanchor="1" siber__q92dpb7seovvtbh5__vptr="540dec0" sourceindex="160" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="228" siber__q92dpb7seovvtbh5__vptr="5413100" sourceindex="161" src="http://3.bp.blogspot.com/-_ivzoYpt4dQ/Tiutd6o3tcI/AAAAAAAAAMY/9BZxk8U6UCQ/s320/mask_FT.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540df20" sourceindex="162" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 9. Top-Bottom: Mask and its FT&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540ddf0" sourceindex="163" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="54130a0" sourceindex="164" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="5413040" sourceindex="165" style="clear: both; text-align: -webkit-auto;"&gt;Fig. 9 shows the inverted mask and its FT. The mask was inverted because the original was meant to block out the signals. Inverting it would approximate a FT that has peaks at the once "masking" areas. The FT clearly reveals that it is indeed the weave pattern as seen in Fig. 8.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540dff0" sourceindex="166" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="5413060" sourceindex="167" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="5413180" sourceindex="168" style="clear: both; text-align: -webkit-auto;"&gt;This activity has again increased my insight on the nature of FTs and their possible applications.&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="540dfa0" sourceindex="169" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="54131e0" sourceindex="170" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="54133e0" sourceindex="171" style="clear: both; text-align: -webkit-auto;"&gt; Self-Assessment: 10/10&amp;nbsp; &lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="5413170" sourceindex="173" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="54130f0" sourceindex="174" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="5413310" sourceindex="175" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="540d930" sourceindex="176" /&gt;&lt;/div&gt;&lt;div class="separator" siber__q92dpb7seovvtbh5__vptr="5413050" sourceindex="177" style="clear: both; text-align: -webkit-auto;"&gt;&lt;br siber__q92dpb7seovvtbh5__vptr="5413350" sourceindex="178" /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-5615326988497261781?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/5615326988497261781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/07/viii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/5615326988497261781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/5615326988497261781'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/07/viii.html' title='VIII'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-2qH2mX1dino/TiqmL16KqII/AAAAAAAAALI/7cNYVhAgfe8/s72-c/8A1.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-7195344959087180511</id><published>2011-07-16T00:58:00.000-07:00</published><updated>2011-10-13T17:04:54.232-07:00</updated><title type='text'>VII</title><content type='html'>2D Fourier Transforms (2D FT) require a deeper understanding of the underlying mathematical arrangements that happen in order to appreciate its capabilities. More imagination and knowledge are needed&amp;nbsp;to properly visualize the transform's effects on images.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;Note: Most of the Fourier Transforms shown here are zoomed and not it their scale. This was done to enhance the clarity of the discussion.&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;7A. 2D FT Familiarization&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-C9fPEnNCulk/Th_GkYyoeMI/AAAAAAAAAKM/IqRW81sHNfU/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="258" src="http://4.bp.blogspot.com/-C9fPEnNCulk/Th_GkYyoeMI/AAAAAAAAAKM/IqRW81sHNfU/s640/1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. L-R Various patterns: Square, annulus, square annulus, 2 slits &amp;amp; 2 dots (top row)&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;and their respective Fourier Transforms (bottom row)&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Fig. 1 exemplifies the quite complicated nature of visualizing FTs of 2D patterns if one doesn't have a firm grasp of its concept. From the square pattern, one realizes that the focused FT in the middle demonstrates that the frequency is focused in the middle, with the trailing &amp;nbsp;frequencies demonstrate the x and y dependence, it being a square. The annulus also demonstrates this, however, the 2D FT is also circular. We get the sense that these arise when there are sharp changes of value (edges) in the image. Speaking in terms of frequency, this is a sharp change. From the square annulus, we also observe the same pattern but with more pronounced black segments, due to the interruption in the middle.&lt;/div&gt;&lt;div&gt;The slits and dots are quite straightforward. The line can be treated as a sinusoid with a frequency that can be observed is projected on its FT. The dots show their spherical nature in its FT.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;7B. Anamorphic Property of Fourier Transforms&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-E9l3O0KALSQ/TiADIXgEe7I/AAAAAAAAAKs/_XNpdnUqMLU/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="313" src="http://4.bp.blogspot.com/-E9l3O0KALSQ/TiADIXgEe7I/AAAAAAAAAKs/_XNpdnUqMLU/s640/2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. L-R Fringes of varying frequency: f = 4, 8, 16 &amp;amp; 32 (top row)&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;and their respective Fourier Transforms (bottom row)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Fig. 2 shows a more simpler approach to understand the Fourier space. We see an immediate trend: as the frequency is increased, the spacing between the values becomes greater. This is now an exemplary example that the scales of the Fourier space is frequency. The presence of the 2 dots is an artifact of the dimension of our image: it is symmetric. Also worth noticing is that the symmetry is confined in one axis, since the corrugated roofs are in one dimension.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-wXCS49YTA2A/TiALn3HTzcI/AAAAAAAAAKw/mchCkA_sSYA/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="162" src="http://2.bp.blogspot.com/-wXCS49YTA2A/TiALn3HTzcI/AAAAAAAAAKw/mchCkA_sSYA/s320/2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 3. L-R: Fringe pattern with f =16 with a bias constant bias of 2 and its FT.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Fig. 3 is the result of adding a constant bias to the function that generates our image. We see that this resulted to a point between the 2 spots in its FT. This indicates the shift of the function from the origin, and thus the symmetry was broken.&amp;nbsp;&lt;/div&gt;&lt;div&gt;To find the actual frequencies in an interferogram image, it is then immediate that FT is the solution. For non-constant biases, we can find the frequencies by noting that what we will see should be symmetric on a diagonal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Lz8fdtAs6vk/TiArHJTB6dI/AAAAAAAAAK4/UUPmT99DwNo/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="159" src="http://4.bp.blogspot.com/-Lz8fdtAs6vk/TiArHJTB6dI/AAAAAAAAAK4/UUPmT99DwNo/s320/3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 4. L-R: Fringe pattern with f =16, shift of 30 degrees&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;and its FT&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Fig. 4 illustrates that a shift in the actual image also reflects as a shift of the bright spots in inverse space.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-dhZ8ZwUb1JA/TiExGn39dYI/AAAAAAAAALA/Pww01kJpR4A/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="158" src="http://3.bp.blogspot.com/-dhZ8ZwUb1JA/TiExGn39dYI/AAAAAAAAALA/Pww01kJpR4A/s320/4.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 5. L-R: Fringe pattern with f =16 on x &amp;amp; y axis&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;and its FT&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Fig. 5 further cements the idea of the symmetry of the FT of straightforward sinusoidal functions. The FT can be interpreted by looking at its quadrant 1. Treating the center as the origin, the bright spot is then easily viewed as having x &amp;amp; y components. Then with that, we see that it is also symmetric in those axes, thus producing the 4 spot FT image.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Lastly, I add 3 rotated&amp;nbsp;sinusoids&amp;nbsp;with (same &lt;i&gt;f&lt;/i&gt;, &lt;i&gt;theta&lt;/i&gt;=30,45,50) to Fig. 5. Before I see the FT, I tried to predict it. The &amp;nbsp;four spots on the FT of Fig. 5 should remain. The addition of the 3 sinusoids should add a total of 9 spots: each per quadrant (symmetry) with an angle equal to theta measured from the origin.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-QuR9hlceuDM/TiFCjYLpvtI/AAAAAAAAALE/TTlFosuZ_Gs/s1600/LAST_FFT.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-QuR9hlceuDM/TiFCjYLpvtI/AAAAAAAAALE/TTlFosuZ_Gs/s1600/LAST_FFT.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 5. FT of a 2D corrugated roof added with 3 rotated sinusoids&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Disappointment. Apparently, addition doesn't yield a symmetry in the Fourier space since it only adds, it doesn't "convolve" functions such as multiplication.&lt;br /&gt;&lt;br /&gt;&amp;nbsp; Self-Assessment: 9/10&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-7195344959087180511?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/7195344959087180511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/07/vii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/7195344959087180511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/7195344959087180511'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/07/vii.html' title='VII'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-C9fPEnNCulk/Th_GkYyoeMI/AAAAAAAAAKM/IqRW81sHNfU/s72-c/1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-3550057522142828810</id><published>2011-07-12T04:58:00.000-07:00</published><updated>2011-10-13T17:04:44.702-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='S'/><title type='text'>VI</title><content type='html'>Activity 6 formally introduces us to the Fourier Transform model of imaging.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-F3A7EYn836Y/Thv5EUO18tI/AAAAAAAAAHE/lD1C6X1YWwg/s1600/eq1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-F3A7EYn836Y/Thv5EUO18tI/AAAAAAAAAHE/lD1C6X1YWwg/s1600/eq1.png" /&gt;&lt;/a&gt;&amp;nbsp;(1)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Eq. 1 is the 2D&amp;nbsp;Fourier&amp;nbsp;transform of a function &lt;i&gt;f(x,y)&lt;/i&gt;. For image processing implementations in this activity, we will be using Cooley and Tukey's Fast Fourier Transform algorithm. Before I discuss the results, I'd like to note the importance of some Scilab functions to achieve the proper results.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;gray_imread()&amp;nbsp;&lt;/i&gt;: As we can see, we can't have a multi-channeled image (hypermatrix). This function basically flattens our subject matrix, else &lt;i&gt;fft2()&lt;/i&gt; won't work properly.&lt;/li&gt;&lt;li&gt;&lt;i&gt;abs()&lt;/i&gt; : Let us not forget that employing a FT generates a complex function. This is thus necessary in appropriately projecting our results as an image (matrix of real values).&lt;/li&gt;&lt;li&gt;&lt;i&gt;fftshift() &lt;/i&gt;: This allows us to flip a matrix along its diagonal. Useful, since &lt;i&gt;fft2()&lt;/i&gt;&amp;nbsp;has its quadrants interchanged along the diagonal.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;6A. Discrete Fourier Transform&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-hicE6p06A3s/Thv-DegGuMI/AAAAAAAAAHI/C_chsYA58MI/s1600/A_1.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-hicE6p06A3s/Thv-DegGuMI/AAAAAAAAAHI/C_chsYA58MI/s1600/A_1.bmp" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-nUynKTf26w4/Thv-EYtvlPI/AAAAAAAAAHM/XBBCtmEAOOg/s1600/A_3.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-nUynKTf26w4/Thv-EYtvlPI/AAAAAAAAAHM/XBBCtmEAOOg/s1600/A_3.bmp" /&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/-Soe2KXayhJc/Thv-FSN9RbI/AAAAAAAAAHQ/mD4u27LCadg/s1600/A_4.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-Soe2KXayhJc/Thv-FSN9RbI/AAAAAAAAAHQ/mD4u27LCadg/s1600/A_4.bmp" /&gt;&lt;/a&gt;&lt;a href="http://1.bp.blogspot.com/-sYC9fWRv-Tg/Thv-HDjGdEI/AAAAAAAAAHU/SqP5Li3qkdA/s1600/A_5a.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-sYC9fWRv-Tg/Thv-HDjGdEI/AAAAAAAAAHU/SqP5Li3qkdA/s1600/A_5a.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. Left to Right: Original image, &lt;i&gt;fft2()&lt;/i&gt; result, &lt;i&gt;fftshift()&lt;/i&gt; result and the twice &lt;i&gt;fft2()&lt;/i&gt;'d image.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Fig. 1 shows the result of a series of FTs on an image of a circle (r=0.9 with respect to 128). The&lt;i&gt; fft2()&lt;/i&gt; resulted an almost black image with some white-ish pixels uniformly distributed on its vertices. Upon inspection of the numerical results, most of the values are well beyond 100, and thus appeared as black pixels. Applying &lt;i&gt;fftshift()&lt;/i&gt;&amp;nbsp;creates a speckled pattern of black pixels on a white background. This function apparently has an effect to the numerical values of the FFT.&amp;nbsp;The right-most image shows that Fourier Transforms are transitive, that is, employing it 2 times results to the original function.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-6QULbFoORHA/Thv-Sq9e3YI/AAAAAAAAAHk/04DKYe_WZ6g/s1600/A_text_5a.bmp" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-6QULbFoORHA/Thv-Sq9e3YI/AAAAAAAAAHk/04DKYe_WZ6g/s1600/A_text_5a.bmp" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-Ai9ikJci3NU/Thv-JPO17dI/AAAAAAAAAHY/r9Mk-HKVh4E/s1600/A_text_1.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-Ai9ikJci3NU/Thv-JPO17dI/AAAAAAAAAHY/r9Mk-HKVh4E/s1600/A_text_1.bmp" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-Po1jtHs2bcs/Thv-KEWD-LI/AAAAAAAAAHc/pr0tJKu4mIA/s1600/A_text_3.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-Po1jtHs2bcs/Thv-KEWD-LI/AAAAAAAAAHc/pr0tJKu4mIA/s1600/A_text_3.bmp" /&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/-uB3Qx8QETxY/Thv-K-buWQI/AAAAAAAAAHg/buP3KdPcgGg/s1600/A_text_4.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-uB3Qx8QETxY/Thv-K-buWQI/AAAAAAAAAHg/buP3KdPcgGg/s1600/A_text_4.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. Left to Right: Original "A" image,&amp;nbsp;&lt;i&gt;fft2()&lt;/i&gt;&amp;nbsp;result,&amp;nbsp;&lt;i&gt;fftshift()&lt;/i&gt;&amp;nbsp;result and the twice&amp;nbsp;&lt;i&gt;fft2()&lt;/i&gt;'d image.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Fig. 2 shows the result of an "A" image that underwent the same processes as that in Fig. 1. It is noticeable that the frequency distribution (3rd image from the left) also has the same triangular features as that of the original image spread radially, possible remnants of the 2D nature of the FT used. The final image is a good example of how&lt;i&gt; fftshift() &lt;/i&gt;corrects the orientation of the transformed image.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;6B. Convolution&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-2kgI7QV0tfo/ThwJ0ICU3cI/AAAAAAAAAJI/ExCpjvmTNpI/s1600/B_3_r3.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-2kgI7QV0tfo/ThwJ0ICU3cI/AAAAAAAAAJI/ExCpjvmTNpI/s200/B_3_r3.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-XNgPvqh5Ip8/ThwJ1udChHI/AAAAAAAAAJM/Mgasw92RZUg/s1600/B_3_r4.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-XNgPvqh5Ip8/ThwJ1udChHI/AAAAAAAAAJM/Mgasw92RZUg/s200/B_3_r4.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-3xZCZUjlzOs/ThwJ2qZSD-I/AAAAAAAAAJQ/CBk3iIgMM3M/s1600/B_3_r5.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-3xZCZUjlzOs/ThwJ2qZSD-I/AAAAAAAAAJQ/CBk3iIgMM3M/s200/B_3_r5.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-3UfftvhfrVk/ThwJ4IqobqI/AAAAAAAAAJU/BycaG7AT5sI/s1600/B_3_r6.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-3UfftvhfrVk/ThwJ4IqobqI/AAAAAAAAAJU/BycaG7AT5sI/s200/B_3_r6.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-FykvF0qQgR8/ThwJ49AVEqI/AAAAAAAAAJY/VgFXuTVnEJE/s1600/B_3_r7.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-FykvF0qQgR8/ThwJ49AVEqI/AAAAAAAAAJY/VgFXuTVnEJE/s200/B_3_r7.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-qUJjWTmoBg8/ThwJ5ePKJJI/AAAAAAAAAJc/bDCLrMvC7EQ/s1600/B_3_r8.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-qUJjWTmoBg8/ThwJ5ePKJJI/AAAAAAAAAJc/bDCLrMvC7EQ/s200/B_3_r8.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-kdLIyK0L7M8/ThwJ6RUdEsI/AAAAAAAAAJg/VUERkDoDF1w/s1600/B_3_r9.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-kdLIyK0L7M8/ThwJ6RUdEsI/AAAAAAAAAJg/VUERkDoDF1w/s200/B_3_r9.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 3. Convoluted images of "VIP" and a simulated aperture of various radii. Top to Bottom: r=0.3, 0.4, 0.5, 0.6, 0.7, 0.8 and 0.9&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;Fig. 3 successfully shows that the convolution is indeed effective in simulating an object-lens relationship. As the aperture is reduced in size, diffraction artifacts became more and more noticeable. These are the result of "smearing" brought by the convolution of the 2 image matrices. Let's investigate the mathematical description for Convolution:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-gEOA2x3rYzw/Thwuw7Uza6I/AAAAAAAAAJ0/ck0ZtcObRxg/s1600/eq2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-gEOA2x3rYzw/Thwuw7Uza6I/AAAAAAAAAJ0/ck0ZtcObRxg/s1600/eq2.png" /&gt;&lt;/a&gt;&amp;nbsp;(2)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;The difference in the &lt;i&gt;g&lt;/i&gt; function ultimately generates the "smearing" that we observe.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;6C. Template Matching using Correlation&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ntxhDIPCnkY/ThwraPbHXbI/AAAAAAAAAJk/z9euST8REYQ/s1600/C_1.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ntxhDIPCnkY/ThwraPbHXbI/AAAAAAAAAJk/z9euST8REYQ/s1600/C_1.bmp" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-ntxhDIPCnkY/ThwraPbHXbI/AAAAAAAAAJk/z9euST8REYQ/s200/C_1.bmp" width="200" /&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/-GqdI7Pk_PMk/ThwrbR6IAOI/AAAAAAAAAJo/JA6dwyUi06c/s1600/C_2.bmp" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-GqdI7Pk_PMk/ThwrbR6IAOI/AAAAAAAAAJo/JA6dwyUi06c/s200/C_2.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-g9C8yhZBwuE/Thwrd8-cZwI/AAAAAAAAAJs/Mf7ZJaMWqr8/s1600/C_5.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-g9C8yhZBwuE/Thwrd8-cZwI/AAAAAAAAAJs/Mf7ZJaMWqr8/s200/C_5.bmp" width="200" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-wSDPS2OXeJY/ThwrgEN9i-I/AAAAAAAAAJw/dhcsiajqzRo/s1600/C_5_ROTATE.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-wSDPS2OXeJY/ThwrgEN9i-I/AAAAAAAAAJw/dhcsiajqzRo/s200/C_5_ROTATE.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 4. Top: L-R Image and pattern filter, "A". Bottom: L-R Output image of correlation, rotated image (180 deg. counter-clockwise)&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;Fig. 4 exemplifies the capabilities of template matching using correlation. White dots on the bottom-right are visible to all the "A" in our base image. Let us note that the Correlation is given by:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-TBhhMsD0YJk/ThwxNR4hgTI/AAAAAAAAAJ8/Lx7IeQea2EU/s1600/eq3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-TBhhMsD0YJk/ThwxNR4hgTI/AAAAAAAAAJ8/Lx7IeQea2EU/s1600/eq3.png" /&gt;&lt;/a&gt;&amp;nbsp;(3)&lt;/div&gt;The sum in the &lt;i&gt;g&lt;/i&gt; function enables proper detection of similar patterns for 2 image matrices. The function &lt;i&gt;conj()&lt;/i&gt;&amp;nbsp;is essential to have the inverse signs for the elements of our initial matrix to facilitate with Eq. 3.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;6D. Edge detection using the convolution integral&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Finally, we examine the capabilities of convolution for identifying patterns, such as linear ones for edge detection.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-AL0jQybEpz8/Thwzvc4-BJI/AAAAAAAAAKA/bcVQY6bGW74/s1600/D_2_1.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-AL0jQybEpz8/Thwzvc4-BJI/AAAAAAAAAKA/bcVQY6bGW74/s1600/D_2_1.bmp" /&gt;&lt;/a&gt;&lt;a href="http://1.bp.blogspot.com/-Uh7oYKau8ms/Thwzwg-hj4I/AAAAAAAAAKE/1Gv-wj5KUU8/s1600/D_2_2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-Uh7oYKau8ms/Thwzwg-hj4I/AAAAAAAAAKE/1Gv-wj5KUU8/s1600/D_2_2.bmp" /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href="http://3.bp.blogspot.com/-Q6vRIEgWCIY/Thwzx_ufZ5I/AAAAAAAAAKI/bMcXZICkKA4/s1600/D_2_3.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-Q6vRIEgWCIY/Thwzx_ufZ5I/AAAAAAAAAKI/bMcXZICkKA4/s1600/D_2_3.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Fig. 5 Results of &lt;i&gt;imcorrcoef(). &lt;/i&gt;Patterns used from&amp;nbsp;L-R: &amp;nbsp;[-1 -1 -1; 2 2 2; -1 -1 -1],&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span"&gt;[-1 2 -1;&amp;nbsp;&lt;/span&gt;-1 2 -1&lt;span class="Apple-style-span"&gt;;&amp;nbsp;&lt;/span&gt;-1 2 -1&lt;span class="Apple-style-span"&gt;] and&amp;nbsp;&lt;/span&gt;&amp;nbsp;[-1 -1 -1; -1 8 -1; -1 -1 -1]&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;The first image shows our image with most of its vertical lines lost. The second one is visibly without its horizontal lines. The third image that used a spot pattern has its vertical and horizontal lines intact, indicating that the algorithm "identifies" closed loops.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This activity has really improved my knowledge on FT and its applications for visual analysis and pattern recognition.&lt;br /&gt;&lt;br /&gt;Self-Assessment: 10/10&amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-3550057522142828810?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/3550057522142828810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/07/vi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/3550057522142828810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/3550057522142828810'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/07/vi.html' title='VI'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-F3A7EYn836Y/Thv5EUO18tI/AAAAAAAAAHE/lD1C6X1YWwg/s72-c/eq1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-7653309591241258727</id><published>2011-07-07T02:36:00.000-07:00</published><updated>2011-10-13T17:04:37.022-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I'/><title type='text'>V</title><content type='html'>Using Photoshop familiarized me on how histogram tweaking can affect the light and dark levels of my image. However, this time, we get to see the gritty parts of how it is actually done: by treating the image as a matrix and performing statistical operations to alter the distribution of its pixel values.&lt;br /&gt;&lt;br /&gt;Numerically converting the image's Cumulative Distribution Function (CDF) to another one is the main idea behind this:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-mEROFCIAH7s/ThVQxkn95xI/AAAAAAAAAF0/IelO0cNwuLs/s1600/Tr.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-mEROFCIAH7s/ThVQxkn95xI/AAAAAAAAAF0/IelO0cNwuLs/s1600/Tr.png" /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/-oE2Gv5RiZxs/ThVQziUtu-I/AAAAAAAAAF4/nraYgh6XtWY/s1600/Gz.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-oE2Gv5RiZxs/ThVQziUtu-I/AAAAAAAAAF4/nraYgh6XtWY/s1600/Gz.png" /&gt;&lt;/a&gt;&amp;nbsp;(1)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Eq. 1 shows the CDF from&lt;i&gt; r&lt;/i&gt; to&lt;i&gt; z&lt;/i&gt; values, where the&amp;nbsp;&lt;i&gt;p&lt;/i&gt;'s are the corresponding PDFs. Hence, the corresponding pixel value &lt;i&gt;z&lt;/i&gt; is given by Eq. 2:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-6DcAkyJGzJQ/ThVRfX2H6OI/AAAAAAAAAF8/bYhn0jKwRzE/s1600/z.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-6DcAkyJGzJQ/ThVRfX2H6OI/AAAAAAAAAF8/bYhn0jKwRzE/s1600/z.png" /&gt;&lt;/a&gt;(2)&lt;/div&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-Lp3fKRfYoxk/ThVSUw_ypXI/AAAAAAAAAGI/HvEQqiARRpE/s1600/CDF.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-eTJ2-z10yLg/ThVideZ58tI/AAAAAAAAAGY/D2gmpdr_KVU/s1600/e1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="124" src="http://1.bp.blogspot.com/-eTJ2-z10yLg/ThVideZ58tI/AAAAAAAAAGY/D2gmpdr_KVU/s320/e1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. Visualization of the transformation process&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-XyAMUFB3tJI/ThVSKgryaaI/AAAAAAAAAGA/7imcFpZXeXk/s1600/1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-XyAMUFB3tJI/ThVSKgryaaI/AAAAAAAAAGA/7imcFpZXeXk/s1600/1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Savz9BllE7c/ThVSUZ4TRhI/AAAAAAAAAGE/SeDTK4S8Y14/s1600/histplot_2000.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://2.bp.blogspot.com/-Savz9BllE7c/ThVSUZ4TRhI/AAAAAAAAAGE/SeDTK4S8Y14/s200/histplot_2000.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-gietXCANyd0/ThVYlwR-YpI/AAAAAAAAAGQ/HjQLQy3JPGA/s1600/CDF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://4.bp.blogspot.com/-gietXCANyd0/ThVYlwR-YpI/AAAAAAAAAGQ/HjQLQy3JPGA/s200/CDF.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. Top to bottom: Original image, its &lt;i&gt;histplot()&lt;/i&gt; and CDF&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-104BH_5rZmY/ThVVI3GyEDI/AAAAAAAAAGM/xTSvHxz0JGE/s1600/c1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="226" src="http://4.bp.blogspot.com/-104BH_5rZmY/ThVVI3GyEDI/AAAAAAAAAGM/xTSvHxz0JGE/s320/c1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 3. Code for generating the CDF&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Fig. 2 shows the original image I've used for this activity. It is very dark, however, its histogram shows that information is stored and we're just visually handicapped to see this. From the bottom image, its CDF immediately rises, giving us the idea that most of its values are situated nearer to the dark (0) pixel values.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-MQL8VYylNyk/ThVpgof7f1I/AAAAAAAAAGc/h_3Tfwfi0l0/s1600/normal.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-MQL8VYylNyk/ThVpgof7f1I/AAAAAAAAAGc/h_3Tfwfi0l0/s1600/normal.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-m2YAfx0xdSM/ThVs0OGxs6I/AAAAAAAAAGk/Vt3aLf2FKaY/s1600/histplot_norm_200.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://2.bp.blogspot.com/-m2YAfx0xdSM/ThVs0OGxs6I/AAAAAAAAAGk/Vt3aLf2FKaY/s200/histplot_norm_200.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-1rmyFFu1muE/ThVs3qGzlRI/AAAAAAAAAGo/zbSJr73IYCk/s1600/normal_CDF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://3.bp.blogspot.com/-1rmyFFu1muE/ThVs3qGzlRI/AAAAAAAAAGo/zbSJr73IYCk/s200/normal_CDF.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 4. Top to bottom: Transformed image, its&amp;nbsp;&lt;i&gt;histplot()&lt;/i&gt;&amp;nbsp;and CDF&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;For a uniform distribution, we have a CDF that is a straight line. This means that the values are equally distributed so that the cumulative sum is linear. Employing the technique illustrated in Fig. 1, with a straight line as a new CDF, I get Fig. 4. The image became more clear than the original. Details can now be seen that were undiscernable before. We see from its &lt;i&gt;histplot()&lt;/i&gt; that the distribution is almost equal in the value range, clearly a result of the new CDF applied to it. I have applied the code shown in Fig. 3 to the transformed image to check if it has really acquired the linear CDF. As we can see, the graph obtained is linear. I am finally successful.&lt;br /&gt;&lt;br /&gt;I now try for a non-linear CDF. I use a cubic function (y=x^3) and get these:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-LZX1vL80cjE/ThVxBf5yCcI/AAAAAAAAAGs/pxc0u5ELI2w/s1600/cubed.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-LZX1vL80cjE/ThVxBf5yCcI/AAAAAAAAAGs/pxc0u5ELI2w/s1600/cubed.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-py344imO6q0/ThVxEj7j59I/AAAAAAAAAGw/EX9Qc_k3zRE/s1600/histplot_cubic_20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://2.bp.blogspot.com/-py344imO6q0/ThVxEj7j59I/AAAAAAAAAGw/EX9Qc_k3zRE/s200/histplot_cubic_20.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-Ur0j6Gou3ho/ThVxHpklRhI/AAAAAAAAAG0/jrNaXqBxk5c/s1600/cubed_CDF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="151" src="http://1.bp.blogspot.com/-Ur0j6Gou3ho/ThVxHpklRhI/AAAAAAAAAG0/jrNaXqBxk5c/s200/cubed_CDF.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 5. Top to bottom: Transformed image, its&amp;nbsp;&lt;i&gt;histplot()&lt;/i&gt;&amp;nbsp;and CDF&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Again, the light areas of the image became more noticeable due to the new CDF. Since it is cubic, the &lt;i&gt;histplot() &lt;/i&gt;roughly&amp;nbsp;shows a quickly increasing histogram. Thus, the image became more concentrated on the range close to 1, translating to an overall increase in white-ish pixel values. Checking the generated image's CDF, we see that it is indeed cubic.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-RcWqcqMKL5c/ThVfjW0zNvI/AAAAAAAAAGU/GCNSiQjGViU/s1600/c2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-RcWqcqMKL5c/ThVfjW0zNvI/AAAAAAAAAGU/GCNSiQjGViU/s320/c2.jpg" width="314" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 6. Code for the CDF transformations used.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;Fig. 6 shows the code I've used for doing the whole transform. Note that I've used &lt;i&gt;gray_imread() &lt;/i&gt;so that I deal with a single channel only, obviously. Overall, it has appropriately satisfied the method, and the small bumps from the CDFs of the images that I've transformed come from the fact that the images are not exported right out through &lt;i&gt;imwrite()&lt;/i&gt; because I can't find a similar argument, [], as in &lt;i&gt;imshow()&lt;/i&gt; to correctly display the image. I have resized the &lt;i&gt;scf()&lt;/i&gt; window and &amp;nbsp;used the &lt;i&gt;File -&amp;gt; &lt;/i&gt;&lt;i&gt;Copy to clipboard&lt;/i&gt; option of the display window.&lt;br /&gt;&lt;br /&gt;To gain an insight to more advanced processes with histogram manipulation, I play around my image in GIMP. Using the Curves option, I got these:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-tnptBZBX9G0/ThV5b7uszkI/AAAAAAAAAG4/aiqEIfEZ5NE/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="206" src="http://1.bp.blogspot.com/-tnptBZBX9G0/ThV5b7uszkI/AAAAAAAAAG4/aiqEIfEZ5NE/s320/11.png" style="cursor: move;" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-2ZvoDl889UM/ThV5fbQYfyI/AAAAAAAAAG8/SLpUE10uGPM/s1600/22.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="206" src="http://1.bp.blogspot.com/-2ZvoDl889UM/ThV5fbQYfyI/AAAAAAAAAG8/SLpUE10uGPM/s320/22.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 7. Curves in GIMP 2&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Trying to find a correlation between this movable line in GIMP with the CDF that I've transformed above, I get the feel that the response is somewhat flipped along that diagonal line. This may be due to GIMP treating the original image's CDF as linear, hence the diagonal line. The cubic CDF when flipped, would then be similar to the top image of Fig. 7.&lt;br /&gt;&lt;br /&gt;Similarly, Photoshop Elements has this, too (Fig. 8). It even has presets.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-zQg3WRWaB9E/ThV89FelSgI/AAAAAAAAAHA/UD9NeKKRtNI/s1600/222.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="187" src="http://4.bp.blogspot.com/-zQg3WRWaB9E/ThV89FelSgI/AAAAAAAAAHA/UD9NeKKRtNI/s320/222.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 8. Photoshop Elements 6.0 curves interface&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;For me, this was a messy activity in terms of coding the transform. Psh.&lt;br /&gt;&lt;br /&gt;&amp;nbsp; Self-Assessment: 9/10&amp;nbsp; &lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;&lt;u&gt;Acknowledgements:&lt;/u&gt;&amp;nbsp;T.J. Abregana, T. Tuballa and K. Cheng for their help in coding.&lt;/span&gt;&lt;/blockquote&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-7653309591241258727?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/7653309591241258727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/07/v.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/7653309591241258727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/7653309591241258727'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/07/v.html' title='V'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-mEROFCIAH7s/ThVQxkn95xI/AAAAAAAAAF0/IelO0cNwuLs/s72-c/Tr.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-4031975755175857972</id><published>2011-06-30T05:02:00.000-07:00</published><updated>2011-10-13T17:04:23.447-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X'/><title type='text'>IV</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: left;"&gt;Green's theorem was employed to determine the area of an image region. As we know, the theorem relates a double integral to a contour integral. The area is then now accessible from the data of the bounding contour.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-7Oe9KkV1RvA/TgwGF03GE0I/AAAAAAAAAEs/EFWAKjOAjKM/s1600/eq1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-7Oe9KkV1RvA/TgwGF03GE0I/AAAAAAAAAEs/EFWAKjOAjKM/s1600/eq1.png" style="cursor: move;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Equation 1. Contour integral of an area bounded by a continuous function&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;div style="text-align: left;"&gt;The discrete form of Eq. 1 is then:&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-iLY_NT4lPW8/TgxXCv8SrjI/AAAAAAAAAEw/MUkfiL1aZPQ/s1600/eq2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-iLY_NT4lPW8/TgxXCv8SrjI/AAAAAAAAAEw/MUkfiL1aZPQ/s1600/eq2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Equation 2. Discrete form of a contour integral&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;div style="text-align: left;"&gt;Scilab's &lt;i&gt;follow()&lt;/i&gt; function extracts the parametric contour of a black and white image, assuming that it has only one definable shape. Using this and Eq. 2, I try it on various circles (generated with our A1 code):&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-xJFtABEQ118/TgxY4W2pf7I/AAAAAAAAAE0/TkIujp_t9zk/s1600/5.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-xJFtABEQ118/TgxY4W2pf7I/AAAAAAAAAE0/TkIujp_t9zk/s1600/5.bmp" /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/-g2pB9HAYs6g/TgxY5SVZy1I/AAAAAAAAAE4/q6vStmJK28o/s1600/1.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-g2pB9HAYs6g/TgxY5SVZy1I/AAAAAAAAAE4/q6vStmJK28o/s1600/1.bmp" /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/-GeIZOMnmj5A/TgxY6WqJY7I/AAAAAAAAAE8/VaIV22tELns/s1600/2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-GeIZOMnmj5A/TgxY6WqJY7I/AAAAAAAAAE8/VaIV22tELns/s1600/2.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://1.bp.blogspot.com/-fIdSIDSoCjY/TgxY7diVewI/AAAAAAAAAFA/tnqc724gZhc/s1600/3.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-fIdSIDSoCjY/TgxY7diVewI/AAAAAAAAAFA/tnqc724gZhc/s1600/3.bmp" /&gt;&lt;/a&gt;&lt;a href="http://1.bp.blogspot.com/-F3mHDJQUIcc/TgxY89Rv9HI/AAAAAAAAAFE/e3IYEyB91wg/s1600/4.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-F3mHDJQUIcc/TgxY89Rv9HI/AAAAAAAAAFE/e3IYEyB91wg/s1600/4.bmp" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 1. Black and white circles. From biggest to smallest: radius 45, 35, 25, 15 and 5 pixels&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-dv-RZQ_nhmo/TgxaiUOvD9I/AAAAAAAAAFI/xPtxfY1yoqM/s1600/greens.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-dv-RZQ_nhmo/TgxaiUOvD9I/AAAAAAAAAFI/xPtxfY1yoqM/s320/greens.png" width="262" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 2. Example code for the computation.&amp;nbsp;Note that the&amp;nbsp;&lt;i&gt;if&lt;/i&gt;&amp;nbsp;statement simulates a cylindrical symmetry for the indices.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;div style="text-align: left;"&gt;Comparing it with the theoretical A=Pi*(radius^2) computation, I obtain the following graph:&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-MyKhv1FE0z4/TgxeTQ-3cdI/AAAAAAAAAFY/Jjv9UqYJuUk/s1600/graph3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="229" src="http://3.bp.blogspot.com/-MyKhv1FE0z4/TgxeTQ-3cdI/AAAAAAAAAFY/Jjv9UqYJuUk/s320/graph3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 3. Radius versus percent deviation graph of the 5 circles&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;div style="text-align: left;"&gt;Fig. 3 shows that as the radius gets smaller, the % deviation becomes larger. This is expected; as the circle is only approximated by pixels which are ultimately square in shape. We can already see the imperfections get more noticeable as the radii gets smaller in Fig. 1.&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" style="text-align: -webkit-auto;"&gt;Next, I picked a location on &lt;a href="http://maps.google.com/"&gt;Googlemaps&lt;/a&gt;, and use the method to approximate the area in square kilometers. I chose the infamous &lt;a href="http://en.wikipedia.org/wiki/Bermuda_Triangle"&gt;Bermuda Triangle&lt;/a&gt;:&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-cgdOaeV9avk/TgxgisZ9QII/AAAAAAAAAFc/ESMX96J-pNQ/s1600/map.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="230" src="http://2.bp.blogspot.com/-cgdOaeV9avk/TgxgisZ9QII/AAAAAAAAAFc/ESMX96J-pNQ/s320/map.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 4. Bermuda Triangle, as seen from Googlemaps. Black lines were added by me to border the region&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" style="text-align: -webkit-auto;"&gt;Now, employing the method used in A3, I converted the Fig. 4 to a black and white image then used Paint to convert it to a purely black and white image:&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-jqk91y3UdbA/TgxhOoQMkxI/AAAAAAAAAFg/Bzb0GfEjxsI/s1600/bw_0pt0001.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="143" src="http://3.bp.blogspot.com/-jqk91y3UdbA/TgxhOoQMkxI/AAAAAAAAAFg/Bzb0GfEjxsI/s200/bw_0pt0001.bmp" width="200" /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/-imXMnIm7NMA/TgxhQQbw1kI/AAAAAAAAAFk/C9UjpjHlSiI/s1600/bw2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="143" src="http://2.bp.blogspot.com/-imXMnIm7NMA/TgxhQQbw1kI/AAAAAAAAAFk/C9UjpjHlSiI/s200/bw2.bmp" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;Figure 5. Left: Result after using &lt;i&gt;im2bw()&lt;/i&gt; with threshold of 0.0001. Right: Final image after cleaning the other parts with Paint and adding the black color fill&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" style="text-align: -webkit-auto;"&gt;With this, I can now find the area using the same method applied on the circle figures as mentioned earlier. However, the result is in pixels. To convert it to the actual area of the region, I have used Photoshop Elements to find the scaling factor.&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-oK78jbCpRbA/TgxiT7XiwKI/AAAAAAAAAFo/WQYfTdP9NMI/s1600/scaling_factor_4pt386+km+per+pxl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="234" src="http://1.bp.blogspot.com/-oK78jbCpRbA/TgxiT7XiwKI/AAAAAAAAAFo/WQYfTdP9NMI/s400/scaling_factor_4pt386+km+per+pxl.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 6. 500 km is equivalent to 114 pixels.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" style="text-align: -webkit-auto;"&gt;With a scaling factor of &lt;b&gt;4386 meters per pixel&lt;/b&gt;, I can now convert the pixel area to actual square meter unit. How do I find for a comparative "theoretical" value for the area? Since the actual region of the legendary Bermuda Triangle varies per author, I can't find an actual official area size. I just settled with measuring the sides (in pixels), then used Heron's method and the scaling factor to find a comparative measurement for the area.&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-8J7ONzvAbRk/TgxjyRQbhQI/AAAAAAAAAFs/YuKsZYArH3E/s1600/heron.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="38" src="http://2.bp.blogspot.com/-8J7ONzvAbRk/TgxjyRQbhQI/AAAAAAAAAFs/YuKsZYArH3E/s320/heron.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Figure 7. Heron's formula for finding the area of a triangle with sides &lt;i&gt;a&lt;/i&gt;, &lt;i&gt;b&lt;/i&gt;, and &lt;i&gt;c&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" style="text-align: -webkit-auto;"&gt;Now, Table 2 tabulates all the important data I've obtained from this experiment:&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Table 2. Summary of the relevant data for Activity 4&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ZpPpmzkg4yo/TgxkPaGifYI/AAAAAAAAAFw/Bif8SC75GRs/s1600/data.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="87" src="http://3.bp.blogspot.com/-ZpPpmzkg4yo/TgxkPaGifYI/AAAAAAAAAFw/Bif8SC75GRs/s400/data.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" style="text-align: -webkit-auto;"&gt;It is evident that there is still a large discrepancy between the Green's and Heron's method of obtaining the area of Bermuda Triangle (2 million square meters). However, being a&amp;nbsp;colossal&amp;nbsp;region, this still came out pretty well with a 0.63% deviation.&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" style="text-align: -webkit-auto;"&gt;Areas with defined edges are now easily computable with the methods I learned from this activity.&lt;br /&gt;&lt;br /&gt;Self-Assessment: 10/10&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-4031975755175857972?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/4031975755175857972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/06/iv.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/4031975755175857972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/4031975755175857972'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/06/iv.html' title='IV'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-7Oe9KkV1RvA/TgwGF03GE0I/AAAAAAAAAEs/EFWAKjOAjKM/s72-c/eq1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-122350765075356665</id><published>2011-06-23T02:51:00.000-07:00</published><updated>2011-10-13T17:04:09.634-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='E'/><title type='text'>III</title><content type='html'>This activity gives us an introductory course on different image types and formats. I used a black &amp;amp; white image to practice some SciLab image reading commands. The command &lt;i&gt;size()&lt;/i&gt; gives the size of my image in its matrix form, giving binary values corresponding to the visible black and white color. It correctly gave the dimensions of &lt;i&gt;468 x 459&lt;/i&gt; for my image. From this information alone, and without seeing the image itself, we can deduce that it has an almost square shape. Also, looking at the values given by I, we can quickly see if it is black and white or if it's not.&lt;br /&gt;&lt;br /&gt;To get more acquainted with file types, I've collected images from the web based from the classification of Activity 3 and investigated the characteristics using Windows and SciLab's &lt;i&gt;imfinfo().&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-NcLj-vqRoYo/TgL9ANqOJwI/AAAAAAAAABk/86RCj0jecqQ/s1600/binary.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="140" src="http://4.bp.blogspot.com/-NcLj-vqRoYo/TgL9ANqOJwI/AAAAAAAAABk/86RCj0jecqQ/s200/binary.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-EtcBaemrU5k/TgL9CS1mk9I/AAAAAAAAABo/KFX7MuQHA-E/s1600/data_binary.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="113" src="http://1.bp.blogspot.com/-EtcBaemrU5k/TgL9CS1mk9I/AAAAAAAAABo/KFX7MuQHA-E/s200/data_binary.png" width="200" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://4.bp.blogspot.com/-j2oOc9vzECs/TgL9C3TU65I/AAAAAAAAABs/7VL1Njv8tfg/s1600/data_binary1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-j2oOc9vzECs/TgL9C3TU65I/AAAAAAAAABs/7VL1Njv8tfg/s200/data_binary1.png" width="176" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 1. Binary image properties&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-CWSv-h97Sio/TgL9qF7YQhI/AAAAAAAAABw/WXsfrlL7rP4/s1600/grayscale.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-CWSv-h97Sio/TgL9qF7YQhI/AAAAAAAAABw/WXsfrlL7rP4/s1600/grayscale.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-dJpynVe2-gw/TgL9r6x84vI/AAAAAAAAAB0/cAmBSXZRqQg/s1600/data_grayscale.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="108" src="http://2.bp.blogspot.com/-dJpynVe2-gw/TgL9r6x84vI/AAAAAAAAAB0/cAmBSXZRqQg/s200/data_grayscale.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-geTFeuFcoK0/TgL9sSVlfgI/AAAAAAAAAB4/EAHoJYrFZaY/s1600/data_grayscale1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-geTFeuFcoK0/TgL9sSVlfgI/AAAAAAAAAB4/EAHoJYrFZaY/s200/data_grayscale1.png" width="176" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 2. Grayscale image properties&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-gx0BmY-Wbi8/TgL-BGQEgbI/AAAAAAAAACA/JuXNnULmBoA/s1600/truecolor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://1.bp.blogspot.com/-gx0BmY-Wbi8/TgL-BGQEgbI/AAAAAAAAACA/JuXNnULmBoA/s200/truecolor.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-xecErpDb_j0/TgL-DEJQxNI/AAAAAAAAACE/9WP-udAuMc8/s1600/data_truecolor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="103" src="http://3.bp.blogspot.com/-xecErpDb_j0/TgL-DEJQxNI/AAAAAAAAACE/9WP-udAuMc8/s200/data_truecolor.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-zi9J_ENv-Hk/TgL-EnxOMjI/AAAAAAAAACI/meXy5afz-rA/s1600/data_truecolor1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-zi9J_ENv-Hk/TgL-EnxOMjI/AAAAAAAAACI/meXy5afz-rA/s200/data_truecolor1.png" width="177" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 3. True Color image properties&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-4XhKyKjgETA/TgL-mb8aleI/AAAAAAAAACM/COoDRsHyvrk/s1600/indexed.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-4XhKyKjgETA/TgL-mb8aleI/AAAAAAAAACM/COoDRsHyvrk/s1600/indexed.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-xH-qY3gUmzU/TgL-n6JH7hI/AAAAAAAAACQ/0HpTlxsamcI/s1600/data_indexed.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="105" src="http://3.bp.blogspot.com/-xH-qY3gUmzU/TgL-n6JH7hI/AAAAAAAAACQ/0HpTlxsamcI/s200/data_indexed.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-W8ysNdgKBi4/TgL-oTUt2iI/AAAAAAAAACU/R9FTjWm3mDg/s1600/data_indexed1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-W8ysNdgKBi4/TgL-oTUt2iI/AAAAAAAAACU/R9FTjWm3mDg/s200/data_indexed1.png" width="177" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 4. Indexed image properties&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-mLmz3W1fr90/TgL_BXm9kjI/AAAAAAAAACY/j525-RECz4s/s1600/HDR.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="133" src="http://2.bp.blogspot.com/-mLmz3W1fr90/TgL_BXm9kjI/AAAAAAAAACY/j525-RECz4s/s200/HDR.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-apNvic2-dK4/TgL_DVtOlII/AAAAAAAAACc/wBKdAYjD2Nk/s1600/data_HDR.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="105" src="http://3.bp.blogspot.com/-apNvic2-dK4/TgL_DVtOlII/AAAAAAAAACc/wBKdAYjD2Nk/s200/data_HDR.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-A-rHePB0Wh0/TgL_Fm3Vo2I/AAAAAAAAACg/ExPYecJqKTs/s1600/data_HDR1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-A-rHePB0Wh0/TgL_Fm3Vo2I/AAAAAAAAACg/ExPYecJqKTs/s200/data_HDR1.png" width="178" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;Figure 5. HDR image properties&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;There are some discrepancies with the bit-depth that is returned by Windows and SciLab. This could be due to the fact that I'm using an older version of SciLab. As such, image header reading could've changed and that's why SciLab differs from what Windows is showing.&lt;br /&gt;&lt;br /&gt;The next figures show further SciLab works for image manipulation. Fig. 6 shows the converted image of my previous True Color (Fig. 3) image to a grayscale one.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-_I4J5OsjxN8/TgMAqjMm_uI/AAAAAAAAACk/JDmrIGFEcaU/s1600/gray.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-JeuhSe5vHBY/TgMA6V2bIpI/AAAAAAAAACs/hDo7KDWBLrI/s1600/graycode.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="188" src="http://3.bp.blogspot.com/-JeuhSe5vHBY/TgMA6V2bIpI/AAAAAAAAACs/hDo7KDWBLrI/s200/graycode.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Vy_RUCh07aE/TgMArY6ma_I/AAAAAAAAACo/w5Ih9qQeSAQ/s1600/graycode2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="189" src="http://3.bp.blogspot.com/-Vy_RUCh07aE/TgMArY6ma_I/AAAAAAAAACo/w5Ih9qQeSAQ/s200/graycode2.png" width="200" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Figure 6. Converted image using&lt;i&gt; im2gray()&lt;/i&gt; and&lt;i&gt; gray_imread()&lt;/i&gt;. Both yield similar results.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Now, I've tried converting the image from True Color to black &amp;amp; white using &lt;i&gt;im2bw()&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-XkTh_Uxi9x4/TgMB4ppu5sI/AAAAAAAAACw/Wy_S80vBMUU/s1600/BW.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://4.bp.blogspot.com/-XkTh_Uxi9x4/TgMB4ppu5sI/AAAAAAAAACw/Wy_S80vBMUU/s200/BW.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-GubzfM3oN4M/TgMB5JikhgI/AAAAAAAAAC0/mYwSI-nfMbQ/s1600/BWcode.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="190" src="http://3.bp.blogspot.com/-GubzfM3oN4M/TgMB5JikhgI/AAAAAAAAAC0/mYwSI-nfMbQ/s200/BWcode.png" width="200" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 7. Converted image using &lt;i&gt;im2bw()&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;This command needs an argument for the baseline value that it will zero out. Notice the &lt;i&gt;0.3&amp;nbsp;&lt;/i&gt;value. Knowing the histogram could give further insight to a better value, but for my image, I just picked 0.3 such that I have a sufficient black &amp;amp; white image.&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-4P1lv95CCO0/TgMI-MxrlwI/AAAAAAAAAC8/9ojmUxcakiA/s1600/1.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;To give an insight on the application of image processing in data analysis, I try to do a background subtraction for my A1 graph. However, my graph is actually clean and thus the effect is not emphasized.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-HrhxtK_1VKU/TgMI3O6KF6I/AAAAAAAAAC4/tmi5rJRIiBY/s1600/grayscale_A1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-HrhxtK_1VKU/TgMI3O6KF6I/AAAAAAAAAC4/tmi5rJRIiBY/s320/grayscale_A1.png" width="242" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;Figure 8. Grayscale converted image [&lt;a href="http://2.bp.blogspot.com/-2Hb9wECcx_I/TfmN2HJacGI/AAAAAAAAAAM/TvbKCrpialw/s1600/454px-Superconductivity_1911.gif"&gt;source&lt;/a&gt;]&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-r_eHA862o0Q/TgMJ4etLHYI/AAAAAAAAADA/9iqoICvy0rk/s1600/gray_histplot+with+code.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="181" src="http://2.bp.blogspot.com/-r_eHA862o0Q/TgMJ4etLHYI/AAAAAAAAADA/9iqoICvy0rk/s320/gray_histplot+with+code.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;Figure 9. &lt;i&gt;histplot() &lt;/i&gt;result of above image&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;We see from Fig. 8 the negligible visual change from the original. I then continue to get the histogram using the &lt;i&gt;histplot()&lt;/i&gt; (Fig. 9) and study the grayscale distribution. The aim is to maximize certain parts of the image histogram and threshold values to become either white or black. However, since my image is particularly "smooth", as we can see in it's histogram, there is little change to the final result.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-nwo9TsIZsAU/TgMKNokHFnI/AAAAAAAAADE/BrimPB7H9MY/s1600/A1graph_rev.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-nwo9TsIZsAU/TgMKNokHFnI/AAAAAAAAADE/BrimPB7H9MY/s200/A1graph_rev.png" width="151" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 10. Final black and white converted image&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&amp;nbsp;I use another scanned image that is visually noisier than my A1 graph image. Implementing the same steps mentioned above, I have improved the clarity of the graph:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-xzGfl93Ue58/TglBYDCKKZI/AAAAAAAAAEA/-2F2qQEBZyE/s1600/graphh.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-xzGfl93Ue58/TglBYDCKKZI/AAAAAAAAAEA/-2F2qQEBZyE/s200/graphh.jpg" width="183" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-TsTYifoP5Rg/TglAVHmf5eI/AAAAAAAAADs/bzAVYQ7ii5s/s1600/graph_08.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-TsTYifoP5Rg/TglAVHmf5eI/AAAAAAAAADs/bzAVYQ7ii5s/s200/graph_08.jpg" width="183" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-ePrm4JdxZjY/TglAWIDCwoI/AAAAAAAAADw/KwZIVo6dODU/s1600/graph_07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-ePrm4JdxZjY/TglAWIDCwoI/AAAAAAAAADw/KwZIVo6dODU/s200/graph_07.jpg" width="183" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-GdO-gtEEvUY/TglAXZ3HfcI/AAAAAAAAAD0/v8zAPQMQD9Y/s1600/graph_06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-GdO-gtEEvUY/TglAXZ3HfcI/AAAAAAAAAD0/v8zAPQMQD9Y/s200/graph_06.jpg" width="183" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-JksOI4k5A9g/TglAbCUmn1I/AAAAAAAAAD8/agfl9dS4e7Y/s1600/graph_05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-JksOI4k5A9g/TglAbCUmn1I/AAAAAAAAAD8/agfl9dS4e7Y/s200/graph_05.jpg" width="183" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 11. Top to bottom: Original, &lt;i&gt;im2bw()&lt;/i&gt; transforms with 0.8, 0.7, 0.6 and 0.5 thresholds, respectively.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-cejtck8NZqE/TglCBni4j3I/AAAAAAAAAEE/DDl-ZaJkOlM/s1600/graph_hist.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="276" src="http://4.bp.blogspot.com/-cejtck8NZqE/TglCBni4j3I/AAAAAAAAAEE/DDl-ZaJkOlM/s320/graph_hist.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 12. &lt;i&gt;histplot()&lt;/i&gt; of the original image&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;As we can see, lowering the threshold improves the clarity of the actual data. By looking at Fig. 12, most of the pixel values are at the 0.8 to 0.95 intensity. Thus, by examining the behavior of the graphs, I've further understood that &lt;i&gt;im2bw() &lt;/i&gt;works by setting pixels with larger intensity values (as can be seen from the &lt;i&gt;histplot()&lt;/i&gt;) than your threshold to 1 (white) and smaller values to 0 (black), hence producing the black and white image. Thus by getting farther away from the 0.8 to 0.95 range, we remove most of the data in the picture which is actually noise. We retain the small amount of data contained (area under the curve of 0 to ~0.65) that is our actual data lines.&lt;br /&gt;&lt;br /&gt;Note that we also have losses since some pixels in our data graph correspond to pixel values white-d out by the thresholding. Also, one might wonder what happened to the darkening of the image produced with the 0.8 threshold. The conversion of the scanned image to a format with lower channels than the original produced this effect. Lastly, in scanned images, it is not necessary that the actual ink images are the blackest, as we can deduce from Fig. 12.&lt;br /&gt;&lt;br /&gt;Lastly, to further elucidate their differences, I have done a side by side comparison of an image saved in the various file formats.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-cNlEh3CLaBk/TgMhwgvGFeI/AAAAAAAAADY/VsmcQY5QHNk/s1600/2_PNG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="190" src="http://1.bp.blogspot.com/-cNlEh3CLaBk/TgMhwgvGFeI/AAAAAAAAADY/VsmcQY5QHNk/s200/2_PNG.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-SqcWgdmSCEU/TgMiJToNnvI/AAAAAAAAADc/F7DFqiMgtKk/s1600/zoomPNG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="116" src="http://2.bp.blogspot.com/-SqcWgdmSCEU/TgMiJToNnvI/AAAAAAAAADc/F7DFqiMgtKk/s200/zoomPNG.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-eLLlVMzOCJU/TgMiK_-V5TI/AAAAAAAAADg/tntdLY69T2g/s1600/zoomJPG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="116" src="http://2.bp.blogspot.com/-eLLlVMzOCJU/TgMiK_-V5TI/AAAAAAAAADg/tntdLY69T2g/s200/zoomJPG.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-5_Fs2K5l_ok/TgMiNTkeuNI/AAAAAAAAADk/-z167jIg_Ec/s1600/zoomGIF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="116" src="http://1.bp.blogspot.com/-5_Fs2K5l_ok/TgMiNTkeuNI/AAAAAAAAADk/-z167jIg_Ec/s200/zoomGIF.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-0ti7DQwJm9k/TgMiOdF8eZI/AAAAAAAAADo/G5GAX9D4HOk/s1600/zoomBMP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="116" src="http://3.bp.blogspot.com/-0ti7DQwJm9k/TgMiOdF8eZI/AAAAAAAAADo/G5GAX9D4HOk/s200/zoomBMP.png" width="200" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 13. Top to bottom:&lt;/span&gt; &lt;span style="font-size: x-small;"&gt;Original [PNG, &lt;a href="http://en.wikipedia.org/wiki/File:PNG_transparency_demonstration_1.png"&gt;source&lt;/a&gt;],&lt;/span&gt; &lt;span style="font-size: x-small;"&gt;&amp;nbsp;zoomed-in shots in PNG, JPG, GIF and BMP formatting, accordingly.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;From Fig. 13, I barely notice differences between the PNG and BMP formats, except the filesize. The PNG format was well over 2 times smaller than its BMP counterpart. For the other 2 lossy formats, JPG is significantly better in terms of quality than GIF and marginally smaller in file size.&lt;br /&gt;&lt;br /&gt;With our brief introduction to image formats, it seems that lossless formats only optimizes the storage of the image data to minimize size. Lossy formats on the other hand, employ various methods and algorithms to remove some data (with specific considerations, of course) such that the resulting file size is smaller. The amount of data removed, method and impact to the actual visual of the image varies with lossy formatting used.&lt;br /&gt;&lt;br /&gt;Self-Assessment: 10/10&amp;nbsp; &lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-nwo9TsIZsAU/TgMKNokHFnI/AAAAAAAAADE/BrimPB7H9MY/s1600/A1graph_rev.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-122350765075356665?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/122350765075356665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/06/iii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/122350765075356665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/122350765075356665'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/06/iii.html' title='III'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-NcLj-vqRoYo/TgL9ANqOJwI/AAAAAAAAABk/86RCj0jecqQ/s72-c/binary.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-5602894999916667696</id><published>2011-06-21T00:36:00.000-07:00</published><updated>2011-10-13T17:03:56.562-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='L'/><title type='text'>II</title><content type='html'>Today, we tinker with the basics of image processing using SciLab and its modules. From the sample code snippet included in the A2 pdf file, I've plotted a circular aperture. It seems that 1=white and 0=black in pixel color.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-EBUWdbRJC7A/TgAqBvGBM9I/AAAAAAAAABM/kjlsaQ0Enls/s1600/0C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="121" src="http://2.bp.blogspot.com/-EBUWdbRJC7A/TgAqBvGBM9I/AAAAAAAAABM/kjlsaQ0Enls/s320/0C.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-VCXPuyLvywE/TgAqDhr3BEI/AAAAAAAAABU/skGXnCMLDw8/s1600/2C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://1.bp.blogspot.com/-OnGVwwlA1V4/TgAosJvPM-I/AAAAAAAAAA0/dDUSDPW-3rY/s1600/0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-OnGVwwlA1V4/TgAosJvPM-I/AAAAAAAAAA0/dDUSDPW-3rY/s200/0.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;Figure 1. Example code and the &lt;i&gt;circular aperture&lt;/i&gt; image it produces&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div align="left" class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&amp;nbsp; Employing matrix subtraction, I have modified the example code to achieve the &lt;b&gt;annulus.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-AkfnEB_-2f0/TgAqCtbZveI/AAAAAAAAABQ/7oobw4yJanQ/s1600/1C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="158" src="http://2.bp.blogspot.com/-AkfnEB_-2f0/TgAqCtbZveI/AAAAAAAAABQ/7oobw4yJanQ/s320/1C.png" width="320" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-HgW-1NJQBIc/TgAo4wX8C6I/AAAAAAAAAA4/xeSFmuME-K4/s1600/1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-HgW-1NJQBIc/TgAo4wX8C6I/AAAAAAAAAA4/xeSFmuME-K4/s200/1.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;Figure 2. Code and image for the &lt;i&gt;annulus&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Next is the &lt;b&gt;sinusoid along the x-direction (corrugated roof)&lt;/b&gt; image. I still used the layout of the example code for this. Now instead of generating &lt;i&gt;A&lt;/i&gt; as a zero matrix, I have used the sine function to form a grayscale image.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-VCXPuyLvywE/TgAqDhr3BEI/AAAAAAAAABU/skGXnCMLDw8/s1600/2C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="96" src="http://1.bp.blogspot.com/-VCXPuyLvywE/TgAqDhr3BEI/AAAAAAAAABU/skGXnCMLDw8/s320/2C.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-kBnCZxqWGqk/TgAo-zTNK8I/AAAAAAAAAA8/rBzFvETSuD8/s1600/2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-kBnCZxqWGqk/TgAo-zTNK8I/AAAAAAAAAA8/rBzFvETSuD8/s200/2.jpg" width="200" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 3. Code and image for the &lt;i&gt;corrugated roof&lt;/i&gt; image. Note the constant 5 in the argument of the sine function. (f=2/5)&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left" class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;For the &lt;b&gt;grating along the x-direction&lt;/b&gt; image, I've just modified the code in Fig. 3 to have binary values. To facilitate the inhomogeneity due to rounding, I've modified the &lt;i&gt;nx&lt;/i&gt; and &lt;i&gt;ny&lt;/i&gt; and the &lt;i&gt;frequency&lt;/i&gt; of the code.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-a2ZqAwHpsj4/TgAqEX8v9II/AAAAAAAAABY/xGjwGWeR3iI/s1600/3C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="89" src="http://3.bp.blogspot.com/-a2ZqAwHpsj4/TgAqEX8v9II/AAAAAAAAABY/xGjwGWeR3iI/s320/3C.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-vHvQp8NO5yw/TgApBixPIcI/AAAAAAAAABA/m9S_u_QlM74/s1600/3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="176" src="http://1.bp.blogspot.com/-vHvQp8NO5yw/TgApBixPIcI/AAAAAAAAABA/m9S_u_QlM74/s200/3.jpg" width="200" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 4. Code and image for the &lt;i&gt;grating along x-axis&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;For the &lt;b&gt;circular aperture with Gaussian transparency&lt;/b&gt;, I've modified the circular aperture with a &lt;u&gt;normal&lt;/u&gt; Gaussian function of &lt;b&gt;r.&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-1-kssg104qI/TgAqIUVDpyI/AAAAAAAAABc/VsLlqa9feCY/s1600/4C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="119" src="http://1.bp.blogspot.com/-1-kssg104qI/TgAqIUVDpyI/AAAAAAAAABc/VsLlqa9feCY/s320/4C.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-rF1ncfo03ZI/TgApE-R-HsI/AAAAAAAAABE/6_v1JbfwLcQ/s1600/4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-rF1ncfo03ZI/TgApE-R-HsI/AAAAAAAAABE/6_v1JbfwLcQ/s200/4.jpg" width="200" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 3. Code and image for the &lt;i&gt;circular aperture with Gaussian transparency&lt;/i&gt;. Sigma = 0.9&lt;/span&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;i&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-mv0FHdECB8w/TgAqJb3sJAI/AAAAAAAAABg/jDpDaRCHxVY/s1600/5C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;The last image I produced is the rectangular aperture at the center. To achieve this, I used&lt;br /&gt;the A&lt;i&gt;(xi:xn,yi:yn)=k&lt;/i&gt; to set the values of the middle segment of the matrix of width 20 pixels.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-mv0FHdECB8w/TgAqJb3sJAI/AAAAAAAAABg/jDpDaRCHxVY/s1600/5C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="106" src="http://4.bp.blogspot.com/-mv0FHdECB8w/TgAqJb3sJAI/AAAAAAAAABg/jDpDaRCHxVY/s320/5C.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-zkkvgBq6fYE/TgApHvuw-zI/AAAAAAAAABI/fTqq8j9RIZk/s1600/5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-zkkvgBq6fYE/TgApHvuw-zI/AAAAAAAAABI/fTqq8j9RIZk/s200/5.jpg" width="200" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 5. Code and image for the &lt;i&gt;square aperture.&lt;/i&gt; Side = 20 pixels.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;Due to time constraints and unfamiliarity with the SciLab, I haven't yet been able to code this in a general, precise and efficient form. I will improve on this.&lt;br /&gt;&lt;br /&gt;&amp;nbsp; Self-Assessment: 10/10&amp;nbsp; &amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-5602894999916667696?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/5602894999916667696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/06/ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/5602894999916667696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/5602894999916667696'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/06/ii.html' title='II'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-EBUWdbRJC7A/TgAqBvGBM9I/AAAAAAAAABM/kjlsaQ0Enls/s72-c/0C.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7535750636146573043.post-7473155229094648754</id><published>2011-06-15T22:58:00.000-07:00</published><updated>2011-10-13T17:03:01.094-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='A'/><title type='text'>I</title><content type='html'>Activity 1 - Digital Scanning&lt;br /&gt;&lt;br /&gt;Using ratio and proportion, I have replicated Onnes' remarkable graph that gave birth to superconductivity.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-2Hb9wECcx_I/TfmN2HJacGI/AAAAAAAAAAM/TvbKCrpialw/s1600/454px-Superconductivity_1911.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-2Hb9wECcx_I/TfmN2HJacGI/AAAAAAAAAAM/TvbKCrpialw/s320/454px-Superconductivity_1911.gif" width="242" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;Figure 1. Superconductivity of mercury [&lt;a href="http://pl.wikipedia.org/wiki/Plik:Superconductivity_1911.gif"&gt;Source&lt;/a&gt;]&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;Using Photoshop Elements, I have obtained the coordinates of the grid lines and obtained the best-fit lines to find a correlation equation between the pixels and the physical values it represents.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-3UUT-_KdmEY/TfmQZXkq4DI/AAAAAAAAAAQ/-YTQaiz2FC8/s1600/democal.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="187" src="http://1.bp.blogspot.com/-3UUT-_KdmEY/TfmQZXkq4DI/AAAAAAAAAAQ/-YTQaiz2FC8/s320/democal.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;Figure 2. Pixel conversion. Note the axes offsets. I have normalized the origin to (0,0)&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/--40SJzeZda4/TfmQde4aCBI/AAAAAAAAAAU/ncbCdHuHdyI/s1600/xbfl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-HqiBVdMij_k/TfmSiL6sqdI/AAAAAAAAAAc/dOvHUkbDxyQ/s1600/bfl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="142" src="http://4.bp.blogspot.com/-HqiBVdMij_k/TfmSiL6sqdI/AAAAAAAAAAc/dOvHUkbDxyQ/s400/bfl.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;Figure 3. Axes' best-fit lines&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;From these equations, I have replicated the 6 data points of the original graph. With these, I have obtained the corresponding slopes per division, corresponding to: Normal, Transition and Superconducting (SC) states of the graph.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-n2Rc7z4giSk/TfmWyKIe7-I/AAAAAAAAAAk/Il0R9a-kAqo/s1600/NSsl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-n2Rc7z4giSk/TfmWyKIe7-I/AAAAAAAAAAk/Il0R9a-kAqo/s1600/NSsl.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-2Y9K3lRiw5Q/TfmWzMGRu8I/AAAAAAAAAAo/gSawtTk1F60/s1600/TSsl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-2Y9K3lRiw5Q/TfmWzMGRu8I/AAAAAAAAAAo/gSawtTk1F60/s1600/TSsl.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-yGe9v0jhjQc/TfmW0WOZdVI/AAAAAAAAAAs/LMJffhk-kNM/s1600/SCsl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-yGe9v0jhjQc/TfmW0WOZdVI/AAAAAAAAAAs/LMJffhk-kNM/s1600/SCsl.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span style="font-size: x-small;"&gt;Figure 4. Linear fitting of the various regions. Normal state is the region with a linear resistance (T&amp;gt;~4.22K), Transition state is the region of greatest resistance change (dashed lines) and the Superconducting state is the region of very low resistance (T&amp;lt;4.2K)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;I had problems with the SC region. This is due to the constant in the line equation, which means that my line can have negative values. Rethinking, I have abandoned the use of the line equation and placed a value of zero for temperatures lower than 4.2K in my graph. This decision came from thinking that realistically speaking, resistance values approaches zero for superconductors. The line equation gave erroneous data points at this region due to the limited amount of original data points that I have used to obtain it. Had the original graph been log scaled, this would've been clearer as the actual resolution of the graph is limited by pen and paper.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-HR_p0U0bddI/TfmYUxVkG5I/AAAAAAAAAAw/pojZP468qx8/s1600/Untitled-5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="276" src="http://3.bp.blogspot.com/-HR_p0U0bddI/TfmYUxVkG5I/AAAAAAAAAAw/pojZP468qx8/s320/Untitled-5.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span style="font-size: x-small;"&gt;Figure 5. Overlay of the simulated graph(blue, step size=0.01) with the original graph image (black + points)&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;The final result is considerably good as we can see from Fig. 5. The Normal state deviation can be attributed to the regression of the line fit. Also, the Transition state is clearly exact due to the fact that it contains only 2 points at that region. Onnes' graph is a very simple scatter plot, as such, I have used linear fit lines to add more points for my replication.&amp;nbsp;&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;Simple but quite arduous. &lt;br /&gt;Self-Assessment: 10/10&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/--40SJzeZda4/TfmQde4aCBI/AAAAAAAAAAU/ncbCdHuHdyI/s1600/xbfl.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7535750636146573043-7473155229094648754?l=ap186.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186.blogspot.com/feeds/7473155229094648754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ap186.blogspot.com/2011/06/i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/7473155229094648754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7535750636146573043/posts/default/7473155229094648754'/><link rel='alternate' type='text/html' href='http://ap186.blogspot.com/2011/06/i.html' title='I'/><author><name>Rusty</name><uri>http://www.blogger.com/profile/01075371591168835973</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/-2Hb9wECcx_I/TfmN2HJacGI/AAAAAAAAAAM/TvbKCrpialw/s72-c/454px-Superconductivity_1911.gif' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
