Monday, June 29, 2009

Activity 4. Enhancement by Histogram Manipulation

This activity focused on the enhancement of a low resolution image using histogram manipulation. The activity was started by selecting and downloading a low contrast image from the internet. The image is shown below.

(static.photo.net)

The image was then resized and converted into grayscale using the im2gray command in Scilab. The histogram of the gray levels was then generated using the same program. The generated histogram is shown below.


The CDF of the image was then generated using Scilab. The CDF is presented in the figure below.The image was then enhanced using a linear function. The enhanced image is shown below.


The CDF and the PDF of the enhanced image was generated using Scilab. The CDF and the PDF of the enhanced image above is shown below, respectively.

The primary axis of the two plots above represent grayscale values. The image was then enhanced using a nonlinear (x^3) function. The image enhanced using the nonlinear function is shown below.



The CDF and the PDF was then computed and generated using Scilab. The CDF and PDF of the enhanced image enhanced using the nonlinear function is shown below. The first image is the CDF and the second image is the PDF.

From the images enhanced using linear and nonlinear function, it can be observed that the image generated or enhanced using the nonlinear function has a higher level of contrast than the image generated after enhancing the original image by the linear function.


I will give myself 8/10 for this activity.

**Neil and Gilbert helped me in debugging the Scilab code.

Monday, June 22, 2009

Activity 3. Image Types and Basic Image Enhancement

Images were categorized into true image, binary image, grayscale image and indexed image in this activity. Different images were selected and downloaded from the internet or drawn through Paint. The sample images for the categories of images are shown below.

A. Binary Image
Pixel Dimension: 640 x 360 pixels
Resolution: 72 x 72 ppi



B. Grayscale
Pixel Dimension:1982 x 1973 pixels
Resolution: 300 x 300 ppi
Source:www.press.roncarter.net



C. True Color
Pixel Dimension:640 x 418 pixels
Resolution:96 x 96 ppi
Source:www.jma.go.jp



D. Indexed Image
Pixel Dimension:300 x 300 pixels
Resolution: 72 x 72 ppi
Source:www.crazylikethat.com



An object was then selected and scanned. The image of the object was then converted into gray and black and white. The conversion of the images were done using Scilab. The images are shown below. The first image is the scanned image, followed by the converted grayscale image and the inverse black and white image.


.

The area of the white portion of the third image was computed using Scilab, using a paint and using ruler. The area measured by the ruler was converted from inch to pixels by multiplying the measured value by 75 (since the image is 75dpi). The computed and measured area was then compared. The area computed using Scilab is 90624 pixels and the measured area is 90816.pixels The area measured using the ruler is 96736.275 pixels. The percent error of the area calculation when the area computed by Scilab and the area measured using the ruler was compared is 6.31%. The error in area when the two measured values was compared, with the ruler measurement set as reference, is 6.12%. The code used to compute the area in Scilab is shown below.

a=imread('ed123.bmp')
[x_ed,y_ed]=follow(a);
Area=[]
l=length(x_ed);
for i=1:l-1
Area(i)=x_ed(i)*y_ed(i+1)-y_ed(i)*x_ed(i+1);
end
TotalArea=sum(Area)/2

I will give myself 10/10 for completing this activity.

**Gilbert helped in debugging the code.

Activity 2. Area Estimation For Images with Defined Edges

Different images were drawn using Microsoft Paint. The images are shown below.

The area of the white area of the images was then computed using the conventional method of computing the area( such as length multiplied by height for a rectangular area) and using Scilab. The area computed by the conventional method was treated as the theoretical value and the area computed using Scilab was treated as the experimental value. The computation of the area using Scilab is based on the Green's Theorem. The formula of the area is given by:
The code used to compute the Area of the white area of the images is shown below.

The theoretical and experimental area summarized in Table 1.

Table 1. Summary of the Theoretical and Experimental Area

The data presented in Table 1 shows that there is only a small difference between the theoretical and the experimental area therefore the use of the Green's theorem is valid for the computation of the area of the generated images.

For accomplishing the given task, I grade myself 10/10.

**Gilbert's corrections and tips helped a lot.


Monday, June 15, 2009

Digital Scanning

June 18, 2009: First Activity

The relationship between variables in experiments are often shown using graphs. Before the 20th century, graphs were hand-drawn. The advancement in technology made the presentation of experimental data easier. Graphs can now be generated with a click of a button. The challenge that scientists and researchers faced is to convert the old hand-drawn graphs and charts into digital charts and data. In this activity, I used ratio and proportion to compute the numerical data and convert a certain graph, taken from a 1940 Botany journal, into digital data.

A graph was first selected and photocopied from the vast array of journals and publications in the College of Science Library. The photocopied graph was then digitally scanned in order to convert it into a digital image. After scanning the graph, the image of the graph was then viewed and edited using the Nero PhotoSnap Viewer Essential in order to remove the unwanted parts and to remove the tilt of the image. The edited image was then opened using Microsoft Paint in order to determine the pixel coordinates of the points in the graph. The measured pixel coordinates was then tabulated using the OpenOffice Calc program. The pixel coordinates was then converted into the physical values of the data presented in the graph. The conversion factor used for the x-axis is 2 units/ 70 pixels while a conversion factor of 10 units/ 71 pixels was used for the y-axis. The original, edited and the two converted graphs are presented in the figures below, respectively.





The first two images show the scanned image of the graph. The third image presented shows the XY scatter of the converted data points. The square marks in the third image are the computed value of the data points while the circle marks are the data points of the original graph. The graph shows that the data points presented in the original graph closely match those of the converted graph. The last image shows the converted fit and the original fit of the graph. The blue line represents the converted fit while the black line is the fit of the original graph. The image also show that there is a very close resemblance between the original graph and the converted graph. The data points used in generating the last 2 graphs are shown in the tables below.


The first table shows the data points of the XY scatter while the second table shows the data points of the fit of the graph.

In summary, a hand-drawn graph was successfully converted into a digital graph. The values presented by the original graph was also measured and computed using ratio and proportion.

I will grade myself 10/10 for completing the assigned tasks in the activity and getting a converted graph that closely fits the original graph.

***Raffy's and Gilbert's tips really helped a lot.