Documente Academic
Documente Profesional
Documente Cultură
HistogramProcessing
i Assume we have image with nk pixels with
intensity rk , k = 0,1,..., L 1
i We define the image histogram as h(rk ) = nk ,
and we define the normalized histogram as:
p (rk ) = h(rk ) / ( M N )
i The normalized histogram is an estimate
of the probability of occurrence of intensity
level rk in an image
i The normalized histogram sums to 1
20120702 2
Fourbasicimagetypes:
dark
light
lowcontrast
highcontrast
Theircorrespondinghistograms
20120702 3
HistogramProcessing
Intuitively,imageswhosepixelsoccupythe
entirerangeofintensitylevelsandtendtobe
distributeduniformlywillhaveanappearance
ofhighcontrast
Itispossibletodevelopatransformation
functionthatcanautomaticallyachievethis
effect,basedonthehistogramoftheinput
image.
20120702 4
HistogramEqualization
i assume continuous intensity values with
intensity r
i assume r in the range [ 0, L 1]
i consider transform of the form s = T (r ), 0 r L 1
i assume:
- T (r ) monotonically increasing in range 0 r L 1
- 0 T (r ) L 1 for 0 r L 1
i possible for multiple values of r to map to a
single value of s
20120702 5
HistogramEqualization
i pr (r ) is the PDF of r
i ps ( s ) is the PDF of s
i if pr (r ) and T (r ) are known, and T (r ) is
continuous and differentiable over the range
of interest, then ps ( s ) can be obtained as:
dr
ps ( s ) = pr (r )
ds
i with
r
s = T (r ) = ( L 1) pr ( w) dw
0
20120702 8
HistogramEqualization Example
i assume:
2r
pr (r ) = ; 0 r L 1
( L 1) 2
r
s = T (r ) = ( L 1) pr ( w) dw
0
r
2 r2
=
( L 1) 0
w dw =
L 1
i thus:
r2
s = T (r ) =
L 1
1
dr ds 1
ps ( s ) = pr (r ) = pr ( r ) =
ds dr ( L 1)
20120702 9
HistogramEqualization DiscreteCase
i for discrete case we have:
k
sk = T (rk ) = ( L 1) pr (rj )
j =0
( L 1) k
=
M N j =0
nj 0 k L 1
20120702 11
HistogramEqualization Discrete
i final transform:
r0 s0 = 1 790 pixels map to 1
r1 s1 = 3 1023 pixels map to 3
r2 s2 = 5 850 pixels map to 5
r3 s3 = 6 656 + 329 = 985 pixels map to 6
r4 s4 = 6 656 + 329 = 985 pixels map to 6
r5 s5 = 7 245 + 122 + 81 = 458 pixels m ap to 7
r6 s6 = 7 245 + 122 + 81 = 458 pixels map to 7
r7 s7 = 7 245 + 122 + 81 = 458 pixels map to 7
20120702 12
HistogramEqualization
20120702 13
HistogramMatching
HistogramMatching
i specify shape of histogram that we want processed
image to have
i let pr (r ) and pz ( z ) represent the PDFs of r and z ,
where r is the input pixel intensity level and z is the
output pixel intensity level)
i estimate pr (r ) from input image histogram
20120702 15
HistogramMatching
i let s be a random variable of the form:
r
s = T (r ) = ( L 1) pr ( w) dw (1)
0
i thus we have:
G ( z ) = T (r ) (3)
z = G 1[T (r )] = G 1 ( s ) (4)
i thus T (r ) is obtained from the input image
intensity PDF and G ( z ) is obtained as s
20120702 16
HistogramMatchingProcess
1. obtain pr (r ) from input image
2. obtain values of s = T (r )
3. obtain G ( z ) from specified PDF (Equation (2))
4. obtain inverse transformation, z = G 1 ( s );
since z obtained from s, this is an s to z
mapping
5. obtain pixel image by equalizing input image
(to uniform PDF); for each pixel with value
s, obtain z = G 1 ( s ) to get output image pixel value
20120702 17
HistogramMatchingExample
i input image intensity levels obey PDF
2r
pr (r ) = 0 r L 1
( L 1) 2
0
( L 1) 0
( L 1) 2
20120702 18
HistogramMatchingExample
i we require G ( z ) = s; thus:
z3
s=
( L 1) 2
1/3
z = ( L 1) 2 s
i next we multiply the histogram equalized pixels
by ( L 1) 2 and take the cube root of the resulting
pixel values, giving an image whose intensities, z ,
have PDF of pz ( z ) = 3 z 2 / ( L 1)3
1/3
z = ( L 1) 2 s = ( L 1) 2 r / ( L 1) 2
1/3
= ( L 1) r 2
i note that we can skip the intermediate step of
equalizing the input image
20120702 19
HistogramMatchingExample
i histogram equalization gives:
k
sk = T (rk ) = ( L 1) pr (rj )
j =0
( L 1) k
=
MN j =0
nj 0 k L 1 (5)
20120702 21
HistogramMatching DiscreteCase
i Discrete Case Solution
1. compute histogram, pr (r ), of image; find histogram equalization transformation:
( L 1) k
sk = T (rk ) = nj
M N j =0
0 k L 1
20120702 23
HistogramMatching Example
0 1.33 1 0 0 0
1 3.08 3 1 0 0
2 4.55 5 2 0 0
3 5.67 6 3 1.05 1
4 6.23 6 4 2.45 2
5 6.65 7 5 4.55 5
6 6.86 7 6 5.95 6
7 7 7 7 7 7
20120702 25
HistogramMatching Example
20120702 26
HistogramMatching Example2
20120702 27
HistogramMatching Example2
20120702 28