139
Chapter 4 Image Enhancement in the Frequency Domain Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier series: Any periodic signals can be viewed as weighted sum of sinusoidal signals with of sinusoidal signals with different frequencies Frequency Domain: Frequency Domain: view frequency as an independent variable independent variable

Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

  • Upload
    ledung

  • View
    237

  • Download
    5

Embed Size (px)

Citation preview

Page 1: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency Domain

An periodic signals can beFourier series:

Any periodic signals can beviewed as weighted sumof sinusoidal signals withof sinusoidal signals with different frequencies

Frequency Domain:Frequency Domain: view frequency as an independent variableindependent variable

Page 2: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency DomainImage Enhancement in the Frequency DomainImage Enhancement in the Frequency Domain

Background- From the observation: any periodic function may be written as the sum of sines and consines of varying amplitudes and frequencies

xxf sin)( = xxf sin)(1 =

xxf 3sin31)(2 =

xxf 5sin1)(3 =f5

)(3

xxxxxf 7sin715sin

513sin

31sin)( +++= xxf 7sin

71)(4 =

Page 3: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency DomainImage Enhancement in the Frequency DomainImage Enhancement in the Frequency Domain

The more terms of the series we have, the closer of the sum will approach the original function

If f(x) is a function period 2T, then we can writethen we can write

)sincos()(1

0 ++= ∑∞

= Txnb

Txnaaxf

nnn

ππ

)(21

0 = ∫ dxxfT

a

whereT

T

....3,2,1,cos)(1

)(20

== ∫

ndxT

xnxfT

a

fT

T

Tn

T

π

111

....3,2,1,sin)(1== ∫−

ndxT

xnxfT

bT

Tnπ

xxxxxf 7sin715sin

513sin

31sin)( +++=

Page 4: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency DomainImage Enhancement in the Frequency DomainImage Enhancement in the Frequency Domain

)sincos()( 0 ++= ∑∞

Txnb

Txnaaxf nn

ππThe Fourier series expansion of f(x) can

)(1

1

=

df

whereTT

T

nbe expressed in complex form

∑∞

= n dxT

xincxf ,)exp()( π

....3,2,1,cos)(1

)(20

==

=

∫−

ndxxnxfa

dxxfT

a

T

n

T

π∫

∑−∞=

−T

n

dxinf

whereT

)()(1 π

....3,2,1,sin)(1

....3,,,cos)(

== ∫

ndxT

xnxfT

b

ndxT

xfT

a

T

Tn

Tn

πIf the function is non-periodic, we need

ll f i

∫−=

Tn dxT

xfT

c )exp()(2

TTall frequencies to represent.

[ ]∫∞

∞−+=

h

dxjbxaxf ωωωωω sin)(cos)()(

∫∞

∞−= xdxxfa

where

ωπ

ω ,cos)(1)(θθθ sincos je j +=

∫∞

∞−= xdxxfb ω

πω

π

sin)(1)(

Page 5: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency Domain

Ti ti l FFourier Tr.

Time, spatial Domain Signals

Frequency Domain SignalsInv Fourier TrSignals SignalsInv Fourier Tr.

1-D, Continuous case

∫∞

j2∫∞−

−= dxexfuF uxj π2)()(Fourier Tr.:

∫∞

= dueuFxf uxj π2)()(Inv. Fourier Tr.:∞−

Page 6: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency Domain

1-D, Discrete casef 1 1 1 1 1 1 1 1

,

fffff = ][

f=1,1,1,1,-1,-1,-1,-1

FFFFF

fffff N −= 1210

][

],....,,[

whereFFFFF N −

⎤⎡

= 1210 ],....,,[

fxNxui

NF

N

xu ∑

=⎥⎦⎤

⎢⎣⎡−=

1

02exp1 π

Page 7: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency Domain

1-D, Discrete case,

∑−

−=1

/2)(1)(N

NuxjexfuF πFourier Tr : u = 0,…,N-1∑=

=0

)()(x

exfN

uFFourier Tr.:

−1N

Inv. Fourier Tr.: ∑=

=0

/2)()(u

NuxjeuFxf π x = 0,…,N-1

Page 8: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency DomainImage Enhancement in the Frequency Domain

1-D, Discrete caseSuppose

Nx fffff −= 1210 ],....,,[is a sequence of length N. we define DFT to be the sequence

Nu FFFFF −= 1210 ],....,,[ℑfF

N

fxuiF

where

∑−

⎥⎤

⎢⎡1

2exp1 π ⎤⎡

ℑ=where

fF

xx

u fN

iN

F ∑=

⎥⎦⎢⎣−=

0

2exp π⎥⎦⎤

⎢⎣⎡−=ℑ 2exp1

, Nmni

Nnm π

As a matrix multiplication: ⎟⎠⎞

⎜⎝⎛ −+−=ℑ )2sin()2cos(1

, Nmnii

Nmni

Nnm ππ

Page 9: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

1-D Discrete Fourier Transforms

1 D Discrete case S f [1 2 3 4] th t N 41-D, Discrete case

Nx fffff −= 1210 ],....,,[

Suppose f=[1,2,3,4] so that N=4

⎥⎤

⎢⎡ 1111

NNu

fxuiF

FFFFF

∑−

⎥⎤

⎢⎡−=

=1

1210

2exp1],....,,[

π ⎥⎥⎥⎥

⎦⎢⎢⎢⎢

−−−−

=ℑ

iii

iinm

11111

11,

xx

u fN

iN

F ∑=

⎥⎦⎢⎣0

2exp π

ℑ= fF⎥⎥⎤

⎢⎢⎡

⎥⎥⎤

⎢⎢⎡

−−

⎥⎦

⎢⎣ −−

ii

ii

21

111111

1

11

⎥⎦⎤

⎢⎣⎡−=ℑ 2exp1

, Nmni

N

where

nm π ⎥⎥⎥

⎦⎢⎢⎢

⎣⎥⎥⎥

⎦⎢⎢⎢

⎣ −−−−

=

iii

iiF

432

11111

1141

⎟⎠⎞

⎜⎝⎛ −+−=ℑ

⎦⎣

)2sin()2cos(1, N

mniiNmni

N

NN

nm ππ

⎥⎥⎥⎤

⎢⎢⎢⎡

+−=

iF

222

10

41

⎥⎥

⎦⎢⎢

⎣ −−−

i2224

Page 10: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

1-D Discrete Fourier Transforms

1 D Discrete case using Matlab>>f=[1,2,3,4]

ff (f ’)

1-D, Discrete case using Matlab

>> fft(f ’)ans =10.0000 -2.0000 + 2.0000i-2.0000 2 0000 2 0000i-2.0000 - 2.0000i

>> ifft(ans)ans =

12334

Page 11: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the Frequency Domain

Chapter 4Image Enhancement in the Frequency Domain

Sines and Consines have variousFrom Euler’s formular

sincos jj θθθ +

Sines and Consines have various frequencies, The domain (u) calledfrequency domain

)]/2sin()/2)[cos((1)(

sincos1

NuxjNuxxfuF

jeM

j

ππ

θθθ +=

∑−

f q y

F( ) b i

)]/2sin()/2)[cos(()(0

NuxjNuxxfN

uFx

ππ −= ∑=

F(u) can be written as)()()( ujeuFuF φ−=or)()()( ujIuRuF += )()(or)()()( j

22

where

⎟⎟⎞

⎜⎜⎛− )(tan)( 1 uIuφ22 )()()( uIuRuF += ⎟⎟

⎠⎜⎜⎝

=)(

tan)(uR

Page 12: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of 1 D Fourier Transforms

Chapter 4Example of 1 D Fourier Transforms Example of 1-D Fourier Transforms Example of 1-D Fourier Transforms

Notice that the longerNotice that the longerthe time domain signal,The shorter its Fouriertransform

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 13: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Relation Between Δx and Δu

Chapter 4Relation Between Δx and Δu

F i l f( ) ith N i t l t ti l l ti Δx bFor a signal f(x) with N points, let spatial resolution Δx be space between samples in f(x) and let frequency resolution Δu be space between frequencies components in F(u) we havebetween frequencies components in F(u), we have

u =Δ1)()( 0 xxxfxf Δ+=

Δ

For x = 0,1,2,... N-1

xNu

Δ=Δ

E l f i l f( ) ith li i d 0 5 100 i t)()( uuFuF Δ=

Δ

u = 0,1,2,…N-1Example: for a signal f(x) with sampling period 0.5 sec, 100 point, we will get frequency resolution equal to

1 Hz02.05.0100

1=

×=Δu

This means that in F(u) we can distinguish 2 frequencies that areThis means that in F(u) we can distinguish 2 frequencies that are apart by 0.02 Hertz or more.

Page 14: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 42-Dimensional Discrete Fourier Transform

Chapter 42-Dimensional Discrete Fourier Transform

F i f i M N i l

1 1M N2-D DFT

For an image of size MxN pixels

∑∑−

=

=

+−=1

0

1

0

)//(2),(1),(M

x

N

y

NvyMuxjeyxfMN

vuF π

= =0 0x y

u = frequency in x direction, u = 0 ,…, M-1v = frequency in y direction v = 0 N-1

2-D IDFT

v frequency in y direction, v 0 ,…, N 1

∑∑− −

+=1

0

1

0

)//(2),(),(M N

NvyMuxjevuFyxf π

0 M 1= =0 0u v x = 0 ,…, M-1y = 0 ,…, N-1

Page 15: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 42 Di i l Di t F i T f ( t )

Chapter 42 Di i l Di t F i T f ( t )2-Dimensional Discrete Fourier Transform (cont.)2-Dimensional Discrete Fourier Transform (cont.)

F(u,v) can be written asF(u,v) can be written as),(),(),( vujevuFvuF φ−=or),(),(),( vujIvuRvuF +=

22 )()()( vuIvuRvuF +

where

⎟⎟⎞

⎜⎜⎛− ),(tan)( 1 vuIvuφ),(),(),( vuIvuRvuF += ⎟⎟

⎠⎜⎜⎝

=),()(tan),(

vuRvuφ

For the purpose of viewing, we usually display only theMagnitude part of F(u,v)ag ude pa o (u,v)

Page 16: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Relation Between Spatial and Frequency

l i

Chapter 4Relation Between Spatial and Frequency

l iResolutionsResolutions

u =Δ1

Nv

Δ=Δ

1xMΔ yNΔ

whereΔx = spatial resolution in x directionΔy = spatial resolution in y direction

( Δx and Δy are pixel width and height. )

Δu = frequency resolution in x directionΔv = frequency resolution in y directionN,M = image width and height

Page 17: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Displaying transforms

• Having obtained the Fourier transform F(u) of a signal f(x), what does it look like?

• Having obtained the Fourier transform F(u,v) of an image f(x,y), what does it look like?g f( y)

• F(u,v) are complex number, we can’t view them directly, but we view their magnitudedirectly, but we view their magnitude |F(u,v)| . We have 3 approaches– 1. Find the maximum value m of |F(u v)| ( DC term), and1. Find the maximum value m of |F(u,v)| ( DC term), and

use imshow to view |F(u,v)| /m– 2. use mat2gray to view |F(u,v)| directlyg y | ( , )| y– 3. use imshow to view log(1+ |F(u,v)| )

Page 18: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Periodicity of 1-D DFT

Chapter 4Periodicity of 1-D DFT

∑−

−=1

0

/2)(1)(M

x

NuxjexfN

uF πFrom DFT:=0xN

0 N 2N-N 0 N 2N-N

DFT repeats itself every N points (Period = N) but we usuallyWe display only in this range

DFT repeats itself every N points (Period N) but we usually display it for n = 0 ,…, N-1

Page 19: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Conventional Display for 1-D DFT

Chapter 4Conventional Display for 1-D DFT

)(uFDFTf(x)

0 N-1

Time Domain Signal

0 N-1

g

L f

High frequencyarea

Low frequencyarea

The graph F(u) is notThe graph F(u) is not easy to understand !

Page 20: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Conventional Display for DFT : FFT Shift

Chapter 4Conventional Display for DFT : FFT Shift

)(uF )(uFFFT Shift: Shift center of thegraph F(u) to 0 to get betterDisplay which is easier to

)(uF0 N 1

Display which is easier to understand.

)(uF0 N-1

High frequency area

0-N/2 N/2-1Low frequency area

Page 21: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Periodicity of 2-D DFT

Chapter 4Periodicity of 2-D DFT

∑∑− −

+−=1 1

)//(2),(1),(M N

NvyMuxjeyxfMN

vuF π2-D DFT: ∑∑= =0 0x yMN

-M

g(x y)

0

g(x,y)

For an image of size NxMpixels, its 2-D DFT repeats

0

itself every N points in x-direction and every M points in y direction

M

in y-direction.

We display only 2M in this range

0 N 2N-N

2M

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 22: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4C ti l Di l f 2 D DFT

Chapter 4C ti l Di l f 2 D DFTConventional Display for 2-D DFTConventional Display for 2-D DFT

F(u,v) has low frequency areasat corners of the image while highat corners of the image while highfrequency areas are at the centerof the image which is inconvenientgto interpret.

High frequency area

Low frequency area

Page 23: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 42 D FFT Shift : Better Display of 2 D DFT

Chapter 42 D FFT Shift : Better Display of 2 D DFT

2-D FFT Shift is a MATLAB function: Shift the zero frequency of F(u v) to the center of an image

2-D FFT Shift : Better Display of 2-D DFT2-D FFT Shift : Better Display of 2-D DFT

Shift the zero frequency of F(u,v) to the center of an image.

2D FFTSHIFT2D FFTSHIFT

High frequency area Low frequency area(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 24: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 42 D FFT Shift (cont ) : How it works

Chapter 42 D FFT Shift (cont ) : How it works

M

2-D FFT Shift (cont.) : How it works2-D FFT Shift (cont.) : How it works

-M

0

Display of 2D DFTAfter FFT Shift

MS

Original displayof 2D DFT

2Mof 2D DFT

0 N 2N-N

Page 25: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of DFT

Chapter 4Example of DFT

• Fourier transforms in MatlabThe relevant Matlab functions for us are:The relevant Matlab functions for us are:

– fft which takes the DFT of a vector,iff hi h k h i DFT f– ifft which takes the inverse DFT of a vector,

– fft2 which takes the DFT of a matrix,– ifft2 which takes the inverse DFT of a matrix,– fftshift which shifts a transformfftshift which shifts a transform.

Page 26: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of DFT

Chapter 4Example of DFT

• Example 1Example 1

Note that the DC coecient is indeed the sum of all theNote that the DC coecient is indeed the sum of all the matrix values.

Page 27: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of DFT

Chapter 4Example of DFT

• Example 2Example 2

Page 28: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of DFT

Chapter 4Example of DFT

E l 3• Example 3

Page 29: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Fourier transforms of images

Chapter 4Fourier transforms of images

• Example 1>> a=[zeros(256 128) ones(256 128)];>> a=[zeros(256,128) ones(256,128)];>> af=fftshift(fft2(a));>> fm = max(af(:));>> imshow(im2uint8(af/fm));( ( ))

Page 30: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Fourier transforms of images

Chapter 4Fourier transforms of images

• Example 2>> a=zeros(256,256);>> a(78:178,78:178)=1;>> imshow(a)( )>> af=fftshift(fft2(a));>> figure,fftshow(af,'abs')g , ( , )

Page 31: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Fourier transforms of images

Chapter 4Fourier transforms of images

• Example 3>> [x,y]=meshgrid(1:256,1:256);

b ( 329)&( 182)&( 67)&( 73)>> b=(x+y<329)&(x+y>182)&(x-y>-67)&(x-y<73);>> imshow(b)>> bf=fftshift(fft2(b));>> bf fftshift(fft2(b));>> fm = max(bf(:));>> imshow(im2uint8(bf/fm));

Page 32: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Fourier transforms of images

Chapter 4Fourier transforms of images

E l 4• Example 4>> [x,y]=meshgrid(-128:217,-128:127);>> z=sqrt(x.^2+y.^2);>> c=(z<15);>> imshow(c);>> cf=fft2shift(fft2(c));>> figure,fftshow(af,'abs')

Page 33: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of 2 D DFT

Chapter 4Example of 2 D DFTExample of 2-D DFTExample of 2-D DFT

Notice that the longer the time domain signalNotice that the longer the time domain signal,The shorter its Fourier transform

Page 34: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of 2-D DFT

Chapter 4Example of 2-D DFTpp

Notice that direction of an object in spatial image andobject in spatial image andIts Fourier transform are orthogonal to each other.

Page 35: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of 2-D DFT

Chapter 4Example of 2-D DFT

2D DFT

Example of 2 D DFTExample of 2 D DFT

2D DFT

Original image

2D FFT Shift

Page 36: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of 2-D DFT

f = zeros(30,30);f(5:24 13:17) = 1;f(5:24,13:17) 1;figure;imshow(f,'notruesize');F = fft2(f);( )F2 = log(abs(F)+1);figure;imshow(F2,[-1 5],'notruesize'); F3 l ( b (fft hift(F))+1)F3=log(abs(fftshift(F))+1);figure;imshow(F3,[-1 5],'notruesize');

Page 37: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Example of 2-D DFT

Chapter 4Example of 2-D DFT

2D DFT

Example of 2 D DFTExample of 2 D DFT

2D DFT

Original image

2D FFT Shift

Page 38: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Basic Concept of Filtering in the Frequency Domain

Chapter 4Basic Concept of Filtering in the Frequency Domain

From Fourier Transform Property:

Basic Concept of Filtering in the Frequency DomainBasic Concept of Filtering in the Frequency Domain

),(),(),(),(),(),( vuGvuHvuFyxhyxfyxg =⋅⇔∗=

We cam perform filtering process by usingWe cam perform filtering process by using

M ltiplication in the freq enc domainMultiplication in the frequency domainis easier than convolution in the spatialDomain.

Page 39: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Filtering in the Frequency Domain with FFT shiftFiltering in the Frequency Domain with FFT shift

F(u,v) H(u,v)(User defined) g(x,y)

FFT hifFFT shift 2D IFFTX

2D FFT FFT shift

f(x,y) G(u,v)f(x,y) G(u,v)

In this case, F(u,v) and H(u,v) must have the same size andhave the zero frequency at the center.

Page 40: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Multiplication in Freq. Domain = Circular ConvolutionMultiplication in Freq. Domain = Circular Convolutionf( ) DFT F( )f(x) DFT F(u)

G(u) = F(u)H(u) h(x) DFT H(u)

g(x)IDFT

1

h(x) DFT H(u)

Multiplication of DFT f 2 i l f( )

0 20 0 60 80 100 1200

0.5DFTs of 2 signalsis equivalent toperform circular

f(x)

0 20 40 60 80 100 120

0 5

1

perform circular convolutionin the spatial domain.

h( )

0 20 40 60 80 100 1200

0.5 h(x)

“Wrap around” effect 0 20 40 60 80 100 120

40g(x)

p

0 20 40 60 80 100 1200

20g(x)

Page 41: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

convolution_discrete_B.swf

Page 42: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier
Page 43: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Applications of the Fourier TransformApplications of the Fourier TransformApplications of the Fourier TransformApplications of the Fourier TransformLocating Image Features

Th F i f l b d f l i hi hThe Fourier transform can also be used to perform correlation, which is closely related to convolution. Correlation can be used to locate features within an image; in this context correlation is often calledfeatures within an image; in this context correlation is often called template matching.

bw = imread('text.png');a = bw(32:45,88:98); C l(iff 2(ff 2(b ) *C = real(ifft2(fft2(bw) .*

fft2(rot90(a,2),256,256)));figure imshow(C []);figure, imshow(C,[]); max(C(:))ans = 68.0000thresh = 60;figure, imshow(C > thresh)

Page 44: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Multiplication in Freq. Domain = Circular ConvolutionMultiplication in Freq. Domain = Circular Convolution

H(u,v)Gaussian

Original image

LowpassFilter with D0 = 5

Filtered image (obtained using circular convolution)circular convolution)

Incorrect areas at image rims

Page 45: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Fil i i h F D i E lFil i i h F D i E lFiltering in the Frequency Domain : ExampleFiltering in the Frequency Domain : Example

In this example, we set F(0,0) to zerowhich means that the zero frequency

t i dcomponent is removed.

N t Z fNote: Zero frequency = average intensity of an image

Page 46: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Filtering in the Frequency Domain : ExampleFiltering in the Frequency Domain : Example

Lowpass Filter

Highpass Filter

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 47: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Filtering in the Frequency Domain : Example Filtering in the Frequency Domain : Example Filtering in the Frequency Domain : Example (cont.)

Filtering in the Frequency Domain : Example (cont.)

Result of Sharpening Filter

Page 48: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Filter Masks and Their Fourier TransformsFilter Masks and Their Fourier Transforms

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 49: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Ideal Lowpass FilterIdeal Lowpass Filter

Ideal LPF Filter Transfer function

⎩⎨⎧

>≤

=0

0

),( 0),( 1

),(DvuDDvuD

vuH⎩

where D(u,v) = Distance from (u,v) to the center of the mask.

Page 50: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Examples of Ideal Lowpass FiltersExamples of Ideal Lowpass Filters

The smaller D0, the more high frequency components are removed.

Page 51: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Results of Ideal Lowpass Filters Results of Ideal Lowpass Filters

Ringing effect can be obviously seen!

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 52: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

How ringing effect happens How ringing effect happens

⎩⎨⎧

>≤

=0

0

),( 0),( 1

),(DvuDDvuD

vuH

Surface Plot

Ideal Lowpass FilterIdeal Lowpass Filterwith D0 = 5

Abrupt change in the amplitudeAbrupt change in the amplitude

Page 53: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

How ringing effect happens (cont ) How ringing effect happens (cont ) How ringing effect happens (cont.) How ringing effect happens (cont.)

x 10-3

Surface Plot

15

5

10

Spatial Response of Ideal Lowpass Filter with D = 5

2020

0Lowpass Filter with D0 = 5

-200

20

-20

0Ripples that cause ringing effect

Page 54: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

How ringing effect happens How ringing effect happens g g pp(cont.)

g g pp(cont.)

Page 55: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Butterworth Lowpass Filter Butterworth Lowpass Filter

1

Transfer function

[ ] NDvuDvuH 2

0/),(11),(

+=

Where D0 = Cut off frequency, N = filter order.

Page 56: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Results of Butterworth Lowpass Filters Results of Butterworth Lowpass Filters

There is less ringing effect compared toeffect compared to those of ideal lowpassfilters!filters!

Page 57: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Spatial Masks of the Butterworth Lowpass Filters Spatial Masks of the Butterworth Lowpass Filters

Some ripples can be seen.

Page 58: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Gaussian Lowpass Filter Gaussian Lowpass Filter

20

2 2/),()( DvuDevuH −=

Transfer function

),( evuH =Where D0 = spread factor.

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Note: the Gaussian filter is the only filter that has no ripple and hence no ringing effect.

Page 59: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Gaussian Lowpass Filter (cont.) Gaussian Lowpass Filter (cont.)

1

20

2 2/),(),( DvuDevuH −=

0 4

0.6

0.8 Gaussian lowpass filter with D0 = 5

0.2

0.4

-200

20

-20

0

20

0.03

0 01

0.02

0.03

Spatial respones of the Gaussian lowpass filter

2020

0

0.01Gaussian lowpass filterwith D0 = 5

-200

20

-20

0

Gaussian shape

Page 60: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Results of Gaussian Results of Gaussian Results of Gaussian Lowpass Filters

Results of Gaussian Lowpass Filters

No ringing effect!

Page 61: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Application of Gaussian Lowpass FiltersApplication of Gaussian Lowpass Filters

Better LookingOriginal image

Th GLPF b d t j d dThe GLPF can be used to remove jagged edges and “repair” broken characters.

Page 62: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Application of Gaussian Lowpass Filters (cont.) Application of Gaussian Lowpass Filters (cont.) R i klRemove wrinkles

Original image

Softer-Looking

Page 63: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Application of Gaussian Lowpass Filters (cont.) Application of Gaussian Lowpass Filters (cont.)

Filtered imageOriginal image : The gulf of Mexico and Filtered imageOriginal image : The gulf of Mexico andFlorida from NOAA satellite. (Images from Rafael C. Gonzalez and Richard E.

Wood, Digital Image Processing, 2nd Edition.

Remove artifact lines: this is a simple but crude way to do it!

Page 64: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Hi h Filt Hi h Filt Highpass Filters Highpass Filters

Hhp = 1 - Hlp

Page 65: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Ideal Highpass Filters Ideal Highpass Filters Ideal Highpass Filters Ideal Highpass Filters

⎨⎧ ≤

= 0),( 0)(

DvuDvuH

Ideal HPF Filter Transfer function

⎩⎨ >

=0),( 1

),(DvuD

vuH

where D(u,v) = Distance from (u,v) to the center of the mask.( , ) ( , )

Page 66: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Butterworth Highpass Filters Butterworth Highpass Filters Butterworth Highpass Filters Butterworth Highpass Filters

T f f ti

[ ]vuH 1)( =

Transfer function

[ ] NvuDDvuH 2

0 ),(/1),(

+

Where D = Cut off frequency N = filter orderWhere D0 = Cut off frequency, N = filter order.

Page 67: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Gaussian Highpass Filters Gaussian Highpass Filters Gaussian Highpass Filters Gaussian Highpass Filters

Transfer function2

02 2/),(1),( DvuDevuH −−=

Transfer function

Where D0 = spread factor.

Page 68: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Gaussian Highpass Filters (cont.) Gaussian Highpass Filters (cont.) g p ( )g p ( )

20

2 2/),(1),( DvuDevuH −−=1

0.6

0.8

Gaussian highpass filter with D = 5

0

0.2

0.4 filter with D0 = 5

1020

3040

5060

20

40

60

2000

3000

0

1000Spatial respones of the Gaussian highpass filter

ith D 5

1020

3040

5060

20

40

60with D0 = 5

Page 69: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Spatial Responses of Highpass Filters Spatial Responses of Highpass Filters

Ripplespp

Page 70: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

R lt f Id l Hi h Filt R lt f Id l Hi h Filt Results of Ideal Highpass Filters Results of Ideal Highpass Filters

Ringing effect can be b i l !obviously seen!

Page 71: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

R lt f B tt th Hi h Filt R lt f B tt th Hi h Filt Results of Butterworth Highpass Filters Results of Butterworth Highpass Filters

Page 72: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Results of Gaussian Highpass Filters Results of Gaussian Highpass Filters g pg p

Page 73: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Laplacian Filter in the Frequency DomainLaplacian Filter in the Frequency Domain

( ) )()( uFjuxfd nn

From Fourier Tr. Property:

( ) )(uFjudxn ⇔

Then for Laplacian operator22 ff ∂∂ ( ) ),(22

2

2

2

22 vuFvu

yf

xff +−⇔

∂∂

+∂∂

=∇

We get( )222 vu +−⇔∇

We get

Image ofg–(u2+v2)

Surface plot

Page 74: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Laplacian Filter in the Frequency Domain (cont.)Laplacian Filter in the Frequency Domain (cont.)

Spatial response of –(u2+v2) Cross section

Laplacian mask in Chapter 3p p

Page 75: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Sharpening Filtering in the Frequency DomainSharpening Filtering in the Frequency DomainSharpening Filtering in the Frequency DomainSharpening Filtering in the Frequency Domain

Spatial Domain

),(),(),( yxfyxfyxf lphp −=

),(),(),( yxfyxAfyxf lphb −=

)()()()1()( yxfyxfyxfAyxf + ),(),(),()1(),( yxfyxfyxfAyxf lphb −+−=

),(),()1(),( yxfyxfAyxf hphb +−=

Frequency Domain Filter

),(),()(),( yfyfyf hphb

q y

),(1),( vuHvuH lphp −=

),()1(),( vuHAvuH hphb +−=

Page 76: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Sharpening Filtering in the Frequency Domain (cont.)Sharpening Filtering in the Frequency Domain (cont.)

p P2∇

P2∇ PP 2∇P2∇ PP 2∇−

Page 77: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Sharpening Filtering in the Frequency Domain (cont.)Sharpening Filtering in the Frequency Domain (cont.)

),(),()1(),( yxfyxfAyxf hphb +−= ),(),()(),( yfyfyf hphb

Pfhp2∇=f

A = 2 A = 2 7A = 2.7

Page 78: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

High Frequency Emphasis FilteringHigh Frequency Emphasis Filtering

),(),( vubHavuH hphfe += ),(),( hphfe

Original Butterworthhighpass g passfilteredimage

High freq. emphasis Afterg q pfiltered image Hist

Eq.

a = 0.5, b = 2

Page 79: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Homomorphic FilteringHomomorphic Filtering

An image can be expressed asg p),(),(),( yxryxiyxf =

i(x y) = illumination componenti(x,y) illumination componentr(x,y) = reflectance component

We need to suppress effect of illumination that cause image Intensity changed slowly.

Page 80: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Homomorphic FilteringHomomorphic Filtering

Page 81: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

H hi Filt iH hi Filt iHomomorphic FilteringHomomorphic Filtering

More details in the room can be seen!More details in the room can be seen!

Page 82: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Retinex Filter

jckI

The Relative reflectance of pixel i to j:

∑ +=ckc IjiR 1log)( δk

ckI 1+

∑=k

ckI

jiR log),( δ

{ Threshold log if 1 1 >+c

ck

II

i =δ { ckI

Threshold log if 0 1 <+ck

ck

II

kI

j=1 j=2 j=4Average Relative Reflectance at i:

jiRN c∑ )(

i

N

jiRiR jc ∑ == 1

),()(

ij=3 j=5

Page 83: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier
Page 84: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier
Page 85: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4How to Perform 2-D DFT by Using 1-D DFT

Chapter 4How to Perform 2-D DFT by Using 1-D DFTHow to Perform 2-D DFT by Using 1-D DFTHow to Perform 2-D DFT by Using 1-D DFT

f(x y)

1-D DFT

by row F(u,y)f(x,y) by row (u,y)1-D DFT

by columnby column

F(u,v)

Page 86: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4How to Perform 2 D DFT by Using 1 D DFT(cont )

Chapter 4How to Perform 2 D DFT by Using 1 D DFT(cont )

Alternative method

How to Perform 2-D DFT by Using 1-D DFT(cont.)How to Perform 2-D DFT by Using 1-D DFT(cont.)

Alternative method

f(x,y)f( ,y)1-D DFT

by columnby column

1-D DFT

by rowF(x,v) F(u,v)

Page 87: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Linear Convolution by using Circular Convolution and Zero Padding Linear Convolution by using Circular Convolution and Zero Padding

f( ) DFT F( )Zero paddingf(x) DFT F(u)G(u) = F(u)H(u)

h(x) DFT H(u)Zero padding

Zero padding

h(x) DFT H(u)IDFT

Zero padding

1

Concatenation0

0.5

g(x)0 50 100 150 200 250

1

0 50 100 150 200 2500

0.5

Padding zerosBefore DFT0 50 100 150 200 250

40

Before DFT

Keep only this part

0 50 100 150 200 2500

20p y p

Page 88: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Linear Convolution by using Circular Convolution and Zero Padding Linear Convolution by using Circular Convolution and Zero Padding

The discrete Fourier transform assumes a The discrete Fourier transform assumes a transform assumes a digital image exists on a closed surface, a torus.

transform assumes a digital image exists on a closed surface, a torus.

Page 89: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Linear Convolution by using Circular Convolution and Zero Padding Linear Convolution by using Circular Convolution and Zero Padding

Page 90: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Linear Convolution by using Circular Convolution and Zero Padding Linear Convolution by using Circular Convolution and Zero Padding

Filtered image

Zero padding area in the spatialDomain of the mask image(th id l l filt )

Only this area is kept.(the ideal lowpass filter)

Page 91: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Correlation Application: Object DetectionCorrelation Application: Object Detection

Page 92: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 42 D DFT P ti

Chapter 42 D DFT P ti2-D DFT Properties2-D DFT Properties

Page 93: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 42 D DFT P ti ( t )

Chapter 42 D DFT P ti ( t )2-D DFT Properties (cont.)2-D DFT Properties (cont.)

Page 94: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 42-D DFT Properties (cont.)2-D DFT Properties (cont.)

Page 95: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 42 D DFT P ti ( t )

Chapter 42 D DFT P ti ( t )2-D DFT Properties (cont.)2-D DFT Properties (cont.)

Page 96: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4C t ti l Ad t f FFT C d t DFT

Chapter 4C t ti l Ad t f FFT C d t DFTComputational Advantage of FFT Compared to DFTComputational Advantage of FFT Compared to DFT

Page 97: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 98: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 99: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 100: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 101: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 102: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 103: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 104: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the

F D i

Chapter 4Image Enhancement in the

F D iFrequency DomainFrequency Domain

Page 105: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the

F D i

Chapter 4Image Enhancement in the

F D iFrequency DomainFrequency Domain

Page 106: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the

Chapter 4Image Enhancement in theImage Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 107: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the

F D i

Chapter 4Image Enhancement in the

F D iFrequency DomainFrequency Domain

Page 108: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Image Enhancement in the

Chapter 4Image Enhancement in theImage Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 109: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 110: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 111: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 112: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 113: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 114: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 115: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 116: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 117: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 118: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 119: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 120: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 121: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 122: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 123: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 124: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 125: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 126: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 127: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 128: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 129: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 130: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 131: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 132: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 133: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 134: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 135: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 136: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 137: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 138: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain

Page 139: Chapter 4 Image Enhancement in the Frequency Domainjan/204584/04-image_enhancement_freq.pdf · Chapter 4 Image Enhancement in the Frequency Domain An periodic signals can be Fourier

Chapter 4Chapter 4Image Enhancement in the

Frequency DomainImage Enhancement in the

Frequency Domain