Monday, June 22, 2009

Activity 3:Image types and basic image enhancement


Objective: Differentiate image formats and apply basic image processing and conversion.

Tools: Image processing software and Scilab

Procedure: We use several different images:



1. RGBImage of NGC 2392, Eskimo Nebula
Taken from www.hubblesite.org200 x 200 pixels.
72x72 dpi
4kB in RGB











2. GrayscaleImage of M17 Nebula taken by HST
Taken from: http://www1.cs.columbia.edu
/~johnc/ta_page/
6998s07/schedule/proj1/proj1.html
200 x200 pixels
149.987 x149.987 dpi







3. Indexed
Colorized image of the entire sky at
gamma-ray energies
477x297 pixels
96 x 96 dpi
46.2 kB



Then in order to apply basic image processing techniques, we use a colored image and convert it to binary using a histogram routine to find the appropriate threshold value. Then we use the routine from the previous Activity to find the are of the ROI. Specifically, we use the figure shown below (taken from E. Marolda, The U.S. Navy in the Vietnam War)


This is then converted to binary using the im2bw routine which uses a threshold value to specify the gray level which is converted to either white or black. The following code is used to generate the historgram of the image:

clc
clf

img=imread('C:\Documents and Settings\2005-09860\Desktop\page3_2_en_sub.png');
//imshow(img);
a = 1;

g= [];
p= [];
for j = 1:256
[x, y] = find(img== j);
g(a) = j;
p(a) = length(x);
a = a + 1;
end
subplot(211)
//p=p/max(max(p));

plot(g,p)

-----------------------------------------------------------------------------------------------------
After conversion, the area of the image is taken using the routine in the previous activity. The routine indicates that this image has an are of 84500.5 units. Compared to the previous images processed, this appears to be a fairly accurate result.


Evaluation:For the effort expended and the acceptable result I can rate this as a 10.

Acknowledgements:I would like to thank Mr. Gubatan for insights on the histogram process as well as the usual folks for their assistance.

References: AP 186 Activity 3 Manual


Activity 2:Area estimation for images with defined edges

Objective: Use image processing software and Green's Theorem to compute the area of a regular polygon and compare this with the analytically computed area.

Tools: Scilab specifically the Image Processing Toolbox, MS Paint

Procedure: We use four different regular shapes drawn in black and white using MS paint.
These have areas of 10285, 6545, 5676 and 42121 square units respectively. Using the "follow" command in Scilab, we can get the x and y coordinates of the contour forming the border of the black and white regions. This creates two arrays of numbers called X and Y.

We then use a "for" loop to substitute these values of X and Y into the equation:where x and y are the coordinate arrays and the index i is the length of the array. This code is implemeted as follows:
______________________________________________________________
clc
clf

fig=imread('C:\Documents and Settings\2005-09860\Desktop\circ.bmp');
fig=im2bw(fig,0.5);
imshow(fig);

[x,y]=follow(fig);

i=length(x);
a=[];

for j=1:i-1
a(j)=x(j)*(y(j+1))-y(j)*x(j+1);
end

Area=sum(a)/2

______________________________________________________________

This code outputs a number which corresponds to the are of the polygon.

Results:


The following results were obtained using the shapes above:


These results correspond closely with the computed values. With the exception of the triangle, the deviations were all below 5% which indicates consistency. The triangle area may have a larger difference due to the manner in which a diagonal line is drawn in MSPaint. The line is drawn as a series of steps instead of a straight line.

Acknowledgements: I would like to thank the usual people for their help.

Refernces:
AP 186 Activity 2 Manual.

Rating: For this Activity, the acceptable correlation of the results with the actual values allow for a rating of 10.

Wednesday, June 17, 2009

Activity 1: Digital Sacnning

Objective: Use ratio and proportion to find the numerical values of a hand-drawn (or machine printed) plot.

Tools: MS Paint, Spreadsheet, image processing software

Description of procedure: We start with an scanned image of an old plot from some journal.


Figure 1. Original image of the plot.

We then take a fixed interval in an axis of the plot (which corresponds to a physical value) and note the number of pixels comprising this interval in the image. This give us a ratio of the physical quantity per pixel. For example, if the plot shows 100 units in the x axis and consists of 200 pixels in the image, we get a ratio of:


100 units/ 200 pixel= 0.5 units per pixel

We do this for both a and y axes. We then take the coordinates of the points in the plot and copy these into a spreadsheet. Using the ratios we derived earlier, we can then get the values corresponding to the physical quantities for both x and y axes. When these are plotted and the graph axes are adjusted to reflect the scale on the image, we get a plot that should correspond to the original drawing as we see below.



Figure 2. Overlay of origial plot and the plotted points from spreadsheet.


Comments: The results correspond well to the curve on the image. Note that the plotted points are represented as squares on the plot above. The main difficulty encountered is the scaling and the correlation of the axes which turns out to be a bit trickier than anticipated.

Source: Wood and Petrie, "Nitrogen metabolism of plants," Annals of Botany, Vol 2. 1938.

Acknowledgements: I would like to thank Doctors Soriano and Perez for their instruction. Also I would like to thank Misters Cabello, Dilla, Garcia, Gubatan and Villoan for their invaluable assistance.

Evaluation: For this activity I give mysely a grade of ten (10) for my output is quite acceptable and that the procedure for this exercise was thoroughly understood.

Additional Image: Trendline from spreadsheet showing logarithmic fit (compare with original scanned line)


Monday, June 15, 2009

First Post

Read the tiltle.

Followers