Professional Documents
Culture Documents
Gray Level Histograms: Histogram
Gray Level Histograms: Histogram
Gray Level Histograms: Histogram
4
x 10 Histogram Brain image
4
3.5
#pixels 3
2.5
1.5
0.5
0
0 50 100 150 200 250
gray level
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 1
4
x 10
3.5
Gray level histograms
x310
4
3.5
2.5
3
2
2.5
1.5
2
#pixels
1
1.5
0.5 Bay image
1
0
0.5 0 50 100 150 200 250
0
0 50 100 150 200 250
gray level
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 2
Gray level histogram in viewfinder
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 3
Gray level histograms
n To measure a histogram:
l For B-bit image, initialize 2B counters with 0
l Loop over all pixels x,y
l When encountering gray level f [x,y]=i, increment counter #i
n Normalized histogram can be thought of as an estimate of the probability
distribution of the continuous signal amplitude
n Use fewer, larger bins to trade off amplitude resolution against sample size.
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 4
Histogram equalization
Idea:
g=T(f)
that is applied to each pixel of the input image f [x,y], such that a uniform
distribution of gray levels results for the output image g[x,y].
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 5
Histogram equalization
Assume
l Normalized input values 0 ≤ f ≤ 1 and output values 0 ≤ g ≤ 1
f = T −1 (g ) 0 ≤ g ≤1
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 6
Histogram equalization for continuous case
n From basic probability theory
f g ⎡ df ⎤
pf ( f ) T(f) pg (g ) = ⎢ p f ( f ) ⎥
⎣ dg ⎦ f =T −1 (g)
n Consider the transformation function
g = T ( f ) = ∫ p f (α ) dα
f
0 ≤ f ≤1
0
dg
n Then . . . = pf ( f )
df
⎡ df ⎤ ⎡ 1 ⎤
pg (g ) = ⎢ p f ( f ) ⎥ = ⎢ pf ( f ) ⎥ =1 0 ≤ g ≤1
⎣ dg ⎦ f =T −1 (g) ⎢⎣ p f ( f )⎥⎦ −1
f =T (g )
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 7
Histogram equalization for discrete case
n Now, f only assumes discrete amplitude values f0 , f1,, fL−1 with empirical
probabilities
n0 n1 nL−1
P0 = P1 = ! PL−1 = where n is total number of pixels
n n n
Discrete approximation of g = T ( f ) = p f (α ) dα
f
n
∫ 0
k
gk = T [ fk ] = ∑ Pi for k = 0,1..., L − 1
i=0
n The resulting values gk are in the range [0,1] and might have to
be scaled and rounded appropriately.
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 8
Histogram equalization example
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 9
Histogram equalization example
Original image Bay . . . after histogram equalization
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 10
Histogram equalization example
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 11
Histogram equalization example
Original image Brain
44
. . . after histogram equalization
44
x x10
10 x x10
10
44 44
3.5
3.5 3.5
3.5
33 33
2.5
2.5 2.5
2.5
22 22
#pixels
#pixels
1.5
1.5 1.5
1.5
11 11
0.5
0.5 0.5
0.5
00 00
00 50
50 100
100 150
150 200
200 250
250 00 50
50 100
100 150
150 200
200 250
250
gray level gray level
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 12
Histogram equalization example
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 13
Histogram equalization example
Original image Moon
4
. . . after histogram equalization
4
x 10 x 10
12 12
10 10
8 8
#pixels
#pixels
6 6
4 4
2 2
0 0
0 50 100 150 200 250 0 50 100 150 200 250
gray level gray level
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 14
Contrast-limited histogram equalization
0.1 0.1
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 15
Adaptive histogram equalization
n Histogram equalization based on a histogram obtained from a portion of the image
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 16
Adaptive histogram equalization
Original image Global histogram
Parrot equalization
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 17
Adaptive histogram equalization
Original image Global histogram
Dental Xray equalization
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 18
Adaptive histogram equalization
Original image Global histogram
Skull Xray equalization
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 19
Ansel Adam’s Zone System (1939)
full tonal gradation
11-step gradation
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 20
Ansel Adams, The Tetons and Snake River, 1942
Digital Image Processing: Bernd Girod, Gordon Wetzstein © 2013-2016 Stanford University -- Histograms 21