Wednesday, June 25, 2008

Image types and basic image enhancement















Using the command imfinfo on scilab, properties of different image types were displayed here in my blog.

For Binary image:
Filesize: 19338 bytes
File format: JPEG
Width: 430
Height: 323
Depth: 8
Storage type: truecolor
Number Of Colors: 0
Resolution Unit: centimeter
X Resolution: 0
Y Resolution: 0

For Grayscale image:

Filesize
: 19993 bytes
File format: JPEG
Width: 430
Height: 323
Depth: 8
Storage type: truecolor
Number Of Colors: 0
Resolution Unit: centimeter
X Resolution: 0
Y Resolution: 0

For Indexed image:

Filesize: 23422 bytes
File format: GIF
Width: 430
Height: 323
Depth: 8
Storage type: indexed
Number Of Colors: 256
Resolution Unit: centimeter
X Resolution: 0
Y Resolution: 0

For Truecolor image:

Filesize: 20414 bytes
File format: JPG
Width: 430
Height: 323
Depth: 8
Storage type: truecolor
Number Of Colors: 0
Resolution Unit: centimeter
X Resolution: 0
Y Resolution: 0


The information of my scanned image are listed below:

Filesize: 11225 bytes
File format: JPG
Width: 355
Height: 336
Depth: 8
Storage type: indexed
Number Of Colors: 256
Resolution Unit: inch
X Resolution: 0
Y Resolution: 0

The total number of pixel (area) of my image using pixel counting is 16423 pixels.

Using the software ImageJ, I can show the histogram of the grayscale of the scanned image. The ROI has a separation with the background.
I simulated the histogram of the image using Scilab. Below is the resulting histogram of the ImageJ and my simulation.




















The first plot is the histogram from ImageJ. The second one is the histogram from simulations.

I posted my source code in getting both for the histogram and the area of the image. I inculded the simulation for thresholding...

a = imread("F:\AP 186\image\others\horge.jpg");
b = im2gray(a);
c = 255*b;
x = [0:255];
n = size(a);
row = n(1);
col = n(2);
for d = 1:256
counter = 0.0; //Initialize count
for i = 1:row // Number of rows
for j = 1:col // Number of columns
if c(i,j) == d
counter = counter + 1.0;
x(d) = counter;
end
end
end
end
//x will be the function for the histogram

//Thresholding
for i = 1:row // Number of rows
for j = 1:col // Number of columns
if c(i,j) < 240 //Choose best threshold from the histogram of the image
c(i,j) = 0;
end
end
end

d = 0.00390625*c;//To convert the value range from 0 to 1
//Getting the Area//
f = im2bw(d,0.01)
counter = 0.0; //Initialize count
for i = 1:row // Number of rows
for j = 1:col // Number of columns
if f(i,j) == 0
counter = counter + 1.0;
end
end
end
f1 = abs(f-1); //area


In this activity, Eduardo David helped me in debugging my program.
The grade that I will give myself is 10 because all of the programming was done by myself.

SOURCE:

www.freshpeel.com


No comments: