DIP03-Image Enhancement-Historgram Equalization
DIP03-Image Enhancement-Historgram Equalization
Image Enhancement
Histogram Equalization
Contents
nk
p(rk )
n
nk: Number of pixels with gray value rk
n: total Number of pixels in the image
Pr( R rk ) p(rk )
Dark image
Bright image
Low contrast
image
we assume that:
T(r) is a monotonically
increasing function for
0 r 1 (preserves
order from black to
white).
T(r) maps [0,1] into
[0,1] (preserves the
range of allowed Gray
values).
NB: The gray values in output are also (0, 1/7, 2/7, …, 1).
# pixels Fraction
of # pixels
Notice that there are only five distinct gray levels ---
(1/7, 3/7, 5/7, 6/7, 1) in the output image. We will
relabel them as (s0, s1, …, s4 ).
With this transformation, the output image will have
histogram
# pixels
Gray values
Note that the histogram of output image is only
approximately, and not exactly, uniform. This should not be
surprising, since there is no result that claims uniformity in
the discrete case.
Image Enhancement-Histogram Equalization 19
Example Original image and its histogram
Step 3:
1 1
z G ( v=s ) z G [T ( r )]
# pixels
Gray value
# pixels
Gray values
Desired histogram