Download FFT: Math Preliminaries

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Image Processing
Math Review Towards
Fourier Transform
• Linear Spaces
• Change of Basis
• Cosines and Sines
• Complex Numbers
1
Part I:
Vector Spaces and Basis Vectors
2
Basis Vectors
• A given vector value is represented with
respect to a coordinate system.
• The coordinate system is arbitrarily
chosen.
• A coordinate system is defined by a set
of linearly independent vectors forming
the system basis.
• Any vector value is represented as a
linear sum of the basis vectors.
a= 0.5 *v1+1*v2 (0.5 , 1)v
v1
a
• v1, v2 are basis vectors
• The representation of a with
respect to this basis is (0.5,1)
v2
3
Orthonormal Basis Vectors
• If the basis vectors are mutually
orthogonal and are unit vectors, the
vectors form an orthonormal basis.
• Example: The standard basis is
orthonormal:
V1=(1 0 0 0 …)
V2=(0 1 0 0 …)
V3=(0 0 1 0 …)
….
V2=(0 1)
a
V1=(1 0)
4
Change of Basis
u2
v2
u1
a
v1
• Question: Given a vector av, represented in an
orthonormal basis {vi} , what is the
representation of av in a different orthonormal
basis {ui}?
• Answer:
a u i   a v , u i
a v   a u i  u i
i
where
c, b  cT b   ci  bi 
i
5
Change of Basis: Matrix Form
u2
v2
u1
a
v1
• Defining the new basis as a collection of
columns in a matrix form
U  u1
u2  un 
au  U av
av  U au
T
6
Signal (image) Transforms
1. Basis Functions.
2. Method for finding the transform
coefficients given a signal.
3. Method for finding the signal given
the transform coefficients.
7
The Orthonormal Standard Basis - 1D
Wave Number
0
N = 16
1
2
3
4
5
6
7
8
9
Standard Basis Functions - 1D
8
The Orthonormal Hadamard Basis – 1D
Wave Number
0
N = 16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
9
Hadamard Transform
Standard Basis
New Basis
Grayscale Image
Transformed Image
Transform Coordinate
spatial Coordinate
Standard Basis:
[ 2 1 6 1 ]standard=
2[ 1 0 0 0 ] + 1[ 0 1 0 0 ] + 6[ 0 0 1 0 ] + 1[ 0 0 0 1 ]
Hadamard Transform:
[ 2 1 6 1 ]standard =
=
5 [ 1 1 1 1 ]/2
+ -2 [ 1 1 -1 -1 ] /2 +
2 [ -1 1 1 -1 ] /2 + -3 [ -1 1 -1 1 ] /2
 [ 5 -2 2 -3 ]
Hadamard
10
Finding the transform coefficients
Signal:
X = [ 2 1 6 1]
standard
Hadamard Basis:
T0 = [ 1 1 1 1 ] /2
T1 = [ 1 1 -1 -1 ] /2
T2 = [ -1 1 1 -1 ] /2
T3 = [ -1 1 -1 1 ] /2
Hadamard Coefficients:
a0 = <X,T0 > = < [ 2 1 6 1 ] , [ 1 1 1 1 ] > /2 = 5
a1 = <X,T1 > = < [ 2 1 6 1 ] , [ 1 1 -1 -1 ] > /2 = -2
a2 = <X,T2 > = < [ 2 1 6 1 ] , [ -1 1 1 -1 ] > /2 = 2
a3 = <X,T3 > = < [ 2 1 6 1 ] , [ -1 1 -1 1 ] > /2 = -3
Signal:
[ 2 1 6 1]
Standard
 [ 5 -2 2 -3 ]
Hadamard
11
Grayscale
Image
X Coordinate
V Coordinates
Y Coordinate
Transforms: Change of Basis - 2D
Transformed
Image
U Coordinates
The coefficients are arranged in a 2D array.
12
Hadamard Basis Functions
size = 8x8
Black = +1 White = -1
13
Transforms: Change of Basis - 2D
Standard Basis:
[
2
1
6
1
1 0
0 0
0 1
0 0
+ 6
0 0
1 0
0 0
0 1
] [ ] [ ] [ ] [ ]
= 2
+ 1
+ 1
Hadamard Transform:
[
2
1
6
1
] [ ]
= 5

[
1 1
1 1
-1 1
-1 1
-2
+2
-3
1 1 /2
-1 -1 /2
1 -1 /2
-1 1 /2
5
-2
2
-3
[ ] [ ]
]
[ ]
Hadamard
14
Finding the transform coefficients
X =
Signal:
[
2
1
6
1
]
standard
New Basis:
1 1
T11 =
1 1
1 1
T12 =
-1 -1
-1 1
T21 =
1 -1
-1 1
T22 =
-1 1
[ ]/2
[ ]/2
[ ]/2
[ ]/2
Signal:
X = a11T11 +a12T12 + a21T21 + a22T22
New Coefficients:
a11 =
a12 =
a21 =
a22 =
<X,T11 > =
<X,T12 > =
<X,T21 > =
<X,T22 > =
X 
sum(sum(X.*T11)) =
sum(sum(X.*T12)) =
sum(sum(X.*T21)) =
sum(sum(X.*T22)) =
[
5
2
-2
-3
]
5
-2
2
-3
new
15
Standard Basis:
[
2
1
6
1
1 0
0 0
0 1
0 0
0 0
1 0
0 0
0 1
[ ] [ ]
]
coefficients
[ ] [ ]
Standard
Basis Elements
Hadamard Transform:
[
5
-2
2
-3
]
coefficients
1 1
1 1 /2
1 1
-1 -1 /2
-1 1
1 -1 /2
-1 1
-1 1 /2
[ ] [ ]
Hadamard
[ ] [ ]
Hadamard
Basis Elements
16
Part II:
Sines and Cosines
17
Wavelength and Frequency of
Sine/Cosin
1
sin()

cos()
1
sinx 
1
x
2
– The wavelength of sin(x) is 2 .
– The frequency is 1/(2) .
18
sinx 
1
x
2
sin2x 
1
x
2/2
sinkx 
1
x
2 / k
19
– Define K=2
sin2πωx 
1
x
1
ω
– The wavelength of sin(2x) is 1/ .
– The frequency is  .
20
– Changing Amplitude:
A sin2πωx 
A
x
– Changing Phase:
A sin2πωx  φ

2
x
21
Sine vs Cosine
sin(x) = cos(x) with a phase shift of /2.
}
/2
sin(x) + cos(x) = ?
22
Sine vs Cosine
sin(x) + cos(x) = sin(x) scaled by 2 with
a phase shift of /4.
3 sin(kx) + 4 cos(kx) = sin(kx) with amplitude
scaled by 5 and phase shift of 0.3
3 sin(kx)
4 cos(kx)
5 sin(kx + 0.3)
23
Combining Sine and Cosine
• If we add a Sine wave to a Cosine
wave with the same frequency we get
a scaled and shifted (Co-) Sine wave
with the same frequency:
a sin kx  b coskx  R sin kx   
b
where R  a  b and   tan  
a
2
2
• What is the result if a=0?
• What is the result if b=0?
1
(prove it!)
tan()
24
Part III:
Complex Numbers
25
Complex Numbers
Imaginary
(a,b)
b
The Complex Plane

Real
a
• Two kind of representations for a point
(a,b) in the complex plane
– The Cartesian representation:
Z  a  ib
where i 2  1
– The Polar representation:
Z  Reiθ
(Complex exponential)
• Conversions:
– Polar to Cartesian:
Reiθ  R cosθ  iR sinθ
– Cartesian to Polar
a  ib  a  b e
2
2
i tan 1  b / a 
26
• Conjugate of Z is Z*:
– Cartesian rep.
a  ib 
– Polar rep.
Re 

iθ 
 a  ib
 Re  iθ
Imaginary
a  ib  Reiθ
b
R

-
a
Real
R
-b
a  ib  Reiθ
27
Algebraic operations:
• addition/subtraction:
(a  ib)  (c  id)  (a  c)  i(b  d)
• multiplication:
a  ib c  id   ac  bd  ibc  ad
Aeiα Beiβ  ABei α β 
• inner Product:
(a  ib), (c  id )  (a  ib)* (c  id )  (a  ib)(c  id )
• norm:
a  ib  a  ib  a  ib   a 2  b2

2
Re
iθ 2
 Re
 Re
iθ 
iθ
 Reiθ Reiθ  R 2
28
Number Multiplication
Im
A*B


i
Re
i
Ae Be  ABe
i    
29
The (Co-) Sinusoid
e  cos  i sin
i
• The (Co-)Sinusoid as complex exponential:
e ix  e ix
cosx  
2
e ix  e ix
sin x  
2i
Or
cosx   Reale

sinx   Imag e 
ix
ix
• What about generalization?
S sin(kx) + C cos(kx) = ?
30
We saw that :
S sin(kx) + C cos(kx) = R sin(kx + )
where
1  C 
2
2




R
tan 
S C and
S 
Using Complex exponentials:
Scaling and phase shifting can be
represented as a multiplication with Z  Re i
R sin kx     Imag ( R e e )
i
ikx
 Imag (Z eikx )
and also
R sin kx     21i ( R ei eikx  R ei eikx )
 (Z e  Z e
1
2i
ikx
*
ikx
)
31
THE END
32
Related documents