Chap 4-2. Frequency domain processing
Jen-Chang Liu, 2006
Extend to 2-D DFT from 1-D
2-D DFT: 1-D DFT in horizontal then vertical
1
0
1
0
)(2),(
1),(
N
y
M
x
yM
vx
M
uj
eyxfMN
vuF
1
0
1
0
)(2),(),(
M
u
N
v
yM
vx
M
ujevuFyxf
Complex Quantities to Real Quantities
Useful representation2/122 )],(),([),( vuIvuRvuF
]),(
),([tan),( 1
vuR
vuIvu
magnitude
phase
),(),(),(),( 222vuIvuRvuFvuP
Power spectrum
Real part
2d DFT basis functions
127,...,2,1,0,127,...,2,1,0,),()
128
1
128
0(2
yxeyxeyxj
1
0
1
0
)(2),(),(
M
u
N
v
yM
vx
M
ujevuFyxf
iDFT:
將影像用 )(2 yN
vx
M
uje
合成,其中(u, v) 代表頻率
DFT
More DFT basis (real part)
(u,v)=(0,2)
(0,30)
u
v
(0,63)
(1,1)
(1,30)
(30,30)
(1,0)
Example: reconstruction from DFT coefficients
1
0
1
0
)(2),(),(
M
u
N
v
yM
vx
M
ujevuFyxf
…Zigzag scan
Example: reconstruction from DFT coefficients
http://www.ncnu.edu.tw/~jcliu/course/dip2005/lenaidft.m
Notes on showingDFT
Lena 256x256
F=fft2(I);imshow(abs(F), [])
F(1,1)=7761921 F(1,127)=334.79+10i
imshow(log(abs(F)), [])
Log transformations
s = c log(1+r)
Compress the dynamic range of images with large variation in pixel values
M
N
M/2
N/2
0
Periodicity and conjugate symmetry property of 2-D DFT
Outline
Frequency domain operations Smoothing Frequency Domain Filters Sharpening Frequency Domain Filters Homomorphic Filtering
mask coefficients
underlying neighborhood
X (product) output
Convolution – 2-D case
2d convolution 旋積
Masking operation
1
0
1
0
),(),(1
),(),(),(M
m
N
n
nymxhnmfMN
yxhyxfyxg
1
0
1
0
),(),(1
),(M
m
N
n
ynxmhnmfMN
yxg
Convolution theorem
),(),(),(),( vuHvuFyxhyxf
f:image
Fouriertransform
F
h: filter or mask
Fouriertransform
H
Timedomain
Frequencydomain
convolution
multiplication
Filtering in the frequency domain
fftshift
Outline
Frequency Domain Operations Smoothing Frequency Domain Filters Sharpening Frequency Domain Filters Homomorphic Filtering
Smoothing frequency-domain filters
Design issue G(u,v)=F(u,v) H(u,v) Remove high freq. component (details,
noise, …) Ideal low-pass filter Butterworth filter Gaussian filter
More smoothin the edge ofcut-off frequency
Ideal low-pass filter
Sharp cut-off frequency
0
0
),( if 0
),( if 1),(
DvuD
DvuDvuH
where D(u,v) is the distance to the center freq.
2/122 ])2/()2/[(),( NvMuvuD
Ideal low-pass filter (cont.)
Cut-off freq.
Ideal low-pass filter (con.t)
ILPF can not be realized in electronic components, but can be implemented in a computer
Decision of cut-off freq.? Measure the percentage of image power
within the low freq.
freqoffcutvu
TPvuP ),(
/)],([100
1
0
1
0
),(M
u
N
vT vuPPTotal image power
ILPF: distribution of image power
original Freq.
99.5
98
96.4
94.692
original =92D0=5
=94.6D0=15
=96.4D0=30
=98D0=80
=99.5D0=230
Ideal low-passfiltering
Ringingeffect
Effects of ideal low-pass filtering
Blurring and ringing
ILPF: Freq.
F-1
blurring
ringing
ILPF: spatial
Effects of ideal low-pass filtering (cont.)
spatial
impulse
ILPF
spatial
Butterworth low-pass filters
nDvuDvuH
20 ]/),([1
1),(
H=0.5 whenD(u,v)=D0
Order of butterworth filters
n=1 n=2 n=5 n=20
Spatial domain filter of butterworth filters
Ringing likeIdeal LPF
Butterworth filtersOrder = 2
original D0=5
D0=15 D0=30
D0=80 D0=230
Gaussian low-pass filters
20
2 2/),(),( DvuDevuH Variance orcut-off freq.
D(u,v)=D0
H = 0.607
Gaussian smoothing
original D0=5
D0=15 D0=30
D0=80 D0=230
Practical applications: 1
444x508 GLPF, D0=80
斷點
Practical applications: 2
GLPF, D0=100
GLPF, D0=80
1028x732
Practical applications: 3
588x600 GLPF, D0=30 GLPF, D0=10
Scan line
Outline
Frequency Domain Operations Smoothing Frequency Domain Filters Sharpening Frequency Domain Filters Homomorphic Filtering
Sharpening frequency-domain filters
Image details corresponds to high-frequency Sharpening: high-pass filters Hhp(u,v)=1-Hlp(u,v)
Ideal high-pass filters Butterworth high-pass filters Gaussian high-pass filters Difference filters
Laplacian filters
Ideal HPF
Butterworth HPF
Gaussian HPF
Spatial-domain HPF
ideal Butterworth Gaussian
negative
Ideal high-pass filters
0
0
),( if 1
),( if 0),(
DvuD
DvuDvuH
D0=15 D0=30 D0=80ringing
original
Butterworth high-pass filters
nvuDDvuH
20 )],(/[1
1),(
n=2, D0=15 D0=30 D0=80
Gaussian high-pass filters
20
2 2/),(1),( DvuDevuH
D0=15 D0=30 D0=80
Laplacian frequency-domain filters
Spatial-domain Laplacian (2nd derivative)
Fourier transform
2
2
2
22
y
f
x
ff
)()()(
uFjux
xf nn
n
),()(
),()(),()(),(),(
22
222
2
2
2
vuFvu
vuFjvvuFjuy
yxf
x
yxf
Laplacian frequency-domain filters
2
2
2
22
y
f
x
ff
Inputf(x,y)
Laplacian
F(u,v)F
F-(u2+v2)F(u,v)
-(u2+v2)
The Laplacian filter in the frequency domain isH(u,v) = -(u2+v2)
0
frequency
spatial
H(u,v) = -(u2+v2)
original Laplacian
ScaledLaplacian
original+Laplacian
Outline
Frequency Domain Operations Smoothing Frequency Domain Filters Sharpening Frequency Domain Filters Homomorphic Filtering
Image Formation Model
Illumination source
scene
reflection
eye
Homomorphic filtering
Image formation model f(x,y)=i(x,y) r(x,y)
illumination: reflectance:
Slow spatial variations vary abruptly, particularlyat the junctions of dissimilarobjects
Homomorphic filtering Product term
Log of product f(x,y)=i(x,y) r(x,y)=> ln f(x,y)=ln i(x,y)+ ln r(x,y)
)},({)},({)},(),({),( yxryxiyxryxiyxf
)},({ln)},({ln
)},(ln),({ln)},({ln
yxryxi
yxryxiyxf
Separation of signal source:
Homomorphic filtering approach
ln i(x,y)
ln r(x,y)
illumination
reflection
filtering
How to identify the illumination and reflection?
Illumination -> low frequency Reflection -> high frequency
Radius fromthe origin
Example filter: sharpening
illumination reflection
Homomophic filtering: example
original Homomorphic filtering