Contrast Enhancing

Bad lighting condition or lighing calibration often results in images with bad contrast. There exist many techniques that try to correct the image contrast (constrast enhancing). The algorithm used in the program is the histogram equalizationenhance1 method, which adjusts the pixel intensity levels so that the resulting image is uniform, thus maximizing the zeroth-order entropy of the image. It is also easy to implement. All it takes is the following transformation

F(I) = $\displaystyle {1 \over J_{\rm max} - J_{min}}$$\displaystyle \sum_{k}^{I}$$\displaystyle {n_k \over N}$$\displaystyle \ceqno$

where F is the mapping function that transforms the input pixel intensity I to the output pixel intensity J; N is the total number of pixels and nk is the number of pixels having the intensity k.

The original algorithm is proposed for grayscale images and it is extended to the color images in the program. Instead of performing the transformation defined by to equalize the RGB histogram seperately, the program uses a comman transforming function and applies it to the RGB colors. The common tranformation is the one defined by gray intensity of the image. This transformatin has the virtue of keeping the overall RGB ratio the image. In almost all cases tested, the enhanced image is somewhat better and also a little brighter.