102
DREAM PLAN IDEA IMPLEMENTATION 1

DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: [email protected]@yahoo.com Email: [email protected]@aut.ac.ir

Embed Size (px)

Citation preview

Page 1: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

1

DREAMDREAM

PLANPLANIDEAIDEA

IMPLEMENTATIONIMPLEMENTATION

Page 3: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

3

Introduction to Image ProcessingIntroduction to Image Processing

Dr. Kourosh KianiEmail: [email protected]: [email protected]: [email protected]: www.kouroshkiani.com

Present to:Amirkabir University of Technology (Tehran

Polytechnic) & Semnan University

Page 4: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

4

Lecture 10

2D Discrete Fourier Transform

(DFT )

Page 5: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

The two-dimensional Fourier transform and its inverse Fourier transform (discrete case) DFt

Inverse Fourier transform:

u, v : the transform or frequency variables x, y : the spatial or image variables

1,...,2,1,0,1,...,2,1,0for

),(1

),(1

0

1

0

)//(2

NvMu

eyxfMN

vuFM

x

N

y

NvyMuxj

1,...,2,1,0,1,...,2,1,0for

),(),(1

0

1

0

)//(2

NyMx

evuFyxfM

u

N

v

NvyMuxj

Page 6: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

24118

25533

14624

269101

19149

I

DFT-6.80 + 7.89i 17.8 - 12.76i 17.8 -7.89i -6.8 - 7.89i 103.00

19.28 + 9.2i 2.05+ 20.34i 5.07 - 13.76i -5.09+- 13.76i 9.28-10.82i

8.43 + 1.31i 9.22 + 14.89i 6.09 + 3.25i -3.55 +13.88i -0.78+ 8i

-3.55 – 13.88i 6.09 - 3.25i 9.22 - 14.89i 8.43 - 1.31i -0.78+ 8i

- 5.09 + 13.76i 5.07 + 2.13i 2.05 - 1.83i 19.28 - 9.2i 9.28-10.82i

4...0,4...0for

),(25

1),(

4

0

4

0

)5/5/(2

vu

eyxIvuFx y

vyuxj

),( vuF

Page 7: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

103.00 10.41 21.90 21.90 10.41

14.26 14.67 5.50 20.44 21.36

8.04 14.33 6.90 17.51 8.53

8.04 8.53 17.51 6.90 14.33

14.26 21.36 20.44 5.50 14.67

|F|=abs(F)=

2.01 1.02 1.34 1.34 1.02

1.15 1.17 0.74 1.31 1.33

0.91 1.16 0.84 1.24 0.93

0.91 0.93 1.24 0.84 1.16

1.15 1.33 1.31 0.74 1.17

log10 |F|=log10(abs(F)) =

Page 8: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

0.00 - 2.28 -0.62 0.62 2.28

-0.86 1.93 -0.40 1.47 0.45

-1.67 1.82 0.49 1.02 0.15

1.67 -0.15 -1.02 -0.49 -1.82

0.86 -0.45 -1.47 0.40 -1.93

angleF =

0.00 - 130.76 - 5.64 35.64 130.76

-49.39 110.30 - 2.74 84.26 25.51

- 95.57 104.33 28.08 58.23 8.86

95.57 - 8.86 58.23- -28.08 - 04.33

49.39 -25.51 - 84.26 22.74 110.30-

radToDegF=

Page 9: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

),(),(),(),(

),(

),(tan),(

),(),(),(

),(),(),(

)(

222

1

22

vuIvuRvuFvuP

SpectrumPower

vuR

vuIvu

SpectrumPhase

vuIvuRvuF

SpectrumAmplitude

vuiIvuRvuF

SpectrumComplex

Page 10: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

24118

25533

14624

269101

19149

)),(( IIvuFInvers

Inverse Fourier transform-6.80 + 7.89i 17.8 - 12.76i 17.8 -7.89i -6.8 - 7.89i 103.00

19.28 + 9.2i 2.05+ 20.34i 5.07 - 13.76i -5.09+- 13.76i 9.28-10.82i

8.43 + 1.31i 9.22 + 14.89i 6.09 + 3.25i -3.55 +13.88i -0.78+ 8i

-3.55 – 13.88i 6.09 - 3.25i 9.22 - 14.89i 8.43 - 1.31i -0.78+ 8i

- 5.09 + 13.76i 5.07 + 2.13i 2.05 - 1.83i 19.28 - 9.2i9.28-10.82i

),( vuF

Page 11: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Inverse Fourier transform

Page 12: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Magnitude and Phase of DFT

• What is more important?

magnitude phase

Page 13: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Magnitude and Phase of DFT

Reconstructed image using

magnitude only

Reconstructed image using

phase only

Page 14: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

original

amplitude

phase

),( vuF

),( vuF

Magnitude and Phase of DFT

Page 15: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Example: DFT of 2D rectangle function

Fourier spectrum

Input function

Spectrum displayed as an intensity function

Page 16: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Extending DFT to 2D2D cos/sin functions

1,...,2,1,01,...,2,1,0for

),(),(1

0

1

0

)//(2

NyMx

evuFyxfM

u

N

v

NvyMuxj

Page 17: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

2D - DFT

Base-functions are waves

u

v

NvyMuxje //2

1,...,2,1,01,...,2,1,0for

),(),(1

0

1

0

)//(2

NyMx

evuFyxfM

u

N

v

NvyMuxj

Page 18: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 19: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 20: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 21: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 22: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 23: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Why is DFT Useful?

• Easier to remove undesirable frequencies.

• Faster perform certain operations in the frequency domain than in the spatial domain.

Page 24: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Properties in the frequency domain

• Fourier transform works globally– No direct relationship between a specific

components in an image and frequencies

• Intuition about frequency– Frequency content– Rate of change of gray levels in an image

Page 25: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Example: Removing undesirable frequencies

remove highfrequencies

reconstructedsignal

frequenciesnoisy signal

To remove certain frequencies, set their corresponding F(u) coefficients to zero!

Page 27: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

How do frequencies show up in an image?• Low frequencies correspond to slowly varying

information (e.g., continuous surface).• High frequencies correspond to quickly varying

information (e.g., edges)

Page 29: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

How do frequencies show up in an image?

Page 34: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

How do frequencies show up in an image?

Page 35: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

The 2D DFT and its inverse

• Centered spectrum for display

)0,0(

)0,0(

)1,1( NM

Page 36: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

2-D Fourier transform

• Frequency axis

[ ( , )( 1) ] ( / 2, / 2)x yf x y F u M v N

x

y

u

v

u

vF shift

0

Page 37: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 38: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 39: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 40: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 41: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 42: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 43: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 44: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 45: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 46: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Low and high frequencies

Low

High

LowLo

w

Hig

h

Low

Low Low

LowLow

High

Frequencies of the 2D DFT

Page 47: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Periodicity of 2-D DFT

For an image of size NxM pixels, its 2-D DFT repeats itself every N points in x-direction and every M points in y-direction.

We display only in this range

1

0

1

0

)//(2),(1

),(M

x

N

y

NvyMuxjeyxfMN

vuF

0 N 2N-N

0

M

2M

-M

2-D DFT:

f(x,y)

Page 48: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Conventional Display for 2-D DFT

High frequency area

Low frequency area

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

Page 49: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

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

2D FFTSHIFT

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

High frequency area Low frequency area

Page 50: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Original displayof 2D DFT

0 N 2N-N

0

M

2M

-M

Display of 2D DFTAfter FFT Shift

2-D FFT Shift : How it works

Page 51: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Example of 2-D DFT

Original image

2D DFT

2D FFT Shift

Page 52: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Example of 2-D DFT

Original image

2D DFT

2D FFT Shift

Page 53: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Spectrum shift

Original imageLog enhanced

transform

Shifted

log enhanced

transform

Page 54: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 55: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 56: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

• Computing DFT– Use the two-dimensional FFT command

E=fft2(A)– Puts center of the beam in the corners

– Use the fftshift command to put it into the centerA=imread(‘slit’, ‘gif’) fft2( A ) fftshift( fft2( A ) )

Page 57: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

DFT Properties: Rotation

• Rotating f(x,y) by θ rotates F(u,v) by θ

Page 58: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

DFT

DFT

DFT Properties: Rotation

Page 59: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

The Property of Two-Dimensional DFT Linear Combination

The Property of Two-Dimensional DFT Linear Combination

DFT

DFT

DFT

A

B

0.25 * A + 0.75 * B

Page 60: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Two-Dimensional DFT with Different FunctionsTwo-Dimensional DFT with Different Functions

Sine wave

Rectangle

Its DFT

Its DFT

Page 61: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Two-Dimensional DFT with Different FunctionsTwo-Dimensional DFT with Different Functions

2D Gaussianfunction

Impulses

Its DFT

Its DFT

Page 62: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Two-Dimensional DFT with Different FunctionsTwo-Dimensional DFT with Different Functions

2D Gaussianfunction

Impulses

Its DFT

Its DFT

Page 63: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 64: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Relation Between Spatial and Frequency Resolutions

xMu

1yN

v

1

whereDx = spatial resolution in x directionDy = spatial resolution in y direction

Du = frequency resolution in x directionDv = frequency resolution in y directionN,M = image width and height

( Dx and Dy are pixel width and height. )

Page 65: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

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

f(x,y)

1-D DFT

by row F(u,y)

1-D DFTby column

F(u,v)

Page 66: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

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

f(x,y)

1-D DFT

by rowF(x,v)

1-D DFTby column

F(u,v)

Alternative method

Page 67: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Filtering in the Frequency Domain with FFT shift

f(x,y)

2D FFT

FFT shift

F(u,v)

FFT shift

2D IFFTX

H(u,v)(User defined)

G(u,v)

g(x,y)

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

Page 68: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 69: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 70: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 71: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 72: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 73: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 74: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 75: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 76: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Smoothing filters: Gaussian

• The weights are samples of the Gaussian function

mask size:

σ = 1.4

Page 77: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Smoothing filters: Gaussian

•As σ increases, more samples must be obtained to represent the Gaussian function accurately.• Therefore, σ controls the amount of smoothing

σ = 3

Page 78: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Smoothing filters: Gaussian

Page 79: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 80: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 81: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 82: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 83: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Fourier Low Pass Filtering

Page 84: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Gaussian Low Pass Filter

Page 85: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Low pass filtering

Page 86: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Low pass filtering

Page 87: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 88: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 89: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 90: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 91: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 92: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 93: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 94: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 95: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Fourier High Pass Filtering

Page 96: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Linear filtering and convolution

DFT

IDFT

Page 97: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

High pass filtering

Page 98: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

High pass filtering

Page 99: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir
Page 100: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Example of noise reduction using DFT

Page 101: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

Questions? Discussion? Suggestions?

Page 102: DREAM PLAN IDEA IMPLEMENTATION 1 2 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir

102