You are on page 1of 50

Digital

Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

Chapter 4 Image Enhancement in the


Frequency Domain

„ The principal objective of enhancement


„ to process an image so that the result is more suitable
than the original image for a specific application.
„ Enhancement methods
„ Spatial Domain (in chapter 3)
„ based on direct manipulation of pixels in an image
„ Frequency Domain (in this chapter)
„ based on modifying the Fourier transform of an image
„ The viewer is the ultimate judge of how well of
a particular method works.
© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

Chapter 4 Image Enhancement in the


Frequency Domain

4.1 Background
4.2 Introduction to the Fourier Transform and the
Frequency Domain
4.3 Smoothing Frequency-Domain Filters
4.4 Sharpening Frequency-Domain filters
4.5 Homomorphic Filtering
4.6 Implementation

© 2002 R. C. Gonzalez & R. E. Woods

1
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.1 Background

„ Jean Baptiste Joseph Fourier(1768~1830)


„ French mathematician

Source:http://www-groups.dcs.st-and.ac.uk/~history/PictDisplay/Fourier.html
© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.1 Background

© 2002 R. C. Gonzalez & R. E. Woods

2
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.1 Background

„ Fourier Series
„ Any periodically repeated function can be expressed
of the sum of sines/cosines
sines/cosines of different frequencies,
frequencies,
each multiplied by a different coefficient
„ Fourier Transform
„ Finite curves can be expressed as the integral of
sines/cosines
sines/cosines multiplied by a weighing function
„ wildly used in signal processing field
„ Fourier Series/Transform can be reconstructed
completely via an inverse process
© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ This Section will introduce


„ One dimension and Two dimension Fourier
transform
„ mostly on a discrete formulation of the continuous
transform and some of its properties

© 2002 R. C. Gonzalez & R. E. Woods

3
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ One dimensional Fourier transform and its


inverse (Fourier transform pair)
Fourier transform 像素強度

頻率強度 F (u ) = ∫ f ( x )e − j 2πux dx (4.2 - 1)
−∞

Inverse Fourier transform 頻率強度



像素強度 f ( x ) = ∫ F (u )e j 2πux du (4.2 - 2)
−∞

其中, f(x)是單變數連續函式,F(u)是f(x)的Fourier
Transform結果,j= − 1
© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ Two dimensional Fourier transform and its


inverse (Fourier transform pair)
Fourier transform
∞ ∞
F (u , v ) = ∫ ∫ f (x, y )e − j 2π (ux + vy )dxdy (4.2 - 3)
−∞ −∞

Inverse Fourier transform


∞ ∞
f ( x, y ) = ∫ ∫ F (u , v )e j 2π (ux + vy )dudv (4.2 - 4)
−∞ −∞

© 2002 R. C. Gonzalez & R. E. Woods

4
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ Discrete Fourier Transform (DFT)


Discrete Fourier Transform
M −1
F (u ) = ∑ f (x )e
1 − j 2πux M
for u = 0 , 1, 2 , ..., M - 1. (4.2 - 5)
M x =0

Inverse Discrete Fourier Transform


M −1
f ( x ) = ∑ F (u )e j 2πux M for x = 0 , 1, 2 , ..., M - 1. (4.2 - 6)
x =0

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ Frequency Domain
Euler’s formula
e jθ = cos θ + j sin θ (4.2 - 7)
substituting this expression into Eq. (4.2-5)
1 M −1
F (u ) = ∑ f (x )[cos 2πux / M − j sin 2πux / M ]
M x =0
for u = 1, 2, ..., M - 1 (4.2 - 8)
F(u)是f(x)的頻率成份,Fourier Transform就像菱鏡的功能一
樣可將f(x)的頻率成份分離出來分離出來的值為F(u)
© 2002 R. C. Gonzalez & R. E. Woods

5
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ To express F(x) in polar coordinates(極座標)
F (u ) = F (u ) e − jφ (u ) (4.2 - 9)

[ ]
1
F (u ) = R (u ) + I (u )
2 2 2
(4.2 - 10) R(u) 與 I(u)分別是F(u)的實部與虛部

|F(u)| is called the magtitute(強度) or spectrum(頻譜)


 I (u ) 
φ (u ) = tan −1   (4.2 - 11)
 R(u )
φ is called the phase angle (相位角) or phase spectrum
P(u ) = F (u ) = R 2 (u ) + I 2 (u ) (4.2 - 12)
2

p(u) is called power spectrum of spectrum density


© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Example M −1
F (u ) = ∑ f (x )e
1 − j 2πux M

M x =0
K −1
1
=
M
∑ Ae
x =0
− j 2πux M

K −1
A
=
M
∑e
x =0
− j 2πux M

K −1
A
F (0) = ∑e − j 2π 0 x M

M x =0

A K −1
= ∑1
M x =0
AK
=
M
© 2002 R. C. Gonzalez & R. E. Woods

6
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

7
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ 2D DFT and its inverse

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ Spectrum, Phase angle, and Spectrum density

© 2002 R. C. Gonzalez & R. E. Woods

8
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ Shifts the origin of F(u, v) to (M/2, N/2)

„ dc (direct current) value


„ zero frequency
„ mean value of an image

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

„ if f(x,y) is real, its Fourier transformation is


conjugate (共軛) symmetric

© 2002 R. C. Gonzalez & R. E. Woods

9
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Example

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

10
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Filtering in the frequency domain
影像灰階內容與頻率的關係

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Steps of Filtering in the frequency domain
1. Multiply the input image by (-1)x+y to center the transform,
as indicated in Eq. (4.2-21).

2. Compute F(u, v), the DFT of the image from (1).


3. Multiply F(u, v) by a filter function H(u,v).

4. Compute the inverse DFT of the result in (3).

5. Obtain the real part of the result in (4).


6. Multiply the result in (5) by (-1)x+y

© 2002 R. C. Gonzalez & R. E. Woods

11
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Some basic filters and their properties
„ Notch filter - remove the average value of an image

© 2002 R. C. Gonzalez & R. E. Woods

12
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Low frequencies
„ Smooth areas
„ High frequencies
„ Edge, Texture, noise
„ Lowpass filter
„ 濾掉高頻部份,保留低頻部份
„ highpass filter
„ 濾掉低頻部份,保留高頻部份

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

13
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Correspondence between filtering in the spatial
and frequency domains
„ Convolution theorem(捲積定理)
捲積

f ( x, y )* h( x, y ) ⇔ F (u , v )H (u , v ) (4.2 - 31)

f ( x, y )h( x, y ) ⇔ F (u , v )* H (u , v ) (4.2 - 32 )

頻域相乘等於空間域做捲積,空間域相乘等於頻域做捲積
© 2002 R. C. Gonzalez & R. E. Woods

14
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Impulse Function(脈衝函式)
M −1 N −1

∑∑ s(x, y )Aδ (x − x , y − y ) = As(x , y )


x =0 y =0
0 0 0 0 (4.2 - 33)
M −1 N −1

∑∑ s(x, y )δ (x, y ) = s(0,0)


x =0 y =0
(4.2 - 34)

函式與
函式與脈衝函式做
脈衝函式做捲積就是將函式
捲積就是將函式複製
複製到脈衝函式所在位置
到脈衝函式所在位置

„ Fourier transform of Impulse Function


M −1 N −1
F (u, v ) = ∑∑ δ (x, y )e
1 − j 2π (ux / M + vy / N ) 1
= (4.2 - 35)
MN x =0 y =0 MN

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Convolution between h(x,y) and Impulse Function
M −1 N −1
f ( x , y ) * h ( x, y ) = ∑∑ δ (m, n)h(x − m, y − n)
1
MN x =0 y =0

h( x,y )
1
= (4.2 - 36)
MN

© 2002 R. C. Gonzalez & R. E. Woods

15
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Correspondence between filtering in the spatial
and frequency domains

Spatial Domain Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain
„ Gaussian filter (高斯濾波器)

H (u ) = Ae −u
2
2
/ 2σ
(4.2 - 38)

h( x ) = 2π σAe −2π σ 2 x2
2
(4.2 - 39)

H (u ) = Ae −u / 2σ 12
- Be − u / 2σ 22
2 2
(4.2 - 40)

h( x ) = 2π σ 1 Ae −2π σ 12 x 2
- 2π σ 2 Be −2π σ 22 x 2
2 2
(4.2 - 41)

© 2002 R. C. Gonzalez & R. E. Woods

16
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.2 Introduction to the Fourier Transform and


the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

G (u , v ) = H (u , v )F (u , v ) (4.3 - 1)
„ 4.3.1 Ideal Lowpass Filters
1 if D (u,v ) ≤ D0
H (u , v ) =  (4.3 - 2)
0 if D(u,v ) > D0

D(u,v)表距中心點距離, MxN的影像,
中心點為(M/2, N/2)
[
D (u , v ) = (u − M / 2 ) + (v − N / 2 )
2 2
]
1
2
(4.3 - 3)

D0 is called cutoff frequency

© 2002 R. C. Gonzalez & R. E. Woods

17
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

„ Choosing the cutoff frequency according to the


power spectrum of an image
M −1 N −1
PT = ∑∑ P (u , v ) (4.3 - 4)
u =0 v =0

 
α = 100 ∑∑ P(u, v ) / PT  (4.3 - 5)
 u v 

© 2002 R. C. Gonzalez & R. E. Woods

18
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

a b c
d e f

© 2002 R. C. Gonzalez & R. E. Woods

19
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

„ blurring and ringing effects

Frequency Domain : G (u , v ) = H (u , v )F (u , v )
Spatial Domain : g (x, y ) = h(x, y )* f (x, y )

Blurring : Low frequencies are removed

Ringing : Cutoff is too sharp

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

20
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

„ 4.3.2 Butterworth Lowpass Filters

H (u , v ) =
1
(4.3 - 6)
1 + [D(u , v ) D0 ]
2n

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters


no ringing

a b c
d e f

FIGURE 4.15 (a) Original image. (b)-(f) Results of filtering with BLPFs of order 2,
with cutoff frequencies at radii of 5, 15, 30, 80, 230, as shown in Fig. 4.11 (b).
Compare with Fig. 4.12.
© 2002 R. C. Gonzalez & R. E. Woods

21
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

„ 4.3.3 Gaussian Lowpass Filters


H (u , v ) = e − D (u ,v ) 2σ 2
2
(4.3 - 7)

H (u , v ) = e − D (u , v )
2
2 D02
(4.3 - 8)

© 2002 R. C. Gonzalez & R. E. Woods

22
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters


no ringing

a b c
d e f

FIGURE 4.18 (a) Original image. (b)-(f) Results of filtering with Gaussian lowpass
filters with cutoff frequencies set at radii of 5, 15, 30, 80, 230, as shown in Fig. 4.11
(b). Compare with Figs. 4.12 and 4.15.
© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

23
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

„ 4.3.4 Additional examples of Lowpass Filtering

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.3 Smoothing Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

24
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

H hp (u , v ) = 1 − H lp (u , v ) (4.4 - 1)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

25
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ 4.4.1 Ideal Highpass Filters


0 if D (u,v ) ≤ D0
H (u , v ) =  (4.4 - 2)
1 if D (u,v ) > D0

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ 4.4.2 Butterworth Highpass Filters


H (u , v ) =
1
(4.4 - 3)
1 + [D0 D(u , v )]
2n

© 2002 R. C. Gonzalez & R. E. Woods

26
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ 4.4.3 Gaussian Highpass Filters


H (u , v ) = 1 − e − D (u , v )
2
2 D02
(4.4 - 4)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ 4.4.4 The Laplacian in the Frequency Domain

© 2002 R. C. Gonzalez & R. E. Woods

27
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ 4.4.4 The Laplacian in the Frequency Domain


{[
∇ 2 f ( x, y ) = ℑ−1 − (u − M / 2 ) + (v − N / 2 ) F (u , v )
2 2
] } (4.4 - 10)

∇2 f ( x, y ) ⇔ −[(u − M / 2 ) ]
+ (v − N / 2 ) F (u , v )
2 2
(4.4 - 11)

An image can be enhanced by subtracting the Laplacian


from the original image.

g ( x, y ) = f ( x, y ) − ∇ 2 f ( x, y ) (4.4 - 12)

{ [
g ( x, y ) = ℑ−1 1 − (u − M 2) + (v − N 2) F (u, v)
2 2
] } (4.4 -13)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

28
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ 4.4.5 Unsharp Masking, High-Boost Filtering,


and High-Grequency Emphasis Filtering
„ Unsharp filtering

f hp ( x, y ) = f ( x, y ) − f lp ( x, y ) (4.4 - 14)

„ High-Boost filtering
f hb ( x, y ) = Af ( x, y ) − f lp ( x, y ) (4.4 - 15)
= (A - 1) f ( x, y ) + f ( x, y ) − f lp ( x, y ) (4.4 - 16)
= (A - 1) f ( x, y ) + f hp ( x, y ) (4.4 - 17)

© 2002 R. C. Gonzalez & R. E. Woods

29
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ Unsharp filtering - frequency-domain filter


H hp (u , v ) = 1 − H lp (u , v ) (4.4 - 18)

„ High Boost filtering - frequency-domain filter


H hb (u, v ) = ( A − 1) − H hp (u, v ) (4.4 - 19)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

30
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

„ High frequency emphasis

H hfe (u , v ) = a + bH hp (u, v ) (4.4 - 20)


typically, 0.25≤ a ≤ 0.5, 1.5 ≤ b ≤ 2.0

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.4 Sharping Frequency-Domain Filters

© 2002 R. C. Gonzalez & R. E. Woods

31
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.5 Homomorphic Filtering

„ illumination-reflectance model
„ simultaneous gray-level range compression and
contract enhancement
f ( x, y ) = i ( x, y )r ( x, y ). (4.5 - 1)

ℑ( f ( x, y )) ≠ ℑ(i ( x, y ))ℑ(r ( x, y )). (4.5 - 2)

Let z ( x, y ) = ln f ( x, y )
= ln i ( x, y ) + ln r ( x, y ). (4.5 - 3)

Then Z (u, v ) = Fi (u, v ) + Fr (u, v ) (4.5 - 4)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.5 Homomorphic Filtering

S (u , v ) = H (u , v )Z (u , v )
= H (u,v )Fi (u,v ) + H (u,v )Fr (u,v ) (4.5 - 5)

s ( x, y ) = ℑ−1 {S (u , v )}
= ℑ−1 {H (u,v )Fi (u,v )}+ ℑ−1 {H (u,v )Fr (u,v )} (4.5 - 6)

Let i ' ( x, y ) = ℑ−1 {H (u,v )Fi (u,v )} (4.5 - 7)


r' ( x,y ) = ℑ −1
{H (u,v )Fr (u,v )} (4.5 - 8)

s ( x, y ) = i ' ( x, y )r ' ( x, y ). (4.5 - 9)

© 2002 R. C. Gonzalez & R. E. Woods

32
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.5 Homomorphic Filtering

g ( x, y ) = e s ( x , y )
= ei' ( x,y ) ⋅ e r' ( x,y )
= i0 ( x,y )r0 ( x,y ) (4.5 - 10)

i0 ( x,y ) = e i '( x , y ) (4.5 - 11)

r0 ( x,y ) = e r '( x , y ) (4.5 - 12)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.5 Homomorphic Filtering

© 2002 R. C. Gonzalez & R. E. Woods

33
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.5 Homomorphic Filtering

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ Some Additional Properties of the 2D Fourier


Transform Translation
„ Shifting

„ Shifts center to (M/2, N/2)

© 2002 R. C. Gonzalez & R. E. Woods

34
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ Distributivity(分配率)
ℑ[ f1 ( x, y ) + f 2 ( x, y )] = ℑ[ f1 ( x, y )] + ℑ[ f 2 ( x, y )] (4.6 - 5)

ℑ[ f1 ( x, y ) ⋅ f 2 ( x, y )] ≠ ℑ[ f1 ( x, y )]⋅ ℑ[ f 2 ( x, y )] (4.6 - 6)

„ Scaling
af ( x, y ) ⇔ aF (u , v ) (4.6 - 7)
1 u v
f (ax, by ) ⇔ F ,  (4.6 - 8)
ab  a b 

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ Rotation
Let x = r cos θ , y = r sin θ u = ω cos ϕ , v = ω sin ϕ
Then f ( x,y ) and F (u,v ) become f (r,θ ) and F (ω,ϕ )

f (r , θ + θ 0 ) ⇔ F (ω , ϕ + θ 0 ) (4.6 - 9)

© 2002 R. C. Gonzalez & R. E. Woods

35
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ Periodicity
F (u , v ) = F (u + M , v ) = F (u , v + N ) = F (u + M , v + N ) (4.6 - 10)
f ( x,y ) = f ( x + M,y ) = f ( x,y + N ) = f ( x + M,y + N ) (4.6 - 11)

„ Conjugate symmetry
F (u , v ) = F * (− u ,−v ) (4.6 - 12)

F (u , v ) = F (− u ,−v ) (4.6 - 13)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

© 2002 R. C. Gonzalez & R. E. Woods

36
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ Separability
M −1 N −1
F (u, v ) = ∑ f (x, y )e
1 1
M
∑ e− j 2πux / M
x =0 N y =0
− j 2πvy / N

M −1

∑ F (x, v )e
1 − j 2πux / M
= (4.6 - 14)
M x =0
N −1
F ( x, v ) = ∑ f (x, y )e
1 − j 2πvy / N
(4.6 - 15)
N y =0

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ Computing the inverse Fourier Transform


using a Forward Transform Algorithm

© 2002 R. C. Gonzalez & R. E. Woods

37
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ More on Periodicity

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

© 2002 R. C. Gonzalez & R. E. Woods

38
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ 避免產生wraparound error在函式後方補零

 f (x ) 0 ≤ x ≤ A -1
f e (x ) =  (4.6 - 21)
0 A≤x≤P

 g (x ) 0 ≤ x ≤ B -1
g e (x ) =  (4.6 - 22)
0 B≤ x ≤P

且P≥A+B-1

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

„ 2D

© 2002 R. C. Gonzalez & R. E. Woods

39
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

© 2002 R. C. Gonzalez & R. E. Woods

40
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The convolution and Correlation Theorems

„ Convolution Theorems

© 2002 R. C. Gonzalez & R. E. Woods

41
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The convolution and Correlation Theorems

„ Correlation Theorems

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The convolution and Correlation Theorems

© 2002 R. C. Gonzalez & R. E. Woods

42
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
Summary of Properties of the 2D Fourier Transform

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
Summary of Properties of the 2D Fourier Transform

© 2002 R. C. Gonzalez & R. E. Woods

43
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
Summary of Properties of the 2D Fourier Transform

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
Summary of Properties of the 2D Fourier Transform

© 2002 R. C. Gonzalez & R. E. Woods

44
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

„ Complexity of Fourier Transformation


„ O(N2)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

M −1
F (u ) = ∑ f (x )W
1 ux
M (4.6 - 35)
M x =0

WM = e − j 2π / M (4.6 - 36)

Let M = 2 n (4.6 - 37)


M = 2K (4.6 - 38)
M −1
F (u ) = ∑ f (x )W
1 ux
M
2K x =0

1  1 k −1 1 k −1 
=  ∑ f (2 x )W2
u (2 x )
K + ∑ f (2 x + 1)W2uK(2 x +1)  (4.6 - 39)
2  K x =0 K x =0 

© 2002 R. C. Gonzalez & R. E. Woods

45
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

M −1
F (u ) = ∑ f (x )W
1 ux
M
2K x =0

1  1 k −1 1 k −1 
=  ∑ f (2 x )W u (2 x )
2K + ∑ f (2 x + 1)W2uK(2 x +1)  (4.6 - 39)
2  K x =0 K x =0 

1 k −1 1 k −1
∑ f (2 x )W2uK(2 x )
K x =0 ∑ f (2 x + 1)W2uK(2 x+1)
K x =0
© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation
M −1
F (u ) = ∑ f (x )W
1 ux
M
2K x =0

1  1 k −1 1 k −1 
=  ∑ f (2 x )W u (2 x )
2K + ∑ f (2 x + 1)W2uK(2 x +1)  (4.6 - 39)
2  K x =0 K x =0 

QW22kux = e − j 2π (2ux )/ 2 K = e − j 2π (ux )/ K = WKux


1  1 k −1 1 k −1 
∴ F (u ) =  ∑ f (2 x )WK
ux
+ ∑ f (2 x + 1)WKuxW2uK  (4.6 - 40)
2  K x =0 K x =0 

© 2002 R. C. Gonzalez & R. E. Woods

46
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

1 k −1
Defining Feven (u ) = ∑ f (2 x )WKux (4.6 - 41)
K x =0

1 k −1
Defining Fodd (u ) = ∑ f (2 x + 1)WKux (4.6 - 42)
K x =0

F (u ) =
1
2
[
Feven (u ) + Fodd (u )W2uK ] (4.6 - 43)

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

QWMu + M = WMu and W2uM+ M = −W2uM 週期性

∴ F (u + K ) =
1
2
[
Feven (u + K ) + Fodd (u + K )W2uk+ k ]
1  1 K −1 1 K −1 
=  ∑ f (2 x )WK(u + K )x + ∑ f (2 x + 1)WK(u + K )xW2uk+ k 
2  K x =0 K x =0 
1  1 K −1 
=  ∑
2  K x =0
f (2 x )WK
ux
+
1 K −1
∑ (
f (2 x + 1)WKux − W2uK  )
K x =0 
1  1 K −1 1 K −1 
=  ∑ f (2 x )WKux − ∑ f (2 x + 1)WKuxW2uK 
2  K x =0 K x =0 
=
1
2
[
Feven (u ) − Fodd (u )W2uK ] (4.6 - 44)
© 2002 R. C. Gonzalez & R. E. Woods

47
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

F (0) =
1
2
[
Feven (0) + Fodd (0)W20k ]
[
F (1) = Feven (1) + Fodd (1)W21k
1
2
]
L

F (K − 1) =
1
2
[F even (K − 1) + Fodd (K − 1)W2KK−1 ]

F (0 + K ) =
1
2
[F even (0) − Fodd (0)W20K ]

F (1 + K ) =
1
2
[F even (1) − Fodd (1)W21K ]

F (K − 1 + K ) =
1
2
[F even (K − 1) − Fodd (K − 1)W2KK−1 ]
© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

FFT所需要的乘法與加法計算次數
其中 M = 2 n

m(n ) = 2m(n − 1) + 2 n −1 n ≥ 1 (4.6 - 45)


a (n ) = 2a(n − 1) + 2 n n ≥1 (4.6 - 46)

m(n ) =
1
M log 2 M (4.6 - 47)
2
a (n ) = M log 2 M (4.6 - 48)

© 2002 R. C. Gonzalez & R. E. Woods

48
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

Advantage of the FFT over Fourier Transform

M2
C (M ) =
M log 2 M
M
= (4.6 - 49)
log 2 M
2n
M = 2 n ⇒ C (n ) = (4.6 - 50)
n

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

© 2002 R. C. Gonzalez & R. E. Woods

49
Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
The Fast Fourier Transformation

© 2002 R. C. Gonzalez & R. E. Woods

Digital
Digital Image
Image Processing,
Processing, 2nd
2nd ed.
ed. www.imageprocessingbook.com

4.6 Implementation
Some comments on filter design

• 頻域可完全掌控filter特性,非常適合在
實驗階段,Filter在頻域設計完成後,通
常會轉成對等的空間域filter,然後使用
韌體或硬體的方式處理影像.

© 2002 R. C. Gonzalez & R. E. Woods

50

You might also like