Tuesday, June 24, 2008

A3 - Image Types and Basic Image Enhancement

PART 1
There are 4 types of images
1. True Color Image

photo from: www.cssnz.org/flower.jpg

Using the command in Scilab
--> imfinfo ('flower1.jpg')
shows the following results

File Name flower1.jpg
File Size 3348
File Format jpeg
Width 115
Height 118
Depth 8
Storage Type truecolor
Number of Colors 0
Resolution Unit centimeter
X Resolution 0
Y Resolution 0

Using the properties in Windows
Width 115
Height 118
Horizontal Resolution 96 dpi
Vertical Resolution 96 dpi
Bit Depth 24

2. Gray Scale imagephoto from: digital-photography-school.com

Using the command in Scilab
--> imfinfo ('flower2.jpg')
shows the following results
File Name flower2.jpg
File Size 4225
File Format JPEG
Width 120
Height 120
Depth 8
Storage Type indexed
Number of Colors 256
Resolution Unit inch
X Resolution 76
Y Resolution 76

Using the properties in Windows
Width 120
Height 120
Horizontal Resolution 72 dpi
Vertical Resolution 72 dpi
Bit Depth 8

3.Indexed Imagephoto from:www.digitalphotoartistry.com/rose1.jpg

Using the command in Scilab
--> imfinfo ('flower3.bmp')
shows the following results
File Name flower3.bmp
File Size 16306
File Format bmp
Width 106
Height 141
Depth 8
Storage Type indexed
Number of Colors 256
Resolution Unit centimeter
X Resolution 28.350000
Y Resolution 28.350000

Using the properties in Windows
Width 106
Height 141
Bit Depth 8

4. Binary Imagephoto from:www.botany.com

Using the command in Scilab
--> imfinfo ('flower4.bmp')
shows the following results
File Name flower4.bmp
File Size 1550
File Format bmp
Width 124
Height 93
Depth 8
Storage Type indexed
Number of Colors 2
Resolution Unit centimeter
X Resolution 28.350000
Y Resolution 28.350000

Using the properties in Windows
Width 124
Height 93
Bit Depth 1

PART 2:
This part of the activity is concerned with our scanned image.
Cambodian money( c/o Anthony Amarra)
I cropped the image so that the rulers will not be included in reading the area of the scanned image.

Using
-->image = imread('gray2.jpg');
-->imfinfo('gray2.jpg')
shows the following properties
FileName: gray2.jpg
FileSize: 20680
Format: JPEG
Width: 422
Height: 201
Depth: 8
StorageType: indexed
NumberOfColors: 256
ResolutionUnit: inch
XResolution: 96.000000
YResolution: 96.000000

Using the command
-->histplot ([0:1:255], image)
We find the histogram of the image
From the histogram we can say that the image is low in contrast.
We can also check the histogram and threshold by using imageJ.
We can also find the histogram using the following commands:
-->gsval=[]
-->pixelnum=[]

-->counter=1;
-->for i=0:1:255

-->[x,y]=find(image==i);

-->gsval(counter)=i;
-->pixelnum(counter)=length(x);
-->counter = counter+1; -->end;
-->plot(gsval,pixelnum);
This will show the image below:

Using the histogram, i find the best threshold is at 189 or 74.117647% of 255. I used this threshold to convert the image to binary
-->bw = im2bw(image,0.74117647);
--> imshow(bw,2)
It shows the image below
Inverting the image using the commands,
--> binary = abs(bw-1); --> imshow (binary)
shows the image below:

Using the commands, in the previous activity, to find the area
-->[x,y] = follow(binary);
-->size(x)
ans =
924. 1.
-->size(y)
ans =
924. 1.
-->x_2(1) = x(924) ;
-->x_2(2:924) = x(1:923);
-->y_2(1) = y(924) ;
-->y_2(2:924) = y(1:923);
-->area=0.5*sum(x.*y_2-y.*x_2);
--> Area = abs(area)
Area =
84200.

The experimental value for area is 84200 square pixels.
The theoretical value for area is ( 419 x 199) 83381 square pixels. This can be solve by pixel counting
The percent error is 0.9822%.

Acknowledgments:
JULIE D.
ED
BETH
AIYIN
- for answering some of my questions

JORGE
- for the histplot
JERIC
- for the histogram code

GRADE:
10/10 because I did my best in this activity and the error is acceptable.

0 comments:

 
template by suckmylolly.com