You are on page 1of 42

Digital Image Processing, 2nd ed.

CH 3 Image Enhancement in the Spatial Domain


3.1 Background

g ( x, y ) = T [ f ( x, y ) ]
f ( x, y ) : the input image
g ( x, y ) : the processed image
T [ •] : an operator on f , defined over some neighborhood of ( x, y )

1 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Point Processing

1× 1 neighborhood → s = T (r )

2 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.2 Gray Level Transformations

3 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.2.1 Image Negatives

s = L −1− r

4 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.2.2 Log Transformations

s = c log(1 + r )

5 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.2.3 Power-Law Transformation

γ
s = cr

6 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Gamma Correction

7 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Gamma Correction: Example 3.1

8 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Gamma Correction: Example 3.2

9 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.2.4 Piecewise-Linear Transformation

Contrast Stretching

10 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Gray-Level Slicing

11 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Bit-Plane Slicing

12 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.3 Histogram Processing

What is Histogram?

Histogram
h( rk ) = nk
rk : k - th gray level
nk : number of pixels in the image having gray level rk
for k = 0,1,  , L − 1

Normalized Histogram
p( rk ) = nk n
n : total number of pixels in the image
rk : k - th gray level
nk : number of pixels in the image having gray level rk
for k = 0,1,  , L − 1

13 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.3.1 Histogram Equalization

Fundamental Assumptions on the Transformation

s = T ( r ), 0 ≤ r ≤ 1

Two assumptions on T ( r ) :
( i ) single - valued, monotonically increasing
( ii ) 0 ≤ T ( r ) ≤ 1, for 0 ≤ r ≤ 1

The inverse transformation :


r = T −1 ( s ) , 0 ≤ s ≤ 1

14 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
Histogram Equalization

The Continuous Case

From an elementary probability theory,


 dr 
ps ( s ) = pr ( r )  ,
 ds 
Consider a transformation function
s = T ( r ) = ∫ pr ( w)dw
r

ds dT ( r ) d  r  = p (r)
( )
dr  ∫0
= = p w dw
dr dr
r  r

dr 1
ps ( s ) = pr ( r ) = pr ( r ) = 1, 0 ≤ s ≤ 1
ds pr ( r )

15 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
Histogram Equalization

The Discrete Case

rk
pr ( rk ) = , k = 0,1,..., L − 1
n
m n
sk = T ( rk ) = ∑ pr ( rj ) = ∑ , k = 0,1,..., L − 1
k
j

j =0 j =0 n

16 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.3.2 Histogram Matching (Specification)

Development of Method

17 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
Histogram Matching (Specification)

Implementation

18 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
Chapter 3

19 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
Chapter 3

20 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
Chapter 3

21 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.3.3 Local Enhancement

22 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.3.4 Use of Histogram Statistics


for Image Enhancement

r ∈ [ 0, L − 1]
pr ( r j ) : normalized histogram of the ith value of r → Probability of occurrence of r j
The nth moment of r
L −1 n L −1
µ n ( n ) = ∑ ( ri − m ) p ( ri ) , where m = ∑ ri p( ri )
i =0 i =0

Since µ 0 = 1, and µ1 = 0,
L −1
µ 2 = ∑ ( ri − m ) p( ri ) = σ 2 → variance of r
2

i =0

Local mean and variance

mS xy = ∑) r p( r )
( s ,t ∈S xy
s ,t s ,t

∑ [r ]
2

σ 2 S xt = s ,t − mS xy p ( rs ,t )
( s ,t )∈S xy

23 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

 E ⋅ f ( x, y ) if mS xy ≤ k0 M 0 and k1 DG ≤ σ S xy ≤ k 2 DG
g ( x, y ) = 
 f ( x, y ) otherwise

24 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.4 Enhancement Using


Arithmetic/Logic Operations

25 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.4.1 Image Subtraction

26 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Image Subtraction: Mask Mode Radiography

27 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.4.2 Image Averaging

g ( x, y ) = f ( x, y ) + η ( x, y )
where η is zero - mean, uncorrelated
K
1
g ( x, y ) = ∑ g ( x, y )
i
K i =1

{ }
E g( x, y ) = f ( x, y ) , and σ 2 g ( x , y ) =
1 2
K
σ η ( x, y )
1
σ g ( x, y ) = ση ( x , y )
K

28 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

29 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.5 Basics of Spatial Filtering

R = w( − 1,−1) f ( x − 1, y − 1) + w( − 1,0) f ( x − 1, y ) + 
+ w( 0,0) f ( x, y ) +  + w(1,0) f ( x + 1, y ) + w(1,1) f ( x + 1, y + 1)
a b
g ( x, y ) = ∑ ∑ w( s, t ) f ( x + s, y + t )
s = −1t = − b

mn
R = w1 z1 +  + wmn z mn = ∑ wi zi
30 중앙대학교 첨단영상대학원
i =1
Digital Image Processing, 2nd ed.

mn
R = w1 z1 +  + wmn z mn = ∑ wi zi
i =1

31 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.6 Smoothing Spatial Filters

3.6.1 Smoothing Linear Filters

1 9
R = ∑ zi
9 i =1
a b

∑ ∑ w( s, t ) f ( x + s, y + t )
g ( x, y ) = s = − at = − b
a b

∑ ∑ w( s, t )
s = − at = − b

32 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Averaging Filter: Hubble Image

33 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.6.2 Order Statistics Filters

34 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.
3.7 Sharpening Spatial Filters

3.7.1 Foundation

The 1D, first - order derivative


∂f
= f ( x + 1) − f ( x )
∂x
The 1D, second - order derivative
∂2 f
= f ( x + 1) − 2 f ( x ) + f ( x − 1)
∂x 2

35 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.7.2 Second Derivatives: Laplacian

The 2D, second - order derivative : Laplacian


∂2 f ∂2 f
∇ f = 2 + 2
2

∂x ∂x
∂2 f
= f ( x + 1, y ) − 2 f ( x, y ) + f ( x − 1, y )
∂x 2
∂2 f
= f ( x, y + 1) − 2 f ( x, y ) + f ( x, y − 1)
∂y 2
∇ 2 f = [ f ( x + 1, y ) + f ( x − 1, y ) + f ( x, y + 1) + f ( x, y − 1)]
− 4 f ( x, y )

36 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Laplacian

 f ( x, y ) − ∇ 2 f ( x, y ) if the center is negative


g ( x, y ) = 
 f ( x, y ) + ∇ f ( x, y ) if the center is positive
2

37 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Laplacian Enhancement: Simplification

g ( x, y ) = f ( x, y ) − ∇ 2 f ( x, y )
5 f ( x, y ) − [ f ( x + 1, y ) + f ( x − 1, y )
+ f ( x, y + 1) + f ( x, y − 1)]

38 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Unsharp Masking and High-Boost Filtering

Unsharp masking
f s ( x, y ) = f ( x , y ) − f ( x, y )
High - boost filtering
f hb ( x, y ) = Af ( x, y ) − f ( x, y )

39 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.7.3 First Derivatives: The Gradient

40 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

3.8 Combining Spatial Enhancement Methods

41 중앙대학교 첨단영상대학원
Digital Image Processing, 2nd ed.

Homework #2
• Problems in Chapter 3
– 3.2(a), 3.8, 3.22, 3.27

42 중앙대학교 첨단영상대학원

You might also like