Lecture # 5-1 Histogram Processing
Lecture # 5-1 Histogram Processing
Fall 2024-2025
Histogram Processing
0 1 0
1 -4 1
0 1 0
g ( x, y) = f ( x, y) - Ñ f 2
0 0 0 -2 0 2
1 2 1 -1 0 1
Grey Levels
24/11/24 13:35:36 Presented by Dr. Ali HAMİTOĞLU 10
Image Histograms
• Let rk , for k=0,1,2,…,L-1, denote the intensities of an L-level digital
image f(x,y).
• The unnormalized histogram of f is defined as
Dark Image
Bright Image
ps (s)ds = pr (r )dr
s = T (r ) 0 £ r £ L -1
24/11/24 13:35:36 Presented by Dr. Ali HAMİTOĞLU 24
Histogram Equalization
cumulative distribution function (CDF)
r
s = T (r ) = ( L - 1) ò pr ( w)dw of random variable r.
0
ds dT (r ) d é r ù
dr
=
dr
= ( L - 1)
dr ê
ë ò0
pr ( w) dw
úû
= ( L - 1) pr (r )
pr (r )dr pr (r ) pr (r ) 1
ps ( s ) = = = =
ds æ ds ö ( ( L - 1) pr (r ) ) L - 1
ç ÷
è dr ø
(a) Image from Phoenix Lander. (b) Result of histogram equalization. (c) Histogram of image
(a). (d) Histogram of image (b). (Original image courtesy of NASA.)
24/11/24 13:35:36 Presented by Dr. Ali HAMİTOĞLU 33
Histogram Processing
• Histogram is an approximation to a PDF
• No new allowed intensity levels are created
– Discrete histogram equalization may not produce a perfectly flat
histograms
• 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)
• 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
-1
zq = G (sk )
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: