Monday, June 22, 2009

Activity 3: Image types and basic image enhancement

Shown are different types of images copied from the web.


Binary Image

Grayscale

True Color

Indexed Image

This activity is similar to the previous one. Again the area of a given image is to be calculated. The scanned image for this activity is show below.


The image above has a dimension of 781 X 445 and was saved in a jpeg format. It was converted into grayscale; hence 256 colors are only present.

The histogram of this image was calculated using the follow function in Scilab. Here is the snippet used.

//histogram
for i=0:255
x = find(im==i);// im is the image used
count(i+1) = sum(x);

end

scf();plot(0:255,count)


Using this code, the histogram of the image was calculated and is shown below.

Recall that in a grayscale image black is zero and white is 255. The histogram clearly shows that the object(the name kaye) which is color white is well separated from its background.

Afterwards the grayscaled image is binarized using the threshold point obtained from the histogram of the image and the function im2bw. In thresholding, a point separating the object from its background is used to map points greater than or equal to it to 1 (white) while points less than it to 0 (black).

After binarization, the same steps in area identification was done. For the shown image, the calculated area of the object (name kaye) was 131142.5 pixels. This was compared to the measured area through pixel count which was equal to 133220 and was found to have a 1.6% error.

The same process was also done for the figure below.


http://en.wikipedia.org/wiki/Coins_of_the_Philippine_peso

After binarizing the image using thresholding..


The area of this one peso coin was calculated and was compared to its analytically computed area. The calculated area was found to deviate 1.3% from the original value.


For this activity, I'll give myself a grade of 10 for I was able to calculate the area with only a 1.6% and 1.3% error for the scanned and one peso coin images, respectively. Also, I'm giving myself a two point bonus since I was able to make a code that computes and plots the histogram of an image.

I thank Miguel Sison, Jica Monsanto, Jay Samuel Combinido and Mark Jason Villangca for the KAYE-image used.

No comments:

Post a Comment