Sunday, August 8, 2010

Enhancement via Histogram Manipulation

A very neat skill was taught to us in Image processing. Using the probability distribution function of the gray level of the image, enhancement is possible. The gist here is that the probability distribution of the gray level is manipulated using a process called backprojecting. In this method, a CDF or Cumulative Distribution Function is used as a pattern to obtain a new PDF of the said gray scale image.

This is how it works.

Using the image below, the histogram of the gray level is obtained.
Grayscaled image

The histogram is then normalized to obtain the PDF or Probability distribution function.
Histogram of the gray levels PDF of the image

Cumulative summing of the PDF will yield to the CDF or Cumulative Distribution Function
CDF of the image
Backprojecting involves another CDF. This time it is at your own liking. A linear CDF is used for this example.
Linear CDF


What is being done in Backprojecting is that from the CDF of the image, the pixel is traced to the desired CDF. Then the value of the pixel in the desired replaces the old value. It is like an iterated trace an replace algorithm.
So the bakprojected image is shown here.
Linearly Backprojected Image
As well as its PDF and CDF.
Histogram of Linearly Backprojected Image/. Normalizeing the Y axis, The PDF is obtained.
CDF of Linearly Backprojected Image


When the desired CDF is nonlinear, This happens:
Nonlinear Desired CDF
Nonlinear Backprojected ImagePDF of Nonlinearly Backprojected Image
CDF of Nonlinearly Backprojected Image


In Gimp, you can do this much simpler. Because the program and the GUI is Built in. Check out the Zerg Hydralisk image in the previously released Starcraft 2: Wings of Liberty. I tried to do histogram manipulation in it using Gimp.

Initial Image

Grayscaled ImageImage with Gimp


Well, I think I'll have an 8/10 in this activity. For a long time, I was stuck at the backprojecting algorithm. Luckily, I was able to figure out how interpolation in scilab. That's where my biggest problem was.

No comments:

Post a Comment