Procedure Conventions & The Stack Jen-Chang Liu, Spring 2006 Adapted from cs61c
Image Enhancement in the Frequency Domain Spring 2006, Jen-Chang Liu.
-
Upload
jerome-charles -
Category
Documents
-
view
229 -
download
3
Transcript of Image Enhancement in the Frequency Domain Spring 2006, Jen-Chang Liu.
Image Enhancement in the Frequency Domain
Spring 2006, Jen-Chang Liu
Outline Introduction to the Fourier Transform and
Frequency Domain Magnitude of frequencies Phase of frequencies Fourier transform and DFT
Filtering in the frequency domain Smoothing Frequency Domain Filters Sharpening Frequency Domain Filters Homomorphic Filtering Implementation of Fourier transform
Background
1807, French math. Fourier Any function that periodically repeats itself
can be expressed as the sum of of sines and/or cosines of different frequencies, each multiplied by a different coefficient (Fourier series)
Periodic function
f(t) = f(t+T), T: period (sec.) 1/T: frequency (cycles/sec.)
Periodic function f
Frequency Weightf1 w1
f2 w2
f3 w3
f4 w4
How to measure weights? Assume f1 , f2 , f3 , f4 are known
How to measure w1 , w2 , w3 , w4 ?
)()()()()( 44332211 tfwtfwtfwtfwtf
min dttfwtfwtfwtfwtf ))]()()()(()([ 244332211
Minimize squared error
Minimize MSE calculation
dttfwtfwtfwtfwtf ))]()()()(()([ 244332211
min ),,,( 4321 wwwwF
dtffw
ffwwffw
ffwwffwwffw
ffwwffwwffwwffw
fwfwfwfwf
)2
22
222
2222
(
44
343433
2442233222
14411331122111
24
24
23
23
22
22
21
21
2
Orthogonal condition
f1 and f2 are orthogonal if
f1 , f2 , f3 , f4 are orthogonal to each other
正交
0)()(, 2121 dttftfff
),,,( 4321 wwwwF
dtffwffwffwffw
fwfwfwfwf
)2-2-2-2
(
44332211
24
24
23
23
22
22
21
21
2
Minimization calculation To satisfy min ),,,( 4321 wwwwF
We have 022 12
111
fffww
F
dtffwffwffwffw
fwfwfwfwf
)2-2-2-2
(
44332211
24
24
23
23
22
22
21
21
2
=>
21
1
1f
ffw
2
1
1,
f
ff
Recall in linear algebra: projection
Weight = Projection magnitude
Represent input f(x) with another basis functions
v
Vector space
(1,0)
projection
Functional space
f
f1
Summary 1
A function f can be written as sum of f1 , f2 , f3 , …
i
ii tfwtf )()(
If f1 , f2 , f3 , … are orthogonal to each other
2
,
i
ii
f
ffw Weight (magnitude)
Summary 1: sine, cosine bases
Let f1 , f2 , f3 , … carry frequency information Let them be sines and cosines
otherwise 0
0 if 2
1 if
)cos()cos( kn
kn
dtktntn, k:integers
otherwise 0
1 if )sin()sin(
kndtktnt
kndtktnt , integers allfor 0)cos()sin(
=> They all satisfy orthogonal conditions
Summary 1: orthogonal
Fourier series For 20 ),( ttf (Assume periodic outside)
)sin()cos()(1
0 ktbktaatf kk
k
,...,,,,,, 3322110 bababaa
DC頻率 =1 頻率 =2 頻率 =3
Outline Introduction to the Fourier Transform and
Frequency Domain Magnitude of frequencies Phase of frequencies Fourier transform and DFT
Filtering in the frequency domain Smoothing Frequency Domain Filters Sharpening Frequency Domain Filters Homomorphic Filtering Implementation of Fourier transform
Correlation with different phase
Weight calculation2
1
11
,
f
ffw
相關係數
f1
f
相位
Correlation with different phase (cont.)
Weight calculation2
1
11
,
f
ffw
相關係數 ?
f1
f
Deal with phase: method 1
For example, expand f(t) over the cos(wt) basis function Consider different phases )cos( wt
dtwttfCorr )cos()()(
0 2
Corr(
Problem: weight(w, )
Deal with phase: method 2
Complex exponential as basis
)sin()cos( tjte jt
j
1
cos
sinrealWith frequency w:
)sin()cos( wtjwte jwt
Advantage: Derive magnitude and phase simultaneously
1j
Deal with phase 2: example
Input )cos()( ttf
2
0)cos( dtet jt
dtetdtet jtjt
2
0
2
0)sin()sin()cos()cos(
jtetw ),cos(
dtttjdttt
2
0
2
0)sin()sin()sin()cos()cos()cos(
jej )sin()cos(magnitude
phase
Fourier series with phase For 20 ),( ttf (Assume periodic outside)
00
)sin(cos)(k
kk
jktk ktjktwewtf
,...,,, 3210 wwww
DC
頻率 k=1 k=2k=3
Complex weight
Outline Introduction to the Fourier Transform and
Frequency Domain Magnitude of frequencies Phase of frequencies Fourier transform and DFT
Filtering in the frequency domain Smoothing Frequency Domain Filters Sharpening Frequency Domain Filters Homomorphic Filtering Implementation of Fourier transform
Fourier transform
Functions that are not periodic can be expressed as the integral of sines and/or cosines multiplied by a weighting functions Frequency up to infinity
Perfect reconstructionFunctions -- Fourier transform
Operation in frequency domainwithout loss of information
1-D Fourier Transform
Fourier transform F(u) of a continuous function f(x) is:
dxexfuF uxj 2)()(
dueuFxf uxj 2)()(
Inverse transform:
1j
Forward Fourier transform:
2-D Fourier Transform
Fourier transform F(u,v) of a continuous function f(x,y) is:
dudvevuFyxf vyuxj )(2),(),(
Inverse transform:
x
y
u
vF
Future development
1950, fast Fourier transform (FFT) Revolution in the signal processing
Discrete Fourier transform (DFT) For digital computation
1-D Discrete Fourier Transform
f(x), x=0,1,…,M-1 . discrete function F(u), u=0,1,…,M-1. DFT of f(x)
1
0
2)(
1)(
M
x
xM
uj
exfM
uF
1
0
2)()(
M
u
xM
ujeuFxf
Inverse transform:
Forward discrete Fourier transform:
Frequency Domain 頻率域 Where is the frequency domain?
sincos je j
j
1
cos
sin
]2sin2)[cos(1
)(1
0
xM
ujx
M
uxf
MuF
M
x
Euler’s formula:
frequency
u
F(u)
Fouriertransform
Physical analogy
Mathematical frequency splitting Fourier transform
Physical device Galss prism 三稜鏡 Split light into frequency components
F(u) Complex quantity? Polar coordinate
real
imaginary
m
)()(
)()()(ujeuF
ujIuRuF
2/122 )]()([)( uIuRuF
])(
)([tan)( 1
uR
uIu
magnitude
phase
)()()()( 222uIuRuFuP Power spectrum
Some notes about sampling in time and frequency axis
Time index
Frequency index
Also follow reciprocal property
1,...,1,0 )()( 0
Mxxxxfxf
])1( ...., , , [ 000 xMxxxx
1,...,1,0 )()(
MuuuFuF
xu 1
Extend to 2-D DFT from 1-D
2-D: x-axis then y-axis
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
DFT: example
log(F)
Properties in the frequency domain
Fourier transform works globally No direct relationship between a specific
components in an image and frequencies Intuition about frequency
Frequency content
Rate of change of gray levels in an image
+45,-45 degree
artifacts