Monday, July 6, 2009

A3.2 Image Types and Background Enhancements

This is the second part and last part of Activity 3.

This is my original scanned image.



Using the command imfinfo(), I found out about the properties of my original image.

Size: 345 rows X 887 columns
Indexed Image
FileName: C:\Documents and Settings\VIP\Desktop\Acads 09-10\186\a3 image types and basic image enhancements\scanned images\che.bmp
FileSize: 307438
Format: BMP
Width: 887
Height: 345
Depth: 8
StorageType: indexed
NumberOfColors: 256
ResolutionUnit: centimeter
XResolution: 59.060000
YResolution: 59.060000

As we can see, the image is already in grayscale (8 bit depth) so there is no need to convert it.

To find out if my region of interest (ROI) is well separated from its background, we look at the image histogram. This can be done either in Gimp or using the Scilab program

Path2='C:\Documents and Settings\VIP\Desktop\Acads 09-10\186\a3 image types and basic image enhancements\scanned images\che2.bmp';
I=imread(Path2);
[nr,nc]=size(I);
range=[0:1:255];
hist=[];

//count histogram
for i=1:256
[x,y]=find(I==(i-1));
hist(i)=length(x);
end;

scf(1)
plot(range,hist/(nr*nc));
a=gca(); a.data_bounds = [0,0;255,max(hist/(nr*nc))]; a.tight_limits='on';

The image below is my ROI (white part) surrounded by the black background. Following it is a plot of the normalized image histogram. As expected, the histogram shows two distinct parts: the low value background and the high value ROI.






To get the area of my ROI, we can use thresholding by converting the image to binary using im2bw().

We can then get the area using the Green’s theorem just like what we did in A2.

Agreen= 55037 sq. pixels

We can also get the area by counting the number of white pixels.
In this case the area = 55058 sq. pixels

The discrepancy could be attributed to the fact that our second method also counted white pixels that are not part of the ROI. For this case the area calculated using Green’s theorem is the more correct one. In any case, the values that we obtained differ only by a very small amount.

For this activity, I fully understood the differences between the 4 basic image types. I learned about the different ways to check an image's properties and see its image type. I was also able to do histogram thresholding to separate the background from the ROI. I therefore give myself a grade of 10.

No comments:

Post a Comment