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 image

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 Image

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 Image

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)


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
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

We can also check the histogram and threshold by using imageJ.
-->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

--> binary = abs(bw-1); --> imshow (binary)
shows the image below:

-->[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:
Post a Comment