Lecture4 Enhancement Frequency
Lecture4 Enhancement Frequency
Image Enhancement in
Frequency Domain
Image Enhancement
2
Fourier Transform: a review
• Basic ideas:
A periodic function can be
represented by the sum of
sines/cosines functions of
different frequencies,
multiplied by a different
coefficient.
Non-periodic functions can
also be represented as the
integral of sines/cosines
multiplied by weighing
function.
3
Fourier transform
basis functions
Approximating a
square wave as the
sum of sine waves.
4
Any function can be written as the
sum of an even and an odd function
E ( x) [ f ( x) f ( x)] / 2
E(-x) = E(x)
O( x) [ f ( x) f ( x)] / 2
O(-x) = -O(x)
f ( x ) E ( x ) O ( x )
5
Fourier Cosine Series
Because cos(mt) is an even function, we can write an even
function, f(t), as:
1
f(t) Fm cos(mt)
m 0
where series Fm is computed as
Fm
f (t ) cos(mt ) dt
6
Fourier Sine Series
f (t)
1
m0
Fmsin(mt)
Fm
f (t ) sin(mt ) dt
7
Fourier Series
Fm
f (t) cos(mt) dt Fm
f (t) sin(mt) dt
8
Our Interest in Fourier Transform
903/
Applications of Fourier Transforms
1003/
Filters to be Discussed
1103/
The Fourier Transform
Let F(m) incorporates both cosine and sine series coefficients,
with the sine series distinguished by making it the imaginary
component:
f (t ) F (u ) f (t ) exp( j 2ut )dt
F(u) is called the Fourier Transform of f(t). We say that f(t)
lives in the “time domain,” and F(u) lives in the “frequency
domain.” u is called the frequency variable.
12
The Inverse Fourier Transform
Inverse
1F (u ) f (t ) F (u ) exp( j 2ut )du Fourier
Transform
13
2-D Fourier Transform
{F (u , v)} f ( x, y )
1
F (u, v) exp( j 2 (ux vy ))dudv
14
Discrete Fourier Transform (DFT)
• A continuous function f(x) is discretized as:
{ f ( x0 ), f ( x0 x), f ( x0 2x),..., f ( x0 ( M 1)x)}
15
Discrete Fourier Transform (DFT)
16
Discrete Fourier Transform (DFT)
• The discrete Fourier transform pair that applies to
sampled functions is given by:
M1
1
F (u )
M
f ( x) exp( j 2ux / M )
x 0
u=0,1,2,…,M-1
and
M 1
f ( x) F (u ) exp( j 2ux / M ) x=0,1,2,…,M-1
u 0
17
2-D Discrete Fourier Transform
F (u , v) R (u , v) j I (u , v)
Polar coordinate
F (u , v) F (u , v) exp( j (u , v))
Magnitude: F (u , v) [ R 2 (u , v) I 2 (u , v )]1/ 2
I (u , v)
1
Phase: (u, v) tan
R (u , v)
19
Fourier Transform: shift
• It is common to multiply input image by (-1)x+y prior to
computing the FT. This shift the center of the FT to (M/2,N/2).
f ( x, y ) F (u , v)
f ( x, y )( 1) x y F (u M / 2, v N / 2)
Shift
20
Symmetry of FT
*
F (u , v) F ( u , v)
• The magnitude of FT is symmetric:
F (u , v) F ( u , v)
21
FT
IFT
22
IFT
IFT
23
The central part of FT, i.e.
the low frequency
components are responsible
for the general gray-level
appearance of an image.
24
Frequency Domain Filtering
25
Filtering using Fourier Transforms
2603/
Frequency Domain Filtering
27
Convolution Theorem
Multiplication in
G(u,v)=F(u,v)●H(u,v) Frequency Domain
g(x,y)=h(x,y)*f(x,y) Convolution in
Time Domain
– f(x,y) is the input image
– g(x,y) is the filtered
– h(x,y): impulse response
• Filtering in Frequency Domain with H(u,v) is
equivalent to filtering in Spatial Domain with f(x,y).
28
Examples of Filters
Frequency
domain
Spatial
domain
29
Ideal low-pass filter (ILPF)
1 D(u, v) D0
H (u, v)
0 D(u, v) D0
2 2 1/ 2
D(u , v) [(u M / 2) (v N / 2) ]
30
Shape of ILPF
Frequency domain
Spatial domain
31
FT
ringing
and
Ideal in frequency blurring
domain means
non-ideal in
spatial domain,
vice versa.
32
Butterworth Lowpass Filters (BLPF)
• Smooth transfer function, 1
no sharp discontinuity, H (u, v) 2n
D(u , v)
no clear cutoff 1
D0
frequency.
1
2
33
Butterworth Lowpass Filters (BLPF)
1
H (u , v) 2n
D(u , v)
1
D0
34
No serious
ringing
artifacts
35
Gaussian Lowpass Filters (GLPF)
• Smooth transfer function,
2
smooth impulse
D ( u ,v )
2 D 20
response, no ringing H (u , v) e
36
GLPF
Frequency
domain
Spatial
domain
37
No ringing
artifacts
38
Examples of Lowpass Filtering
39
Examples of Lowpass Filtering
40
Sharpening High-pass Filters
• Hhp(u,v)=1-Hlp(u,v)
1 D(u, v) D0
• Ideal: H (u, v)
0 D(u, v) D0
2 1
• Butterworth: | H (u , v) | 2n
D0
1
D (u , v )
D 2 ( u ,v ) / 2 D02
• Gaussian: H (u , v) 1 e
41
42
High-pass Filters
43
Ideal High-pass Filtering
ringing artifacts
44
Butterworth High-pass Filtering
45
Gaussian High-pass Filtering
46
Gaussian High-pass Filtering
47
Laplacian in Frequency Domain
2 f ( x , y ) 2 f ( x, y )
[ ] 2
2
(u v ) F (u, v)
x 2
y 2
H1 (u, v) 2
(u v )2
Frequency
2 2
Spatial domain
2 f f domain
f 2 2 Laplacian operator
x y
48
49
Subtract Laplacian from the Original
Image to Enhance It
Spatial
g ( x, y ) f ( x, y ) 2
f ( x, y )
domain
Frequency
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)
Laplacian
50
f 2 f
2
f f
51
Unsharp Masking, High-boost Filtering
54
Homomorphic Filtering
55
Homomorphic Filtering
ln : z x, y ln f x, y ln ix, y ln r x, y
DFT : Z u , v Fi u , v Fr 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 )
56
Homomorphic Filtering
57
Homomorphic Filtering
58
Homomorphic Filtering: Example 1
59
Homomorphic Filtering: Example 2
60
61