Sie sind auf Seite 1von 34

Image Processing - Lesson 5

Fourier Transform - Part I

Introduction to Fourier Transform

Image Transforms Basis to Basis Fourier Basis Functions Fourier Coefficients

Fourier Transform - 1D Fourier Transform - 2D

The Fourier Transform

Jean Baptiste Joseph Fourier

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.

How can we enhance such an image?

Solution: Image Representation

= 3

+5

+ 10

+ 23

+ ...

2 5 0

1 8 3

3 7 5

0 0 0

0 0 0

1 0 0

0 0 0

0 0

+1

0 0

0 0 0

1 0 0

0 0 0

0 0 0

+3

0 0

+5

1 0

+ ...

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.

f ( x ) = F ( ) e

i 2x

How is this done?

Transforms: Change of Basis


Standard Basis Grayscale Image
X Coordinate

New Basis Fourier Image


Frequency Coordinate

Standard Basis:

[ 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:

[ 2 1 0 1] =
= [ 1 1/2 -1/2 0 ] Hadamard

= 1 [ 1 1 1 1 ] + 1/2 [ 1 1 -1 -1 ] - 1/2 [ -1 1 1 -1 ] + 0 [ -1 1 -1 1 ]

1. Basis Functions. 2. Method for finding the image given the transform coefficients. 3. Method for finding the transform coefficients given the image.

Hadamard Basis Functions - 1D


Wave Number 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 N = 16

Finding the transform coefficients


Signal: New Basis: X = [ 2 1 0 1]

standard

T0 = [ 1 1 1 1 ] T1 = [ 1 1 -1 -1 ] T2 = [ -1 1 1 -1 ] T3 = [ -1 1 -1 1 ]

New Coefficients: a0 = <X,T0 > =< [ 2 1 0 1 ] , [ 1 1 1 1 ] > /4 = 1 a1 = <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

Signal:

X = [ 1 1/2 -1/2 0 ]

new

Transforms: Change of Basis - 2D


Y Coordinate

Grayscale Image

Y Frequency

Fourier Image

X Coordinate

X Frequency

Standard Basis: a11 a12 a21 a22

= a11

[ ]
1 0 0 0

+ a12

[ ] [ ] [ ]
0 1 0 0 0 0 + a21 + a22 0 0 1 0 0 1

Hadamard Transform:

[ ]
1 0

= 1

[ ] [ ] [ ] [ ] [ ]
1 1 1 -1 -1 -1 -1 1 + 1/2 - 1/2 + 0 1 1 1 -1 1 1 1 -1 1 1/2 -1/2 0
Hadamard

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:

2 1

1 0

] [ ] [ ] [ ] [ ]
= 2 1 0 0 0 + 1 0 1 + 1 0 0 0 0 + 0 1 0 0 0 0 1 1 0

2 1

[ ] [ ]
1 0 0 0 0 1 0 0 0 0 0 1

coefficients

[ ] [ ]
0 0 1 0
Standard

Basis Elements Hadamard Transform:

1/2 0

-1/2

] [ ]
= 1

1 1 1 -1 -1 -1 -1 1 + 1/2 - 1/2 + 0 1 1 1 -1 1 1 1 -1

[ ] [ ] [ ] [ ] [ ]
1 1 1 1 1 -1 1 -1

1 1/2 -1/2 0

Hadamard

coefficients

[ ] [ ]
-1 -1 1 1 -1 1 1 -1
Hadamard

Basis Elements

Hadamard Basis Functions

size = 8x8

Black = +1 White = -1

For continuous images/signals f(x):


1) The number of Basis Elements Bi is .

f ( x) =
2) The dot product:

a
i

B i (x) di

<f(x),Bi(x)> =

f(x) B i (x) dx

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)

Every function equals a sum of sines and cosines

3 sin(x)

+ 1 sin(3x)

B A+B

+ 0.8 sin(5x)

C A+B+C D A+B+C+D

+ 0.4 sin(7x)

The Fourier Transform


The inverse Fourier Transform composes a signal f(x) given F( )

f (x) =

F ( ) e i 2 x d

The Fourier Transform finds the F( ) given the signal f(x):

F ( ) = f(x)e
x

i2 x

dx

F() is the Fourier transform of f(x):

~ F { f ( x )} = F ( )

f(x) is the inverse Fourier transform of F():


~ F 1{F ( )} = f ( x )

f(x) and F() are a Fourier transform pair.

The Fourier transform F() is a function over the complex numbers:

F ( ) = R e

R tells us how much of frequency is needed. tells us the shift of the Sine wave with frequency .

Alternatively:

F ( ) = a + ib
a tells us how much of cos with frequency is needed. b tells us how much of sin with frequency is needed.

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 .

Why do we need representation in the frequency domain?

Problem in Frequency Space

Relatively easy solution

Solution in Frequency Space

Fourier Transform

Inverse Fourier Transform

Original Problem

Difficult solution

Solution of Original Problem

Examples:
The Delta Function: Let

f ( x) = (x )
F ( ) =
f(x)
i 2 x ( x ) e =1

Fourier

The Constant Function: Let

f ( x ) =1

i 2 x ( ) F = e = ()

f(x)

Fourier

Real

Imag
0

The Cosine wave: Let

f ( x) = cos(2 0 x )

1 i 20 x i 20 x i 2x F ( )= e +e e dx = 2 1 = [ ( 0 )+ ( + 0 )] 2
f(x)

Fourier

x Real

-0

-0

Imag

The Window Function (rect): Let


0 .5

1 if x < 1 rect 1 ( x ) = 2 2 0 otherwise


i 2x

F ( ) = e
0.5

sin ( ) dx = = sinc ( )
f(x)

x
-0.5 Fourier 0.5

Proof:

f(x) = rect1/2(x) =
1/2

1 0

|x| 1/2 otherwise

-1/2

F(u) = f (x)e2iuxdx= e2iuxdx


1/ 2

1/ 2

1 1/ 2 e2iux 1/ 2 2iu 1 = eiu eiu =

1 = [cos(u) i sin(u) cos(u) i sin(u)] 2iu


= sin(u) u
= sinc(u) F(u)

[ 2iu

sinc(u)

The Gaussian: Let

f ( x) = e

x 2

F ( )= e
f(x)

x
Fourier

The bed of nails function:

f(x)

ck(x)
x

k
Fourier

C1/k()

1/k

Fourier Transform - 2D
Given a continuous real function f(x,y), its Fourier transform F(u,v) is defined as:
~ F{f (x,y)}= F(u,v) = f (x,y)e 2i(ux+vy)dxdy

The Inverse Fourier Transform:


~ 1 F { F(u,v)}= f(x,y) = F(u,v)e2 i(ux+vy)dudv

F(u,v) = a(u,v) + ib(u,v) =|F(u,v)|ei(u,v)

Phase =

(u,v) = tg-1(b(u,v)/a(u,v))

Spectrum (Amplitude) = |F(u,v)| = a2(u,v) + b2(u,v) Power Spectrum = |F(u,v)|2 = a2(u,v) + b2(u,v)

Fourier Wave Functions - 2D


F(u,v) is the coefficient of the sine wave e2i(ux+vy)
y

1 u2 + v2

1 v 1/u

lines of (real) value 1

e2i(ux+vy) = cos(2(ux+vy)) + isin(2(ux+vy))


The ratio u v determines the Direction. The size of u,v determines the Frequency.

u=0 v=0

direction of waves

direction of waves

u=-2, v=2

u=-1, v=2

u=0, v=2

u=1, v=2

u=2, v=2

u=-2, v=1

u=-1, v=1

u=0, v=1

u=1, v=1

u=2, v=1

U
u=-2, v=0 u=-1, v=0 u=0, v=0 u=1, v=0 u=2, v=0

u=-2, v=-1

u=-1, v=-1

u=0, v=-1

u=1, v=-1

u=2, v=-1

u=-2, v=-2

u=-1, v=-2

u=0, v=-2

u=1, v=-2

u=2, v=-2

Fourier Transform 2D - Example


2D Function

2D Fourier Transform

Fourier Transform 2D - Example

f(x,y)
1 1/2 1/2

f(x,y) = rect(x,y) =

1 |x| 1/2, |y| 1/2 0 otherwise

F(u,v) = sinc(u) sinc(v) = sinc(u,v)

|F(u,v)|

Proof of Fourier of Rect = sinc in 2D


F (u ) =

f ( x, y )e 2i ( ux + vy ) dxdy =

1 / 2 1/ 2

1 / 2 1 / 2

2i ( ux + vy ) e dxdy

1/2

1 / 2

e 2 iux dx

1/2

1 / 2

e 2 ivy dy

sin( u ) sin( v ) = = Sinc ( u , v ) u v

Fourier Transform Examples


Image Domain Frequency Domain

Das könnte Ihnen auch gefallen