EE663 Image Processing Histogram Equalization
EE663 Image Processing Histogram Equalization
EE663 Image Processing Histogram Equalization
Image Processing
Histogram Equalization
Dark image
Bright image
We consider the gray values in the input image and output
image as random variables in the interval [0, 1].
1
pout ( s ) pin (r ) 1 r T 1 ( s ) 1, 0 s 1
pin (r ) r T 1 ( s )
NB: The gray values in output are also (0, 1/7, 2/7, …, 1).
# pixels Fraction
of # pixels
# pixels
Gray values
z=H(r) = G-1(v=s=T(r))
If the desired output image were available, then the following
transformation would generate an image with uniform density:
z
V G ( z ) pout ( w)dw , 0 z 1 (**)
0
From the gray values we can obtain the gray values z by
using the inverse transformation, z G-1(v)
If instead of using the gray values obtained from (**), we
use the gray values s obtained from (*) above (both are
uniformly distributed ! ), then the point transformation
Z=H(r)= G-1[ v=s =T(r)]
In practice, this is not usually the case (i.e., ) zk G(zk)is not
one-to-one) and we assign gray values to match the given
histogram, as closely as possible.
Algorithm for histogram specification:
1 1
(3)
z G ( v=s ) z G [T ( r )]
Example:
Consider an 8-level 64 x 64 previous image.
# pixels
Gray value
It is desired to transform this image into a new image, using a
transformation Z=H(r)= G-1[T(r)], with histogram as specified
below:
# pixels
Gray values
The transformation T(r) was obtained earlier (reproduced
below):
G-1(0) = ?
G-1(1/7) = 3/7
G-1(2/7) = 4/7
G-1(3/7) = ?
G-1(4/7) = ?
G-1(5/7) = 5/7
G-1(6/7) = 6/7
G-1(1) = 1
Combining the two transformation T and G-1 , compute
z=H(r)= G-1[v=s=T(r)]
Applying the transformation H to the original image yields an
image with histogram as below:
Again, the actual histogram of the output image does not exactly
but only approximately matches with the specified histogram. This
is because we are dealing with discrete histograms.
Original image and its histogram