<?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-6407872634751791939</id><updated>2012-02-16T16:55:03.978-08:00</updated><title type='text'>Image Processing</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-6123913297851988372</id><published>2008-10-05T18:21:00.000-07:00</published><updated>2008-10-12T20:39:06.265-07:00</updated><title type='text'>A20 - Neural Networks</title><content type='html'>Neural network is a mathematical model that mimics brain function. It is made up of interconnecting artificial neurons (programming constructs that mimic the properties of biological neurons) in a similar manner shown below.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPLCpzHE_wI/AAAAAAAAAZg/jh65uM-WBcE/s1600-h/neural+network.png"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPLCpzHE_wI/AAAAAAAAAZg/jh65uM-WBcE/s320/neural+network.png" alt="" id="BLOGGER_PHOTO_ID_5256477738445111042" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;http://upload.wikimedia.org/wikipedia/en/thumb/1/1d/Neural_network_example.png/180px-Neural_network_example.png&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;In this activity, we use neural networks as a method to classify objects into classes depending on the extracted features. We again use pillows and kwek-kwet data set from &lt;a href="http://ap186dado.blogspot.com/search?updated-max=2008-10-05T18%3A21%3A00-07%3A00&amp;amp;max-results=1"&gt;activity19&lt;/a&gt;. The features used are ROI pixel area, length-to-width ratio, average red component (NCC) and average green component (NCC).&lt;br /&gt;&lt;br /&gt;A code was already prepared by Jeric Tugaff and was only modified for this activity's purpose. The values used are as 4 input feature vectors (normalized between 0-1) both from 4 training objects for each class and 4 test objects for each class.&lt;br /&gt;&lt;br /&gt;The neural network is trained using the training set. The code is expected to output values close to&lt;br /&gt;&lt;div style="text-align: center;"&gt; [0 0 0 0 1 1 1 1]&lt;br /&gt;&lt;div style="text-align: left;"&gt;meaning the first four test object will be classified as belonging to the pillows class and the second set of test objects will be classified under the kwek-kwek class. The output is as follows. From this table, 100% classification of the test objects is obviously obtained.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPKi2JkuzcI/AAAAAAAAAYI/iPpWHz5zV2c/s1600-h/ann.PNG"&gt;&lt;img style="cursor: pointer; width: 474px; height: 32px;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPKi2JkuzcI/AAAAAAAAAYI/iPpWHz5zV2c/s400/ann.PNG" alt="" id="BLOGGER_PHOTO_ID_5256442766261407170" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;//code&lt;br /&gt;chdir('C:\Documents and Settings\VIP\Desktop\ap186\A20');&lt;br /&gt;&lt;br /&gt;training = fscanfMat('training.txt');&lt;br /&gt;test = fscanfMat('test.txt');&lt;br /&gt;&lt;br /&gt;//training&lt;br /&gt;mntr = min(training, 'c');&lt;br /&gt;tr2 = training - mtlb_repmat(mntr, 1, 8);&lt;br /&gt;mxtr = max(tr2, 'c');&lt;br /&gt;tr2 = tr2./mtlb_repmat(mxtr, 1, 8);&lt;br /&gt;&lt;br /&gt;//test&lt;br /&gt;mnts = min(test, 'c');&lt;br /&gt;ts2 = test - mtlb_repmat(mnts, 1, 8);&lt;br /&gt;mxts = max(ts2, 'c');&lt;br /&gt;ts2 = ts2./mtlb_repmat(mxts, 1, 8);&lt;br /&gt;&lt;br /&gt;tr_out = [0 0 0 0 1 1 1 1];&lt;br /&gt;N = [4, 10, 1];&lt;br /&gt;lp = [0.1, 0];&lt;br /&gt;W = ann_FF_init(N);&lt;br /&gt;&lt;br /&gt;T = 400;&lt;br /&gt;W = ann_FF_Std_online(tr2,tr_out,N,W,lp,T);&lt;br /&gt;//x is the training t is the output W is the initialized weights,&lt;br /&gt;//N is the NN architecture, lp is the learning rate and T is the number of iterations&lt;br /&gt;&lt;br /&gt;// full run&lt;br /&gt;ann_FF_run(ts2,N,W) // classification output&lt;br /&gt;&lt;br /&gt;//end code&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Thanks Jeric Tugaff for helping me understand how neural network works and for helping me with the program.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Rating 7/10 since I implemented the program correctly but was very dependent on Jeric's tutorial and discussion. :)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-6123913297851988372?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/6123913297851988372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=6123913297851988372' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/6123913297851988372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/6123913297851988372'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/10/a20-neural-networks.html' title='A20 - Neural Networks'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SPLCpzHE_wI/AAAAAAAAAZg/jh65uM-WBcE/s72-c/neural+network.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-1470627419489986780</id><published>2008-09-20T18:15:00.000-07:00</published><updated>2008-10-12T20:11:15.804-07:00</updated><title type='text'>A19 - Probabilistic Classification</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;Linear discriminant analysis is a classification technique by which one creates a discriminant function from predictor variables.&lt;br /&gt;&lt;br /&gt;In discriminant analysis, there is a dependent variable (Y) which is the group and the independent variables (X) which are the object features that might describe the group. If the groups are linearly separable, then we can use linear discriminant analysis. This method suggests that the groups can be separated by a linear combination of features that describe the objects.&lt;br /&gt;&lt;br /&gt;In this activity, i used LDA to classify &lt;span style="font-weight: bold; font-style: italic;"&gt;pillows&lt;/span&gt; (chocolate-coated snack) and &lt;span style="font-weight: bold; font-style: italic;"&gt;kwek-kwek&lt;/span&gt; (orange, flour-coated quail egg) based on the features such as pixel area, length-to-width ratio, average red component (NCC), and average green component (NCC).&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPKiDD6KUQI/AAAAAAAAAXw/8hyVf05epJs/s1600-h/pillows-gw.jpg"&gt;&lt;img style="cursor: pointer; width: 126px; height: 168px;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPKiDD6KUQI/AAAAAAAAAXw/8hyVf05epJs/s320/pillows-gw.jpg" alt="" id="BLOGGER_PHOTO_ID_5256441888567349506" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKiDKx3AyI/AAAAAAAAAXo/XYCHam7_dhk/s1600-h/kwekkwek-gw.jpg"&gt;&lt;img style="cursor: pointer; width: 148px; height: 168px;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKiDKx3AyI/AAAAAAAAAXo/XYCHam7_dhk/s320/kwekkwek-gw.jpg" alt="" id="BLOGGER_PHOTO_ID_5256441890411578146" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Images of the two samples were taken using Olympus Stylus 770SW. The images are then white balanced using reference white algorithm with the white tissue as the reference. This is to maintain uniform tissue color in each of the images. The images are then cut such that a single image contains a single sample. Features are then extracted from each of the cut images in the same manner as the &lt;a href="http://ap186dado.blogspot.com/2008/09/a18-pattern-recognition.html"&gt;previous activity&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The data set is again divided into training and test sets, with the first four images of each sample comprising the training set while the last four images for the test set.&lt;br /&gt;&lt;br /&gt;Following the discussion and equations from &lt;span style="font-style: italic; color: rgb(204, 0, 0);"&gt;Pattern_Recognition_2.pdf by Dr. S. Marcos&lt;/span&gt;, I computed the following values.&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKiS1mYmUI/AAAAAAAAAX4/FrXw4a5sY2I/s1600-h/LDA.PNG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKiS1mYmUI/AAAAAAAAAX4/FrXw4a5sY2I/s320/LDA.PNG" alt="" id="BLOGGER_PHOTO_ID_5256442159604209986" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;An object is assigned to a class with the highest f value. As can be seen from the table below, most of group 1 (pillows) have higher f1 values while those in group 2 (kwek-kwek) have higher f2 values. 100% classification is obtained.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;---&lt;br /&gt;//code&lt;br /&gt;&lt;br /&gt;TRpillow=fscanfMat('TrainingSet-Pillows.txt');&lt;br /&gt;TSpillow=fscanfMat('TestSet-Pillows.txt');&lt;br /&gt;&lt;br /&gt;TRkwek=fscanfMat('TrainingSet-Kwekkwek.txt');&lt;br /&gt;TSkwek=fscanfMat('TestSet-Kwekkwek.txt');&lt;br /&gt;&lt;br /&gt;TRpillow=TRpillow';&lt;br /&gt;TSpillow=TSpillow';&lt;br /&gt;TRkwek=TRkwek';&lt;br /&gt;TSkwek=TSkwek';&lt;br /&gt;&lt;br /&gt;TRpilmean=mean(TRpillow,1);&lt;br /&gt;TRkwekmean=mean(TRkwek,1);&lt;br /&gt;&lt;br /&gt;globalmean=(TRpilmean+TRkwekmean)/2;&lt;br /&gt;globalmean=mtlb_repmat(globalmean,4,1);&lt;br /&gt;&lt;br /&gt;TRpillow=TRpillow-globalmean;&lt;br /&gt;TRkwek=TRkwek-globalmean;&lt;br /&gt;&lt;br /&gt;c_pil=((TRpillow')*TRpillow)/4;&lt;br /&gt;c_kwek=((TRkwek')*TRkwek)/4;&lt;br /&gt;&lt;br /&gt;C=((4*c_pil)+(4*c_kwek))/8;&lt;br /&gt;P = [0.5;0.5];&lt;br /&gt;for i=1:4&lt;br /&gt;f1(i) = (TRpilmean*inv(C)*(TSkwek(i,:)'))-((0.5)*(TRpilmean)*inv(C)*(TRpilmean')+log(P(1)));&lt;br /&gt;f2(i) = (TRkwekmean*inv(C)*(TSkwek(i,:)'))-((0.5)*(TRkwekmean)*inv(C)*(TRkwekmean')+log(P(2)));&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;//end code&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Thanks Jeric Tugaff for the tips and discussions and Cole Fabros for the images of the sample.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Rating 8.5/10 since I implemented and understood the technique correctly but was late in posting this blog entry.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-1470627419489986780?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/1470627419489986780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=1470627419489986780' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/1470627419489986780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/1470627419489986780'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/09/a19-probabilistic-classification.html' title='A19 - Probabilistic Classification'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_v7ISAk_qGb8/SPKiDD6KUQI/AAAAAAAAAXw/8hyVf05epJs/s72-c/pillows-gw.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-2636288709433291327</id><published>2008-09-15T19:27:00.000-07:00</published><updated>2008-10-12T20:46:03.151-07:00</updated><title type='text'>A18 - Pattern Recognition</title><content type='html'>Pattern recognition, as a subtopic of machine learning, aims to classify data according to a statistical information extracted from its patterns.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;A pattern is usually a group of measurements or observations extracted from the data set. In essence, a pattern is a set of quantifiable features. These features are then arranged into an ordered set to define a feature vector. Feature vectors, then,  define the grouping of the data into classes.&lt;br /&gt;&lt;br /&gt;In pattern recognition, the specific goal is to decide if a given feature vector belongs to one of the several classes.&lt;br /&gt;&lt;br /&gt;In this activity, we aim to classify a set of images into one of the four classes - &lt;span style="font-weight: bold;"&gt;kwek-kwek&lt;/span&gt; (orange, flour-coated quail egg), &lt;span style="font-weight: bold;"&gt;squid balls&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;piatos potato chips&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;pillows&lt;/span&gt; (chocolate coated snack).&lt;br /&gt;&lt;br /&gt;Images of the four samples were taken using Olympus Stylus 770SW. The images are then white balanced using reference white algorithm with the white tissue as the reference. This is to maintain uniform tissue color in each of the images. The images are then cut such that a single image contains a single sample.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKpFFGMTSI/AAAAAAAAAYQ/xYxfEiOrCWQ/s1600-h/kwekkwek.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKpFFGMTSI/AAAAAAAAAYQ/xYxfEiOrCWQ/s200/kwekkwek.JPG" alt="" id="BLOGGER_PHOTO_ID_5256449619827379490" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPKpwYUInQI/AAAAAAAAAYw/NCFCcZHf-Dw/s1600-h/squidballs.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPKpwYUInQI/AAAAAAAAAYw/NCFCcZHf-Dw/s200/squidballs.JPG" alt="" id="BLOGGER_PHOTO_ID_5256450363720506626" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPKpFiJjQCI/AAAAAAAAAYg/dW2b5FhuaYU/s1600-h/piatos.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPKpFiJjQCI/AAAAAAAAAYg/dW2b5FhuaYU/s200/piatos.JPG" alt="" id="BLOGGER_PHOTO_ID_5256449627626094626" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKpFuLavVI/AAAAAAAAAYo/gehW9jZVLlg/s1600-h/pillows.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKpFuLavVI/AAAAAAAAAYo/gehW9jZVLlg/s200/pillows.JPG" alt="" id="BLOGGER_PHOTO_ID_5256449630855150930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPKrNK0KasI/AAAAAAAAAY4/pAy2xvWAVPE/s1600-h/kwekkwek-1.JPG"&gt;&lt;img style="cursor: pointer; width: 79px; height: 88px;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPKrNK0KasI/AAAAAAAAAY4/pAy2xvWAVPE/s320/kwekkwek-1.JPG" alt="" id="BLOGGER_PHOTO_ID_5256451957824580290" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKrNL-fPUI/AAAAAAAAAZA/O425XwNLmNE/s1600-h/squidballs-1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKrNL-fPUI/AAAAAAAAAZA/O425XwNLmNE/s320/squidballs-1.JPG" alt="" id="BLOGGER_PHOTO_ID_5256451958136323394" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKrNGpEQhI/AAAAAAAAAZI/uGiyH2w-REM/s1600-h/piatos-1.JPG"&gt;&lt;img style="cursor: pointer; width: 115px; height: 87px;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKrNGpEQhI/AAAAAAAAAZI/uGiyH2w-REM/s320/piatos-1.JPG" alt="" id="BLOGGER_PHOTO_ID_5256451956704297490" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKrNLCoeaI/AAAAAAAAAZQ/iGi3y0tdyck/s1600-h/pillows-1.JPG"&gt;&lt;img style="cursor: pointer; width: 71px; height: 87px;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKrNLCoeaI/AAAAAAAAAZQ/iGi3y0tdyck/s320/pillows-1.JPG" alt="" id="BLOGGER_PHOTO_ID_5256451957885270434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: bold;"&gt;FEATURE VECTOR&lt;/span&gt;&lt;br /&gt;For each of the individual sample, the features extracted are as follows:&lt;br /&gt;1. pixel area&lt;br /&gt;2. length-to-width ratio&lt;br /&gt;3. average red component (NCC)&lt;br /&gt;4. average green component (NCC)&lt;br /&gt;&lt;br /&gt;To get the pixel area, the sample images were first binarized to separate ROI from the background. Closing operation is then performed on the binarized images to reduce effect of poor thresholding. The pixel area is then equal to the sum of the (binarized then closed) image.&lt;br /&gt;&lt;br /&gt;Length-to-width ratio is computed as the maximum filled pixel coordinate along the x-axis minus the minimum filled pixel coordinate along x-axis divided by its y-axis counterpart.&lt;br /&gt;&lt;br /&gt;The average red component and green component is obtained from the ROI only using Normalized Chromaticity Coordinates.&lt;br /&gt;&lt;br /&gt;The following table summarizes the features extracted for all the sample images.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPKbmUDQ9yI/AAAAAAAAAXA/SOpb-dx0_zQ/s1600-h/set.PNG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPKbmUDQ9yI/AAAAAAAAAXA/SOpb-dx0_zQ/s320/set.PNG" alt="" id="BLOGGER_PHOTO_ID_5256434797614528290" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: bold;"&gt;MINIMUM DISTANCE CLASSIFICATION&lt;/span&gt;&lt;br /&gt;The data set is divided into two - training and test sets. The training set is composed of the first four images from each classes while the test set are the last four images for each sample.&lt;br /&gt;(Note: Pixel Area was first normalized before subjecting to minimum distance classification.)&lt;br /&gt;&lt;br /&gt;To facilitate classification of the test images into one of the four classes, we use minimum distance classification.&lt;br /&gt;&lt;br /&gt;This is done by getting the mean feature vector from the training set for each class. Therefore, we get the mean of the training set by getting the mean pixel area, mean L/W, mean r, mean g for each of the four classes.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKbmWoL_DI/AAAAAAAAAXI/-rHAEllfF8k/s1600-h/mean.PNG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKbmWoL_DI/AAAAAAAAAXI/-rHAEllfF8k/s320/mean.PNG" alt="" id="BLOGGER_PHOTO_ID_5256434798306262066" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Classification is done by getting the Euclidean distance of an unknown feature vector from the mean feature vector of each class. The unknown feature vector then belongs to the class with which it has the smallest distance.&lt;br /&gt;&lt;br /&gt;In this activity, we use the test set to check for the validity of minimum distance classification as a pattern recognition algorithm. The following results were obtained.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKbmflaJNI/AAAAAAAAAXQ/XHH7frnHmgg/s1600-h/confusion+matrix.PNG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPKbmflaJNI/AAAAAAAAAXQ/XHH7frnHmgg/s320/confusion+matrix.PNG" alt="" id="BLOGGER_PHOTO_ID_5256434800710526162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;From the matrix above, it is shown that among the 16 samples of the test set, only 1 was misclassified as belonging to another class.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Thanks Benj for the discussions with regards to this activity and Cole for the sample images.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Rating: 8.5/10 since I implemented the task correctly but was late in posting this blog entry.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-2636288709433291327?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/2636288709433291327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=2636288709433291327' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/2636288709433291327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/2636288709433291327'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/09/a18-pattern-recognition.html' title='A18 - Pattern Recognition'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_v7ISAk_qGb8/SPKpFFGMTSI/AAAAAAAAAYQ/xYxfEiOrCWQ/s72-c/kwekkwek.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-4463749519626987811</id><published>2008-09-01T23:42:00.000-07:00</published><updated>2008-09-02T02:03:05.686-07:00</updated><title type='text'>A16 - Color Image Segmentation</title><content type='html'>In image segmentation, a region of interest (ROI) is picked out from the rest of the image such that further processing can be done on it. Selection rules are based on features unique to the ROI.&lt;br /&gt;&lt;br /&gt;In this activity, we use color as a feature for segmenting images. To do so, we first transform the color image's RGB into rgI. rgI is part of the normalized chromaticity coordinates or NCC color space. This color space separates chromaticity (r g) and brightness (I) information.&lt;br /&gt;&lt;br /&gt;Per pixel, let I = R+G+B. Then the normalized chromaticity coordinates are&lt;br /&gt;&lt;div style="text-align: center;"&gt;r = R/I&lt;br /&gt;g = G/I&lt;br /&gt;b = B/I&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;---&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLzwbeHcr4I/AAAAAAAAAUw/CK17EyD-z50/s1600-h/greenmug.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLzwbeHcr4I/AAAAAAAAAUw/CK17EyD-z50/s320/greenmug.jpg" alt="" id="BLOGGER_PHOTO_ID_5241328421083852674" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;*&lt;a href="http://images.replacements.com/images/images5/china/H/homer_laughlin_fiesta_shamrock_green_mug_P0000201549S0044T2.jpg"&gt;http://images.replacements.com/images/images5/china/H/homer_laughlin_fiesta_shamrock_green_mug_P0000201549S0044T2.jpg&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Parametric Probability Distribution&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Segmentation based on color can be performed by determining the probability that a pixel belongs to a color distribution of interest. This implies that the color histogram of the region of interest must first be extracted. To do so, one crops a subregion of the ROI and compute the histogram from it. The histogram when normalized by the number of pixels is already the probability distribution function (PDF) of the color. To tag a pixel as belonging to a region of interest or not is to find its probability of belonging to the color of the ROI. Since our space is r and g we can have a joint probability p(r) p(g) function to test the likelihood of pixel membership to the ROI. We can assume a Gaussian distribution independently along r and g, that is, from the r-g values of the cropped pixel we compute the mean μr , μg and standard deviation σr , σg from the pixel samples. The probability that a pixel with chromaticity r or g belongs to the ROI is then&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLz9PfMkaaI/AAAAAAAAAVA/9ztQDRpGINc/s1600-h/eq1.png"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLz9PfMkaaI/AAAAAAAAAVA/9ztQDRpGINc/s320/eq1.png" alt="" id="BLOGGER_PHOTO_ID_5241342508866496930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SLz9PUzdgcI/AAAAAAAAAVI/PJ2dhygoMzs/s1600-h/eq2.png"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SLz9PUzdgcI/AAAAAAAAAVI/PJ2dhygoMzs/s320/eq2.png" alt="" id="BLOGGER_PHOTO_ID_5241342506076832194" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;The joint probability is just the product of p(r) and p(g).&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Shown below is the cropped region of the colored image, wherein we get the mean and standard deviation for both r and g so as to get the probability that a certain pixel belongs to the ROI.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLzwbrvTnYI/AAAAAAAAAU4/yoBVHY6gr2U/s1600-h/greenmug-cropped.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLzwbrvTnYI/AAAAAAAAAU4/yoBVHY6gr2U/s320/greenmug-cropped.jpg" alt="" id="BLOGGER_PHOTO_ID_5241328424740691330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We perform this over all pixels and plot the probability that a pixel belongs to our ROI.&lt;br /&gt;Here's the distribution&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLz-SiRP6CI/AAAAAAAAAVQ/KnmiCoiy_zc/s1600-h/PDF.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLz-SiRP6CI/AAAAAAAAAVQ/KnmiCoiy_zc/s320/PDF.jpg" alt="" id="BLOGGER_PHOTO_ID_5241343660742666274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And here's the segmented image, wherein the white parts corresponds to the pixels belonging to the ROI according to our Gaussian PDF.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLz-nuS6AQI/AAAAAAAAAVY/ADTyLzsXjlw/s1600-h/parametric+segmentation.jpg"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLz-nuS6AQI/AAAAAAAAAVY/ADTyLzsXjlw/s320/parametric+segmentation.jpg" alt="" id="BLOGGER_PHOTO_ID_5241344024748097794" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Nonparametric Segmentation (Histogram Backprojection)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;In non-parametric estimation, the histogram itself is used to tag the membership of pixels. Histogram backprojection is one such technique where based on the color histogram, a pixel location is given a value equal to its histogram value in chromaticity space.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;Here's the histogram used&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLz_MaqjNgI/AAAAAAAAAVg/T4t5tnQpB-A/s1600-h/histogram.png"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLz_MaqjNgI/AAAAAAAAAVg/T4t5tnQpB-A/s320/histogram.png" alt="" id="BLOGGER_PHOTO_ID_5241344655133718018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;and the corresponding segmented image&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLz_MvPqlkI/AAAAAAAAAVo/AzjDAaBDYyU/s1600-h/nonparametric+segmentation.jpg"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLz_MvPqlkI/AAAAAAAAAVo/AzjDAaBDYyU/s320/nonparametric+segmentation.jpg" alt="" id="BLOGGER_PHOTO_ID_5241344660658099778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Nonparametric image segmentation produced better results as compared to the parametric segmentation. Also, in nonparametric segmentation, we never assumed normality of distribution of the r and g, thus, this method is more accurate as compared to parametric segmentation.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;---&lt;br /&gt;Reference:&lt;br /&gt;Activity 16 Lecture Handouts by Dr. Maricor Soriano.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;---&lt;br /&gt;Thanks to Ed for the valuable discussions and arguments with regards to the technique.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;I give myself a 10 for I implemented image segmentation quite well. :)&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-4463749519626987811?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/4463749519626987811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=4463749519626987811' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/4463749519626987811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/4463749519626987811'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/09/a16-color-image-segmentation.html' title='A16 - Color Image Segmentation'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SLzwbeHcr4I/AAAAAAAAAUw/CK17EyD-z50/s72-c/greenmug.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-5659767742155741422</id><published>2008-08-28T04:35:00.000-07:00</published><updated>2008-10-10T19:52:55.378-07:00</updated><title type='text'>A15 - Color Image Processing</title><content type='html'>A colored digital image is an array of pixels each having red, green and blue light overlaid in various proportions. Per pixel, the color captured by a digital color camera is an integral of the product of the spectral power distribution of the incident light source S(λ), the surface reflectance r(λ) and the spectral sensitivity of the camera η(λ).&lt;br /&gt;&lt;br /&gt;Each pixel in a color image has R, G, B values, each of which has a balancing constant equal to the inverse of the camera output when the camera is shown a white object. This balancing constant is implemented through white balancing algorithm of a digital camera. &lt;strong&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;&lt;span style="font-weight: bold;"&gt;At its simplest - the reason we adjust white balance is to get the colors in your images as accurate as possible.*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;More on white balancing at this &lt;a href="http://digital-photography-school.com/blog/introduction-to-white-balance/"&gt;link&lt;/a&gt;. *&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div style="text-align: center;"&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;---&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;The following images shows the effect of changing white balance on camera settings&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLa3phctaiI/AAAAAAAAATY/SHLnGZebqVY/s1600-h/auto.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLa3phctaiI/AAAAAAAAATY/SHLnGZebqVY/s320/auto.JPG" alt="" id="BLOGGER_PHOTO_ID_5239577140473457186" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;WB: auto&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class="on" style="display: block;" id="formatbar_JustifyCenter" title="Align Center" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 11);ButtonMouseDown(this);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SLa3puH7XXI/AAAAAAAAATg/CrMwRr9nWmM/s1600-h/sunny.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SLa3puH7XXI/AAAAAAAAATg/CrMwRr9nWmM/s320/sunny.JPG" alt="" id="BLOGGER_PHOTO_ID_5239577143875951986" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLa3p7Ig9GI/AAAAAAAAATo/lAUFDRTyYNk/s1600-h/cloudy.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SLa3p7Ig9GI/AAAAAAAAATo/lAUFDRTyYNk/s320/cloudy.JPG" alt="" id="BLOGGER_PHOTO_ID_5239577147368076386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;sunny and cloudy settings&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SLa3p1HyrzI/AAAAAAAAATw/38e4gCzRla8/s1600-h/fluorescent.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SLa3p1HyrzI/AAAAAAAAATw/38e4gCzRla8/s320/fluorescent.JPG" alt="" id="BLOGGER_PHOTO_ID_5239577145754431282" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SLa3qLhwmyI/AAAAAAAAAT4/hcX5oGd43WE/s1600-h/tungsten.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SLa3qLhwmyI/AAAAAAAAAT4/hcX5oGd43WE/s320/tungsten.JPG" alt="" id="BLOGGER_PHOTO_ID_5239577151768927010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;strong style="font-weight: normal;"&gt;fluorescent and tungsten settings&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;From these images, we can obviously account that white doesn't appear white especially in tungsten settings. We therefore correct this image using the two algorithms we describe below.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div style="text-align: center;"&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;---&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div style="text-align: center;"&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;AUTOMATIC WHITE BALANCING ALGORITHMS&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;There are two popular algorithms of achieving automatic white balance. The first is Reference White Algorithm and the second is the Gray World Algorithm.&lt;br /&gt;&lt;br /&gt;In the Reference White Algorithm, you capture an image using an unbalanced camera and use the RGB values of a known white object as the divider.&lt;br /&gt;&lt;br /&gt;In the Gray World Algorithm, it is assumed that the average color of the world is&lt;br /&gt;gray. Gray is part of the family of white, as is black. Therefore, if you know the RGB of a gray object, it is essentially the RGB of white up to a constant factor. Thus, to get the balancing constants, you take the average red, green and blue value of the captured image and utilize them as the balancing constants.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLa48CNi1WI/AAAAAAAAAUA/JXLO0QtotQc/s1600-h/tungsten.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SLa48CNi1WI/AAAAAAAAAUA/JXLO0QtotQc/s320/tungsten.JPG" alt="" id="BLOGGER_PHOTO_ID_5239578558017492322" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;original image (tungsten WB)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPAT7lDIqVI/AAAAAAAAAV4/gBhzkrvmW6M/s1600-h/tungsten-reference.jpg"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPAT7lDIqVI/AAAAAAAAAV4/gBhzkrvmW6M/s320/tungsten-reference.jpg" alt="" id="BLOGGER_PHOTO_ID_5255722679419840850" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;reference white algorithm&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAT7lX_yCI/AAAAAAAAAVw/AS7nRsz4NPA/s1600-h/tungsten-grayworld.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAT7lX_yCI/AAAAAAAAAVw/AS7nRsz4NPA/s320/tungsten-grayworld.jpg" alt="" id="BLOGGER_PHOTO_ID_5255722679507339298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;gray world algorithm&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;As can be seen from the images, the reference white is superior in terms of image quality. This is because in gray world algorithm, averaging channels puts bias to colors that are not abundant.&lt;br /&gt;---&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;We also test this algorithm for an image with objects of the same hue.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SLa6via2WuI/AAAAAAAAAUY/O6zzMD2gJCs/s1600-h/green-tungsten.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SLa6via2WuI/AAAAAAAAAUY/O6zzMD2gJCs/s320/green-tungsten.JPG" alt="" id="BLOGGER_PHOTO_ID_5239580542348188386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;original image (green objects under tungsten WB settings)&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAUM__eXbI/AAAAAAAAAWI/i25vn1WP7ew/s1600-h/green-tungsten-reference.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAUM__eXbI/AAAAAAAAAWI/i25vn1WP7ew/s320/green-tungsten-reference.jpg" alt="" id="BLOGGER_PHOTO_ID_5255722978710019506" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;reference white algorithm&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPAUM2rILTI/AAAAAAAAAWA/sgxyazQerzA/s1600-h/green-tungsten-grayworld.jpg"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPAUM2rILTI/AAAAAAAAAWA/sgxyazQerzA/s320/green-tungsten-grayworld.jpg" alt="" id="BLOGGER_PHOTO_ID_5255722976208760114" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span&gt;gray world algorithm&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;In these images, we see that the gray world algorithm is superior in terms of producing accurate colors. The green objects looks more green than in the reference algorithm.&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;---&lt;br /&gt;Note: All images may look dark. This is because I used 0.7 exposure value to avoid saturation of images after processing them.&lt;br /&gt;&lt;br /&gt;I give myself a 10 for I implemented the algorithms correctly. :)&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Thanks to VIP's digital SLR camera. *&lt;span style="font-style: italic;"&gt;nakisingit po ako sa experiment ni Ate Loren.&lt;/span&gt;*&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-5659767742155741422?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/5659767742155741422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=5659767742155741422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5659767742155741422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5659767742155741422'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/08/a15-color-image-processing.html' title='A15 - Color Image Processing'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SLa3phctaiI/AAAAAAAAATY/SHLnGZebqVY/s72-c/auto.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-807280832748385957</id><published>2008-08-25T18:06:00.000-07:00</published><updated>2008-10-12T22:04:05.941-07:00</updated><title type='text'>A14 - Stereometry</title><content type='html'>Stereometry is another 3D reconstruction algorithm based on the human eye perception of depth. We perceive depth by viewing the same object at two different angles (two eyes separated by some distance).&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;In this activity, we explore how stereometry works. We try to reconstruct a 3D object using 2 images of taken by the same camera at the same distance z from the object but with a different x position (assuming x is the parallel axis between the camera and the object).&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPLOtbCsGkI/AAAAAAAAAZ4/OxdtqsSLpm0/s1600-h/stereometry.PNG"&gt;&lt;img style="cursor: pointer; width: 257px; height: 258px;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPLOtbCsGkI/AAAAAAAAAZ4/OxdtqsSLpm0/s320/stereometry.PNG" alt="" id="BLOGGER_PHOTO_ID_5256490994843261506" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;From this diagram, by simple ratio and proportion, depth z is perceived using the relation&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPLPfyHPrtI/AAAAAAAAAaA/LqxyDW16ff8/s1600-h/z.PNG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPLPfyHPrtI/AAAAAAAAAaA/LqxyDW16ff8/s320/z.PNG" alt="" id="BLOGGER_PHOTO_ID_5256491860029845202" border="0" /&gt;&lt;/a&gt;   (1)&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;If done on several points, we can reconstruct the 3D surface of the object.&lt;br /&gt;&lt;br /&gt;The sample I used is a rubik's cube shown below with the tsai grid. (b=50mm, refer to diagram)&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPAhih--BGI/AAAAAAAAAWQ/DyQQ4HyOQ6U/s1600-h/P8272816.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPAhih--BGI/AAAAAAAAAWQ/DyQQ4HyOQ6U/s320/P8272816.JPG" alt="" id="BLOGGER_PHOTO_ID_5255737642263118946" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAhi_iqffI/AAAAAAAAAWY/lK5Q0S8t56U/s1600-h/P8272817.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAhi_iqffI/AAAAAAAAAWY/lK5Q0S8t56U/s320/P8272817.JPG" alt="" id="BLOGGER_PHOTO_ID_5255737650197462514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The camera used was first calibrated to get its internal parameter f (focal length). From the a's calculated using &lt;a href="http://ap186dado.blogspot.com/2008/07/a11-camera-calibration.html"&gt;Activity 11&lt;/a&gt; – Camera Calibration, matrix A is formed by recasting the a's. We then get the values of matrix A(1:3,1:3) and factorize this using RQ factorization, to get upper diagonal matrix K. (Note: Ensure that the factorized A(3,3) element is 1 by dividing the matrix by K(3,3)). The K-matrix obtained is shown below.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAjdH51WLI/AAAAAAAAAW4/pGwxRCivUHI/s1600-h/K-matrix.PNG"&gt;&lt;img style="cursor: pointer; width: 243px; height: 63px;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAjdH51WLI/AAAAAAAAAW4/pGwxRCivUHI/s320/K-matrix.PNG" alt="" id="BLOGGER_PHOTO_ID_5255739748386166962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Knowing that K is just&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPLSJLbF3nI/AAAAAAAAAaI/koQPDhrwWuo/s1600-h/K.PNG"&gt;&lt;img style="cursor: pointer; width: 133px; height: 84px;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPLSJLbF3nI/AAAAAAAAAaI/koQPDhrwWuo/s320/K.PNG" alt="" id="BLOGGER_PHOTO_ID_5256494770221866610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;and &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPLSn8jtlEI/AAAAAAAAAaQ/AkDqR5Q3r5c/s1600-h/alpha.PNG"&gt;&lt;img style="cursor: pointer; width: 164px; height: 25px;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPLSn8jtlEI/AAAAAAAAAaQ/AkDqR5Q3r5c/s320/alpha.PNG" alt="" id="BLOGGER_PHOTO_ID_5256495298807436354" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;we now have a value for focal length &lt;span style="font-style: italic;"&gt;f&lt;/span&gt; (let kx=1);&lt;br /&gt;&lt;br /&gt;We then get z values (using the equation 1) for different points on the object (purple dots).&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPLUmNtIN2I/AAAAAAAAAaY/EZb8QO3zwNQ/s1600-h/points.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPLUmNtIN2I/AAAAAAAAAaY/EZb8QO3zwNQ/s320/points.JPG" alt="" id="BLOGGER_PHOTO_ID_5256497468073850722" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Reconstruction was done using &lt;span style="font-style: italic; color: rgb(0, 0, 153);"&gt;Matlab's &lt;span style="font-weight: bold;"&gt;griddata&lt;/span&gt;&lt;/span&gt; instead of &lt;span style="font-style: italic; color: rgb(0, 0, 153);"&gt;SciLab's &lt;span style="font-weight: bold;"&gt;splin2d&lt;/span&gt;&lt;/span&gt; because of the latter's initial requirement of increasing values for both x and y image coordinates. Matlab's griddata function, however, works well for random values of x and y image coordinates.&lt;br /&gt;&lt;br /&gt;Reconstruction of the rubik's cube is shown below.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPAhi7FbZuI/AAAAAAAAAWg/JV8yk7Gm2lA/s1600-h/recons1.png"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPAhi7FbZuI/AAAAAAAAAWg/JV8yk7Gm2lA/s320/recons1.png" alt="" id="BLOGGER_PHOTO_ID_5255737649001096930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAhi40K79I/AAAAAAAAAWo/m5mAozi-Piw/s1600-h/recons2.png"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SPAhi40K79I/AAAAAAAAAWo/m5mAozi-Piw/s320/recons2.png" alt="" id="BLOGGER_PHOTO_ID_5255737648391843794" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPAhjD0wiDI/AAAAAAAAAWw/4eejhHFVKZQ/s1600-h/recons3.png"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SPAhjD0wiDI/AAAAAAAAAWw/4eejhHFVKZQ/s320/recons3.png" alt="" id="BLOGGER_PHOTO_ID_5255737651347097650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;It may not seem obvious but the reconstruction obtained the general height difference of the points selected. The edges are not defined but it somehow approximates the shape of the rubik's cube.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Thanks Cole for helping me with the images and JC for the discussions with regards to reconstruction.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Rating 6/10 since&lt;br /&gt;1. reconstruction is not that good&lt;br /&gt;2. I used Matlab in reconstruction rather than SciLab&lt;br /&gt;3. I posted this blog very late.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-807280832748385957?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/807280832748385957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=807280832748385957' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/807280832748385957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/807280832748385957'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/08/a14-stereometry.html' title='A14 - Stereometry'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_v7ISAk_qGb8/SPLOtbCsGkI/AAAAAAAAAZ4/OxdtqsSLpm0/s72-c/stereometry.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-4567007352515611894</id><published>2008-08-06T21:35:00.001-07:00</published><updated>2008-10-12T21:19:03.433-07:00</updated><title type='text'>A13 - Photometric Stereo</title><content type='html'>Photometric stereo is an algorithm for obtaining local surface orientation by using several images of a surface taken under different illumination conditions with the camera viewpoint held fixed.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;The technique assumes that intensity &lt;span style="font-style: italic;"&gt;I&lt;/span&gt; captured by camera at point &lt;span style="font-style: italic;"&gt;(x,y)&lt;/span&gt; is directly proportional to brightness of surface at that point. This also assumes that light rays arriving on the surface are parallel. Shape of the surface is estimated from the multiple images and the information about the surface is coded in the shadings obtained from the images.&lt;br /&gt;&lt;br /&gt;In this activity, we use Photometric Stereo technique to obtain a 3D reconstruction from 2D images. The input images are shown below.&lt;br /&gt;&lt;/div&gt;  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SJp73soZAII/AAAAAAAAATI/mc6t_nz6nkg/s1600-h/Photometric+Images.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SJp73soZAII/AAAAAAAAATI/mc6t_nz6nkg/s320/Photometric+Images.JPG" alt="" id="BLOGGER_PHOTO_ID_5231630113947844738" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The intensity at each point is denoted in matrix form as&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPLLGWnzbKI/AAAAAAAAAZw/z7Y5KN9sOGA/s1600-h/I.PNG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SPLLGWnzbKI/AAAAAAAAAZw/z7Y5KN9sOGA/s320/I.PNG" alt="" id="BLOGGER_PHOTO_ID_5256487025106971810" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Knowing the light source directions (V) for each of the input images (I), we use the equation below to solve for g.&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class="on" style="display: block;" id="formatbar_JustifyLeft" title="Align Left" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 10);ButtonMouseDown(this);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPLKHRSAS9I/AAAAAAAAAZo/q7BuRCn1uIk/s1600-h/g.PNG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SPLKHRSAS9I/AAAAAAAAAZo/q7BuRCn1uIk/s320/g.PNG" alt="" id="BLOGGER_PHOTO_ID_5256485941341604818" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;From the computed values of g (a 3 row matrix corresponding to the xyz locations), we get a normal vector by dividing each element in a column with the magnitude of that column. After this, a linear integral was used to obtain the z values. Plotting z with a 128x128 plane yields the following 3D reconstruction.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SJp733QbAKI/AAAAAAAAATQ/s-_FXe0LLX8/s1600-h/Photometric+Reconstruction.PNG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SJp733QbAKI/AAAAAAAAATQ/s-_FXe0LLX8/s320/Photometric+Reconstruction.PNG" alt="" id="BLOGGER_PHOTO_ID_5231630116800102562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;---&lt;br /&gt;Rating: 10/10 for the accurate reconstruction of the shape of the input images using the algorithm&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-4567007352515611894?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/4567007352515611894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=4567007352515611894' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/4567007352515611894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/4567007352515611894'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/08/a13-photometric-stereo.html' title='A13 - Photometric Stereo'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SJp73soZAII/AAAAAAAAATI/mc6t_nz6nkg/s72-c/Photometric+Images.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-5735463380850634783</id><published>2008-07-30T16:42:00.000-07:00</published><updated>2008-12-11T14:23:35.595-08:00</updated><title type='text'>A11 - Camera Calibration</title><content type='html'>In this activity we model the geometric aspects of image formation to recover information that was lost in the process of projecting brightness values from surfaces existing in 3D world space to 2D sensor space.&lt;br /&gt;&lt;br /&gt;To do this, we first take a picture of a checkerboard pattern known as Tsai Grid.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SJD_M-fOPoI/AAAAAAAAASg/y2qYVD0cmPc/s1600-h/tsai_grid.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SJD_M-fOPoI/AAAAAAAAASg/y2qYVD0cmPc/s320/tsai_grid.JPG" alt="" id="BLOGGER_PHOTO_ID_5228959765774614146" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Using SciLab's &lt;span style="font-style: italic;"&gt;locate&lt;/span&gt; function, we selected 25 points on this image to get the pixel value of these points. We also take note of the real world coordinates of these points by letting the left side of the board to be the x-axis, the right side as the y-axis and the vertical as the z-axis. Each square has a side length of one inch. The origin is shown in pink below.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SJEEOhGEQjI/AAAAAAAAASo/GuV8zM8AsDw/s1600-h/tsaigrid.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SJEEOhGEQjI/AAAAAAAAASo/GuV8zM8AsDw/s320/tsaigrid.JPG" alt="" id="BLOGGER_PHOTO_ID_5228965289802351154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The green dots are the 25 points we've selected for our calibration. Next, we set up the matrix &lt;span style="font-style: italic; font-weight: bold;"&gt;Q&lt;/span&gt; shown by equation below for values of i from 1 to 25. (i stands for image coordinate, o for real world object coordinate)&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SJEGK3YJsGI/AAAAAAAAASw/7-2QypUVEuE/s1600-h/equation1.PNG"&gt;&lt;img style="cursor: pointer; width: 439px; height: 225px;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SJEGK3YJsGI/AAAAAAAAASw/7-2QypUVEuE/s320/equation1.PNG" alt="" id="BLOGGER_PHOTO_ID_5228967426087563362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We then solve for &lt;span style="font-style: italic; font-weight: bold;"&gt;a&lt;/span&gt; using equation below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SJEG7sLnL9I/AAAAAAAAATA/UVeVWtXMpFg/s1600-h/a.PNG"&gt;&lt;img style="cursor: pointer; width: 127px; height: 27px;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SJEG7sLnL9I/AAAAAAAAATA/UVeVWtXMpFg/s320/a.PNG" alt="" id="BLOGGER_PHOTO_ID_5228968264895770578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The resulting values of matrix &lt;span style="font-style: italic; font-weight: bold;"&gt;a&lt;/span&gt; can then be used in the following equations to get the resulting 2D image coordinate by knowing the real world coordinates of the point. (&lt;span style="font-style: italic;"&gt;a&lt;/span&gt;_34 is set to 1)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SJEGLOrHhFI/AAAAAAAAAS4/qmQzkUuQ3mc/s1600-h/equation2.PNG"&gt;&lt;img style="cursor: pointer; width: 228px; height: 120px;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SJEGLOrHhFI/AAAAAAAAAS4/qmQzkUuQ3mc/s320/equation2.PNG" alt="" id="BLOGGER_PHOTO_ID_5228967432341128274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Implementing this method:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Real world coordinates of the green dots:&lt;br /&gt;1. (8,0,12)&lt;br /&gt;2. (6,0,10)&lt;br /&gt;3. (2,0,10)&lt;br /&gt;4. (4,0,9)&lt;br /&gt;5. (6,0,8)&lt;br /&gt;6. (6,0,3)&lt;br /&gt;7. (4,0,2)&lt;br /&gt;8. (2,0,3)&lt;br /&gt;9. (6,0,5)&lt;br /&gt;10. (4,0,3)&lt;br /&gt;11. (0,8,12)&lt;br /&gt;12. (0,5,10)&lt;br /&gt;13. (0,2,10)&lt;br /&gt;14. (0,5,8)&lt;br /&gt;15. (0,3,7)&lt;br /&gt;16. (0,5,4)&lt;br /&gt;17. (0,7,2)&lt;br /&gt;18. (0,2,1)&lt;br /&gt;19. (0,3,3)&lt;br /&gt;20. (0,5,1)&lt;br /&gt;21. (0,0,1)&lt;br /&gt;22. (0,0,3)&lt;br /&gt;23. (0,0,5)&lt;br /&gt;24. (0,0,6)&lt;br /&gt;25. (0,0,11)&lt;br /&gt;&lt;br /&gt;Corresponding Image Coordinates (Pixel Value)&lt;br /&gt;&lt;br /&gt;&lt;table str="" style="border-collapse: collapse; width: 218pt;" border="0" cellpadding="0" cellspacing="0" width="290"&gt;&lt;col style="width: 48pt;" width="64"&gt;  &lt;col style="width: 84pt;" width="112"&gt;  &lt;col style="width: 86pt;" width="114"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 48pt;" width="64" height="17"&gt;point&lt;/td&gt;   &lt;td class="xl24" style="width: 84pt;" width="112"&gt;y_image&lt;/td&gt;   &lt;td class="xl24" style="width: 86pt;" width="114"&gt;z_image&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;1&lt;/td&gt;   &lt;td class="xl24" num="23.214286000000001"&gt;23.214286&lt;/td&gt;   &lt;td class="xl24" num="235.11904999999999"&gt;235.11905&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;2&lt;/td&gt;   &lt;td class="xl24" num="53.571429000000002"&gt;53.571429&lt;/td&gt;   &lt;td class="xl24" num=""&gt;200&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;3&lt;/td&gt;   &lt;td class="xl24" num="108.33333"&gt;108.33333&lt;/td&gt;   &lt;td class="xl24" num="205.35713999999999"&gt;205.35714&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;4&lt;/td&gt;   &lt;td class="xl24" num="82.738095000000001"&gt;82.738095&lt;/td&gt;   &lt;td class="xl24" num="185.11904999999999"&gt;185.11905&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;5&lt;/td&gt;   &lt;td class="xl24" num="54.761904999999999"&gt;54.761905&lt;/td&gt;   &lt;td class="xl24" num="163.09523999999999"&gt;163.09524&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;6&lt;/td&gt;   &lt;td class="xl24" num="57.738095000000001"&gt;57.738095&lt;/td&gt;   &lt;td class="xl24" num="73.214286000000001"&gt;73.214286&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;7&lt;/td&gt;   &lt;td class="xl24" num="85.714286000000001"&gt;85.714286&lt;/td&gt;   &lt;td class="xl24" num="63.095238000000002"&gt;63.095238&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;8&lt;/td&gt;   &lt;td class="xl24" num="110.11905"&gt;110.11905&lt;/td&gt;   &lt;td class="xl24" num="86.904762000000005"&gt;86.904762&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;9&lt;/td&gt;   &lt;td class="xl24" num="55.952381000000003"&gt;55.952381&lt;/td&gt;   &lt;td class="xl24" num="108.92856999999999"&gt;108.92857&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;10&lt;/td&gt;   &lt;td class="xl24" num="85.119048000000006"&gt;85.119048&lt;/td&gt;   &lt;td class="xl24" num="80.357142999999994"&gt;80.357143&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;11&lt;/td&gt;   &lt;td class="xl24" num="246.42857000000001"&gt;246.42857&lt;/td&gt;   &lt;td class="xl24" num="236.90476000000001"&gt;236.90476&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;12&lt;/td&gt;   &lt;td class="xl24" num="201.19048000000001"&gt;201.19048&lt;/td&gt;   &lt;td class="xl24" num="202.38095000000001"&gt;202.38095&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;13&lt;/td&gt;   &lt;td class="xl24" num="159.52381"&gt;159.52381&lt;/td&gt;   &lt;td class="xl24" num="205.95238000000001"&gt;205.95238&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;14&lt;/td&gt;   &lt;td class="xl24" num="201.19048000000001"&gt;201.19048&lt;/td&gt;   &lt;td class="xl24" num="166.66667000000001"&gt;166.66667&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;15&lt;/td&gt;   &lt;td class="xl24" num="172.61904999999999"&gt;172.61905&lt;/td&gt;   &lt;td class="xl24" num="152.97619"&gt;152.97619&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;16&lt;/td&gt;   &lt;td class="xl24" num="199.40476000000001"&gt;199.40476&lt;/td&gt;   &lt;td class="xl24" num="80.357142999999994"&gt;80.357143&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;17&lt;/td&gt;   &lt;td class="xl24" num="227.97619"&gt;227.97619&lt;/td&gt;   &lt;td class="xl24" num="55.952381000000003"&gt;55.952381&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;18&lt;/td&gt;   &lt;td class="xl24" num="159.52381"&gt;159.52381&lt;/td&gt;   &lt;td class="xl24" num="55.357143000000001"&gt;55.357143&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;19&lt;/td&gt;   &lt;td class="xl24" num="172.02381"&gt;172.02381&lt;/td&gt;   &lt;td class="xl24" num="85.119048000000006"&gt;85.119048&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;20&lt;/td&gt;   &lt;td class="xl24" num="198.80951999999999"&gt;198.80952&lt;/td&gt;   &lt;td class="xl24" num="45.238095000000001"&gt;45.238095&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;21&lt;/td&gt;   &lt;td class="xl24" num="133.92857000000001"&gt;133.92857&lt;/td&gt;   &lt;td class="xl24" num="60.714286000000001"&gt;60.714286&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;22&lt;/td&gt;   &lt;td class="xl24" num="134.52381"&gt;134.52381&lt;/td&gt;   &lt;td class="xl24" num="92.261904999999999"&gt;92.261905&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;23&lt;/td&gt;   &lt;td class="xl24" num="133.92857000000001"&gt;133.92857&lt;/td&gt;   &lt;td class="xl24" num=""&gt;125&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;24&lt;/td&gt;   &lt;td class="xl24" num="133.33332999999999"&gt;133.33333&lt;/td&gt;   &lt;td class="xl24" num="141.07142999999999"&gt;141.07143&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;25&lt;/td&gt;   &lt;td class="xl24" num="132.7381"&gt;132.7381&lt;/td&gt;   &lt;td class="xl24" num="224.40476000000001"&gt;224.40476&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Resulting matrix &lt;span style="font-style: italic; font-weight: bold;"&gt;a&lt;/span&gt;&lt;br /&gt;&lt;table str="" style="border-collapse: collapse; width: 92px; height: 198px;" border="0" cellpadding="0" cellspacing="0"&gt;&lt;col style="width: 48pt;" width="64"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 48pt;" num="-13.256119999999999" width="64" height="17"&gt;-13.2561&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="9.7368558000000007" height="17"&gt;9.736856&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="-0.88993670000000002" height="17"&gt;-0.88994&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="134.71170000000001" height="17"&gt;134.7117&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="-4.0764233000000001" height="17"&gt;-4.07642&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="-4.2727956000000002" height="17"&gt;-4.2728&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="15.077733" height="17"&gt;15.07773&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="45.714264999999997" height="17"&gt;45.71427&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="-1.3706299999999999E-2" height="17"&gt;-0.01371&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="-1.50419E-2" height="17"&gt;-0.01504&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="-5.5861000000000001E-3" height="17"&gt;-0.00559&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;New image coordinates after using the matrix &lt;span style="font-style: italic; font-weight: bold;"&gt;a&lt;br /&gt;&lt;/span&gt;  &lt;table str="" style="border-collapse: collapse; width: 217pt;" border="0" cellpadding="0" cellspacing="0" width="288"&gt;&lt;col style="width: 67pt;" width="89"&gt;  &lt;col style="width: 77pt;" width="102"&gt;  &lt;col style="width: 73pt;" width="97"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 67pt;" width="89" height="17"&gt;point&lt;/td&gt;   &lt;td class="xl24" style="width: 77pt;" width="102"&gt;y_new&lt;/td&gt;   &lt;td class="xl24" style="width: 73pt;" width="97"&gt;z_new&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;1&lt;/td&gt;   &lt;td class="xl24" num="21.842763000000001"&gt;21.842763&lt;/td&gt;   &lt;td class="xl24" num="235.67576"&gt;235.67576&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;2&lt;/td&gt;   &lt;td class="xl24" num="53.690170000000002"&gt;53.69017&lt;/td&gt;   &lt;td class="xl24" num="199.59721999999999"&gt;199.59722&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;3&lt;/td&gt;   &lt;td class="xl24" num="108.32033"&gt;108.32033&lt;/td&gt;   &lt;td class="xl24" num="205.44708"&gt;205.44708&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;4&lt;/td&gt;   &lt;td class="xl24" num="82.330770999999999"&gt;82.330771&lt;/td&gt;   &lt;td class="xl24" num="184.49905999999999"&gt;184.49906&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;5&lt;/td&gt;   &lt;td class="xl24" num="55.041758000000002"&gt;55.041758&lt;/td&gt;   &lt;td class="xl24" num="162.50364999999999"&gt;162.50365&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;6&lt;/td&gt;   &lt;td class="xl24" num="58.274084999999999"&gt;58.274085&lt;/td&gt;   &lt;td class="xl24" num="73.794279000000003"&gt;73.794279&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;7&lt;/td&gt;   &lt;td class="xl24" num="85.553674000000001"&gt;85.553674&lt;/td&gt;   &lt;td class="xl24" num="63.772888000000002"&gt;63.772888&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;8&lt;/td&gt;   &lt;td class="xl24" num="110.40640999999999"&gt;110.40641&lt;/td&gt;   &lt;td class="xl24" num="86.620738000000003"&gt;86.620738&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;9&lt;/td&gt;   &lt;td class="xl24" num="57.005504000000002"&gt;57.005504&lt;/td&gt;   &lt;td class="xl24" num="108.60975999999999"&gt;108.60976&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;10&lt;/td&gt;   &lt;td class="xl24" num="85.109881000000001"&gt;85.109881&lt;/td&gt;   &lt;td class="xl24" num="80.396867"&gt;80.396867&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;11&lt;/td&gt;   &lt;td class="xl24" num="248.48566"&gt;248.48566&lt;/td&gt;   &lt;td class="xl24" num="236.84126000000001"&gt;236.84126&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;12&lt;/td&gt;   &lt;td class="xl24" num="200.81791999999999"&gt;200.81792&lt;/td&gt;   &lt;td class="xl24" num="201.54409999999999"&gt;201.5441&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;13&lt;/td&gt;   &lt;td class="xl24" num="158.94668999999999"&gt;158.94669&lt;/td&gt;   &lt;td class="xl24" num="205.61779000000001"&gt;205.61779&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;14&lt;/td&gt;   &lt;td class="xl24" num="200.29104000000001"&gt;200.29104&lt;/td&gt;   &lt;td class="xl24" num="164.72203999999999"&gt;164.72204&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;15&lt;/td&gt;   &lt;td class="xl24" num="172.19655"&gt;172.19655&lt;/td&gt;   &lt;td class="xl24" num="151.17308"&gt;151.17308&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;16&lt;/td&gt;   &lt;td class="xl24" num="199.27642"&gt;199.27642&lt;/td&gt;   &lt;td class="xl24" num="93.813046"&gt;93.813046&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;17&lt;/td&gt;   &lt;td class="xl24" num="227.59700000000001"&gt;227.597&lt;/td&gt;   &lt;td class="xl24" num="52.018523000000002"&gt;52.018523&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;18&lt;/td&gt;   &lt;td class="xl24" num="158.96576999999999"&gt;158.96577&lt;/td&gt;   &lt;td class="xl24" num="54.178964999999998"&gt;54.178965&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;19&lt;/td&gt;   &lt;td class="xl24" num="171.88968"&gt;171.88968&lt;/td&gt;   &lt;td class="xl24" num="83.282960000000003"&gt;83.28296&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;20&lt;/td&gt;   &lt;td class="xl24" num="198.54783"&gt;198.54783&lt;/td&gt;   &lt;td class="xl24" num="42.893636000000001"&gt;42.893636&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;21&lt;/td&gt;   &lt;td class="xl24" num="134.57351"&gt;134.57351&lt;/td&gt;   &lt;td class="xl24" num="61.133496999999998"&gt;61.133497&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;22&lt;/td&gt;   &lt;td class="xl24" num="134.29240999999999"&gt;134.29241&lt;/td&gt;   &lt;td class="xl24" num="92.497568000000001"&gt;92.497568&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;23&lt;/td&gt;   &lt;td class="xl24" num="134.00484"&gt;134.00484&lt;/td&gt;   &lt;td class="xl24" num="124.58259"&gt;124.58259&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;24&lt;/td&gt;   &lt;td class="xl24" num="133.85856999999999"&gt;133.85857&lt;/td&gt;   &lt;td class="xl24" num="140.90326999999999"&gt;140.90327&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;25&lt;/td&gt;   &lt;td class="xl24" num="133.10108"&gt;133.10108&lt;/td&gt;   &lt;td class="xl24" num="225.42079000000001"&gt;225.42079&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Getting the difference between these computed values with the actual values gives the following mean values for each coordinate:&lt;br /&gt;y: 0.474705&lt;br /&gt;z: 1.365954&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Collaborator: Cole Fabros&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Grade: 10/10 since I implemented the camera calibration well, and that the mean difference for each axis is within one pixel. :)&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-5735463380850634783?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/5735463380850634783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=5735463380850634783' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5735463380850634783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5735463380850634783'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/07/a11-camera-calibration.html' title='A11 - Camera Calibration'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SJD_M-fOPoI/AAAAAAAAASg/y2qYVD0cmPc/s72-c/tsai_grid.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-1815449374686922768</id><published>2008-07-22T19:03:00.000-07:00</published><updated>2008-12-11T14:23:36.499-08:00</updated><title type='text'>A10 – Preprocessing Handwritten Text</title><content type='html'>In this activity we tried to extract handwritten text from an imaged document with lines. The image I used is shown below.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SIfHY9eAI8I/AAAAAAAAARo/xEasFSmQlME/s1600-h/crop3.jpg"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SIfHY9eAI8I/AAAAAAAAARo/xEasFSmQlME/s320/crop3.jpg" alt="" id="BLOGGER_PHOTO_ID_5226365124217938882" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To remove the lines, I first obtained the FFT of this image.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIfHYyU9GMI/AAAAAAAAARw/HT1ae3_U9T4/s1600-h/fft.jpg"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIfHYyU9GMI/AAAAAAAAARw/HT1ae3_U9T4/s320/fft.jpg" alt="" id="BLOGGER_PHOTO_ID_5226365121227200706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The lines in the image are frequent, therefore, we can conclude that to remove the lines we need to suppress the frequencies that correspond to these lines.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIfHY0Ix7GI/AAAAAAAAAR4/ibMislN6Hec/s1600-h/newfft.jpg"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIfHY0Ix7GI/AAAAAAAAAR4/ibMislN6Hec/s320/newfft.jpg" alt="" id="BLOGGER_PHOTO_ID_5226365121713007714" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;The enhanced image after working on the Fourier space is shown below.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIfHZOakNBI/AAAAAAAAASA/LOq0Js0Emzs/s1600-h/after_fft.jpg"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIfHZOakNBI/AAAAAAAAASA/LOq0Js0Emzs/s320/after_fft.jpg" alt="" id="BLOGGER_PHOTO_ID_5226365128766927890" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;We then binarized this image for further cleaning process.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SIfIHfYazRI/AAAAAAAAASI/kfGINyjBaWw/s1600-h/bwimage.bmp"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SIfIHfYazRI/AAAAAAAAASI/kfGINyjBaWw/s320/bwimage.bmp" alt="" id="BLOGGER_PHOTO_ID_5226365923595308306" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The image below is a result of performing opening operation on the binary image.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIfIHVdUQgI/AAAAAAAAASQ/uPkf6H0CyiM/s1600-h/opening+image+1.bmp"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIfIHVdUQgI/AAAAAAAAASQ/uPkf6H0CyiM/s320/opening+image+1.bmp" alt="" id="BLOGGER_PHOTO_ID_5226365920931496450" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I repeated the same opening operation on the image, ad this results to the following image.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIfIHqoU-AI/AAAAAAAAASY/dUuhqHthddk/s1600-h/opening+image+2.bmp"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIfIHqoU-AI/AAAAAAAAASY/dUuhqHthddk/s320/opening+image+2.bmp" alt="" id="BLOGGER_PHOTO_ID_5226365926614824962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In both opening operations, the resulting image shows no success. The text are not readable. Part of the lines were even enhanced.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;-o0o-&lt;br /&gt;Thanks Ed for pointers and help in GIMP.&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Rating: 5/10 since I was only able to remove the lines from the original image and that I wasn't successful in extracting the text from the image. The resulting image was also very dirty.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-1815449374686922768?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/1815449374686922768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=1815449374686922768' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/1815449374686922768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/1815449374686922768'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/07/a10-preprocessing-handwritten-text.html' title='A10 – Preprocessing Handwritten Text'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_v7ISAk_qGb8/SIfHY9eAI8I/AAAAAAAAARo/xEasFSmQlME/s72-c/crop3.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-6107340947660077821</id><published>2008-07-21T07:21:00.000-07:00</published><updated>2008-12-11T14:23:38.985-08:00</updated><title type='text'>A9 - Binary Operations</title><content type='html'>The goal for this activity is to integrate everything we have learned so far to determine the best estimate of area (in pixel count) of simulated “cells”. We will also learn to use more morphological operators for enhancing and analyzing binarized images.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIUXcdvb0aI/AAAAAAAAAQY/mcBGMia_Y04/s1600-h/Circles001.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIUXcdvb0aI/AAAAAAAAAQY/mcBGMia_Y04/s320/Circles001.jpg" alt="" id="BLOGGER_PHOTO_ID_5225608720420688290" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;CLOSING and OPENING Morphological Operations&lt;/span&gt;&lt;br /&gt;Opening is defined as an erosion followed by a dilation &lt;em&gt;using the same structuring element for both operations&lt;/em&gt;. The basic effect of opening is somewhat like erosion in that it tends to remove some of the foreground (bright) pixels from the edges of regions of foreground pixels, but is less destructive. &lt;a href="http://homepages.inf.ed.ac.uk/rbf/HIPR2/open.htm"&gt;*&lt;/a&gt;&lt;a href="http://homepages.inf.ed.ac.uk/rbf/HIPR2/open.htm"&gt;**&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIUfth6ihlI/AAAAAAAAARQ/koVn6X0KvcY/s1600-h/opening.png"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIUfth6ihlI/AAAAAAAAARQ/koVn6X0KvcY/s320/opening.png" alt="" id="BLOGGER_PHOTO_ID_5225617809691805266" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;Closing is defined as a dilation followed by an erosion &lt;em&gt;using the same structuring element for both operations&lt;/em&gt;. Closing is similar in some ways to dilation in that it tends to enlarge the boundaries of foreground (bright) regions in an image (and shrink background color holes in such regions), but it is less destructive of the original boundary shape. &lt;a href="http://homepages.inf.ed.ac.uk/rbf/HIPR2/close.htm"&gt;***&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIUftjb5JAI/AAAAAAAAARY/PvmsGgrckSg/s1600-h/closing.png"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIUftjb5JAI/AAAAAAAAARY/PvmsGgrckSg/s320/closing.png" alt="" id="BLOGGER_PHOTO_ID_5225617810100134914" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Getting Cell Area&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The above image was first sampled by cropping 256x256 images. This was done because of two reasons. One is to save memory space since working with large images correspond to larger memory and two is to obtain an accurate value for the cell area by sampling on different regions of the image.&lt;br /&gt;&lt;br /&gt;Below is a 256x256 cropped image. We first binarized this image to simplify the separation of background from region of interest (ROI). The optimum threshold can be found by examining the histogram of this image.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SIUXcmsn_qI/AAAAAAAAAQg/Wtd-KDU0fLo/s1600-h/C1_05.jpg"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SIUXcmsn_qI/AAAAAAAAAQg/Wtd-KDU0fLo/s320/C1_05.jpg" alt="" id="BLOGGER_PHOTO_ID_5225608722824822434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The binarized image is shown below.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIUXj2mHbnI/AAAAAAAAAQo/6VtVAFtQ_7I/s1600-h/circle_binary.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIUXj2mHbnI/AAAAAAAAAQo/6VtVAFtQ_7I/s320/circle_binary.JPG" alt="" id="BLOGGER_PHOTO_ID_5225608847351574130" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Performing OPENING on the image results to the following image. The white pixels which are part of the background were removed.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIUXj1PjBYI/AAAAAAAAAQw/IyCDGWs9mdA/s1600-h/circle_closing.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIUXj1PjBYI/AAAAAAAAAQw/IyCDGWs9mdA/s320/circle_closing.JPG" alt="" id="BLOGGER_PHOTO_ID_5225608846988477826" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Performing CLOSING operation results to the image below. Separation of touching blobs were observed.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIUXkBe6izI/AAAAAAAAAQ4/9V2HFzSgaaE/s1600-h/circle_opening.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SIUXkBe6izI/AAAAAAAAAQ4/9V2HFzSgaaE/s320/circle_opening.JPG" alt="" id="BLOGGER_PHOTO_ID_5225608850274159410" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;We then use &lt;span style="font-style: italic;"&gt;bwlabel&lt;/span&gt; function in SciLab to returns an image matrix which is of the same size as the original image but now containing labels for the connected objects in it. &lt;span style="font-family:monospace;"&gt;&lt;/span&gt;From this matrix, we can get the area of the cells since the each blob is a set of connected pixels.&lt;br /&gt;&lt;br /&gt;We repeated the above procedures for different sample images and obtained a histogram of the cell area.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIUX-qjCpCI/AAAAAAAAARA/9JjqyYC78wY/s1600-h/cell+area+histogram.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SIUX-qjCpCI/AAAAAAAAARA/9JjqyYC78wY/s320/cell+area+histogram.JPG" alt="" id="BLOGGER_PHOTO_ID_5225609307973919778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;From this histogram, we can deduce that the pixel area of a cell in the image has a value between 500-550 pixels. Reducing the x-axis to 450-550 pixels shows the following histogram. This was done to limit the calculated area to those that best represents the cell area, since bins with smaller values can be accounted to small connected components, which is unlikely area of the cell.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIUX-nGNh9I/AAAAAAAAARI/LePBySSs7QY/s1600-h/cell+area+histogram+2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIUX-nGNh9I/AAAAAAAAARI/LePBySSs7QY/s320/cell+area+histogram+2.JPG" alt="" id="BLOGGER_PHOTO_ID_5225609307047692242" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;We then get the mean and the standard deviation of the cell area obtained. The values were&lt;br /&gt;area = 521.84444 pixels&lt;br /&gt;std dev  = 20.685915&lt;br /&gt;&lt;br /&gt;We then checked if this values are correct. This was done by getting the cell area from an image with separated cells.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIUwFeFqtgI/AAAAAAAAARg/mvI_N2CI0CQ/s1600-h/C1_07.jpg"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SIUwFeFqtgI/AAAAAAAAARg/mvI_N2CI0CQ/s320/C1_07.jpg" alt="" id="BLOGGER_PHOTO_ID_5225635813167642114" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The values obtained are as follows&lt;br /&gt;544.&lt;br /&gt;527.&lt;br /&gt;518.&lt;br /&gt;535.&lt;br /&gt;530.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Clearly, these values lie within the acceptable limit for the calculated area of the cell. The mean value obtained is thus correct. :)&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Thanks Jeric for the tips on getting the histogram of the areas obtained.&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;I give myself a 10 for I implemented the necessary techniques well.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-6107340947660077821?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/6107340947660077821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=6107340947660077821' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/6107340947660077821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/6107340947660077821'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/07/a9-binary-operations.html' title='A9 - Binary Operations'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SIUXcdvb0aI/AAAAAAAAAQY/mcBGMia_Y04/s72-c/Circles001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-4379650716839093927</id><published>2008-07-15T23:12:00.000-07:00</published><updated>2008-12-11T14:23:43.153-08:00</updated><title type='text'>A8 - Morphological Operations</title><content type='html'>Morphology refers to shape or structure. In image processing, classical morphological operations are treatments done on binary images, particularly aggregates of 1's that form a particular shape, to improve the image for further processing or to extract information from it. All morphological operations affect the shape of the image in some way, for example, the shapes may be expanded, thinned, internal holes could be closed, disconnected blobs can be joined.&lt;br /&gt;&lt;br /&gt;In this activity, we learned two basic morphological operations done on images --- DILATION and EROSION.&lt;br /&gt;&lt;br /&gt;From Dr. Soriano's lecture notes, dilation is defined as follows.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SH3Vu4bB3wI/AAAAAAAAAOY/l-umK7XljnI/s1600-h/dilation.PNG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SH3Vu4bB3wI/AAAAAAAAAOY/l-umK7XljnI/s320/dilation.PNG" alt="" id="BLOGGER_PHOTO_ID_5223566144216096514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;On the other hand, erosion operator is defined as&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SH3VvFwNAzI/AAAAAAAAAOg/7_cKaIBcHRc/s1600-h/erosion.PNG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SH3VvFwNAzI/AAAAAAAAAOg/7_cKaIBcHRc/s320/erosion.PNG" alt="" id="BLOGGER_PHOTO_ID_5223566147794567986" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;From these definitions, we predicted the outcome of an image after dilating and eroding it with certain structuring elements.&lt;br /&gt;&lt;br /&gt;We used the following binary images as test objects:&lt;br /&gt;&lt;br /&gt;square (50×50)&lt;br /&gt;triangle (base = 50 , height = 30)&lt;br /&gt;hollow square (60×60, edges are 4 pixels thick)&lt;br /&gt;plus sign (8 pixels thick and 50 pixels long for each line)&lt;br /&gt;circle (radius 25)&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH3YBOlfj7I/AAAAAAAAAOo/-79yOdmPGMc/s1600-h/objects.bmp"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH3YBOlfj7I/AAAAAAAAAOo/-79yOdmPGMc/s320/objects.bmp" alt="" id="BLOGGER_PHOTO_ID_5223568658426466226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The structuring elements used are shown below.&lt;br /&gt;1. 4×4 ones&lt;br /&gt;2.  4×2 ones&lt;br /&gt;3. 2×4 ones&lt;br /&gt;4. cross, 5 pixels long, one pixel thick.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH3Y-4mPbNI/AAAAAAAAAOw/16QNM5PpWBo/s1600-h/structuring+elements.bmp"&gt;&lt;img style="cursor: pointer; width: 87px; height: 81px;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH3Y-4mPbNI/AAAAAAAAAOw/16QNM5PpWBo/s320/structuring+elements.bmp" alt="" id="BLOGGER_PHOTO_ID_5223569717675912402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;We then check our predictions using SciLab's &lt;span style="font-style: italic;"&gt;dilate&lt;/span&gt; and&lt;span style="font-style: italic;"&gt; erode&lt;/span&gt; functions.&lt;br /&gt;&lt;br /&gt;DILATION&lt;br /&gt;The dilation results for each structuring element is shown below&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH3en6-wBpI/AAAAAAAAAO4/vwW5wcl9-EI/s1600-h/square_dilate.bmp"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH3en6-wBpI/AAAAAAAAAO4/vwW5wcl9-EI/s320/square_dilate.bmp" alt="" id="BLOGGER_PHOTO_ID_5223575920248358546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH3eoIumk3I/AAAAAAAAAPA/85hh5tgpe2Q/s1600-h/triangle_dilate.bmp"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH3eoIumk3I/AAAAAAAAAPA/85hh5tgpe2Q/s320/triangle_dilate.bmp" alt="" id="BLOGGER_PHOTO_ID_5223575923938726770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH3eocnhGCI/AAAAAAAAAPI/DyeOGGZrG3g/s1600-h/hollowsquare_dilate.bmp"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH3eocnhGCI/AAAAAAAAAPI/DyeOGGZrG3g/s320/hollowsquare_dilate.bmp" alt="" id="BLOGGER_PHOTO_ID_5223575929277716514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SH3eoRK8ajI/AAAAAAAAAPQ/6-mVx4UgxXs/s1600-h/cross_dilate.bmp"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SH3eoRK8ajI/AAAAAAAAAPQ/6-mVx4UgxXs/s320/cross_dilate.bmp" alt="" id="BLOGGER_PHOTO_ID_5223575926205082162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH3eoT4-c-I/AAAAAAAAAPY/T50nh34V5js/s1600-h/circle_dilate.bmp"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH3eoT4-c-I/AAAAAAAAAPY/T50nh34V5js/s320/circle_dilate.bmp" alt="" id="BLOGGER_PHOTO_ID_5223575926935024610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;EROSION&lt;br /&gt;The erosion results for each structuring element is shown below&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH310_q4pHI/AAAAAAAAAPg/_NUA7lshja8/s1600-h/square_erode.bmp"&gt;&lt;img style="cursor: pointer; width: 320px; height: 60px;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH310_q4pHI/AAAAAAAAAPg/_NUA7lshja8/s320/square_erode.bmp" alt="" id="BLOGGER_PHOTO_ID_5223601433612952690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH311DWi2dI/AAAAAAAAAPo/pp39eoWoTuI/s1600-h/triangle_erode.bmp"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH311DWi2dI/AAAAAAAAAPo/pp39eoWoTuI/s320/triangle_erode.bmp" alt="" id="BLOGGER_PHOTO_ID_5223601434601380306" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SH311et_14I/AAAAAAAAAPw/v2bvYrMFTaw/s1600-h/hollowsquare_erode.bmp"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SH311et_14I/AAAAAAAAAPw/v2bvYrMFTaw/s320/hollowsquare_erode.bmp" alt="" id="BLOGGER_PHOTO_ID_5223601441947506562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH311RwFAjI/AAAAAAAAAP4/F5vFxGRGSXU/s1600-h/cross_erode.bmp"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH311RwFAjI/AAAAAAAAAP4/F5vFxGRGSXU/s320/cross_erode.bmp" alt="" id="BLOGGER_PHOTO_ID_5223601438466572850" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SH311ucDXkI/AAAAAAAAAQA/6pwSeySuHdc/s1600-h/circle_erode.bmp"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SH311ucDXkI/AAAAAAAAAQA/6pwSeySuHdc/s320/circle_erode.bmp" alt="" id="BLOGGER_PHOTO_ID_5223601446167207490" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;THIN&lt;br /&gt;According to SciLab:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;thin&lt;/span&gt; - thinning by border deletion&lt;br /&gt;Function &lt;span style="font-style: italic;"&gt;thin&lt;/span&gt; performs thinning of binary objects. It uses the Zhang-Suen, a de facto standard and simple technique. The resulting image, the skeleton, is not always connected and is very sensible to noise. For thin shapes, it should work faster and provide better quality. You will need some pruning criterium to eliminate spurs.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH36owpHoJI/AAAAAAAAAQI/E9X6Mr3E2rw/s1600-h/thin.bmp"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SH36owpHoJI/AAAAAAAAAQI/E9X6Mr3E2rw/s320/thin.bmp" alt="" id="BLOGGER_PHOTO_ID_5223606720978722962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;SKEL&lt;br /&gt;According to SciLab:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;skel&lt;/span&gt; - skeletonization, thinning, Medial Axis Transform&lt;br /&gt;Function &lt;span style="font-style: italic;"&gt;skel&lt;/span&gt; performs skeletonization (thinning) of a binary object. The resulting medial axis is multi-scale, meaning that it can be progressively pruned to eliminate detail. This pruning is done by thresholding the output skeleton image.&lt;br /&gt;The algorithm computes skeletons that are guaranteed to be connected over all scales of simplification. The skeletons are computed using the euclidean metric. This has the advantage to produce high-quality, isotropic and well-centered skeletons in the shape. However the exact algorithm is computationally intensive.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH36pTY2NAI/AAAAAAAAAQQ/VPKWH9UY0hU/s1600-h/skel.bmp"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SH36pTY2NAI/AAAAAAAAAQQ/VPKWH9UY0hU/s320/skel.bmp" alt="" id="BLOGGER_PHOTO_ID_5223606730305713154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;-o0o-&lt;br /&gt;Notes:&lt;br /&gt;The predictions were visualized and written in a piece of paper. I'll try to scan them for posting and for comparison as well. For now, I could only say that some of my predictions, as to what the outcome of the image looked like after dilation and erosion using the given structuring elements, did not match the simulation done in SciLab. I would say 70% of my predictions were correct. I had difficulty especially with predicting images after erosion. Also, I wasn't so sure about my prediction in using the cross structuring element.&lt;br /&gt;With all these reasons and knowing that I'd only predict roughly 70% of the outcome of the images, I give myself a 7/10 for this activity.&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Collaborators:&lt;br /&gt;Thank you &lt;span style="font-style: italic;"&gt;JC Nadora, Jeric Tugaff, Toni Lei Uy, Benj Palmares, Cole Fabros, Ed David, Angel Lim, Mark Bejemino&lt;/span&gt; for the invaluable discussions regarding erosion and dilation, especially with prediction. More thanks to &lt;span style="font-style: italic;"&gt;Ed&lt;/span&gt; for pointers in drawing the test objects in GIMP. (I was doing it in Paint with so much difficulty so he showed me how to do it easily.)&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-4379650716839093927?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/4379650716839093927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=4379650716839093927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/4379650716839093927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/4379650716839093927'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/07/a8-morphological-operations.html' title='A8 - Morphological Operations'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SH3Vu4bB3wI/AAAAAAAAAOY/l-umK7XljnI/s72-c/dilation.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-5620692352055427414</id><published>2008-07-09T18:37:00.000-07:00</published><updated>2008-12-11T14:23:46.101-08:00</updated><title type='text'>A7 - Enhancement in the Frequency Domain</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Anamorphic Property of the Fourier Transform&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Varying the frequency of the sinusoid changes the location of the FFT peaks from (0,0). As observed, higher frequencies would result to peaks farther from the origin.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHVoQTONHxI/AAAAAAAAAMA/b4ZPWOY61Qk/s1600-h/vary_f.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHVoQTONHxI/AAAAAAAAAMA/b4ZPWOY61Qk/s320/vary_f.JPG" alt="" id="BLOGGER_PHOTO_ID_5221193972253007634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Rotation of the image, on the other hand, corresponds to the rotation of its FFT but on the other direction.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHVoQQ82NGI/AAAAAAAAAMI/HPxkddB2UXc/s1600-h/vary_theta.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHVoQQ82NGI/AAAAAAAAAMI/HPxkddB2UXc/s320/vary_theta.JPG" alt="" id="BLOGGER_PHOTO_ID_5221193971643331682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Multiplying two sinusoids result to peaks which form the corner of a square. Adding them, however, result to a cross-like pattern, wherein the vertical dots correspond to fft peaks of the horizontal sinusoid and horizontal dots to vertical sinusoid. The effect in the Fourier space is much like adding each FFT.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHVvrYXyCFI/AAAAAAAAAMQ/JOIQKgpVFyw/s1600-h/2sines.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHVvrYXyCFI/AAAAAAAAAMQ/JOIQKgpVFyw/s320/2sines.JPG" alt="" id="BLOGGER_PHOTO_ID_5221202134073215058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Filtering in Fourier Space&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;a) Fingerprint Enhancement&lt;br /&gt;&lt;br /&gt;Shown below is a fingerprint image. We want to enhance the ridges present on it by filtering in Fourier space.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHVwbLyzSdI/AAAAAAAAAMY/1rbBoKgJQ5A/s1600-h/fingerprint.jpg"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHVwbLyzSdI/AAAAAAAAAMY/1rbBoKgJQ5A/s320/fingerprint.jpg" alt="" id="BLOGGER_PHOTO_ID_5221202955330603474" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;We know that the ridges would correspond to high frequencies since they are repetitive patterns present in the image. Also, we can think of them as sinusoids in different directions. Therefore, we get the FFT of the fingerprint image.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHv2ooT-6SI/AAAAAAAAAMw/8o2OQgoAELE/s1600-h/original_fft.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHv2ooT-6SI/AAAAAAAAAMw/8o2OQgoAELE/s320/original_fft.JPG" alt="" id="BLOGGER_PHOTO_ID_5223039370742655266" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;We then designed a filter mask using &lt;span style="font-style: italic;"&gt;mkfftfilter&lt;/span&gt; function in SciLab. Since we want to enhance the higher frequencies corresponding to the ridges, we design a high pass filter. Shown below is a high-pass exponential filter.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHv3LphGScI/AAAAAAAAANI/Tomu257BwDI/s1600-h/exp_filter.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHv3LphGScI/AAAAAAAAANI/Tomu257BwDI/s320/exp_filter.JPG" alt="" id="BLOGGER_PHOTO_ID_5223039972361521602" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;We multiplied this filter with the original FFT of the fingerprint image. After this, we again get its FFT to get the following enhanced image.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHxWT8JB_wI/AAAAAAAAANg/4osNiQba8lw/s1600-h/enhanced_fingerprint.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHxWT8JB_wI/AAAAAAAAANg/4osNiQba8lw/s320/enhanced_fingerprint.JPG" alt="" id="BLOGGER_PHOTO_ID_5223144568404442882" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The FFT of the enhanced image is shown below. The lower frequencies were removed thereby resulting to enhancement of the higher frequencies.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHv22_2erQI/AAAAAAAAANA/DX_X_z_dxCM/s1600-h/enhanced_fft.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHv22_2erQI/AAAAAAAAANA/DX_X_z_dxCM/s320/enhanced_fft.JPG" alt="" id="BLOGGER_PHOTO_ID_5223039617579527426" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;We then tried using a high-pass binary filter shown below.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHv4xf1B7ZI/AAAAAAAAANQ/_iC1Es8oGgU/s1600-h/filter_binary.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHv4xf1B7ZI/AAAAAAAAANQ/_iC1Es8oGgU/s320/filter_binary.JPG" alt="" id="BLOGGER_PHOTO_ID_5223041722107424146" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The resulting image is shown below.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHxWj-2-ohI/AAAAAAAAANo/7HXfX3AcH2o/s1600-h/binary_enhanced.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHxWj-2-ohI/AAAAAAAAANo/7HXfX3AcH2o/s320/binary_enhanced.JPG" alt="" id="BLOGGER_PHOTO_ID_5223144844011938322" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;b) Lunar Landing Scanned Picture: Line Removal&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;The two groups of irregularly shaped craters north and west of the landing site are secondaries from Sabine Crater. This view was obtained by the unmanned Lunar Orbiter V spacecraft in 1967 prior to the Apollo missions to the Moon. The black and white film was automatically developed onboard the spacecraft and subsequently digitized for transmission to Earth. The regularly spaced vertical lines are the result of combining individually digitized 'framelets' to make a composite photograph and the irregularly-shaped bright and dark spots are due to nonuniform film development. [NASA Lunar Orbiter photograph]&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHxd88Js38I/AAAAAAAAANw/jZ9_iDFI5gU/s1600-h/lunar.PNG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHxd88Js38I/AAAAAAAAANw/jZ9_iDFI5gU/s320/lunar.PNG" alt="" id="BLOGGER_PHOTO_ID_5223152969363283906" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;By filtering in the Fourier domain, we can remove the vertical lines present in this image. We first get its FFT.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHxeFvXfNJI/AAAAAAAAAN4/apueLgILuQA/s1600-h/lunar_fft.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHxeFvXfNJI/AAAAAAAAAN4/apueLgILuQA/s320/lunar_fft.JPG" alt="" id="BLOGGER_PHOTO_ID_5223153120550270098" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Using the hints from &lt;a href="http://www.roborealm.com/help/FFT.php"&gt;http://www.roborealm.com/help/FFT.php&lt;/a&gt;, we designed a filter mask such that the peaks which lie horizontally along the center of the FFT image will be suppressed. These peaks corresponds to the strong vertical lines in the original image. The filter mask we designed is shown below.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHxeVQpZ5gI/AAAAAAAAAOI/RNzEejDMdPU/s1600-h/filter.PNG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHxeVQpZ5gI/AAAAAAAAAOI/RNzEejDMdPU/s320/filter.PNG" alt="" id="BLOGGER_PHOTO_ID_5223153387181827586" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;This mask is then multiplied to the FFT of the original image to get the following enhanced FFT.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHxeOEfgh0I/AAAAAAAAAOA/Qq9keaT1WeA/s1600-h/enhancedfft_lunar.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHxeOEfgh0I/AAAAAAAAAOA/Qq9keaT1WeA/s320/enhancedfft_lunar.JPG" alt="" id="BLOGGER_PHOTO_ID_5223153263660009282" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;From this enhanced FFT, we obtain the following enhanced image which obviously has no vertical lines present. Clearly, the image was enhanced.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHxeeA0dWfI/AAAAAAAAAOQ/uDO5kUcx5V0/s1600-h/enhanced_lunar.PNG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHxeeA0dWfI/AAAAAAAAAOQ/uDO5kUcx5V0/s320/enhanced_lunar.PNG" alt="" id="BLOGGER_PHOTO_ID_5223153537552046578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;-o0o-&lt;br /&gt;Collaborators:&lt;br /&gt;Jeric Tugaff for the FFT discussions and hints on filtering in the Fourier space.&lt;br /&gt;Cole Fabros, Benj Palmares and Ed David for the FFT discussions.&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Rating:&lt;br /&gt;I give myself an 8/10 because&lt;br /&gt;1. I'm not satisfied with my fingerprint enhancement algorithm. SciLab's mkfftfilter seems not suitable for this job.&lt;br /&gt;2. I'm happy with the results of the Lunar Image tho, we had a hard time figuring how to do it properly. I'm thankful for Jeric's resourcefulness for he found hints in the internet.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-5620692352055427414?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/5620692352055427414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=5620692352055427414' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5620692352055427414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5620692352055427414'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/07/a7-enhancement-in-frequency-domain.html' title='A7 - Enhancement in the Frequency Domain'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_v7ISAk_qGb8/SHVoQTONHxI/AAAAAAAAAMA/b4ZPWOY61Qk/s72-c/vary_f.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-9161872423059707066</id><published>2008-07-07T18:53:00.000-07:00</published><updated>2008-12-11T14:23:51.820-08:00</updated><title type='text'>A6 - Fourier Transform Model of Image Formation</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;"&gt;Familiarization with Discrete FFT&lt;/span&gt;&lt;br /&gt;Test Image 1: 128x128 image of a white circle, centered and with the background black&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLZMhH-iiI/AAAAAAAAAIg/1YwrcNGkG3c/s1600-h/circle1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLZMhH-iiI/AAAAAAAAAIg/1YwrcNGkG3c/s320/circle1.JPG" alt="" id="BLOGGER_PHOTO_ID_5220473727149312546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Applying FFT on the image and computing the intensity values resulted to the following image:&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLaIUTaoRI/AAAAAAAAAJA/yVqvWrDSXIg/s1600-h/circle_fft.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLaIUTaoRI/AAAAAAAAAJA/yVqvWrDSXIg/s320/circle_fft.JPG" alt="" id="BLOGGER_PHOTO_ID_5220474754499780882" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;However, the FFT algorithm inverts the quadrants of the FT plane resulting to the image above. Applying fftshift() command on it yields the correct FT of a circle whose analytical solution is the Airy circle, as shown in the figure below&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLZNfTGYqI/AAAAAAAAAIw/cFJctM9MV98/s1600-h/circle_fftshift.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLZNfTGYqI/AAAAAAAAAIw/cFJctM9MV98/s320/circle_fftshift.JPG" alt="" id="BLOGGER_PHOTO_ID_5220473743838962338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;One characteristic of FFT is that it can retrieve the original image by performing FFT on the FFT of the image, as seen on the resulting image below.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLZNh1MgfI/AAAAAAAAAI4/s3ibIEHNonY/s1600-h/circle_2fft.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLZNh1MgfI/AAAAAAAAAI4/s3ibIEHNonY/s320/circle_2fft.JPG" alt="" id="BLOGGER_PHOTO_ID_5220473744518840818" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Test Image 2: 128x128 image of a letter “A”&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLaVEPYtdI/AAAAAAAAAJI/mPVpxa4wFxQ/s1600-h/A1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLaVEPYtdI/AAAAAAAAAJI/mPVpxa4wFxQ/s320/A1.JPG" alt="" id="BLOGGER_PHOTO_ID_5220474973526210002" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;applying fft()&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLaVbtmyPI/AAAAAAAAAJQ/lAnAOigZzMg/s1600-h/A_fft.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLaVbtmyPI/AAAAAAAAAJQ/lAnAOigZzMg/s320/A_fft.JPG" alt="" id="BLOGGER_PHOTO_ID_5220474979826977010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;then fftshift()&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLaVQd1W6I/AAAAAAAAAJY/-vsyD0mMy3g/s1600-h/A_fftshift.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLaVQd1W6I/AAAAAAAAAJY/-vsyD0mMy3g/s320/A_fftshift.JPG" alt="" id="BLOGGER_PHOTO_ID_5220474976808033186" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;FFT on FFT of an image&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHLaVt6PfrI/AAAAAAAAAJg/_XeJahmsPPs/s1600-h/A_2fft.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHLaVt6PfrI/AAAAAAAAAJg/_XeJahmsPPs/s320/A_2fft.JPG" alt="" id="BLOGGER_PHOTO_ID_5220474984711814834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Convolution&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;img src="file:///C:/DOCUME%7E1/user/LOCALS%7E1/Temp/moz-screenshot-2.jpg" alt="" /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNMOARzfOI/AAAAAAAAAKo/BDpZwjNKXQk/s1600-h/conv.GIF"&gt;&lt;img style="cursor: pointer; width: 105px; height: 46px;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNMOARzfOI/AAAAAAAAAKo/BDpZwjNKXQk/s320/conv.GIF" alt="" id="BLOGGER_PHOTO_ID_5220600196529093858" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The convolution is a linear operation which means that if f and g are recast by&lt;br /&gt;linear transformations, such as the Laplace or Fourier transform, they obey the&lt;br /&gt;convolution theorem:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;H=FG&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;where H , F and G are the transforms of h, f and g, respectively. The convolution&lt;br /&gt;is a “smearing” of one function against another such that the resulting function&lt;br /&gt;h looks a little like both f and g. Convolution is used to model the linear regime of&lt;br /&gt;instruments or detection devices such as those used in imaging. For example, in&lt;br /&gt;imaging, f can be the object, g can be the transfer function of the imaging system.&lt;br /&gt;Their convolution, h, is then the image produced by the detection system which in&lt;br /&gt;general is not 100% identical to the original object. *&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;*AP186 Notes, Maricor Soriano, 2008&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;For this part of the activity, we simulate an imaging device such as lens by using images of circles with different radii. These images represent the aperture of a circular lens. We then convolve another image with these lenses and observe the resulting image.&lt;br /&gt;&lt;br /&gt;Original Image:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNP1XjqjKI/AAAAAAAAAKw/Gf2IomQjddE/s1600-h/VIP.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNP1XjqjKI/AAAAAAAAAKw/Gf2IomQjddE/s320/VIP.JPG" alt="" id="BLOGGER_PHOTO_ID_5220604171327802530" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;a) circular lens of small aperture with resulting image after convolution&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLcM7qPmwI/AAAAAAAAAJo/Xei1eJGae6A/s1600-h/convcircle1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLcM7qPmwI/AAAAAAAAAJo/Xei1eJGae6A/s320/convcircle1.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477032807242498" border="0" /&gt;&lt;/a&gt;          &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLcM92xSbI/AAAAAAAAAJw/LGkd0dFN8M8/s1600-h/conv1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLcM92xSbI/AAAAAAAAAJw/LGkd0dFN8M8/s320/conv1.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477033396652466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;b) circular lens of medium aperture with resulting image after convolution&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLcNMu30lI/AAAAAAAAAJ4/gpjrgI4yhpE/s1600-h/convcircle2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHLcNMu30lI/AAAAAAAAAJ4/gpjrgI4yhpE/s320/convcircle2.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477037390058066" border="0" /&gt;&lt;/a&gt;          &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLcNLvAHkI/AAAAAAAAAKA/AO2QJtM8doA/s1600-h/conv2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLcNLvAHkI/AAAAAAAAAKA/AO2QJtM8doA/s320/conv2.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477037122166338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;c) circular lens of large aperture with resulting image after convolution&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLckuugFvI/AAAAAAAAAKI/GcRXPPqlheQ/s1600-h/convcircle3.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHLckuugFvI/AAAAAAAAAKI/GcRXPPqlheQ/s320/convcircle3.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477441652299506" border="0" /&gt;&lt;/a&gt;          &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLckozezRI/AAAAAAAAAKQ/qxfTvxXaew8/s1600-h/conv3.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLckozezRI/AAAAAAAAAKQ/qxfTvxXaew8/s320/conv3.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477440062573842" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;d) circular lens of very large aperture with resulting image after convolution&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLcknRuyKI/AAAAAAAAAKY/_BNotI1kW4k/s1600-h/convcircle4.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLcknRuyKI/AAAAAAAAAKY/_BNotI1kW4k/s320/convcircle4.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477439652579490" border="0" /&gt;&lt;/a&gt;          &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLck_S5RxI/AAAAAAAAAKg/Jk-Qb6weKkU/s1600-h/conv4.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLck_S5RxI/AAAAAAAAAKg/Jk-Qb6weKkU/s320/conv4.JPG" alt="" id="BLOGGER_PHOTO_ID_5220477446099912466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As observed, the resulting images for lenses with larger aperture are better as compared to those with smaller aperture. This is because the resulting image is dependent on the finite size of the lens.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Correlation via Template Matching&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Correlation is a measure of the degree of similarity between two functions f and g. The more identical they are at a certain position, the higher their correlation value. Therefore, the correlation function is used mostly in template matching or pattern recognition.&lt;br /&gt;&lt;br /&gt;Template Matching is a pattern recognition technique suitable for finding exactly identical patterns in a scene such as in the case of finding a certain word in a document.&lt;br /&gt;&lt;br /&gt;The image on the left is correlated with the template on the right. This is done to find the location of the letters A on the original image.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNSnE8ozZI/AAAAAAAAAK4/sGwn4RMjFlE/s1600-h/correlation.JPG"&gt;&lt;img style="cursor: pointer; width: 128px; height: 128px;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNSnE8ozZI/AAAAAAAAAK4/sGwn4RMjFlE/s320/correlation.JPG" alt="" id="BLOGGER_PHOTO_ID_5220607224348986770" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt;          &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHNSndrAG0I/AAAAAAAAALA/6v4B1wOoYNc/s1600-h/correlation_A.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SHNSndrAG0I/AAAAAAAAALA/6v4B1wOoYNc/s320/correlation_A.JPG" alt="" id="BLOGGER_PHOTO_ID_5220607230985902914" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The resulting image highlights the points where A is located. These are the points where bright white spots occur.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNTq9UxQDI/AAAAAAAAALI/TFTPKkPMY3I/s1600-h/correlation_image.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNTq9UxQDI/AAAAAAAAALI/TFTPKkPMY3I/s320/correlation_image.JPG" alt="" id="BLOGGER_PHOTO_ID_5220608390533824562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Edge detection using the convolution integral&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Edge detection can be seen as template matching of an edge pattern with an image. In this activity, we created a 3x3 matrix pattern of an edge such that the total sum is zero.&lt;br /&gt;&lt;br /&gt;We used three different patterns corresponding to three different directions.&lt;br /&gt;&lt;br /&gt;horizontal/vertical/spot&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNVWqdGvVI/AAAAAAAAALo/DDOay_57nb4/s1600-h/hor.GIF"&gt;&lt;img style="cursor: pointer; width: 176px; height: 113px;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNVWqdGvVI/AAAAAAAAALo/DDOay_57nb4/s320/hor.GIF" alt="" id="BLOGGER_PHOTO_ID_5220610240894385490" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNVW6Dg1NI/AAAAAAAAALw/MGkqTWr5ccs/s1600-h/vert.GIF"&gt;&lt;img style="cursor: pointer; width: 155px; height: 113px;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNVW6Dg1NI/AAAAAAAAALw/MGkqTWr5ccs/s320/vert.GIF" alt="" id="BLOGGER_PHOTO_ID_5220610245082010834" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNVW7rU7jI/AAAAAAAAAL4/gVViLH1n5uY/s1600-h/spot.GIF"&gt;&lt;img style="cursor: pointer; width: 175px; height: 112px;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNVW7rU7jI/AAAAAAAAAL4/gVViLH1n5uY/s320/spot.GIF" alt="" id="BLOGGER_PHOTO_ID_5220610245517438514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Using imcorrcoef() function in SciLab, we then correlate these patterns to an original image to be able to detect edges. Observe from the results below that horizontal patterns are highlighted on the first image, vertical ones on the second image while edges were better defined using the spot pattern since it can include both horizontal and vertical edges even smooth edges.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHNVHIPyyfI/AAAAAAAAALQ/pQxu1QUNnRI/s1600-h/hor.JPG"&gt;&lt;img style="cursor: pointer; width: 185px; height: 179px;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SHNVHIPyyfI/AAAAAAAAALQ/pQxu1QUNnRI/s320/hor.JPG" alt="" id="BLOGGER_PHOTO_ID_5220609974013708786" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNVHbtDfJI/AAAAAAAAALY/V7q9pzzrxS8/s1600-h/vert.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SHNVHbtDfJI/AAAAAAAAALY/V7q9pzzrxS8/s320/vert.JPG" alt="" id="BLOGGER_PHOTO_ID_5220609979236711570" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNVHegGrLI/AAAAAAAAALg/5MSs-3l51ec/s1600-h/spot.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SHNVHegGrLI/AAAAAAAAALg/5MSs-3l51ec/s320/spot.JPG" alt="" id="BLOGGER_PHOTO_ID_5220609979987700914" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This technique can refine edges but it is limited to monochrome images as your original image because in using a 256 color bitmap as input image, the edge detection technique results to a noisy image, therefore one cannot see clearly defined edges.&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Collaborators: Jeric and Benj&lt;br /&gt;&lt;br /&gt;-o0o-&lt;br /&gt;Rating: 10/10&lt;br /&gt;Expected results were observed for each part of the activity.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-9161872423059707066?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/9161872423059707066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=9161872423059707066' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/9161872423059707066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/9161872423059707066'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/07/a6-fourier-transform-model-of-image.html' title='A6 - Fourier Transform Model of Image Formation'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_v7ISAk_qGb8/SHLZMhH-iiI/AAAAAAAAAIg/1YwrcNGkG3c/s72-c/circle1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-3035247668094017955</id><published>2008-07-02T18:02:00.000-07:00</published><updated>2008-12-11T14:23:53.267-08:00</updated><title type='text'>A5 - Physical Measurements for Discrete Fourier Transforms</title><content type='html'>Discrete Fourier Transform (DFT) is one of the specific forms of Fourier analysis. It transforms a time-domain function into its frequency domain representation.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGw6X4HPyQI/AAAAAAAAAHA/PlhJ-8RH8P8/s1600-h/DFT.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGw6X4HPyQI/AAAAAAAAAHA/PlhJ-8RH8P8/s320/DFT.JPG" alt="" id="BLOGGER_PHOTO_ID_5218610250089744642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:78%;"&gt;*AP186 Lecture Notes, Maricor Soriano, 2008&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;We used the following code by Dr. Soriano in getting the FFT of a temporal signal. Fast Fourier Transform (FFT) is a DFT algorithm.&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;T = 2;&lt;br /&gt;N = 256;&lt;br /&gt;dt = T/N;&lt;br /&gt;t = [0:dt:(N-1)*dt];&lt;br /&gt;f = 5;&lt;br /&gt;y = sin(2*%pi*f*t);&lt;br /&gt;f1 = scf(1); subplot(2,1,1); plot(t,y); xtitle('sin 10*pi*t');&lt;br /&gt;&lt;br /&gt;FY = fft(y);&lt;br /&gt;F = 1/(2*dt);&lt;br /&gt;df = 2*F/256;&lt;br /&gt;f = [-(df*(N/2)):df:df*(N/2 -1)];&lt;br /&gt;&lt;br /&gt;subplot(2,1,2); plot(f, fftshift(abs(FY))); xtitle('FFT');&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;The following plots show the FFT of a 1-D sinusoid. Observe that peaks on the FFT corresponds to the frequency of the sinusoidal function.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGwzxQn8XMI/AAAAAAAAAGo/XeDUcBZCEQQ/s1600-h/10pit.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGwzxQn8XMI/AAAAAAAAAGo/XeDUcBZCEQQ/s320/10pit.JPG" alt="" id="BLOGGER_PHOTO_ID_5218602989584669890" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGwzxt1Vb7I/AAAAAAAAAGw/idxVpCXtMDw/s1600-h/20pi.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGwzxt1Vb7I/AAAAAAAAAGw/idxVpCXtMDw/s320/20pi.JPG" alt="" id="BLOGGER_PHOTO_ID_5218602997425467314" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGwzxtMdPzI/AAAAAAAAAG4/5jiIdGeVypQ/s1600-h/10pi%2B20pi.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGwzxtMdPzI/AAAAAAAAAG4/5jiIdGeVypQ/s320/10pi%2B20pi.JPG" alt="" id="BLOGGER_PHOTO_ID_5218602997254012722" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;For images, which are two dimensional in nature, we use pixels as our discrete time. Therefore, FT of images is much like doing FT for temporal signals, only that now, we perform spatial FT rather than temporal FT. In SciLab and Matlab, a built-in function called fft2 is used for performing 2-D DFT.&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/fft2.html&amp;amp;http://www.google.com.ph/search?q=fft2&amp;amp;ie=utf-8&amp;amp;oe=utf-8&amp;amp;aq=t&amp;amp;rls=org.mozilla:en-US:official&amp;amp;client=firefox-a"&gt;Mathworks&lt;/a&gt; the fft2 algorithm is defined as follows:&lt;br /&gt;&lt;p  style="text-align: center;font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;fft2(X) can be simply computed as&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: center;"&gt; &lt;pre class="programlisting"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt; fft(fft(X).').'&lt;/span&gt;&lt;/pre&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;This computes the one-dimensional DFT of each column X, then of each row of the result.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;tt&gt;&lt;br /&gt;&lt;/tt&gt;&lt;/p&gt;From the DFT equation above, one could infer that increasing the number of samples &lt;span style="font-style: italic;"&gt;N&lt;/span&gt; in the signal would result in widening the domain of the FT.&lt;br /&gt;&lt;br /&gt;This is supported by the FT analyses of a sinusoidal function with dominant frequency equal to 5. I increased the number of samples from N=128, 256,512 and 1024.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGxEAnae5iI/AAAAAAAAAHI/21BLy5ORNKk/s1600-h/N.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGxEAnae5iI/AAAAAAAAAHI/21BLy5ORNKk/s320/N.JPG" alt="" id="BLOGGER_PHOTO_ID_5218620845586310690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Next, decreasing the sampling interval Δt would increase the Δf in the FT. This suggests that in doing so, you actually decrease the resolution of your frequency analysis.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGxH3IDdIhI/AAAAAAAAAHQ/tpIbeA4EbiQ/s1600-h/dt.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGxH3IDdIhI/AAAAAAAAAHQ/tpIbeA4EbiQ/s320/dt.JPG" alt="" id="BLOGGER_PHOTO_ID_5218625080595915282" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-3035247668094017955?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/3035247668094017955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=3035247668094017955' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/3035247668094017955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/3035247668094017955'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/07/a5-physical-measurements-for-discrete.html' title='A5 - Physical Measurements for Discrete Fourier Transforms'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_v7ISAk_qGb8/SGw6X4HPyQI/AAAAAAAAAHA/PlhJ-8RH8P8/s72-c/DFT.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-6188611145165508125</id><published>2008-06-25T18:32:00.000-07:00</published><updated>2008-12-11T14:23:56.714-08:00</updated><title type='text'>A4 - Enhancement by Histogram Manipulation</title><content type='html'>&lt;span style="font-weight: bold;"&gt;HISTOGRAM MANIPULATION: LINEAR CDF&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;This activity is designed to improve the quality of an image by manipulating its histogram. Histogram manipulation enhances certain image features such as brightness and contrast. The image below is a good example for histogram manipulation since as shown, the image seems to be too dark.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGLx6t2u0wI/AAAAAAAAAEY/NrDNGnRJRTE/s1600-h/war-time-1.jpg"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGLx6t2u0wI/AAAAAAAAAEY/NrDNGnRJRTE/s320/war-time-1.jpg" alt="" id="BLOGGER_PHOTO_ID_5215997309492318978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:78%;"&gt;*http://www.dphclub.com/tutorials/images/war-time-1.jpg&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The observation that the image is dark is supported by plotting its histogram. The histogram of a grayscale image is equal to the graylevel probability distribution function (PDF) if normalized by the total number of pixels. &lt;span style="font-style: italic;font-size:78%;" &gt;(AP186 Notes, Maricor Soriano, 2008)&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; Observe that pixel values of the image cluster on the darker region of the PDF, that is near the lower values of the gray level. The lowest pixel value of the image is equal to 15 while the highest is 114.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGMGytFw0vI/AAAAAAAAAEw/cavzo-N8PkI/s1600-h/histogram.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGMGytFw0vI/AAAAAAAAAEw/cavzo-N8PkI/s320/histogram.JPG" alt="" id="BLOGGER_PHOTO_ID_5216020261592158962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;We then get the Cumulative Distribution Function (CDF) of the image from its PDF, simply by getting the cumulative sum of the values in the PDF.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGMIaGtVekI/AAAAAAAAAE4/_HLOx15Vnu0/s1600-h/CDF.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGMIaGtVekI/AAAAAAAAAE4/_HLOx15Vnu0/s320/CDF.JPG" alt="" id="BLOGGER_PHOTO_ID_5216022037995551298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;The CDF is nonlinear and the values cluster on the darker region of the CDF. We then use this CDF to map each pixel of the original image to a new array with the CDF as the mapping function. The resulting image is shown below.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGmpZfeF33I/AAAAAAAAAFg/LdvwkBceOpE/s1600-h/image_enhanced.jpg"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGmpZfeF33I/AAAAAAAAAFg/LdvwkBceOpE/s320/image_enhanced.jpg" alt="" id="BLOGGER_PHOTO_ID_5217887898694967154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;As observed, the image is much brighter than the original. This is because, after mapping the original image using its CDF, the pixel values of the image is 'stretched' within the 0-255 gray levels, therefore values where evenly distrbuted within the gray level The histogram plot below signifies that a slightly even distribution actually happened.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGmjg_51F5I/AAAAAAAAAFA/9a3dwhpUG-U/s1600-h/histogram2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGmjg_51F5I/AAAAAAAAAFA/9a3dwhpUG-U/s320/histogram2.JPG" alt="" id="BLOGGER_PHOTO_ID_5217881430590560146" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Since the values were evenly distributed (relatively) among the gray levels, the expected CDF must be linear. The 'ringings' on the lower part is caused by contributions from the darker gray levels which are relatively more than those present in the lighter side. (see histogram) This is again due to the fact that the original image has more darker values than lighter ones.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGmj8V8p-rI/AAAAAAAAAFQ/IV-KiqWQHLs/s1600-h/CDF2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGmj8V8p-rI/AAAAAAAAAFQ/IV-KiqWQHLs/s320/CDF2.JPG" alt="" id="BLOGGER_PHOTO_ID_5217881900364462770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;Here is the code I used:&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;getf('imhist.sci');&lt;br /&gt;&lt;br /&gt;im=imread('image_tc.jpg');     //opens a 24 bit image&lt;br /&gt;im=im(:,:,1);&lt;br /&gt;imwrite(im(:,:), 'image_gs.jpg');   //converts to 8 bit grayscale image&lt;br /&gt;im=imread('image_gs.jpg'); //saves the grayscale image&lt;br /&gt;[val,num]=imhist(im);&lt;br /&gt;imsize=size(im,1)*size(im,2);&lt;br /&gt;normCDF=cumsum(num/imsize);&lt;br /&gt;h=scf(1); plot(val, num/imsize);&lt;br /&gt;h=scf(2); plot(val,normCDF);&lt;br /&gt;&lt;br /&gt;//pixel mapping using CDF of image&lt;br /&gt;imnew=[];&lt;br /&gt;for i=1:size(im,1)&lt;br /&gt;for j=1:size(im,2)&lt;br /&gt;imnew(i,j)=normCDF(find(im(i,j)==val));&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;imwrite(imnew,'image_enhanced.jpg'); // saves enhanced image after mapping&lt;br /&gt;imenhanced=imread('image_enhanced.jpg');&lt;br /&gt;[val,num]=imhist(imenhanced);&lt;br /&gt;imsize=size(imenhanced,1)*size(imenhanced,2);&lt;br /&gt;normCDF=cumsum(num/imsize);&lt;br /&gt;h=scf(3); plot(val, num/imsize);&lt;br /&gt;h=scf(4); plot(val,normCDF);&lt;br /&gt;---&lt;br /&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;***imhist.sci is the histogram plotting code written by Jeric Tugaff&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: bold;"&gt;HISTOGRAM MANIPULATION: NON-LINEAR CDF&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Below is a flowchart of pixel backprojection using a non-linear CDF, as summarized by Dr. Maricor Soriano in her lecture notes.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGo8YjZNu6I/AAAAAAAAAGI/_6ctQVQYzeM/s1600-h/notes.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGo8YjZNu6I/AAAAAAAAAGI/_6ctQVQYzeM/s320/notes.JPG" alt="" id="BLOGGER_PHOTO_ID_5218049510777666466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The following is an enhanced image after mapping the original pixel values using a nonlinear CDF given by the equation G=1/2+ 1/2(tanh(16*((z-128)/255))) where z is from 0-255.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGmqYm6o9WI/AAAAAAAAAFo/6h1SzlaA5fg/s1600-h/image_enhanced2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGmqYm6o9WI/AAAAAAAAAFo/6h1SzlaA5fg/s320/image_enhanced2.JPG" alt="" id="BLOGGER_PHOTO_ID_5217888983025513826" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The histogram of this enhanced image is shown below with its CDF as well. The blue plot is the CDF used for mapping while the red plot is the CDF of the enhanced image. &lt;span&gt;The difference in the CDF &lt;/span&gt;is probably due to the interpolation method I used in &lt;span&gt;pixel backprojection&lt;/span&gt;. &lt;span style="font-style: italic;"&gt;(click CDF plot for a clearer view)&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGmkKS2330I/AAAAAAAAAFY/Cj2T3AWTZLM/s1600-h/histogram3.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGmkKS2330I/AAAAAAAAAFY/Cj2T3AWTZLM/s320/histogram3.JPG" alt="" id="BLOGGER_PHOTO_ID_5217882140053069634" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGo6f9xFlxI/AAAAAAAAAGA/5Jt1LxEEHkQ/s1600-h/CDF+sigmoid.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGo6f9xFlxI/AAAAAAAAAGA/5Jt1LxEEHkQ/s320/CDF+sigmoid.JPG" alt="" id="BLOGGER_PHOTO_ID_5218047439092946706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I observed that the sigmoid CDF I used didn't enhance the image well as seen with the naked eye. I experimented with using a parabolic function as my desired CDF.&lt;br /&gt;&lt;br /&gt;G=(z.^2);&lt;br /&gt;G=G/max(G);&lt;br /&gt;&lt;br /&gt;where z is again between 0-255. I divided it with its maximum value to obtain a function with 1 as the highest value. The enhanced image is shown below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGo8-5V2S2I/AAAAAAAAAGQ/mMCecLD3O9o/s1600-h/image_parabola.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGo8-5V2S2I/AAAAAAAAAGQ/mMCecLD3O9o/s320/image_parabola.JPG" alt="" id="BLOGGER_PHOTO_ID_5218050169504156514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Below is the histogram and CDF of this image. The blue plot is the desired CDF, red plot is the CDF of the enhanced image. &lt;span style="font-style: italic;"&gt;(click CDF plot for a clearer view) &lt;/span&gt;&lt;span&gt;The difference in the CDF &lt;/span&gt;is probably due to the interpolation method I used in &lt;span&gt;pixel backprojection&lt;/span&gt;.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGo9o_8pD6I/AAAAAAAAAGY/6A_VDv-sjP4/s1600-h/histogram_parabola.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGo9o_8pD6I/AAAAAAAAAGY/6A_VDv-sjP4/s320/histogram_parabola.JPG" alt="" id="BLOGGER_PHOTO_ID_5218050892831985570" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGo9o0FLKfI/AAAAAAAAAGg/qNY2_9hN2Vk/s1600-h/CDF+parabola.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGo9o0FLKfI/AAAAAAAAAGg/qNY2_9hN2Vk/s320/CDF+parabola.JPG" alt="" id="BLOGGER_PHOTO_ID_5218050889646549490" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is the code I used:&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;getf('imhist.sci');&lt;br /&gt;&lt;br /&gt;im=imread('image_tc.jpg');     //opens a 24 bit image&lt;br /&gt;im=im(:,:,1);&lt;br /&gt;imwrite(im(:,:), 'image_gs.jpg');   //converts to 8 bit grayscale image&lt;br /&gt;im=imread('image_gs.jpg');&lt;br /&gt;[val,num]=imhist(im);&lt;br /&gt;imsize=size(im,1)*size(im,2);&lt;br /&gt;normCDF=cumsum(num/imsize);&lt;br /&gt;h=scf(1); plot(val, num/imsize);&lt;br /&gt;h=scf(2); plot(val,normCDF);&lt;br /&gt;&lt;br /&gt;z=[0:255];&lt;br /&gt;G=(1+(tanh(16*((z-128)/255))))/2;&lt;br /&gt;//G=(z.^2);&lt;br /&gt;//G=G/max(G);&lt;br /&gt;h=scf(5); plot(z,G,'b');&lt;br /&gt;&lt;br /&gt;imnew=[];&lt;br /&gt;imnew2=[];&lt;br /&gt;for i=1:size(im,1)&lt;br /&gt;  for j=1:size(im,2)&lt;br /&gt;    imnew(i,j)=normCDF(find(im(i,j)==val));&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;imnew2=interp1(G,z,imnew);&lt;br /&gt;imnew2=round(imnew2);&lt;br /&gt;h=scf(3); imshow(imnew2,[0 255]);&lt;br /&gt;&lt;br /&gt;[val,num]=imhist(imnew2);&lt;br /&gt;imsize=size(imnew2,1)*size(imnew2,2);&lt;br /&gt;normCDF=cumsum(num/imsize);&lt;br /&gt;h=scf(4); plot(val, num/imsize);&lt;br /&gt;h=scf(5); plot(val,normCDF,'r');&lt;br /&gt;---&lt;br /&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;***imhist.sci is the histogram plotting code written by Jeric Tugaff&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;--o0o--&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:100%;"&gt;Collaborator: Jeric Tugaff&lt;br /&gt;...thank you for the histogram plotting code and for the interp1 syntax&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;&lt;span style="font-size:100%;"&gt;--o0o--&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:100%;"&gt;Grade: 10/10 since image was enhanced thru histogram manipulation and that CDF of enhanced image is almost the same as that of the desired CDF, especially for the nonlinear part.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-6188611145165508125?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/6188611145165508125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=6188611145165508125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/6188611145165508125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/6188611145165508125'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/06/a4-enhancement-by-histogram.html' title='A4 - Enhancement by Histogram Manipulation'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_v7ISAk_qGb8/SGLx6t2u0wI/AAAAAAAAAEY/NrDNGnRJRTE/s72-c/war-time-1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-2921143981573496371</id><published>2008-06-24T10:49:00.000-07:00</published><updated>2008-12-11T14:23:59.981-08:00</updated><title type='text'>A3 - Image Types and Basic Image Enhancements</title><content type='html'>&lt;span style=";font-family:arial;font-size:130%;"  &gt;&lt;span style="font-weight: bold;"&gt;Image Types&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;1. Truecolor Image&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGGcCfFXR6I/AAAAAAAAACo/3vZ5EgRKz6A/s1600-h/truecolor.JPG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGGcCfFXR6I/AAAAAAAAACo/3vZ5EgRKz6A/s320/truecolor.JPG" alt="" id="BLOGGER_PHOTO_ID_5215621409989412770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;*photographed by Kate Dado&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;FileName: truecolor.jpg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   FileSize: 35662&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     Format: JPEG&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      Width: 300&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     Height: 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      Depth: 8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;StorageType: truecolor&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;NumberOfColors: 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;ResolutionUnit: inch&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;XResolution: 72.000000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;YResolution: 72.000000&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2. Grayscale Image&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGGc9Lx0EFI/AAAAAAAAACw/4anE1nEfaVQ/s1600-h/grayscale.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGGc9Lx0EFI/AAAAAAAAACw/4anE1nEfaVQ/s320/grayscale.jpg" alt="" id="BLOGGER_PHOTO_ID_5215622418419421266" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;font-size:78%;"  &gt;*http://www.jnevins.com/Angelwebgrayscale.jpg&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;FileName: grayscale.jpg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    FileSize: 47925&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      Format: JPEG&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       Width: 378&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      Height: 504&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       Depth: 8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; StorageType: indexed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;NumberOfColors: 256&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;ResolutionUnit: inch&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; XResolution: 72.000000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; YResolution: 72.000000&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;3. Indexed Image&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGGdbmbjR6I/AAAAAAAAAC4/FF1EAf30xHk/s1600-h/indexed.png"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGGdbmbjR6I/AAAAAAAAAC4/FF1EAf30xHk/s320/indexed.png" alt="" id="BLOGGER_PHOTO_ID_5215622940969879458" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;&lt;span style=""&gt;*http://imgtops.sourceforge.net/bakeoff/o-png8.png&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;FileName: indexed.png&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     FileSize: 139332&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       Format: PNG&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        Width: 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       Height: 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        Depth: 8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  StorageType: indexed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;NumberOfColors: 256&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;ResolutionUnit: centimeter&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  XResolution: 72.000000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  YResolution: 72.000000&lt;br /&gt;&lt;br /&gt;4. Binary Image&lt;br /&gt;&lt;br /&gt;Shown below is a truecolor image of a flower.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGIfv43ez2I/AAAAAAAAADA/-jW0L568pzY/s1600-h/truecolor-2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGIfv43ez2I/AAAAAAAAADA/-jW0L568pzY/s320/truecolor-2.JPG" alt="" id="BLOGGER_PHOTO_ID_5215766226027859810" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;*photographed by Kate Dado&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;To obtain a binary image from this truecolor image, I first converted it to grayscale using the following code.&lt;br /&gt;&lt;br /&gt;im=imread('flower.jpg');&lt;br /&gt;im=im(:,:,1);&lt;br /&gt;imwrite(im,'flower_gs.jpg');&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGIg-1l7_wI/AAAAAAAAADI/pIQOQ-uA-zA/s1600-h/gray.jpg"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGIg-1l7_wI/AAAAAAAAADI/pIQOQ-uA-zA/s320/gray.jpg" alt="" id="BLOGGER_PHOTO_ID_5215767582358634242" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I then examined the histogram of &lt;span style="font-style: italic;"&gt;flower_gs.jpg&lt;/span&gt; using...&lt;br /&gt;&lt;br /&gt;(a) GIMP&lt;/span&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGIjR3rq6pI/AAAAAAAAADQ/HRJ6kJ9mJBg/s1600-h/gimp.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGIjR3rq6pI/AAAAAAAAADQ/HRJ6kJ9mJBg/s320/gimp.JPG" alt="" id="BLOGGER_PHOTO_ID_5215770108360321682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;(b) SciLab Histogram Plotting Code (© Jeric Tugaff)&lt;br /&gt;&lt;br /&gt;im=imread('flower_gs.jpg');&lt;br /&gt;val=[];&lt;br /&gt;num=[];&lt;br /&gt;counter=1;&lt;br /&gt;for i=0:1:255&lt;br /&gt;[x,y]=find(im==i);&lt;br /&gt;val(counter)=i;&lt;br /&gt;num(counter)=length(x);&lt;br /&gt;counter=counter+1;&lt;br /&gt;end&lt;br /&gt;plot(val, num);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGIoPBqnUyI/AAAAAAAAADY/O6Wr3Osbiis/s1600-h/hist.PNG"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGIoPBqnUyI/AAAAAAAAADY/O6Wr3Osbiis/s320/hist.PNG" alt="" id="BLOGGER_PHOTO_ID_5215775557058777890" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;From the histogram, we see that there are two significant clusters of pixel values, one on the black side (0) and one on the white side (255). Therefore, we can choose a value for thresholding the image to separate the background from the region of interest (ROI), by simply examining the image histogram. Then we incorporate this threshold value to convert &lt;span style="font-style: italic;"&gt;flower_gs.jpg&lt;/span&gt; to binary.&lt;br /&gt;&lt;br /&gt;thresh=150;&lt;br /&gt;im=im2bw(im,thresh/255);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGIyejIgVLI/AAAAAAAAADg/lyQP-m3NvU0/s1600-h/binary.gif"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGIyejIgVLI/AAAAAAAAADg/lyQP-m3NvU0/s320/binary.gif" alt="" id="BLOGGER_PHOTO_ID_5215786818856834226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;FileName: binary.gif&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       FileSize: 19608&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         Format: GIF&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;          Width: 400&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         Height: 300&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;          Depth: 8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    StorageType: indexed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; NumberOfColors: 256&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; ResolutionUnit: centimeter&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    XResolution: 72.000000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    YResolution: 72.000000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Thresholding and Area Calculation Part 2&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;Thresholding is done by examining the histogram of an image, as detailed above. Shown is a scanned image of a leaf.&lt;br /&gt;&lt;br /&gt;im=imread('leaf.jpg');&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGI8Lv93TtI/AAAAAAAAADo/c6CzKaWZfwM/s1600-h/leaf.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGI8Lv93TtI/AAAAAAAAADo/c6CzKaWZfwM/s320/leaf.JPG" alt="" id="BLOGGER_PHOTO_ID_5215797491000626898" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;For purposes, which I'll explain later, I cropped the image.**&lt;br /&gt;&lt;br /&gt;im=imread('cropleaf.jpg');&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGI9F41tI8I/AAAAAAAAADw/5nTu8g7ww9I/s1600-h/cropleaf.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGI9F41tI8I/AAAAAAAAADw/5nTu8g7ww9I/s320/cropleaf.JPG" alt="" id="BLOGGER_PHOTO_ID_5215798489814737858" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;This is a truecolor image, and so, I first converted it to grayscale to obtain its histogram.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;im=imread('cropleaf_gs.jpg');&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGI9aWf-hgI/AAAAAAAAAD4/4FVFmmkEvKs/s1600-h/cropleaf_gs.jpg"&gt;&lt;img style="cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SGI9aWf-hgI/AAAAAAAAAD4/4FVFmmkEvKs/s320/cropleaf_gs.jpg" alt="" id="BLOGGER_PHOTO_ID_5215798841374049794" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGI9jWQZyBI/AAAAAAAAAEA/RAN-Qi9N9yY/s1600-h/hist_leaf.PNG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SGI9jWQZyBI/AAAAAAAAAEA/RAN-Qi9N9yY/s320/hist_leaf.PNG" alt="" id="BLOGGER_PHOTO_ID_5215798995927549970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Two peaks are evident on the histogram, a hint that the image is of good quality, and that we can separate the leaf from the background. We then again find a threshold to be used for converting the image into binary.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;thresh=175;&lt;br /&gt;im=im2bw(im,thresh/255);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGI-x5aJnAI/AAAAAAAAAEI/CY5ANA-pvyc/s1600-h/leaf_binary.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SGI-x5aJnAI/AAAAAAAAAEI/CY5ANA-pvyc/s320/leaf_binary.JPG" alt="" id="BLOGGER_PHOTO_ID_5215800345393470466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;To calculate the area of the leaf, using Green's theorem (see &lt;a href="http://ap186dado.blogspot.com/2008/06/activity-2-area-estimation-for-images.html"&gt;this&lt;/a&gt;), we first incorporate the following code.&lt;br /&gt;&lt;br /&gt;im=1-im;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGI_zh0fJNI/AAAAAAAAAEQ/CnyoRmE2HPI/s1600-h/leaf_invert.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SGI_zh0fJNI/AAAAAAAAAEQ/CnyoRmE2HPI/s320/leaf_invert.JPG" alt="" id="BLOGGER_PHOTO_ID_5215801472932848850" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Effectively, this inverts the pixel values such that the area bounded by the contour of the leaf would be 1's (white) and those outside are 0's (black). This is important since what we are going to calculate the area of the leaf, not the area outside the leaf (or the background).&lt;br /&gt;&lt;br /&gt;Using Green's theorem, the area calculated is &lt;span style="font-style: italic;"&gt;21466.5 pixels.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Comparing this with the area calculated using pixel counting* which is &lt;span style="font-style: italic;"&gt;21967 pixels&lt;/span&gt;, we see a 2.28% difference between them.&lt;br /&gt;&lt;br /&gt;*ImageArea=sum(im);&lt;br /&gt;//summing can be done since we know that the value inside the contour of the leaf are all 1's and that outside are 0's, and therefore summing the whole image will just result to the area (in pixels) of the leaf.&lt;br /&gt;&lt;br /&gt;**The image of the leaf was cropped so that the ruler won't be included in the area calculation.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Thanks to...&lt;br /&gt;Jeric Tugaff for the histogram plotting code. :)&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Rating: 10/10&lt;br /&gt;since a 2.28% difference between the two methods for area calculation is within the 5% acceptable limit.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-2921143981573496371?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/2921143981573496371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=2921143981573496371' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/2921143981573496371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/2921143981573496371'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/06/a3-image-types-and-basic-image.html' title='A3 - Image Types and Basic Image Enhancements'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_v7ISAk_qGb8/SGGcCfFXR6I/AAAAAAAAACo/3vZ5EgRKz6A/s72-c/truecolor.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-5886697500734565458</id><published>2008-06-18T20:14:00.000-07:00</published><updated>2008-12-11T14:24:01.052-08:00</updated><title type='text'>A2 - Area Estimation for Images with Defined Edges</title><content type='html'>Activity 2 - Area Estimation for Images with Defined Edges&lt;br /&gt;&lt;br /&gt;The goal of this activity is to get the area of a regular geometric image (i.e. circle, rectangle, triangle). To do this, we use the 'follow' command in SIP toolbox of SciLab to obtain the edge pixel values of an image and then use these values (these values  form the contour of the shape) to obtain the area bounded by this contour using Green's theorem.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFnR2eQu6eI/AAAAAAAAAA0/30jaGziEwcQ/s1600-h/Green%27s.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 572px; height: 108px;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFnR2eQu6eI/AAAAAAAAAA0/30jaGziEwcQ/s320/Green%27s.JPG" alt="" id="BLOGGER_PHOTO_ID_5213428777424447970" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;*AP 186 A2-Area Estimation for Images with Defined Edges, M. Soriano, 2008&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The following illustrates the code which I used in implementing Green's theorem for computing areas bounded by a contour.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;---&lt;br /&gt;//Area Estimation for Images with Defined Edges&lt;br /&gt;//Julie Mae B. Dado&lt;br /&gt;//AP186&lt;br /&gt;&lt;br /&gt;TestImg=imread('C:\Documents and Settings\AP186user03\Desktop\rect.jpg');&lt;br /&gt;TestImg=im2bw(TestImg,0.5);&lt;br /&gt;//imshow(TestImg);&lt;br /&gt;&lt;br /&gt;[x,y]=follow(TestImg);&lt;br /&gt;size_x=length(x);&lt;br /&gt;size_y=length(y);&lt;br /&gt;&lt;br /&gt;x1(1)=x(size_x);&lt;br /&gt;x1(2:size_x)=x(1:size_x-1);&lt;br /&gt;&lt;br /&gt;y1(1)=y(size_y);&lt;br /&gt;y1(2:size_y)=y(1:size_y-1);&lt;br /&gt;&lt;br /&gt;area=0.5*sum((x1.*y)-(y1.*x));&lt;br /&gt;&lt;br /&gt;//theoretical area&lt;br /&gt;tarea=(max(x)-min(x))*(max(y)-min(y)); //rectangle or square&lt;br /&gt;//tarea=%pi*(((max(x)-min(x))/2)^2);  // circle&lt;br /&gt;//tarea=0.5*(max(x)-min(x))*(max(y)-min(y)); //triangle&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;RESULTS:&lt;br /&gt;*Image size: 63x71&lt;br /&gt;Test Image 1: Rectangle&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SFnS1zMdeoI/AAAAAAAAAA8/mB1W6R9HztM/s1600-h/rect.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SFnS1zMdeoI/AAAAAAAAAA8/mB1W6R9HztM/s320/rect.JPG" alt="" id="BLOGGER_PHOTO_ID_5213429865375431298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Area Computed Using Green's Theorem: 1763&lt;br /&gt;Theoretical Area (pixel count): 1763&lt;br /&gt;% Error: 0%&lt;br /&gt;&lt;br /&gt;Test Image 2: Triangle&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SFnTYKy5c1I/AAAAAAAAABE/ddg2O4kgSFQ/s1600-h/triangle.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SFnTYKy5c1I/AAAAAAAAABE/ddg2O4kgSFQ/s320/triangle.JPG" alt="" id="BLOGGER_PHOTO_ID_5213430455826215762" border="0" /&gt;&lt;/a&gt;Area Computed Using Green's Theorem: 876.5&lt;br /&gt;Theoretical Area (pixel count): 860&lt;br /&gt;% Error: 1.9%&lt;br /&gt;&lt;br /&gt;Test Image 3: Circle (large)&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_v7ISAk_qGb8/SFnT12rZ0XI/AAAAAAAAABM/lYbBFaWuNoE/s1600-h/circle.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_v7ISAk_qGb8/SFnT12rZ0XI/AAAAAAAAABM/lYbBFaWuNoE/s320/circle.JPG" alt="" id="BLOGGER_PHOTO_ID_5213430965822148978" border="0" /&gt;&lt;/a&gt;Area Computed Using Green's Theorem: 1658&lt;br /&gt;Theoretical Area (pixel count): 1661.9&lt;br /&gt;% Error: 0.23%&lt;br /&gt;&lt;br /&gt;Test Image 4: Circle (medium)&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_v7ISAk_qGb8/SFnUbFHaCtI/AAAAAAAAABc/yUP81tbfCEk/s1600-h/circle1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_v7ISAk_qGb8/SFnUbFHaCtI/AAAAAAAAABc/yUP81tbfCEk/s320/circle1.JPG" alt="" id="BLOGGER_PHOTO_ID_5213431605352860370" border="0" /&gt;&lt;/a&gt;Area Computed Using Green's Theorem: 341&lt;br /&gt;Theoretical Area (pixel count): 346.4&lt;br /&gt;% Error: 1.6%&lt;br /&gt;&lt;br /&gt;Test Image 5: Circle (small)&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_v7ISAk_qGb8/SFnU5jlXzoI/AAAAAAAAABk/BAL34ag9_mQ/s1600-h/circle2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_v7ISAk_qGb8/SFnU5jlXzoI/AAAAAAAAABk/BAL34ag9_mQ/s320/circle2.JPG" alt="" id="BLOGGER_PHOTO_ID_5213432128927682178" border="0" /&gt;&lt;/a&gt;Area Computed Using Green's Theorem: 64&lt;br /&gt;Theoretical Area (pixel count): 78.5&lt;br /&gt;% Error: 18.5%&lt;br /&gt;&lt;br /&gt;Observations:&lt;br /&gt;1. Maximum differences between area estimation using Green's theorem (that is, obtaining pixel values for the contour)  and analytical estimation of area using pixel counting were observed for circular shapes while minimum errors were observed for rectangular shapes. This error can be accounted for the pixel shape which are actually small squares. Circular shapes relatively do not have smooth contours. (this may be observed if you zoom in on a circular image)&lt;br /&gt;&lt;br /&gt;2. For circle with smaller radii, the errors are larger. This is because the smaller the radius, the less number of pixels used to estimate the smooth shape of the circle.&lt;br /&gt;&lt;br /&gt;3. Area estimation by obtaining pixel values of a contour used for Green's theorem are somehow limited shapes with straight sides. This technique somehow isn't suited for smooth contours unless pixel values are compensated such that it can approximate the shape with less error.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Thanks to...&lt;br /&gt;Jeric for helping me debug my program whenever it doesn't work and for showing me how to obtain theoretical area using pixel counting.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;Grade: 7/10&lt;br /&gt;because I had a hard time debugging simple errors and that I pretty much didn't analyze how to obtain area using pixel counting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-5886697500734565458?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/5886697500734565458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=5886697500734565458' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5886697500734565458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/5886697500734565458'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/06/activity-2-area-estimation-for-images.html' title='A2 - Area Estimation for Images with Defined Edges'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_v7ISAk_qGb8/SFnR2eQu6eI/AAAAAAAAAA0/30jaGziEwcQ/s72-c/Green%27s.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6407872634751791939.post-2550796773555728996</id><published>2008-06-11T19:27:00.000-07:00</published><updated>2008-12-11T14:24:02.085-08:00</updated><title type='text'>A1 - Digital Scanning</title><content type='html'>&lt;div style="text-align: center; font-family: trebuchet ms; color: rgb(102, 255, 255);"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCJxUrvFqI/AAAAAAAAAAU/N9Z4Pdk6df4/s1600-h/img001+crop.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCJxUrvFqI/AAAAAAAAAAU/N9Z4Pdk6df4/s320/img001+crop.jpg" alt="" id="BLOGGER_PHOTO_ID_5210816249326409378" border="0" /&gt;&lt;/a&gt; I obtained this plot from Canadian Journal of Physics dated 1953.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The following table shows the pixel locations of the tick marks for both X and Y axes of the digitally scanned plot.&lt;br /&gt;&lt;br /&gt;&lt;table str="" style="border-collapse: collapse; width: 144pt;" border="0" cellpadding="0" cellspacing="0" width="192"&gt;&lt;col style="width: 48pt;" span="3" width="64"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 48pt;" width="64" height="17"&gt;along x&lt;/td&gt;   &lt;td class="xl24" style="width: 48pt;" width="64"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 48pt;" width="64"&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" height="17"&gt;points&lt;/td&gt;   &lt;td class="xl24"&gt;px&lt;/td&gt;   &lt;td class="xl24"&gt;py&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1129&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.2&lt;/td&gt;   &lt;td class="xl24" num=""&gt;271&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1129&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.4&lt;/td&gt;   &lt;td class="xl24" num=""&gt;401&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1129&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.6&lt;/td&gt;   &lt;td class="xl24" num=""&gt;531&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1129&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.8&lt;/td&gt;   &lt;td class="xl24" num=""&gt;661&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1129&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;1&lt;/td&gt;   &lt;td class="xl24" num=""&gt;791&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1129&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" height="17"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" height="17"&gt;along y&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" height="17"&gt;points&lt;/td&gt;   &lt;td class="xl24"&gt;px&lt;/td&gt;   &lt;td class="xl24"&gt;py&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1129&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;4&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;994&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;8&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;859&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;12&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;724&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;16&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;589&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;20&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;457&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;24&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;324&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;28&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;190&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;32&lt;/td&gt;   &lt;td class="xl24" num=""&gt;140&lt;/td&gt;   &lt;td class="xl24" num=""&gt;60&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;To obtain a conversion factor (pixel/unit) for each axis, simply count the number of pixels that lie within each tick mark. For cases wherein the number of pixels within tick marks of one axis ( Y-axis in my case) varies, average the values to obtain a general conversion factor. The values I obtained are the following:&lt;br /&gt;&lt;br /&gt;x-axis: 130.2 pixels/unit (unit in this case, means, within one tick mark)&lt;br /&gt;y-axis: 133.625 pixels/unit&lt;br /&gt;&lt;br /&gt;These values are then used to obtain physical values of the points on the graph. The next step is to get the pixel values of the points the graph. I obtained the following for the scanned plot shown above.&lt;br /&gt;&lt;br /&gt;&lt;table str="" style="border-collapse: collapse; width: 96pt;" border="0" cellpadding="0" cellspacing="0" width="128"&gt;&lt;col style="width: 48pt;" span="2" width="64"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 48pt;" width="64" height="17"&gt;px&lt;/td&gt;   &lt;td class="xl24" style="width: 48pt;" width="64"&gt;py&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;203&lt;/td&gt;   &lt;td class="xl24" num=""&gt;998&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;267&lt;/td&gt;   &lt;td class="xl24" num=""&gt;936&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;331&lt;/td&gt;   &lt;td class="xl24" num=""&gt;879&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;398&lt;/td&gt;   &lt;td class="xl24" num=""&gt;824&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;461&lt;/td&gt;   &lt;td class="xl24" num=""&gt;773&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;528&lt;/td&gt;   &lt;td class="xl24" num=""&gt;722&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;591&lt;/td&gt;   &lt;td class="xl24" num=""&gt;665&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;658&lt;/td&gt;   &lt;td class="xl24" num=""&gt;602&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;721&lt;/td&gt;   &lt;td class="xl24" num=""&gt;459&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;780&lt;/td&gt;   &lt;td class="xl24" num=""&gt;58&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;Using the conversion factor (pixel/unit) for both axes, I obtained the following physicals values by dividing the pixel values with the conversion factor. (i.e. px/130.2 for x location values)&lt;/span&gt;  &lt;table str="" style="border-collapse: collapse; width: 224pt; font-family: trebuchet ms; color: rgb(102, 255, 255);" border="0" cellpadding="0" cellspacing="0" width="298"&gt;&lt;col style="width: 88pt;" width="117"&gt;  &lt;col style="width: 136pt;" width="181"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 88pt;" width="117" height="17"&gt;x&lt;/td&gt;   &lt;td class="xl24" style="width: 136pt;" width="181"&gt;y&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="1.5591397849462367" height="17"&gt;1.559139785&lt;/td&gt;   &lt;td class="xl24" num="7.4686623012160895"&gt;7.468662301&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="2.0506912442396317" height="17"&gt;2.050691244&lt;/td&gt;   &lt;td class="xl24" num="7.0046772684752101"&gt;7.004677268&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="2.5422427035330264" height="17"&gt;2.542242704&lt;/td&gt;   &lt;td class="xl24" num="6.5781103835360151"&gt;6.578110384&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="3.0568356374807992" height="17"&gt;3.056835637&lt;/td&gt;   &lt;td class="xl24" num="6.1665107577174929"&gt;6.166510758&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="3.5407066052227347" height="17"&gt;3.540706605&lt;/td&gt;   &lt;td class="xl24" num="5.7848456501403183"&gt;5.78484565&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="4.0552995391705071" height="17"&gt;4.055299539&lt;/td&gt;   &lt;td class="xl24" num="5.4031805425631427"&gt;5.403180543&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="4.5391705069124431" height="17"&gt;4.539170507&lt;/td&gt;   &lt;td class="xl24" num="4.9766136576239477"&gt;4.976613658&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="5.0537634408602159" height="17"&gt;5.053763441&lt;/td&gt;   &lt;td class="xl24" num="4.5051449953227314"&gt;4.505144995&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="5.5376344086021509" height="17"&gt;5.537634409&lt;/td&gt;   &lt;td class="xl24" num="3.4349859681945745"&gt;3.434985968&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="5.9907834101382491" height="17"&gt;5.99078341&lt;/td&gt;   &lt;td class="xl24" num="0.43405051449953225"&gt;0.434050514&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;I then used Excel to plot these values and see if the same trend as the scanned plot will be observed. (Note: Image origin is different from Excel. Image origin is on the upper left corner of the image while Excel is on the lower left. For comparison, in plotting the physical values in Excel, plot values in reverse order.)&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;  &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;This is how the plot in Excel looks&lt;/span&gt;  &lt;a style="font-family: trebuchet ms; color: rgb(102, 255, 255);" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCQhUrvFsI/AAAAAAAAAAk/_TlbYObwx38/s1600-h/1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCQhUrvFsI/AAAAAAAAAAk/_TlbYObwx38/s320/1.JPG" alt="" id="BLOGGER_PHOTO_ID_5210823671029896898" border="0" /&gt;&lt;/a&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;The trend is much obvious with the original image superimposed on the plot.&lt;/span&gt;  &lt;a style="font-family: trebuchet ms; color: rgb(102, 255, 255);" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCRHUrvFtI/AAAAAAAAAAs/cXfdNVNAMLQ/s1600-h/2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCRHUrvFtI/AAAAAAAAAAs/cXfdNVNAMLQ/s320/2.JPG" alt="" id="BLOGGER_PHOTO_ID_5210824323864925906" border="0" /&gt;&lt;/a&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;...&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;  &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;Rating&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;  &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;10 - The trend I obtained in re-plotting the scanned copy was similar to the original plot.&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;  &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;...&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;  &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;Thanks to...&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt; &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;...Benj Palmares for helping with the Excel, especially with superimposing the original image.&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt; &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;...Jeric Tugaff for pointers in paint.&lt;/span&gt;  &lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;__________________________________________________________________&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;_______________&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt; &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;&lt;br /&gt;A1 - Digital Scanning&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt; &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;EDITED VERSION: posted June 19, 2008&lt;/span&gt;  &lt;div style="text-align: center; font-family: trebuchet ms; color: rgb(102, 255, 255);"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCJxUrvFqI/AAAAAAAAAAU/N9Z4Pdk6df4/s1600-h/img001+crop.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCJxUrvFqI/AAAAAAAAAAU/N9Z4Pdk6df4/s320/img001+crop.jpg" alt="" id="BLOGGER_PHOTO_ID_5210816249326409378" border="0" /&gt;&lt;/a&gt;I obtained this plot from Canadian Journal of Physics dated 1953.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt; &lt;div  style="text-align: left; color: rgb(102, 255, 255);font-family:trebuchet ms;"&gt;The following table shows the pixel locations of the tick marks for both X and Y axes of the digitally scanned plot.&lt;br /&gt;&lt;table str="" style="border-collapse: collapse; width: 344px; height: 252px;" border="0" cellpadding="0" cellspacing="0"&gt;&lt;col style="width: 50pt;" width="66"&gt;  &lt;col style="width: 47pt;" width="63"&gt;  &lt;col style="width: 38pt;" width="50"&gt;  &lt;col style="width: 48pt;" span="2" width="64"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 50pt;" str="along x " width="66" height="17"&gt;&lt;a name="RANGE!A1:C9"&gt;&lt;br /&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/a&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 47pt;" width="63"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 38pt;" width="50"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 48pt;" width="64"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 48pt;" width="64"&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl25" style="height: 12.75pt;" height="17"&gt;&lt;a name="RANGE!A1:C9"&gt;&lt;span style="font-weight: bold;"&gt;along x&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;   &lt;td class="xl25"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl25"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl25"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl25"&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl25" style="height: 12.75pt; font-weight: bold;" str="points " height="17"&gt;points&lt;span style=""&gt; &lt;/span&gt;&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl25" str="px "&gt;px&lt;span style=""&gt; &lt;/span&gt;&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl25"&gt;py&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl25"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl25"&gt;pixel values included within each tick mark&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1126&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;135&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.2&lt;/td&gt;   &lt;td class="xl24" num=""&gt;271&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1126&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;130&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.4&lt;/td&gt;   &lt;td class="xl24" num=""&gt;401&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1126&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;131&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.6&lt;/td&gt;   &lt;td class="xl24" num=""&gt;532&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1126&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;131&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0.8&lt;/td&gt;   &lt;td class="xl24" num=""&gt;663&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1126&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;131&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;1&lt;/td&gt;   &lt;td class="xl24" num=""&gt;794&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1126&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl25"&gt;average&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl25" num="" fmla="=SUM(E4:E8)/5"&gt;131.6&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table str="" style="border-collapse: collapse; width: 346px; height: 306px;" border="0" cellpadding="0" cellspacing="0"&gt;&lt;col style="width: 50pt;" width="66"&gt;  &lt;col style="width: 47pt;" width="63"&gt;  &lt;col style="width: 38pt;" width="50"&gt;  &lt;col style="width: 48pt;" span="2" width="64"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 50pt;" str="along y " width="66" height="17"&gt;&lt;a name="RANGE!A11:C22"&gt;&lt;br /&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/a&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 47pt;" width="63"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 38pt;" width="50"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 48pt;" width="64"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 48pt;" width="64"&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; font-weight: bold;" height="17"&gt;&lt;a name="RANGE!A11:C22"&gt;along y&lt;/a&gt;&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" str="points " height="17"&gt;&lt;span style="font-weight: bold;"&gt;points&lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/td&gt;   &lt;td class="xl24" str="px "&gt;&lt;span style="font-weight: bold;"&gt;px&lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl24"&gt;py&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl24"&gt;pixel values included within each tick mark&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;0&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;1126&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;134&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;4&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;992&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;133&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;8&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;859&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;135&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;12&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;724&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;135&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;16&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;589&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;132&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;20&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;457&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;134&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;24&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;323&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;133&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;28&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;190&lt;/td&gt;   &lt;td class="xl24"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl24" num=""&gt;131&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt;" num="" height="17"&gt;32&lt;/td&gt;   &lt;td class="xl24" num=""&gt;136&lt;/td&gt;   &lt;td class="xl24" num=""&gt;59&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl24"&gt;average&lt;/td&gt;   &lt;td style="font-weight: bold;" class="xl24" num="133.375" fmla="=SUM(E4:E11)/8"&gt;133.375&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;To obtain a conversion factor (pixel/unit) for each axis, simply count the number of pixels that lie within each tick mark. Then, average the values to obtain a general conversion factor. The values I obtained are the following:&lt;br /&gt;&lt;br /&gt;x-axis: 131.6 pixels/one tick mark&lt;br /&gt;y-axis: 133.375 pixels/one tick mark&lt;br /&gt;&lt;br /&gt;These  are then used to obtain physical values of the points on the graph. The next step is to get the pixel values of the points the graph. I obtained the following for the scanned plot shown above.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;table str="" style="border-collapse: collapse; width: 97pt;" border="0" cellpadding="0" cellspacing="0" width="129"&gt;&lt;col style="width: 50pt;" width="66"&gt;  &lt;col style="width: 47pt;" width="63"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 50pt; text-align: center; font-weight: bold;" str="px " width="66" height="17"&gt;&lt;a name="RANGE!A24:B34"&gt;px&lt;span style=""&gt; &lt;/span&gt;&lt;/a&gt;&lt;/td&gt;   &lt;td class="xl24" style="width: 47pt; text-align: center; font-weight: bold;" width="63"&gt;py&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;203&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;998&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;267&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;936&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;331&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;879&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;398&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;824&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;461&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;772&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;528&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;721&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;590&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;665&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;658&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;602&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;721&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;458&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;780&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num=""&gt;58&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;Using the conversion factor for both axes, I obtained the following physicals values by dividing the pixel values with the conversion factor. (i.e. px/131.6 for x location values)&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;. These physical values, however, should be biased in order to properly correlate the points with those present in the image. Therefore, for both x and y, I subtracted the physical value of the origin from x physical values and y physical values (i.e. &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;x biased = x-(136/131.6) &lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;and&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt; y biased = y-(1126/133.375)&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;).&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;&lt;/span&gt;  &lt;table str="" style="border-collapse: collapse; width: 230px; height: 198px; color: rgb(102, 255, 255);" border="0" cellpadding="0" cellspacing="0"&gt;&lt;col style="width: 74pt;" width="98"&gt;  &lt;col style="width: 75pt;" width="100"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 74pt; text-align: center; font-weight: bold;" width="98" height="17"&gt;x&lt;/td&gt;   &lt;td class="xl24" style="width: 75pt; text-align: center; font-weight: bold;" width="100"&gt;y&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="1.5425531914893618" height="17"&gt;1.542553191&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="7.4826616682286788"&gt;7.482661668&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="2.0288753799392096" height="17"&gt;2.02887538&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="7.0178069353327084"&gt;7.017806935&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="2.5151975683890577" height="17"&gt;2.515197568&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="6.5904404873477036"&gt;6.590440487&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="3.0243161094224926" height="17"&gt;3.024316109&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="6.1780693533270856"&gt;6.178069353&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="3.5030395136778116" height="17"&gt;3.503039514&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="5.7881911902530456"&gt;5.78819119&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="4.0121580547112465" height="17"&gt;4.012158055&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="5.4058106841611995"&gt;5.405810684&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="4.4832826747720365" height="17"&gt;4.483282675&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="4.9859418931583876"&gt;4.985941893&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="" height="17"&gt;5&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="4.5135895032802251"&gt;4.513589503&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="5.4787234042553195" height="17"&gt;5.478723404&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="3.4339268978444237"&gt;3.433926898&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="5.9270516717325235" height="17"&gt;5.927051672&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="0.43486410496719774"&gt;0.434864105&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table str="" style="border-collapse: collapse; width: 265px; height: 198px; color: rgb(102, 255, 255);" border="0" cellpadding="0" cellspacing="0"&gt;&lt;col style="width: 92pt;" width="122"&gt;  &lt;col style="width: 86pt;" width="115"&gt;  &lt;tbody&gt;&lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; width: 92pt; text-align: center; font-weight: bold;" width="122" height="17"&gt;x biased&lt;/td&gt;   &lt;td class="xl24" style="width: 86pt; text-align: center; font-weight: bold;" width="115"&gt;y biased&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="0.50911854103343468" height="17"&gt;0.509118541&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-0.95970009372071186"&gt;-0.959700094&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="0.99544072948328255" height="17"&gt;0.995440729&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-1.4245548266166823"&gt;-1.424554827&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="1.4817629179331306" height="17"&gt;1.481762918&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-1.8519212746016871"&gt;-1.851921275&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="1.9908814589665655" height="17"&gt;1.990881459&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-2.2642924086223051"&gt;-2.264292409&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="2.4696048632218845" height="17"&gt;2.469604863&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-2.6541705716963451"&gt;-2.654170572&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="2.9787234042553195" height="17"&gt;2.978723404&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-3.0365510777881912"&gt;-3.036551078&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="3.4498480243161094" height="17"&gt;3.449848024&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-3.456419868791003"&gt;-3.456419869&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="3.9665653495440729" height="17"&gt;3.96656535&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-3.9287722586691656"&gt;-3.928772259&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="4.4452887537993924" height="17"&gt;4.445288754&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-5.0084348641049665"&gt;-5.008434864&lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 12.75pt;" height="17"&gt;   &lt;td class="xl24" style="height: 12.75pt; text-align: center;" num="4.8936170212765964" height="17"&gt;4.893617021&lt;/td&gt;   &lt;td style="text-align: center;" class="xl24" num="-8.0074976569821921"&gt;-8.007497657&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;I then used Excel to plot these values and see if the same trend as the scanned plot will be observed. This can be done because the points which are now biased according to the origin can be plotted in a manner that will coincide with your scanned image given that you overlay a properly cropped image&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;, that is cropped at the pixel value of the origin. One should also be careful in overlaying the image to your Excel plot, therefore check the limits of both your x and y axes to see if proper correlation with your cropped image is observed.  The following shows the Excel plot.&lt;/span&gt;  &lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a style="font-family: trebuchet ms; color: rgb(102, 255, 255);" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFos6WzFZPI/AAAAAAAAABs/JrNxMtiat4I/s1600-h/Excel+Plot.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFos6WzFZPI/AAAAAAAAABs/JrNxMtiat4I/s320/Excel+Plot.JPG" alt="" id="BLOGGER_PHOTO_ID_5213528899698648306" border="0" /&gt;&lt;/a&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;The following shows the Excel plot with an overlay of the cropped image.&lt;/span&gt;  &lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;a style="font-family: trebuchet ms; color: rgb(102, 255, 255);" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFotm96LUUI/AAAAAAAAAB0/nYS7frAGWf0/s1600-h/overlay.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_v7ISAk_qGb8/SFotm96LUUI/AAAAAAAAAB0/nYS7frAGWf0/s320/overlay.JPG" alt="" id="BLOGGER_PHOTO_ID_5213529666111623490" border="0" /&gt;&lt;/a&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;br /&gt;---&lt;br /&gt;Thanks to...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;... Dr. Maricor Soriano for pointing out my mistake, giving tips on how to correct that mistake and for giving me a second chance at a 10. :)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 255, 255);font-family:trebuchet ms;" &gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6407872634751791939-2550796773555728996?l=ap186dado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ap186dado.blogspot.com/feeds/2550796773555728996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6407872634751791939&amp;postID=2550796773555728996' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/2550796773555728996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6407872634751791939/posts/default/2550796773555728996'/><link rel='alternate' type='text/html' href='http://ap186dado.blogspot.com/2008/06/a1-digital-scanning.html' title='A1 - Digital Scanning'/><author><name>Julie Mae B. Dado</name><uri>http://www.blogger.com/profile/17921670968713124217</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://photos-908.friendster.com/e1/photos/80/95/5535908/1_889537520l.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_v7ISAk_qGb8/SFCJxUrvFqI/AAAAAAAAAAU/N9Z4Pdk6df4/s72-c/img001+crop.jpg' height='72' width='72'/><thr:total>2</thr:total></entry></feed>
