Matlab Tricks - VIA Lab Home Page

Download Report

Transcript Matlab Tricks - VIA Lab Home Page

Methods in Image Analysis – Lecture 3
Fourier
George Stetten, M.D., Ph.D.
U. Pitt Bioengineering 2630
CMU Robotics Institute 16-725
Spring Term, 2006
1
Frequency in time vs. space
• Classical “signals and systems” usually temporal
signals.
• Image processing uses “spatial” frequency.
• We will review the classic temporal description first,
and then move to 2D and 3D space.
2
Phase vs. Frequency
• Phase,  , is angle, usually represented in radians.
• 2 radians  360  (circumference of unit circle)
• Frequency,  , is the rate of change for phase.

 t
• In a discrete system, the sampling frequency, s ,
is the amount of phase-change per sample.
  s n
3
Euler’s Identity
e
j
 cos  j sin

4
Phasor = Complex Number
5
multiplication = rotate and scale
j
z  x  jy  re
x1  jy1 x2  jy2 
 r1e
j1
 r1r2e
r e 
j 2
2
j 1  2 
rotateby  and scale by r.
6
Spinning phasor
  2 f
7
8
9
10
Continuous Fourier Series
0
is the Fundamental Frequency
Synthesis
x t  
Analysis

a e
k 
k
jk0t
1
 jk 0 t
ak   x t e
dt
T0 T0
11
Selected properties of Fourier Series
Fs
xt 
ak
Fs
yt  
bk
Fs
Axt   Byt 
Aak  Bbk
a k  a k
*
for real x t 
dx t  Fs
 jk 0 ak
dt
1
Fs
 xt dt  jk0 ak
12
Differentiation boosts high frequencies
13
Integration boosts low frequencies
14
Continuous Fourier Transform
F
xt 
X  
Synthesis
1
x t  
2

Analysis
 X  e d

jt
X   

 jt


x
t
e
dt


15
Selected properties of Fourier Transform
 
x t  X  
  
1
F
xt   yt  X  Y  
F

 xt 
-
2
1
dt 
2

 X  
2
d

16
Special Transform Pairs
• Impulse has all frequences
xt   t   X    1
F
• Average value is at frequency = 0
xt   1  X    2
F
• Aperture produces sync function
1,
x t   
0
t  T1
2 sin T1 
F
 X   
t  T1

17
Discrete signals introduce aliasing
Frequency is no longer
the rate of phase change
in time, but rather the
amount of phase change
per sample.
18
Sampling > 2 samples per cycle
19
Sampling < 2 samples per cycle
20
Under-sampled sine
For xt  sampledat s
s
2
is the Nyquist frequency.
21
Discrete Time Fourier Series
xn  xn  N 
assume s  N0  2
Sampling frequency is 1 cycle per second, and
fundamental frequency is some multiple of that.
ak  ak  N
Synthesis
xn 
a e
k N
k
Analysis
jk0 t
1
ak 
N
 xne
 jk0 t
k N
22
Matrix representation w  e
2
j
N
w 1
N
23
Fast Fourier Transform
• N must be a power of 2
• Makes use of the tremendous
symmetry within the F-1 matrix
• O(N log N) rather than O(N2)
24
Discrete Time Fourier Transform
assume s  2
Sampling frequency is still 1 cycle per second, but now
any frequency are allowed because x[n] is not periodic.
X e
j
  X e
j   2 
Synthesis
1
xn 
2

Analysis
 X e  e


j
jn
d

X e    xn e
j
 jn
n  
25
The Periodic Spectrum
26
Aliasing Outside the Base Band
1
4
Perceived as  sin s
27
2D Fourier Transform
F u,v  
 
Analysis
  f x, y e
 j 2  ux vy
dx dy
 
or separating dimensions,


 j 2  ux
 j 2  vy
F u,v     f x, y e
dx e
dy

 
 
f x, y  
 
Synthesis
  F u,v e
 
j 2  ux vy
du dv
28
Properties
•
•
•
•
Most of the usual properties, such as linearity, etc.
Shift-invariant, rather than Time-invariant
Parsevals relation becomes Rayleigh’s Theorem
Also, Separability, Rotational Invariance, and
Projection (see below)
29
Separability
if
f  x , y   f1  x  f 2  y 
f  x, y   F u, v 
then
F
f1  x  f 2  y   F1 u F2 v   F u, v 
F
f1  x   F1 u 
F
f 2  y   F2 v 
F
30
Rotation Invariance
 x  cos
 y   sin 
  
sin    x 



cos   y 
F
f x cos  y sin  ,  x sin   y cos 
F u cos  v sin  ,  u sin   v cos 
31
Projection
px  

 f x, y  dy

Pu   F u, 0
Combine with rotation, have arbitrary projection.
32
Gaussian
F
gx 

Gu
g1x  g2 x   g3 x 
G1uG2 u  G3 u
g3 x 
G3 u
F

seperable

e
 x2  y2
2 2

e
 x2
2 2
e
 y2
2 2
Since the Fourier Transform is also
separable, the spectra of the 1D
Gaussians are, themselves, separable.
33
Hankel Transform
For radially symmetrical functions
f  x, y   f r r , r  x  y
2
2
F u, v   Fr q , q  u  v
2
F u, v  
  
  f  x, y  e
2
2
2
 j 2 ux  vy 
dx dy 
  


0
2  j 2qr cos 
f r r   e
d  r dr  Fr q 
0

34
Elliptical Fourier Series for 2D Shape
Parametric function, usually
with constant velocity.
xt  ak
Fs
yt bk
Fs
center  a0, b0 
Truncate harmonics to smooth.
35
Fourier shape in 3D
• Fourier surface of 3D shapes (parameterized on
surface).
• Spherical Harmonics (parameterized in spherical
coordinates).
• Both require coordinate system relative to the
object. How to choose? Moments?
• Problem of poles: singularities cannot be avoided
36
Quaternions – 3D phasors
a  a1  ia2  ja3  ka4
i  j  k  ijk  1
2
2
2
a  a1  ia2  ja3  ka4
*

a  a  a2  a  a4
2
1
2
2
3
2

1
2
a  b  a1  b1   ia2  b2   ja3  b3   k a4  b4 
Product is defined such that rotation by arbitrary angles from
arbitrary starting points become simple multiplication.
37
Summary
• Fourier useful for image “processing”, convolution
becomes multiplication.
• Fourier less useful for shape.
• Fourier is global, while shape is local.
• Fourier requires object-specific coordinate system.
38