Thursday, June 26, 2008

Activity 3

PART 1. 4 Basic Image Types

image 1 (original image)



image 2 (binary image)

image 3 (greyscale image)


image 4 (indexed image)


image 1 image 2 image 3 image 4 not shown
FileSize 123232 38462 36422 68111 303780
Format JPEG BMP JPEG GIF PNG
Width 640 640 640 640 640
Height 480 480 480 480 480
Depth 24 1 8 8 24
StorageType truecolor indexed greyscale indexed truecolor
NumberOfColors 0 2 256 256 0

//i converted the same image (a beautifully 3D rendered glass heart by bryan shane oney) into binary, grayscale, and indexed images. Scilab returned zero for the number of colors for both truecolor images, i did not upload the PNG image because it looked exactly like the original JPEG image, the larger file size of the former was as discussed in class, due to the success of the compression of *.jpg images. Also, *.gif images are indexed by default and as we see here, though it is colored, the file size is considerably smaller than the other colored images. The indexing/compression of GIF files seem a little buggy though because upon closer inspection, it undermines the quality of the image.



PART 2. Basic Image Enhancement


The original image:
FileSize 38200
Format PNG
Width 400
Height 444
Depth 8
StorageType grayscale
NumberOfColors 256

\\of course to be able to find the area of the object i had to crop away the rulers using Corel PhotoPaint 12, the same program i used to place the vertical ruler in the picture in the first place.
Cropped Image:\\the contrast is already obviously quite good in this picture, and according to its histogram:
\\histogram obtained using the following Scilab Code provided by jeric tugaff:

im=imread('C:\Documents and Settings\Endura\My Documents\1863.jpg');
getf('imhist.sce');

[val, num]=imhist(im);
plot(val, num);

\\it was then converted to black and white (through thresholding with the threshold value inferred from the histogram plot values) and then inverted.

imb=im2bw(im,0.8);
imb=abs(1-imb);

\\the same methods (and code) from the last activity were then used to find the area of the object from this last inverted black and white picture.

[a,b] = follow(imb);
i = [1:760]; //index
a(i) = abs((x(i).*y(i+1))-(y(i).*x(i+1)))/2;
a(761) = abs((x(761)*y(1))-(y(761)*x(1)))/2;
sum(a)

***The 10-line code returned an area value of 51848.5 pixel units squared.

***I give myself a grade of 8 for this activity because my attempts at making the code work by myself kept failing because of little things that made a lot of difference and eventually gave in and used jeric's suggested codes. Also, since my object has a *very* irregular shape, i could not find a way to measure its "real" area to compare with the result of the code.

***thank you to cole fabros and jeric tugaff for being huge helps in this activity

No comments: