Sunday, July 5, 2009

Activity 3 | Image Types and Basic Image Enhancement

Digitized images have four types. We can obtain sample images for each type by searching over the internet. The following four images obtained from the internet (Figure 1-4) show an example for each image type together with their properties obtained using the SIP Toolbox function imfinfo().

BINARY IMAGE

File Source : http://www.fmwconcepts.com/imagemagick/morphology/images/logo2_fuzz15_mask_binary_open_1.gif
Format: GIF | Size : 951 | Width: 240 | Height: 240
Depth: 8 //bits per pixel
Storage Type: Indexed
Number of Colors: 2
Resolution Unit: centimeter
X&Y Resolution: 0

GRAYSCALE IMAGE

File Source : http://mangs.multiply.com/photos/album/13/hellsing_volume_1_chapter_3#3
Format: JPEG | Size : 52017 | Width: 352 | Height: 499
Depth: 8 //bits per pixel
Storage Type: Indexed
Number of Colors: 256
Resolution Unit: inch
X&Y Resolution: 0

TRUECOLOR IMAGE

File Source : http://www.dcercado.tk
Format: JPEG | Size : 38668 | Width: 500 | Height: 350
Depth: 8 //bits per pixel
Storage Type: Truecolor
Number of Colors: 0
Resolution Unit: inch
X&Y Resolution: 0

INDEXED IMAGE

File Source : http://mangs.multiply.com/photos/album/37/album_covers#21
Format: GIF | Size : 7550 | Width: 100 | Height: 100
Depth: 8 //bits per pixel
Storage Type: Indexed
Number of Colors: 256
Resolution Unit: centimeter
X&Y Resolution: 0


Now knowing the four basic image types let us do some basic image enhancement of a grayscale image by thresholding to separate the background from the Region Of Interest or ROI. To do this we need to know the grayscale distribution which can help in knowing the gray values of the ROI and obtain it by thresholding.

Figures 4 and 5 shows the scanned images to be used for basic image enhancement and below them are their image properties again using imfinfo(). Similar properties of both images are, Format: BMP, Depth: 8bits/pixel, Storage Type: Indexed, No. of Colors: 256, Resolution Unit: centimeter, and X&Y Resolution: - 1.718D+09.


Figure 4. HEART | Size : 82174 | Width: 370 | Height: 218


Figure 5. BATMAN | Size : 78610 | Width: 363 | Height: 213


From the grayscale images we can get the histogram of the gray values by using the Scilab Statistics function tabul() which returns a matrix of the pixel values and the corresponding frequency of each value in an image. To get the Probability Density Function of PDF of the image we normalize the histogram by the total number of pixels in the image. Figures 6 and 7 shows the corresponding PDFs for HEART and BATMAN.


Figure 6. HEART PDF


Figure 7. BATMAN PDF


The PDFs shows clearly the pixel values of the background and the ROI. Based from both histograms we can decide what threshold value to use to get the ROI and compute its area just like what was done previously in Activity 2. The threshold value used for both images is 0.5 but the threshold value for both images can be anything between the pixel values between the two distinct peaks that has a frequency value of zero. Anything in this range separates the pixel values for the background and the ROI. Figures 8 and 9 show the corresponding black and white images for HEART and BATMAN.


Figure 8. HEART with threshold at 0.5


Figure 9. BATMAN with threshold at 0.5


Now let us apply what we have learned from Activity 2 and compute the area of the ROI for each of our images. Figure 10 shows the obtained contour of the ROI. The computed area of the ROI using Green's Theorem in pixels for HEART is 8418px while for BATMAN is 12552.5px. But summing up the number of pixels with values equal to 1 the total area in pixels for HEART is 8598px and for BATMAN, 12885px. The physical area can be computed since the images were taken along with a ruler beside them. By computing the physical area of one pixel, we could estimate the physical area of the ROI. Using GIMP we observed that 1mm covers 3px and thus we can estimate the physical area of the ROI. A summary on the area measurements is provided below the ROI contours.


Figure 10. HEART and BATMAN contours.


HEART | Green's: 8418px > 935.33mm2 | PxCount: 8598px > 955.33mm2
BATMAN | Green's: 12552.5px > 1394.72mm2 | PxCount: 12885px > 1431.66mm2

From the obtained area measurements there is a great difference observed. Possible sources of error are the contour used as mentioned in Activity 2, the thresholding and the estimation of the area of 1 pixel. Still I give myself a 9 or a 10 for this activity since I have fully understood the concepts used and was able to get estimated area measurements of scanned images of irregularly shaped ROIs.

I thank Jay Samuel Combinido, Jica Monsanto and Miguel Sison for providing the scanned images that I used in this activity. I also thank Jica Monsanto for referring me to the function tabul() in getting the histogram of the gray values for the scanned images.

No comments:

Post a Comment