You are on page 1of 7

Histogram Equalization

ECE/VT
Histogram Specification
•  How can we accomplish this?

specified

ECE/VT
Approach (Histogram Specification)
•  An image r -> an image z
•  Histogram: pr(r) -> pz(z) (specified) z = G −1 (s ')

z
s ' = G ( z ) = ( L − 1) ∫ pz (u )du
r
s = T (r ) = ( L − 1) ∫ pr (u )du 0
0

KEY POINT: s = s’

z = G −1 (s ') = G −1 (T (r )) = G −1 (s)

The overall transformation: G −1 (T (r ))

ECE/VT
Algorithm (Histogram Specification)
• Step 1: Find histogram of input image px(i),
and find histogram equalization mapping:
j
Fx ( j ) = ( L − 1)∑ px (i ) j
i =0
Fx ( j ) = ∑ px (i ) (L-1)
• Step 2: Specify the desired histogram pz(i), i =0

and find histogram equalization mapping:


j
    F ( j ) = ( L − 1)∑ p (i)
z z
i =0

• Step 3: Build a lookup table:


For each gray level l, find Fx     
(l ) and then find a
j  level so that F     
x (l )
best matches Fz ( j ):
j
Fx ( j ) = ∑ px (i )
i =0
(L-1)

setup a lookup entry              .

ECE/VT
An Example
q

(2) G( zq ) = ( L − 1)∑
i =0
p z ( zi ) (3) mapping

(1) Histogram equalized input (s = T(r)):

0 -> 1, 1 -> 3; 2 -> 5, 3 -> 6, (r -> s)


4 -> 7, 5 -> 7, 6 -> 7, 7 -> 7

ECE/VT
Histogram Specification

specified

G(z)

G-1(s)

ECE/VT
Matlab IPT – histeq()

J = histeq(I, hgram)

ECE/VT

You might also like