Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 •...
Transcript of Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 •...
![Page 1: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/1.jpg)
Image Processing - Lesson 5
• Introduction to Fourier Transform
• Image Transforms
• Basis to Basis
• Fourier Basis Functions
• Fourier Coefficients
• Fourier Transform - 1D
• Fourier Transform - 2D
Fourier Transform - Part I
![Page 2: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/2.jpg)
The Fourier Transform
Jean Baptiste Joseph Fourier
![Page 3: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/3.jpg)
Efficient Data Representation
• Data can be represented in many ways.
• There is a great advantage using an appropriate representation.
• It is often appropriate to view images as combinations of waves.
![Page 4: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/4.jpg)
How can we enhance such an image?
![Page 5: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/5.jpg)
Solution: Image Representation
2 1 3
5 8 7
0 3 5
= 1 0 0
0 0 0
0 0 0
2 + 1
0 1 0
0 0 0
0 0 0
0 0 1
0 0 0
0 0 0
+ 3 + 5
0 0 0
1 0 0
0 0 0
+
+ ...
= 3 + 5 +
+ 10 + 23 + ...
![Page 6: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/6.jpg)
The inverse Fourier Transform
• For linear-systems we saw that it is convenient to represent a signal f(x) as a sum of scaled and shifted sinusoids.
( ) ωωω
πω deFxf xi∫= 2)(
How is this done?
![Page 7: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/7.jpg)
X Coordinate
Grayscale Image
[ a1 a2 a3 a4 ] =
a1 [ 1 0 0 0 ] + a2 [ 0 1 0 0 ] + a3 [ 0 0 1 0 ] + a4 [ 0 0 0 1 ]
Hadamard Transform:
1. Basis Functions.2. Method for finding the image given the transform coefficients. 3. Method for finding the transform coefficients given the image.
Standard Basis:
Transforms: Change of Basis
Frequency Coordinate
Fourier Image
Standard Basis New Basis
[ 2 1 0 1 ] =
= 1 [ 1 1 1 1 ] + 1/2 [ 1 1 -1 -1 ] - 1/2 [ -1 1 1 -1 ] + 0 [ -1 1 -1 1 ]
= [ 1 1/2 -1/2 0 ]Hadamard
![Page 8: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/8.jpg)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Wave Number
Hadamard Basis Functions - 1D
N = 16
![Page 9: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/9.jpg)
X = [ 2 1 0 1 ] standard
New Basis:
Finding the transform coefficients
T0 = [ 1 1 1 1 ]T1 = [ 1 1 -1 -1 ]T2 = [ -1 1 1 -1 ]T3 = [ -1 1 -1 1 ]
Signal:
New Coefficients:
a0 = <X,T0 > =< [ 2 1 0 1 ] , [ 1 1 1 1 ] > /4 = 1a1 = <X,T1 > =< [ 2 1 0 1 ] , [ 1 1 -1 -1 ] > /4 = 1/2
a2 = <X,T2 > =< [ 2 1 0 1 ] , [ -1 1 1 -1 ] > /4 = -1/2
a3 = <X,T3 > =< [ 2 1 0 1 ] , [ -1 1 -1 1 ] > /4 = 0
X = [ 1 1/2 -1/2 0 ] newSignal:
![Page 10: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/10.jpg)
1. Basis Functions.2. Method for finding the image given the transform coefficients. 3. Method for finding the transform coefficients given the image.
X Frequency
Y F
requ
ency
X Coordinate
Y C
oord
inat
e
Grayscale Image
FourierImage
1 00 0[ ]a11 a12
a21 a22[ ] 0 1
0 0[ ] 0 01 0[ ] 0 0
0 1[ ]+ a22+ a21+ a12= a11
Hadamard Transform:
1 11 1[ ]2 1
1 0[ ] 1 -11 -1[ ] -1 -1
1 1[ ] -1 11 -1[ ]+ 0- 1/2+ 1/2= 1
1 1/2-1/2 0[ ]=
Standard Basis:
Hadamard
Transforms: Change of Basis - 2D
![Page 11: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/11.jpg)
[1 11 1[ ] 1 -1
1 -1[ ]-1 -11 1[ ] -1 1
1 -1[ ]1 1/2
-1/2 0 ][
Hadamard Transform:
1 11 1[ ]1 1/2
-1/2 0 ] 1 -11 -1[ ] -1 -1
1 1[ ] -1 11 -1[ ]+ 0- 1/2+ 1/2= 1
1 00 0[ ]2 1
1 0[ ] 0 10 0[ ] 0 0
1 0[ ] 0 00 1[ ]+ 0+ 1+ 1= 2
Standard Basis:
[[
[1 00 0[ ] 0 1
0 0]0 01 0] 0 0
0 1]2 1
1 0[ ]
Hadamard
Hadamard
Standardcoefficients
Basis Elements
Basis Elements
coefficients
![Page 12: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/12.jpg)
Hadamard Basis Functions
size = 8x8 Black = +1 White = -1
![Page 13: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/13.jpg)
For continuous images/signals f(x):
1) The number of Basis Elements Bi is ∞.
<f(x),Bi(x)> = dx
x
(x)iBf(x)∫
diBxf ii∫=i
(x)a)(
2) The dot product:
![Page 14: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/14.jpg)
Fourier Transform
Basis Functions are sines and cosines
sin(x)
cos(2x)
sin(4x)
The transform coefficients determine the amplitude:
a sin(2x) 2a sin(2x) -a sin(2x)
![Page 15: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/15.jpg)
3 sin(x)
+ 1 sin(3x)
+ 0.8 sin(5x)
+ 0.4 sin(7x)
=
A
B
C
D
A+B
A+B+C
A+B+C+D
Every function equals a sum of sines and cosines
![Page 16: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/16.jpg)
The Fourier Transform
• The inverse Fourier Transform composes a signal f(x) given ( )ωF
( ) ωωω
πω deFxf xi∫= 2)(
• The Fourier Transform finds the given the signal f(x):
( ) dx∫ −=x
xi2f(x)eF πωω
( )ωF
![Page 17: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/17.jpg)
• F(ω) is the Fourier transform of f(x):
• f(x) is the inverse Fourier transform of F(ω):
• f(x) and F(ω) are a Fourier transform pair.
( ){ } ( )ωFxfF =~
( ){ } ( )xfFF =− ω1~
![Page 18: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/18.jpg)
• The Fourier transform F(ω) is a function over the complex numbers:
– Rω tells us how much of frequency ωis needed.
– θω tells us the shift of the Sine wave with frequency ω.
• Alternatively:
– aω tells us how much of cos with frequency ω is needed.
– bω tells us how much of sin with frequency ω is needed.
( ) ωθωω ieRF =
( ) ωωω ibaF +=
![Page 19: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/19.jpg)
• Rω - is the amplitude of F(ω).
• θω - is the phase of F(ω).
• |Rω|2=F*(ω) F(ω) - is the power
spectrum of F(ω) .
• If a signal f(x) has a lot of fine details
F(ω) will be high for high ω.
• If the signal f(x) is "smooth" F(ω) will
be low for high ω.
![Page 20: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/20.jpg)
Problem in Frequency
Space
Original Problem
Solution in Frequency
Space
Solution of Original Problem
Relatively easy solution
Difficult solution
Fourier Transform
Inverse Fourier
Transform
Why do we need representation in the frequency domain?
![Page 21: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/21.jpg)
Examples:
• Let ( )xxf δ=)(
( ) ( ) 12 =⋅= −∞
∞−∫ xiexF πωδω
Fourier
x
f(x)
The Delta Function:
0
![Page 22: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/22.jpg)
• Let 1)( =xf
( ) ( )ωδω πω == ∫∞
∞−
− xieF 2
Fourier
ω
x
f(x)
Rω
ω
θω
ω
Real
ω
Imag
The Constant Function:
0
0
0
![Page 23: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/23.jpg)
• Let ( )xxf 02cos)( πω=
( ) ( ) =⋅+= −∞
∞−
−∫ dxeeeF xixixi πωπωπωω 222 00
21
x
ω
Rω
ω
θω
( ) ( )[ ]0021
ωωδωωδ ++−=
f(x)
Fourier
ω0-ω0ω
Real
ω
Imag
ω0-ω0
The Cosine wave:
![Page 24: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/24.jpg)
• Let
<=
otherwise021if1)(
21
xxrect
( ) ( ) ( )πωπω
πωω πω sincsin5.0
5.0
2 === ∫−
− dxeF xi
x
f(x)
Fourier
Rω
ω
The Window Function (rect):
-0.5 0.5
![Page 25: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/25.jpg)
Proof:
f(x) = rect1/2(x) ={1 |x| ≤ 1/2
0 otherwise1
-1/2 1/2
dxedxexfuF iuxiux ∫∫−
−∞
∞−
− ==2/1
2/1
22)()( ππ
[ ] 2/12/1
2
21
−−
−= iuxe
iuπ
π[ ]iuiu ee
iuππ
π −−
= −
21
[ ])sin()cos()sin()cos(21
uiuuiuiu
πππππ
−−−−
=
uu
ππ )sin(
= = sinc(u)
sinc(u)
u
F(u)
![Page 26: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/26.jpg)
• Let2
)( xexf π−=
( ) 2πωω −=eF
x
f(x)
Fourier
Rω
ω
The Gaussian:
![Page 27: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/27.jpg)
x
f(x)
Fourier
Rω
ω
k
1/k
The bed of nails function:
ck(x)
C1/k(ω)
![Page 28: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/28.jpg)
{ } dxdyeyxfvuFyxfF vyuxi∫ ∫∞
∞−
∞
∞−
+−== )(2),(),(),(~ π
Fourier Transform - 2D
Given a continuous real function f(x,y),its Fourier transform F(u,v) is defined as:
The Inverse Fourier Transform:
F(u,v) = a(u,v) + ib(u,v) =|F(u,v)|eiφ(u,v)
Phase =
Spectrum (Amplitude) =
φ(u,v) = tg-1(b(u,v)/a(u,v))
|F(u,v)| = a2(u,v) + b2(u,v)
|F(u,v)|2 = a2(u,v) + b2(u,v)
√Power Spectrum =
{ } dudvevuFyxfvuFF vyuxi∫ ∫∞
∞−
∞
∞−
+− == )(21 ),(),(),(~ π
![Page 29: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/29.jpg)
Fourier Wave Functions - 2D
F(u,v) is the coefficient of the sine wave e2πi(ux+vy)
1/u
1v
x
y
lines of (real) value 1
e2πi(ux+vy) = cos(2π(ux+vy)) + isin(2π(ux+vy))
The ratio determines the Direction.uv
The size of u,v determines the Frequency.
u = 0 direction of waves
v = 0
direction of waves
22
1
vu +
![Page 30: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/30.jpg)
u=0, v=0 u=1, v=0 u=2, v=0u=-2, v=0 u=-1, v=0
u=0, v=1 u=1, v=1 u=2, v=1u=-2, v=1 u=-1, v=1
u=0, v=2 u=1, v=2 u=2, v=2u=-2, v=2 u=-1, v=2
u=0, v=-1 u=1, v=-1 u=2, v=-1u=-2, v=-1 u=-1, v=-1
u=0, v=-2 u=1, v=-2 u=2, v=-2u=-2, v=-2 u=-1, v=-2
U
V
![Page 31: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/31.jpg)
Fourier Transform 2D - Example
2D Function
2D Fourier Transform
![Page 32: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/32.jpg)
Fourier Transform 2D - Example
x
y
f(x,y)
1/2
1/2
1
f(x,y) = rect(x,y) = {1 |x| ≤ 1/2, |y| ≤ 1/2
0 otherwise
|F(u,v)|
F(u,v) = sinc(u) ⋅ sinc(v) = sinc(u,v)
![Page 33: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/33.jpg)
Proof of Fourier of Rect = sinc in 2D
),()sin()sin(
vuSincv
vu
u==
ππ
ππ
∫ ∫∫ ∫− −
+−∞
∞−
∞
∞−
+− ==2/1
2/1
2/1
2/1
)(2)(2),()( dxdyedxdyeyxfuF vyuxivyuxi ππ
dyedxe ivyiux ∫∫−
−
−
−=2/1
2/1
22/1
2/1
2 ππ
![Page 34: Fourier Transform - Part I - Haifadkeren/ip/lecture5.pdf · Image Processing - Lesson 5 • Introduction to Fourier Transform • Image Transforms • Basis to Basis • Fourier Basis](https://reader031.fdocuments.in/reader031/viewer/2022022600/5b3a91ee7f8b9a895a8b95de/html5/thumbnails/34.jpg)
Image Domain Frequency Domain
Fourier Transform Examples