Image processing – contrasting things

When we talk about image enhancement, one of the most commonly used filters involves enhancement of contrast – i.e. enhancement of the difference between objects. This is helpful in situations where there is very little contrast due to low-lighting, or to make small features stand out. Ideally contrast enhancement occurs independent of changes to colours in an image. In many cases increasing the enhancement just stretches out the histogram of intensity levels. Low contrast usually manifests itself as an image histogram which is not evenly distributed. Consider the photograph below – taken in the inside of an old workshop with low lighting (in this case only the natural lighting provided by the windows). The histogram of the image is skewed towards the lower intensities, a consequence of being underexposed. (Note that this is the “intensity” histogram of the RGB colour image, usually taken to be the green channel).


Fig 1: An underexposed image (low lighting conditions)

Many of the techniques used to enhance contrast work by manipulating histograms. There are two major categories of techniques: automatic, and manual. The automatic techniques work almost like a black-box: image goes in, processed image comes out. There are no parameters to tweak, and so they are completely automatic – and the results are sometimes good, and sometimes not so good. The manual techniques require the user to adjust parameters, so they can produce a better result, but at the expense of having to find the right set of parameters – which likely will be different for each image being processed. Consider the image above processed using four different methods. The first method, requiring no parameters is histogram equalization (HE), a process which has the effect of spreading out the most frequent intensity values in an image. The result is a vastly improved image, with pink undertones. At the other end of the spectrum is the Retinex algorithm, with three parameters. It has the effect of reducing shadows in an image, at the expense of over-highlighting other areas.


Fig 2: Histogram equalization and Retinex

One solution to this is to derive an image which is the average of both the HE and Retinex (shown in Fig.3).This has removed the pink undertones, and some of the harsh lighting of Retinex. Compare this to histogram stretching, which effectively stretches the histogram towards the higher intensity spectrum of the histogram. There are other algorithms as well, such as CLAHE (contrast-limited adaptive histogram equalization), localized HE (where each pixel is processed by applying HE to a small neighbourhood around it), or bi-histogram equalization (find the mean intensity, then apply HE separately to the sub-histogram either side). Indeed there are many algorithms for improving contrast, but the result is truly in the eyes of the beholder. Some of the four examples shown are more aesthetically pleasing to some people. Some people may not like any of them.


Fig 3: AVG(Histogram equalization, Retinex), Histogram stretching



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s