An image histogram represents the frequency distribution of pixel values in an image. It tells us about the spread of the colors in an image; take for example black (value = 0) and white (value = 1) for grayscale images. The image histogram is actually the (graylevel) probability density function (PDF) of the image. In some cases, images are dark and low contrast due to low exposure and poor lighting conditions and a histogram represents this by having peaks clustered at lower values of the histogram.
In order enhance low quality images,their histograms are manipulated. This is done by remapping the Cumulative Density Function or CDF of the poor image with new grayscale values from a desired CDF. Suppose the graylevels r of an image has a probability distribution function (PDF) given by $p_1(r)$ and the cumulative distribution function is given by
\[ \begin{equation} \label{cdf} T(r) = \int_{0}^{r} p_1 \, g \, dg \end{equation} \]
where g is a dummy variable.
We want to map the r's to a different set of graylevel z's such that the new image will have a CDF given by \[\begin{equation} \label{cdf2} G(z) = \int_{0}^{z} p_2(t)\,dt \end{equation}\] where $p_2(z)$ is the PDF of the transformed image and t is a dummy variable.
Figure 1 best explains the steps to be taken.
Now that we know the steps, consider a picture of me with my research ate, Anjali Tarun at the Dome of Light in Taiwan during the Physics Society of the Republic of China (PSROC) Annual Meeting. This was taken using a phone camera. Because the background is really bright, we non-bioluminiscent creatures looked super dark!
Figure 2. Ate Banana and I at the Dome of Light |
For this picture and others, I considered three desired CDFs namely linear, logarithmic and parabolic as shown in Figure 3. I considered the last two functions because the human eye, as we know, has nonlinear response (more specifically, it reacts logarithmically).
Figure 3. Desired CDFs (from L-R): Linear, Parabolic and Logarithmic |
Below is the result for my first image after remapping the CDFs with the desired ones previously shown in Figure 3.
Figure 4a is the grayscale image of Figure 2. Figure4b-4d are the enhanced images using the Linear, Logarithmic and Parabolic CDFs. Figures 4e-4h are their respective PDFs for us to see how the images have improved while Figures 4i-4l are the CDFs. The same layout is done for the other images considered.
We shall see that visually, the linearly and parabolically enhanced images looked comparable with each other but upon seeing the enhanced PDFs we see that the pixel values looked more spread out and varied more evenly across using the linear function.
Now consider a quick selfie with my close friend Ace who went out making digma with traffic to come see because I said I was sad.(Felt blessed beyond measure for the people in my life like Ace <3 ) We didn't care about the lighting basta may selfie and so again, we looked darker so it's not Instagram-able. :((
Figure 5. Quick selfie with Ace |
The same procedure is applied to Figure 5. And the results are shown in Figure 6.
Figure 6. The same procedure applied on Fig. 5. It looks as though the parabolic function has the same effect as the linear. |
Similar to the previous result, it seems that the result for linear is comparable with the parabolic but upon closer inspection, we shall see that the result for the logarithmic seems to have over exposure patterns on the surface.
Enhancement via histogram manipulation is not limited to grayscale images. It can also be done on colored images like the one in Figure 2. In the rgb manipulation, we manipulate the intensity I of the image and what I got is shown in Figure 7.
Figure 7. Enhanced colored image via RGB manipulation |
For comparison, I also used GIMP 2.0, an image processing software that serves many functions, to enhance Figure 2. I set the curve to be logarithmic and the result is Figure 8.
Instant whitening happened to us! *O*
Figure 8. Enhanced via GIMP |
Acknowledgements:
Thank you Angelo Rillera for the helpful discussions!
References:
M.Soriano, " Enhancement by Histogram Manipulation",AP 186 class manual.(2016)
No comments:
Post a Comment