Anda di halaman 1dari 19

Gray level histograms

4
x 10
4

3.5

#pixels 3

2.5

1.5
Brain image
1

0.5

0
0 50 100 150 200 250
gray level

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 1


Gray level histograms
4
x 10
3.5

2.5

2
#pixels

1.5

Bay image
1

0.5

0
0 50 100 150 200 250
gray level

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 2


Gray level histogram in viewfinder

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 3


Gray level histograms
To measure a histogram:
For B-bit image, initialize 2B counters with 0
Loop over all pixels x,y
When encountering gray level f [x,y]=i, increment counter # i
Normalized histogram can be thought of as an estimate of the probability
distribution of the continuous signal amplitude
Use fewer, larger bins to trade off amplitude resolution against sample size.

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 4


Histogram equalization
Idea:

Find a non-linear transformation

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, 2013 Stanford University -- Histograms 6


Histogram equalization

Analyse ideal, continuous case first ...

Assume
Normalized input values 0 f 1 and output values 0 g 1

T(f) is differentiable, increasing, and invertible, i.e., there exists

f = T 1 (g ) 0 g 1

Goal: pdf pg(g) = 1 over the entire range 0 g 1

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 7


Histogram equalization for continuous case
From basic probability theory

pf ( f ) T (f ) df
f g
pg (g ) = p f ( f )
dg f =T 1 (g )
Consider the transformation function

g = T ( f ) = p f ( ) d
f
0 f 1
0

dg
= pf ( f )
Then . . .
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, 2013 Stanford University -- Histograms 8


Histogram equalization for discrete case

Now, f only assumes discrete amplitude values with empirical


probabilities
pixel count for amplitude fl

Discrete approximation of g = T ( f ) = p f ( ) d
f

0

k
gk = T [ fk ]= Pi for k = 0,1..., L 1
i=0

The resulting values gk are in the range [0,1] and might have to
be scaled and rounded appropriately.

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 10


Histogram equalization example

Original image Bay ... after histogram equalization

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 11


Histogram equalization example
Original image Bay
4
. . . after histogram equalization
4
x 10 x 10
3.5 3.5

3 3

2.5 2.5

#pixels

#pixels
2 2

1.5 1.5

1 1

0.5 0.5

0 0
0 50 100 150 200 250 0 50 100 150 200 250
gray level gray level

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 12


Histogram equalization example

Original image Brain ... after histogram equalization

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 13


Histogram equalization example
Original image Brain
4
. . . after histogram equalization
4
x 10 x 10
4 4

3.5 3.5

3 3

2.5 2.5

2 2

#pixels
#pixels

1.5 1.5

1 1

0.5 0.5

0 0
0 50 100 150 200 250 0 50 100 150 200 250
gray level gray level

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 14


Histogram equalization example

Original image Moon ... after histogram equalization

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 16


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, 2013 Stanford University -- Histograms 17


Contrast-limited histogram equalization

Output gray level


no clipping
0.7
#pixels
0.7
0.4 0.4

0.1 0.1

Input gray level Input gray level

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 18


Adaptive histogram equalization
Histogram equalization based on a histogram obtained from a portion of the image

Sliding window approach: Tiling approach:


different histogram (and subdivide into overlapping
mapping) for every pixel regions, mitigate blocking
effect by smooth blending
between neighboring tiles

Limit contrast expansion in flat regions of the image,


e.g., by clipping histogram values.
(Contrast-limited adaptive histogram equalization)
[Pizer, Amburn et al. 1987]

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 19


Adaptive histogram equalization
Original image Global histogram
Parrot equalization

Adaptive histogram Adaptive histogram


equalization, 8x8 tiles equalization, 16x16 tiles

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 20


Adaptive histogram equalization
Original image Global histogram
Dental Xray equalization

Adaptive histogram Adaptive histogram


equalization, 8x8 tiles equalization, 16x16 tiles

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 21


Adaptive histogram equalization
Original image Global histogram
Skull Xray equalization

Adaptive histogram Adaptive histogram


equalization, 8x8 tiles equalization, 16x16 tiles

Digital Image Processing: Bernd Girod, 2013 Stanford University -- Histograms 22

Anda mungkin juga menyukai