Wednesday, July 21, 2010

A5 - Enhancement by Histogram Manipulation

Histogram Equalization


Figure 1a ,1b, and 1c (from left to right)

Given a dark image with low contrast (Fig 1a), we could improve its equivalent grayscale image (Fig 1b) by manipulating its histogram, or the probability density function (PDF) of the different grayscale values of the image, shown in Fig 2a.

This is done using a simple process wherein we obtain the cumulative distribution function (CDF) shown in Fig 3a which is just the cumulative sum of the PDF (we use the function cumsum of Scilab). We create an 'ideal' CDF, which in this case is a straight increasing line for a uniform distribution. We then replace the dark pixel values with the intensity values from the desired CDF. To obtain faster calculations, we use the interp1 function of Scilab instead of using a for loop.

The histogram of the output image is shown in Fig 2b. We could see that it has a totally different shape from Fig 2a and shows a relatively uniform distribution for the different intensities. The histogram equalized image found in Fig 1c shows a brighter grayscale image than the original one (Fig 1b). Its cdf is shown in Figure 3b, showing a straight increasing line and verifying that our output follows the desired manipulation after processing the image.

Figure 2a and 2b (from left to right)

Figure 3a and 3b (from left to right)

Nonlinear Response


Figure 4a and 4b (from left to right)

The images above show the output images after using different nonlinear cdfs. Fig 4a is the output of a parabolic cdf (y = x^2). This image more closely models the response of the human eye in comparison to the histogram equalized image found in Fig 1c. Fig 4b shows a beautiful metallic image created using a cdf of the equation y = (x + 0.5)^-2. I also tried sine and cosine cdf's but they did not produce aesthetically pleasing results.

Using Advanced Image Processing Software (GIMP)



The histogram CDF could also be manipulated in GIMP as shown by the figure above. It is a cool application but I find it easier to define a cdf as in the previos procedure. This application of GiMP could be used for more personalized editing.

For this activity, I give myself a grade of 11 for discovering matrix calculations and trying out a wide range of different nonlinear cdf's to thoroughly explore this procedure.

No comments:

Post a Comment