Professional Documents
Culture Documents
Gray levels
9/4/2018
Histograms
HISTOGRAMS
9/4/2018
HISTOGRAMS
9/4/2018
Histogram Equalization
0 Principle: to find the intensity transform such that
histogram of transformed image is uniform.
Histogram
Equalization
9/4/2018
Histogram Equalization
0 Principle: to find the intensity transform such that
histogram of transformed image is uniform.
s = T(r)
such that,
1. T(r) is single-valued and monotonically increasing in
interval 0 ≤ r ≤ 1, so that inverse transformation exists
and increasing order from black to white is preserved, i.e.
output intensity value is never less than input value.
2. 0 ≤ T(r) ≤ 1 for 0 ≤ r ≤ 1, so that output gray levels lie in
the same range as input.
9/4/2018
Transform examples
9/4/2018
Mathematical Proof
0 Let, r, s be random variables in the range [0,L-1],
whose PDFs are pr(r) and ps(s) respectively, then
……(1)
9/4/2018
Leibniz’s rule states that the derivative of a definite integral with respect to
its upper limit is simply the integrand evaluated at that limit. In other words,
Since, s = T(r)
(L-1)
(L-1)
Thus,
9/4/2018
Histogram equalization:
Example
9/4/2018
rk Pr(rk) CDF CDF*(L-1) sk rk sk
0 0.19 0.19 1.33 1 0 1
1 0.25 0.44 3.08 3
1 3
2 0.21 0.65 4.55 5
2 5
3 0.16 0.81 5.67 6
4 0.08 0.89 6.23 6 3 6
7 7
sk Ps(sk)
0 0
1 Pr(0) = 0.19
2 0
3 Pr(1) = 0.25
4 0
5 Pr(2) = 0.21
6 Pr(3) +Pr(4) = 0.24
7 Pr(5) + Pr(6) + Pr(7) = 0.11
9/4/2018
Why does equalization of discrete
histogram not produce a perfectly flat
histogram?
Discrete histogram equalization basically performs the
remapping of histogram components of an image on
the intensity scale. To obtain a flat histogram, the pixel
intensities should be redistributed in such a way that
there are L groups on n/L pixels of same intensity,
where L is the number of allowed discrete intensity
levels and n is the number of pixels in input image. The
histogram equalization method has no provision for
this type of redistribution process hence discrete
histogram
9/4/2018
equalization does not yield a flat histogram.
What if we want the
distribution to be
something other than
uniform?
9/4/2018
Histogram Matching (Specification)
15
Histogram Specification
(Matching)
Input image Image with specified histogram
r pr(r) z pz(z)
T(r) =G(z)
z = G-1(T(r))
Procedure Conclusion
z = G-1(s) = G-1[T(r)]
18
Example: Histogram Matching
Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096)
has the intensity distribution shown in the following table (on the
left). Get the histogram transformation function and make the output
image with the specified histogram, listed in the table on the right.
9/4/2018 19
0 Equalized Input Image 0 Equalized Image with
Specified HIstogram
9/4/2018
rk sk zk vk
rk sk vk
0 1 0 0
1 3 1 0 0 T 1 0
2 5 2 0 1 3 0
3 6 3 1 2 5 0
4 6 4 2 3 G-16 1
5 7 5 5 4 6 2
6 7 6 6 5 7 5
7 7 7 7 6 7 6
7 7 7
9/4/2018
Example
The histogram equalization doesn’t make the result image look better than the
original image.
Consider the histogram of the result image, the net effect of this method is to
map a very narrow interval of dark pixels into the upper end of the gray scale of
the output image.
As a consequence, the output image is light and has a washed-out appearance. 23
Solve the Problem
24
Histogram Specification
k 0 ,1,2 ,..., L 1
25
Result Image and its Histogram