Histogram Equalization
What is Histogram
The histogram in the context of image
processing is the operation by which the occurrences of each intensity value in
the image is shown. Normally, the histogram is a graph showing the number of
pixels in an image at each different intensity value found in that image. For an
8-bit grayscale image there are 256 different possible intensities, and so the
histogram will graphically display 256 numbers showing the distribution of
pixels amongst those grayscale values. More about the histogram can be found in
the Histogram/Normalized Histogram Operation article.
What is Histogram Equalization
Histogram equalization is the technique by
which the dynamic range of the histogram of an image is increased. Histogram equalization assigns the intensity values of pixels in the input image
such that the output image contains a uniform distribution of intensities.
It improves contrast and the goal of histogram equalization is to obtain a
uniform histogram. This technique can be used on a whole image or just on a part
of an image.
Histogram
equalization redistributes intensity distributions. If the histogram of any
image has many peaks and valleys, it will still have peaks and valley after
equalization, but peaks and valley will be shifted. Because of this, "spreading"
is a better term than "flattening" to describe histogram equalization. In
histogram equalization, each pixel is assigned a new intensity value based on
the its previous intensity level.
General Working
The histogram equalization is
operated on an image in three step:
1). Histogram Formation
2). New Intensity Values calculation for each
Intensity Levels
3). Replace the previous Intensity values with
the new intensity values
For the first step see the article on histogram.
In step 2, new intensity values are calculated
for each intensity level by applying the following equation:

The meaning of Max. Intensity Levels maximum intensity
level which a pixel can get. For example, if the image is in the
grayscale domain, then the count is 255. And if the image is of size 256x256
then, the No. of pixels is 65536. And the expression is the bracket means
that the no. of pixels having the intensity below the output intensity level or
equal to it. For example, if we are calculating the output intensity level for 1
input intensity level, then the it means that the no. of pixels in the image
having the intensity below or equal to 1 means 0 and 1. If we are calculating
the output intensity level for 5 input intensity level, then the it means that
the no. of pixels in the image having the intensity below or equal to 5 means 0
, 1 , 2 , 3 , 4 , 5. Thus, if we are calculating the output intensity level for
255 input intensity level, then the it means that the no. of pixels in the image
having the intensity below or equal to 255 means 0 , 1 , 2 , 3 , ...... , 255.
That is how new intensity levels are calculated for the previous intensity
levels.
The next step is to replace the previous intensity level with the new
intensity level. This is accomplished by putting the value of Oi in the
image for all the pixels, where Oi represents the new intensity value,
whereas i represents the previous intensity level.
Guidelines for Use
To understand the working of the
histogram equalization, take the example of the following image:

the dynamic range of image intensities is shown
by the following histogram:
when the histogram equalization operation
is performed on this image, the effects can be shown by the following equalized
histogram:

and the following image shows the achieved image:

Sample Project
The interface for the sample project for the histogram equalization is the
same as for the histogram. So, the readers are encouraged to read the Histogram/Normalized Histogram Operation article, before
they start to read this article.
Attachments:
Project Files: HistogramEquailzation.zip