You are here: Home > Histogram equalization and specification

Histogram equalization and specification

Short tutorial

In histogram equalization we are trying to maximize the image contrast by applying a gray level transform which tries to flatten the resulting histogram. It turns out that the gray level transform that we are seeking is simply a scaled version of the original image's cumulative histogram. That is, the graylevel transform T is given by T[i] = (G-1)c(i), where G is the number of gray levels and c(i) is the normalized cumulative histogram of the original image.

When we want to specify a non-flat resulting histogram, we can use the following steps:

1. Specify the desired histogram g(z)
2. Obtain the transform which would equalize the specified histogram, Tg, and its inverse Tg-1
3. Get the transform which would histogram equalize the original image, s=T[i]
4. Apply the inverse transform Tg-1 on the equalized image, that is z=Tg-1[s]

Applet instructions

Click the images on the upper right to change the image being processed. You can choose the specified histogram using the radio buttons. In "User defined" mode you simply hold down the left mousebutton while painting your desired histogram in the figure depicting the specified histogram.