Professional Documents
Culture Documents
CoE4TN3
• Basic ideas:
Image Processing ¾ A periodic function can be
represented by the sum of
Image Enhancement in sines/cosines functions of
different frequencies,
Freq enc Domain
Frequency multiplied by a different
coefficient.
¾ Non-periodic functions can
also be represented as the
integral of sines/cosines
multiplied by weighing
function.
2 5
Image Enhancement
Fourier transform
basis functions
• Image enhancement techniques:
¾ Spatial domain methods
¾ Frequency domain methods
• S
Spatial
i l (time)
( i ) domain
d i techniques
h i are techniques
h i that
h
operate directly on pixels.
Approximating a
• Frequency domain techniques are based on modifying
square wave as the
the Fourier transform of an image.
sum of sine waves.
3 6
1
Any function can be written as the Fourier Series
sum of an even and an odd function
So if f(t) is a general function, neither even nor
E ( x) ≡ [ f ( x ) + f ( − x)] / 2 odd, it can be written:
∞ ∞
1 1
E(-x) = E(x)
f (t ) =
π
∑ m =0
Fm cos(mt ) +
π
∑ m =0
Fm′ sin(mt )
O ( x) ≡ [ f ( x ) − f ( − x)] / 2
Even component Odd component
O(-x) = -O(x)
⇓ where the Fourier series is
f ( x) = E ( x) + O( x)
Fm =
∫ f (t) cos(mt) dt Fm′ =
∫ f (t) sin(mt) dt
7 10
∑F
1
f(t) = cos(mt) F (m) = Fm − jFm' = ∫ f (t ) cos(mt )dt − j ⋅ ∫ f (t ) sin( mt )dt
π m
m =0
where series Fm is computed as Let’ss now allow f(t) range from –∞ to ∞, we rewrite:
Let
∞
π
ℑ{ f (t )} = F (u ) = ∫ f (t ) exp(− j 2πut )dt
Fm =
∫
−π
f (t ) cos(mt) dt −∞
Because sin(mt) is an odd function, we can write any We go from f(t) to F(u) by
odd function, f(t), as: ∞
Fourier
ℑ{ f (t )} = F (u ) = ∫ f (t ) exp(− j 2πut )dt
∑
∞
1 Transform
f (t) = Fm′ sin(mt) −∞
π
m= 0
9 12
2
2-D Fourier Transform Discrete Fourier Transform (DFT)
• The discrete Fourier transform pair that applies to
Fourier transform for f(x,y) with two variables sampled functions is given by:
∞ ∞
ℑ{ f ( x, y )} = F (u, v) = ∫ ∫ f ( x, y ) exp(− j 2π (ux + vy ))dxdy M −1
−∞ −∞
1
F (u ) =
M
∑ f ( x) exp(− j 2πux / M )
x =0
uu=0
0,1,2,…,M
1 2 M-1 1
and the inverse Fourier transform
and
∞ ∞
ℑ−1{F (u , v)} = f ( x, y ) = ∫ ∫ F (u , v) exp( j 2π (ux + vy ))dudv M −1
−∞ −∞ f ( x) = ∑ F (u ) exp( j 2πux / M ) x=0,1,2,…,M-1
u =0
13 16
• A continuous function f(x) is discretized as: • In 2-D case, the DFT pair is:
{ f ( x0 ), f ( x0 + Δx), f ( x0 + 2Δx),..., f ( x0 + ( M − 1)Δx)}
M −1 N −1
1
F (u, v) =
MN
∑∑ f ( x, y) exp(− j 2π (ux / M + vy / N ))
x =0 y = 0
u=0,1,2,…,M-1
012 1 andd v=0,1,2,…,N-1
012 1
and:
M −1 N −1
f ( x, y ) = ∑∑ F (u , v) exp( j 2π (ux / M + vy / N ))
u =0 v =0
Let x denote the discrete values (x=0,1,2,…,M-1), • The Fourier transform of a real function is generally
i.e. complex and we use polar coordinates:
3
Fourier Transform: shift Edge Effect on FT
ℑ{ f ( x, y )} = F (u, v)
ℑ{ f ( x, y )(−1) x + y } = F (u − M / 2, v − N / 2)
Shift
19 22
F (u , v) = F * (−u , −v)
• The magnitude of FT is symmetric:
F (u , v) = F (−u , −v)
20 23
21 24
4
Image Frequency Domain
(log magnitude)
FT v Detail
u
IFT
General
appearance
25 28
IFT
5% 10 % 20 % 50 %
IFT
26 29
27 30
5
Frequency Domain Filtering Ideal low-pass filter (ILPF)
31 34
g(x,y)=h(x,y)*f(x,y) Convolution in
Time Domain
– f(x
f(x,y)
y) is the input image
– g(x,y) is the filtered
Frequency domain
– h(x,y): impulse response
• Filtering in Frequency Domain with H(u,v) is
equivalent to filtering in Spatial Domain with f(x,y). Spatial domain
32 35
Examples of Filters
FT
Frequency
domain
ringing
and
Ideal in frequency g
blurring
Gaussian lowpass filter Gaussian highpass filter domain means
non-ideal in
Spatial
domain spatial domain,
vice versa.
33 36
6
Butterworth Lowpass Filters (BLPF) Gaussian Lowpass Filters (GLPF)
• Smooth transfer function, 1
• Smooth transfer function,
no sharp discontinuity, H (u, v) = 2n smooth impulse −
D 2 ( u ,v )
⎡ D(u , v) ⎤
H (u, v) = e 2 D 0
2
no clear cutoff 1+ ⎢ ⎥ response, no ringing
frequency. ⎣ D0 ⎦
1
2
37 40
Frequency
domain
Spatial
1 domain
H (u, v) = 2n
⎡ D(u , v) ⎤
1+ ⎢ ⎥
⎣ D0 ⎦
38 41
No serious
ringing No ringing
artifacts artifacts
39 42
7
Examples of Lowpass Filtering
43 46
44 47
1
• Butterworth: | H (u , v) |2 = 2n
⎡ D0 ⎤
1+ ⎢ ⎥
⎣ D (u , v ) ⎦
2
( u ,v ) / 2 D02
• Gaussian: H (u, v) = 1 − e − D
45 48
8
Butterworth High-pass Filtering Laplacian in Frequency Domain
∂ 2 f ( x , y ) ∂ 2 f ( x, y )
ℑ[ + ] = −(u 2 + v 2 ) F (u, v)
∂x 2 ∂y 2
H1 (u, v ) = −(u 2 + v 2 )
Frequency
Spatial domain
∂ f
2
∂ f domain
2
∇2 f = + Laplacian operator
∂x 2 ∂y 2
49 52
50 53
Spatial g ( x , y ) = f ( x , y ) − ∇ 2 f ( x, y )
domain
Gaussian filter H(u,v) Frequency
Original image G (u , v) = F (u , v) + (u 2 + v 2 ) F (u , v)
domain
new operator H 2 (u , v) = 1 + (u 2 + v 2 ) = 1 − H 1 (u , v)
Filtered image and its FT Laplacian
51 54
9
An image formation model
• We can view an image f(x,y) as a product of two
components:
f ∇2 f
f (x , y ) = i (x , y ) ⋅ r (x , y )
0 < i( x, y ) < ∞
0 < r(x, y) < 1
55 58
56 59
Homomorphic Filtering
ln : z(x, y) = ln f (x, y) = ln i(x, y) + ln r (x, y)
DFT : Z (u , v ) = F i (u , v ) + F r (u , v )
H(u,v) : S ( u , v ) = H ( u , v ) Z (u , v )
(DFT)-1 : s ( x, y ) = i ' ( x, y ) + r ' ( x, y )
exp : g ( x, y ) = e s ( x , y ) = i0 ( x, y ) r0 ( x, y )
57 60
10
Homomorphic Filtering Homomorphic Filtering: Example 2
61 64
Homomorphic Filtering
End of Lecture
62 65
63
11