Week 3 Part1
Week 3 Part1
ds dT (r ) d r ( L 1) p (r )
dr 0
( L 1) p ( w) dw
dr dr
r r
1
ps ( s )
L 1
k k nj
sk T (rk ) ( L 1) pr (rj ) ( L 1) , k 0,1,2,..., L 1
j 0 j 0 n
Example: histogram equalization
· Consider an 8-level 64 x 64 image with gray values (0, 1, …,
7). The normalized gray values are (0, 1/7, 2/7, …, 1). The
normalized histogram is given below:
NB: The gray values in output are also (0, 1/7, 2/7, …, 1).
# pixels Fraction of
# pixels
# 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.
Example Original image and its histogram
Histogram equalized image and its histogram
Histogram matching
(specification)
• Histogram matching (specification)
r
s T (r ) ( L 1) pr ( w)dw
0
z
G ( z ) ( L 1) p z (t )dt s
0
z G 1 ( s ) G 1[T (r )]
# 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