UCSE715 - Slide 4
UCSE715 - Slide 4
Histogram Matching
Histogram matching (histogram specification)
— generate a processed image that has a specified histogram
Let p r ( r ) and p z ( z ) denote the continous probability
density functions of the variables r and z . p z ( z ) is the
specified probability density function.
Let s be the random variable with the prob ability
r
s T ( r ) ( L 1) p r ( w ) dw
0
Histogram Matching
r
s T ( r ) ( L 1) p r ( w ) dw
0
z
G ( z ) ( L 1) p z (t ) dt s
0
z G 1 ( s ) G 1 T (r )
1
19-08-2024
► Obtain pr(r) from the input image and then obtain the values of s
r
s ( L 1) pr ( w)dw
0
► Use the specified PDF and obtain the transformation function G(z)
z
G ( z ) ( L 1) pz (t ) dt s
0
► Mapping from s to z
z G 1 ( s )
2
19-08-2024
z z 3t 2 z3
G ( z ) ( L 1) pz (t )dt ( L 1) dt s
0 0 ( L 1)3 ( L 1)2
The transformation function
1/3
1/3 2 r
2
1/3
z ( L 1) s
2
( L 1) ( L 1)r 2
L 1
► Obtain pr(rj) from the input image and then obtain the values of
sk, round the value to the integer range [0, L-1].
k
( L 1) k
sk T (rk ) ( L 1) pr ( rj ) nj
j 0 MN j 0
► Use the specified PDF and obtain the transformation function
G(zq), round the value to the integer range [0, L-1].
q
G ( zq ) ( L 1) pz ( zi ) sk
i 0
► Mapping from sk to zq
zq G 1 ( sk )
3
19-08-2024
s0 1, s1 3, s2 5, s3 6, s4 7,
s5 7, s6 7, s7 7.
Compute all the values of the transformation function G,
0
G ( z0 ) 7 pz ( z j ) 0.00 0
j 0
G ( z1 ) 0.00 0 G ( z2 ) 0.00 0
G ( z3 ) 1.05 1 G ( z4 ) 2.45 2
G ( z5 ) 4.55 5 G ( z6 ) 5.95 6
G ( z7 ) 7.00 7
4
19-08-2024
s0 1, s1 3, s2 5, s3 6, s4 7,
s5 7, s6 7, s7 7.
Compute all the values of the transformation function G,
0
G ( z0 ) 7 pz ( z j ) 0.00 0
j 0
G ( z1 ) 0.00 0 G ( z2 ) 0.00 0
G ( z3 ) 1.05 1 s0 G ( z4 ) 2.45 2 s1
G ( z5 ) 4.55 5 s2 G ( z6 ) 5.95 6 s3
G ( z7 ) 7.00 7 s4 s5 s6 s7
5
19-08-2024
s0 1, s1 3, s2 5, s3 6, s4 7,
s5 7, s6 7, s7 7.
rk
0
1
2
3
4
5
6
7
6
19-08-2024
7
19-08-2024
8
19-08-2024
Variance L 1 M 1 N 1
1
u2 (r ) (ri m) f ( x, y ) m
2 2 2
p( ri )
i 0
MN x 0 y 0
9
19-08-2024
Local variance
L 1
2
s xy ( ri msxy ) 2 psxy (ri )
i 0
10
19-08-2024
Spatial Filtering
a b
g ( x, y ) w( s , t ) f ( x s , y t )
s a t b
Spatial Filtering
11
19-08-2024
Spatial Correlation
a b
w( x, y ) f ( x, y ) w( s, t ) f ( x s, y t )
s a t b
Spatial Convolution
a b
w( x, y ) f ( x, y ) w( s, t ) f ( x s, y t )
s a t b
12
19-08-2024
13
19-08-2024
w(s, t ) f ( x s, y t )
g ( x, y ) s a t b
a b
w( s, t )
s a t b
where m 2 a 1, n 2b 1.
14
19-08-2024
15
19-08-2024
— Nonlinear
16