Monday, June 30, 2008

..on enhancement by histogram manipulation

Below is sample image w/ poor contrast. Our goal is to enhance the image by manipulating its histogram.



www.flickr.com






Original Image

The image was first converted into gray scale. Below is the corresponding probability distribution function(PDF) and the commulative distribution function (CDF) of image.





Original PDF













Original CDF








We now enhance the image by manipulating the original CDF. We do this by getting the T(r) of the CDF corresponding to the value of the pixel. The corresponding T(r) would be the new value of that pixel. We do this for every pixel of the original image. Below are the resulting enhanced images and their corresponding PDF and CDF. The resulting PDF is more "spread" than the original PDF. Also, The resulting CDF is now linear. We could observe that the contrast of the image was improved. The image of the rose petal becomes more distinct.




Resulting PDF













Resulting CDF










Resulting Image








Another Technique

We now apply another technique. In this method, we manipulate the CDF of the original image by "mapping" it on the desired CDF (G(z)). Specifically, we do this by getting the T(r) of the original CDF corresponding to the value of the pixel. We then map T(r) into G(z) and find the corresponding z. Below is an illustration of the "mapping".









We use G(z)=sqrt(z). Below is the original image and the resulting image with the corresponding CDF.



Original Image
theterroristsdictionary.blogspot.com












Original CDF










Desired CDF (G(z)=sqrt(z))









Resulting Image











Resulting CDF






The resulting CDF is verry much like the desired CDF. And we could see that the contrast of the resulting image is enhanced.

I want to give myself a 10. I have done the activity successfully.

Acknowledgment to Julie and Ed for the help.

Monday, June 23, 2008

..on image types and basic enhancement

Below are the different types of images of Albert Einstein (binary, gray scale, true color, and indexed). Also shown are the properties of each image which was derived using imfinfo of scilab: "imfinfo("imagefilname",'verbose') ".

Binary
FileSize: 3971
Format: JPEG
Width: 118
Height: 145
Depth: 8
StorageType: indexed
NumberOfColors: 256
ResolutionUnit: inch
XResolution: 72.000000
YResolution: 72.000000

www.flickr.com


Gray Scale
FileSize: 3621
Format: JPEG

Width: 109
Height: 150
Depth: 8
StorageType: indexed
NumberOfColors: 256
ResolutionUnit: inch
XResolution: 72.000000
YResolution: 72.000000

www.newz.dk

True Color
FileSize: 5236
Format: JPEG
Width: 145
Height: 122
Depth: 8
StorageType: truecolor
NumberOfColors: 0
ResolutionUnit: centimeter
XResolution: 72.000000
YResolution: 72.000000

www.flickr.com

Indexed(Portable Network Graphics)
FileSize: 2938 Format:
JPEG
Width: 130
Height: 113
Depth: 8

StorageType: truecolor

NumberOfColors: 0
ResolutionUnit: centimeter

XResolution: 72.000000

YResolution: 72.000000

us.geocities.com


Measuring the size of an image

Here is a scanned image of the ace of diamond card. The ruler serves as a reference measurement for the size of a pixel (1mm=13pixels or .005917sq. mm/pixel).




















Below are the images of the center diamond (true color, gray scale, and binary) and the corresponding properties. To convert the image to binary, the histogram of the gray scale image was analyze (see plot below). We could see a clear separation at around 220. This was used as the threshold.

True Color
FileSize: 3549
Format: JPEG
Width: 160
Height: 211
Depth: 8
StorageType: truecolor
NumberOfColors: 0
ResolutionUnit: inch
XResolution: 96.000000
YResolution: 96.000000



Gray Scale
FileSize: 2466
Format: JPEG
Width: 160
Height: 211
Depth: 8
StorageType: indexed
NumberOfColors: 256
ResolutionUnit: inch
XResolution: 72.000000
YResolution: 72.000000


Binary

FileSize: 2584
Format: JPEG
Width: 160
Height: 211
Depth: 8
StorageType: indexed
NumberOfColors: 256
ResolutionUnit: inch
XResolution: 72.000000
YResolution: 72.000000



Histogram Plot













Finally, we measure the area of the diamond. We use the technique from the previous activity utilizing the follow command of scilab and the Green's Theorem. But before this, the image have to be inverted.

Inverted Image










The measured area is 10265 pixels. Using the conversion factor(.005917 sq. mm/pixel), the measured area is 60.74 sq. mm. The analytic area (using pixel counting) is 10464 pixels or 61.92 sq. mm. The percent error is just 1.9%.

I want to give myself a 10 since I was able to successfully finish the task .

Acknowledgment to Lei for the scanned images, Jeric and Ed for their help with Scilab code.

Wednesday, June 18, 2008

..on measuring area

Below are some regular geometric shapes. Using Green's Theorem, the white areas were measured. This was done by utilizing Scilab's contour follower command (provided by the Sip toolbox library).






Rectangle
obtained area: 18387
analytic area: 18696












Circle
obtained area: 34636
analytic area: 33944












Square
obtained area: 41818
analytic area: 42228









Green's Theorem



For the rectangle, the percent deviation from the analytic area is 1.65%. For the circle it is 1.89%, and 0.97% for the square. These values are well below 5% acceptance threshold. The technique is accurate enough.

I want to give mysef a 10. I was successful in implementing the technique.

Thanks to Rica and Ed for the help with the Sip toolbox.

Wednesday, June 11, 2008

.. on digital scanning

This hand-drawn plot was obtained from the paper Some Dynamic Applications of Liquid Manometrs (American Journal of Physics, 1935).




















After scanning the image in grayscale, Paint was used to determine the locations of the points on the curve and replot them in MS Excel. To get the exact values for the curve, the ratio of the number of pixels per unit (x and y axis) was incorporated. Below is the superimposed plot of the original and the reconstructed.
















Since I was able to accurately reconstruct the plot, i want to give myself a 10. Also, i get the bonus point for overlaying the two plots.