31
3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros Niko University of Ioannina - Department of Computer Science Christophoros Nikou [email protected] 2 Filtering in the Frequency Domain Filter: A device or material for suppressing or minimizing waves or oscillations of certain frequencies. Frequency: The number of times that a periodic function repeats the same sequence of values during a unit variation of the independent variable. C. Nikou – Digital Image Processing (E12) Webster’s New Collegiate Dictionary

Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

1

Digital Image Processing

Filtering in the Frequency Domain(Fundamentals)

Christophoros Niko

University of Ioannina - Department of Computer Science

Christophoros [email protected]

2 Filtering in the Frequency Domain

Filter: A device or material for suppressing or minimizing waves or oscillations of certain frequencies.

Frequency: The number of times that a periodic function repeats the same sequence of values during a unit variation of the independent variable.

C. Nikou – Digital Image Processing (E12)

Webster’s New Collegiate Dictionary

Page 2: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

2

3 Jean Baptiste Joseph Fourier

Fourier was born in Auxerre, France in 1768.

– Most famous for his work “La Théorie Analitique de la Chaleur” published in 1822.

– Translated into English in 1878: “The Analytic Theory of Heat”.

C. Nikou – Digital Image Processing (E12)

Nobody paid much attention when the work was first published.One of the most important mathematical theories in modern engineering.

4 The Big Idea

g (2

002)

=

& W

oods

, Dig

ital I

mag

e P

roce

ssin

C. Nikou – Digital Image Processing (E12)

Any function that periodically repeats itself can be expressed as a sum of sines and cosines of different frequencies each multiplied by a different coefficient – a Fourier series

Imag

es ta

ken

from

Gon

zale

z &

Page 3: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

3

5 1D continuous signalsg

(200

2) • It may be considered both as

& W

oods

, Dig

ital I

mag

e P

roce

ssin

0, x x+∞ =⎧⎨

considered both as continuous and discrete.

• Useful for the representation of

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & 0

0

,( )

0 otherwisex x

x xδ+⎧

− = ⎨⎩

discrete signals through sampling of continuous signals. 0 0( ) ( ) ( )f x x x dx f xδ

+∞

−∞

− =∫

6 1D continuous signals (cont.)

g (2

002) Impulse train function

& W

oods

, Dig

ital I

mag

e P

roce

ssin

( ) ( )Tn

S t t n Tδ+∞

Δ=−∞

= − Δ∑

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

[ ] ( ) ( ) ( ) ( ) ( ) ( )Tn n

x n x t S t x t t n T x n T t n Tδ δ+∞ +∞

Δ=−∞ =−∞

= = − Δ = Δ − Δ∑ ∑

Page 4: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

4

7 1D continuous signals (cont.)g

(200

2)

[ ] ( ) ( )x n x t S t

& W

oods

, Dig

ital I

mag

e P

roce

ssin [ ] ( ) ( )Tx n x t S tΔ=

( ) ( )n

x t t n Tδ+∞

=−∞

= − Δ∑

+∞

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

( ) ( )n

x n T t n Tδ=−∞

= Δ − Δ∑

8 1D continuous signals (cont.)

g (2

002) • The Fourier series expansion of a periodic

signal f (t)

& W

oods

, Dig

ital I

mag

e P

roce

ssin signal f (t).

2

( )j nt

Tn

nf t c e

π+∞

=−∞

= ∑

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

/ 2 2

/ 2

1 ( )T

j ntT

nT

c f t e dtT

π−

= ∫

Page 5: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

5

9 1D continuous signals (cont.)g

(200

2) • The Fourier transform of a continuous signal f (t)

& W

oods

, Dig

ital I

mag

e P

roce

ssin signal f (t).

2( ) ( ) j tF f t e dtπμμ+∞

−∞

= ∫

2( ) ( ) j tf t F e dπμμ μ+∞

= ∫

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & ( ) ( )f μ μ

−∞∫

• Attention: the variable is the frequency (Hz) and not the radial frequency (Ω=2πμ) as in the Signals and Systems course.

10 1D continuous signals (cont.)

g (2

002)

& W

oods

, Dig

ital I

mag

e P

roce

ssin

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

/ 2sin( )( ) ( ) ( )

( )WWf t P t F W

Wπμμ

πμ= Α ↔ = Α

Page 6: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

6

11 1D continuous signals (cont.)g

(200

2) • Convolution property of the FT.

& W

oods

, Dig

ital I

mag

e P

roce

ssin

( )* ( ) ( ) ( )

( )* ( ) ( ) ( )

f t h t f h t d

f t h t F H

τ τ τ

μ μ

+∞

−∞

= −

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

( ) ( ) ( )* ( )f t h t F Hμ μ↔

12 1D continuous signals (cont.)

g (2

002) • Intermediate result

− The Fourier transform of the impulse train

& W

oods

, Dig

ital I

mag

e P

roce

ssin − The Fourier transform of the impulse train.

1( )n n

nt n TT T

δ δ μ+∞ +∞

=−∞ =−∞

⎛ ⎞− Δ ↔ −⎜ ⎟Δ Δ⎝ ⎠∑ ∑

• It is also an impulse train in the frequency

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & • It is also an impulse train in the frequency

domain.• Impulses are equally spaced every 1/ΔΤ.

Page 7: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

7

13 1D continuous signals (cont.)g

(200

2) Sampling

& W

oods

, Dig

ital I

mag

e P

roce

ssin

[ ] ( ) ( )Tx n x t S tΔ=

( ) ( )n

x t t n Tδ+∞

=−∞

= − Δ∑

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

( ) ( )n

x n T t n Tδ+∞

=−∞

= Δ − Δ∑

14 1D continuous signals (cont.)

g (2

002) • Sampling

− The spectrum of the discrete signal consists of

& W

oods

, Dig

ital I

mag

e P

roce

ssin − The spectrum of the discrete signal consists of

repetitions of the spectrum of the continuous signal every 1/ΔΤ.

− The Nyquist criterion should be satisfied.

( ) ( )f t F μ↔

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & ( ) ( )

1( ) [ ] ( )n

f t Fnf n T f n F F

T T

μ

μ μ+∞

=−∞

⎛ ⎞Δ = ↔ = −⎜ ⎟Δ Δ⎝ ⎠∑

Page 8: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

8

15 1D continuous signals (cont.)g

(200

2)&

Woo

ds, D

igita

l Im

age

Pro

cess

in

Nyquist theorem

max1 2T

μ≥Δ

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & TΔ

16 1D continuous signals (cont.)

g (2

002)

FT of a continuous signal

& W

oods

, Dig

ital I

mag

e P

roce

ssin

Oversampling

Critical sampling with

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

Undersampling Aliasing appears

C ca sa p gthe Nyquist frequency

Page 9: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

9

17 1D continuous signals (cont.)g

(200

2) • Reconstruction (under correct sampling).

& W

oods

, Dig

ital I

mag

e P

roce

ssin

( ) ( ) ( )F F Hμ μ μ=

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

( ) ( )* sin tf t f t T cT

⎛ ⎞= ⎜ ⎟Δ⎝ ⎠

18 1D continuous signals (cont.)

g (2

002) • Reconstruction

−Provided a correct sampling the continuous

& W

oods

, Dig

ital I

mag

e P

roce

ssin −Provided a correct sampling, the continuous

signal may be perfectly reconstructed by its samples.

( )T+∞ Δ⎡ ⎤

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & ( )( ) ( ) sinc

n

t n Tf t f n Tn T

+∞

=−∞

− Δ⎡ ⎤= Δ ⎢ ⎥Δ⎣ ⎦∑

Page 10: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

10

19 1D continuous signals (cont.)g

(200

2)

• Under aliasing, the

& W

oods

, Dig

ital I

mag

e P

roce

ssin reconstruction of

the continuous signal not correct.

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

20 1D continuous signals (cont.)

g (2

002) Aliased signal

& W

oods

, Dig

ital I

mag

e P

roce

ssin

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

Page 11: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

11

21 The Discrete Fourier Transformg

(200

2) • The Fourier transform of a sampled (discrete) signal is a continuous function of the frequency.

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g q y

1( )n

nF FT T

μ μ+∞

=−∞

⎛ ⎞= −⎜ ⎟Δ Δ⎝ ⎠∑

• For a N-length discrete signal, taking N samples of its Fourier transform at frequencies:

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & q

provides the discrete Fourier transform (DFT) of the signal.

0,1, .., 1,k k Nk

N Tμ = −=

Δ

22The Discrete Fourier Transform

(cont.)

g (2

002) • DFT pair of signal f [n] of length N.

& W

oods

, Dig

ital I

mag

e P

roce

ssin

21

021

0 1

0 1

[ ] [ ] ,

1[ ] [ ] ,

nkN jN

nnkN j

N

k N

n N

F k f n e

f n F k e

π

π

− −

=

≤ ≤ −

≤ ≤ −

=

=

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

0

[ ] [ ] ,n

fN =∑

Page 12: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

12

23The Discrete Fourier Transform

(cont.)g

(200

2) • PropertyThe DFT of a N length f [n] signal is periodic

& W

oods

, Dig

ital I

mag

e P

roce

ssin – The DFT of a N-length f [n] signal is periodic

with period N.

[ ] [ ]F k N F k+ =

– This is due to the periodicity of the complex exponential:

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & exponential:

( )2 2n nj jn nN N

N Nw e w eπ π

− −⎛ ⎞= ⇔ =⎜ ⎟⎝ ⎠

24The Discrete Fourier Transform

(cont.)

g (2

002) • Property: sum of complex exponentials

& W

oods

, Dig

ital I

mag

e P

roce

ssin

0

1, ,10, otherwise

NknN

n

k rN rw

N =

= ∈⎧= ⎨⎩

The proof is left as an exercise

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & The proof is left as an exercise.

2jN

Nw eπ

−=

Page 13: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

13

25The Discrete Fourier Transform

(cont.)g

(200

2) • DFT pair of signal f [n] of length N may be expressed in matrix-vector form

& W

oods

, Dig

ital I

mag

e P

roce

ssin expressed in matrix-vector form.

1

0

1

0 1

0 1

[ ] [ ] ,

1[ ] [ ] ,

NnkN

n

Nnk

N

k N

n N

F k f n w

f n F k wN

=

−−

≤ ≤ −

≤ ≤ −

=

=

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

0[ ] [ ] ,N

nf

N =∑

2jN

Nw eπ

−=

26The Discrete Fourier Transform

(cont.)F = Af

( ) ( ) ( ) ( )( ) ( ) ( ) ( )

( ) ( ) ( ) ( )

0 1 2 10 0 0 0

0 1 2 11 1 1 1

0 1 2 1

N

N N N N

N

N N N N

N

w w w w

w w w w

⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥=⎢ ⎥⎢ ⎥⎢ ⎥

A

C. Nikou – Digital Image Processing (E12)

[ ] [ ][0], [1],..., [ 1] , [0], [1],..., [ 1]T Tf f f N F F F N− −f = F =

( ) ( ) ( ) ( )0 1 2 11 1 1 1 NN N N NN N N Nw w w w− − − −⎢ ⎥

⎣ ⎦…

Page 14: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

14

27The Discrete Fourier Transform

(cont.)

Example for N=4

1 1 1 11 11 1 1 11 1

j j

j j

⎡ ⎤⎢ ⎥− −⎢ ⎥=⎢ ⎥− −⎢ ⎥− −⎣ ⎦

A

C. Nikou – Digital Image Processing (E12)

1 1j j− −⎣ ⎦

28The Discrete Fourier Transform

(cont.)The inverse DFT is then expressed by:

-1f = A Ff = A F

( )

( ) ( ) ( ) ( )( ) ( ) ( ) ( )

( ) ( ) ( ) ( )

*0 1 2 10 0 0 0

0 1 2 11 1 1 11 *

0 1 2 1

1 1

TN

N N N N

NT N N N N

N

w w w w

w w w wN N

⎛ ⎞⎡ ⎤⎜ ⎟⎢ ⎥⎜ ⎟⎢ ⎥⎜ ⎟⎢ ⎥= = ⎜ ⎟⎢ ⎥⎜ ⎟⎢ ⎥⎜ ⎟⎢ ⎥

A A

C. Nikou – Digital Image Processing (E12)

( ) ( ) ( ) ( )0 1 2 11 1 1 1 NN N N NN N N Nw w w w− − − −⎜ ⎟⎢ ⎥⎜ ⎟⎣ ⎦⎝ ⎠

This is derived by the complex exponential sum property.

Page 15: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

15

29 Linear convolution

1 2[ ] 1, 2, 2, [ ] 1, 1, 3, 2f n h n N N= = − = =

[ ] [ ]* [ ] [ ] [ ]m

g n f n h n f m h n m+∞

=−∞

= = −∑

C. Nikou – Digital Image Processing (E12)

is of length N=N1+N2-1=4

30 Linear convolution (cont.)

1 2[ ] 1, 2, 2, [ ] 1, 1, 3, 2f n h n N N= = − = =+∞

[ ] 1 2 2 [ ]0 [0 ] 1 1 11 [1 ] 1 1 1

f m g nn h mn h m= − − →= − − →

[ ] [ ]* [ ] [ ] [ ]m

g n f n h n f m h n m=−∞

= = −∑

C. Nikou – Digital Image Processing (E12)

1 [1 ] 1 1 12 [2 ] 1 1 03 [3 ] 1 1 2

n h mn h mn h m

→= − − →= − − → −

[ ] 1, 1, 0, 2g n = −

Page 16: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

16

31 Circular shift

• Signal x[n] of length N.• A circular shift ensures that the resulting

signal will keep its length N.• It is a shift modulo N denoted by

[( ) ] [( ) mod ]Nx n m x n m N− = −

C. Nikou – Digital Image Processing (E12)

• Example: x[n] is of length N=8.

8[( 2) ] [( 2) ] [6]Nx x x− = − =

8[(10) ] [(10) ] [2]Nx x x= =

32 Circular convolution

1 2[ ] 1, 2, 2, [ ] 1, 1, 3, 2f n h n N N= = − = =

[ ] [( ) ]Nm

f m h n m+∞

=−∞

= −∑g[n]=f [n] h[n]

Circ lar shift mod lo N

C. Nikou – Digital Image Processing (E12)

The result is of length 1 2max , 3N N N= =

Circular shift modulo N

Page 17: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

17

33 Circular convolution (cont.)

1 2[ ] 1, 2, 2, [ ] 1, 1, 3, 2f n h n N N= = − = =

[ ] 1 2 2 [ ]0 [(0 ) ] 1 1 1 1N

f m g nn h m= − − − −

[ ] [( ) ]Nm

f m h n m+∞

=−∞

= −∑g[n]=f [n] h[n]

C. Nikou – Digital Image Processing (E12)

1 [(1 ) ] 1 1 12 [(2 ) ] 1 1 0

N

N

n h mn h m= − −= − −

[ ] 1, 1, 0,g n = −

34 DFT and convolution

[ ] [ ] [ ]G k F k H k↔ =g[n]=f [n] h[n]

• The property holds for the circular convolution.

• In signal processing we are interested in linear convolution

C. Nikou – Digital Image Processing (E12)

linear convolution.• Is there a similar property for the linear

convolution?

Page 18: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

18

35 DFT and convolution (cont.)

[ ] [ ] [ ]G k F k H k↔ =g[n]=f [n] h[n]

Let f [ ] be of length N and h[ ] be of length N• Let f [n] be of length N1 and h[n] be of length N2.

• Then g[n]=f [n]*h[n] is of length N1+N2-1.

• If the signals are zero-padded to length N=N1+N2-1then their circular convolution will be the same as their linear convolution:

C. Nikou – Digital Image Processing (E12)

[ ] [ ]* [ ] [ ] [ ] [ ]g n f n h n G k F k H k= ↔ =

Zero-padded signals

36 DFT and convolution (cont.)

1 2[ ] 1, 2, 2, [ ] 1, 1, 3, 2f n h n N N= = − = =

Zero padding to length N=N +N 1 =4[ ] 1, 2, 2, 0, [ ] 1, 1, 0, 0f n h n= = −

Zero-padding to length N=N1+N2-1 =4

4

[ ] 1 2 2 0 [ ][( 0) ] 0 0 1 1 0 0 1 1[( 1) ] 0 0 1 1 0 0 1

f m g nh nh n

− − −

C. Nikou – Digital Image Processing (E12)

4

4

4

[( 1) ] 0 0 1 1 0 0 1[( 2) ] 0 0 1 1 0 0[( 3) ] 0 0 1 1 2

h nh nh n

− −− −− − −

The result is the same as the linear convolution.

Page 19: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

19

37 DFT and convolution (cont.)

Verification using DFT1 1 1 1 1 5⎡ ⎤ ⎡ ⎤ ⎡ ⎤1 1 1 1 1 51 1 2 1 21 1 1 1 2 11 1 0 1 2

j j j

j j j

⎡ ⎤ ⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥ ⎢ ⎥− − − −⎢ ⎥ ⎢ ⎥ ⎢ ⎥= =⎢ ⎥ ⎢ ⎥ ⎢ ⎥− −⎢ ⎥ ⎢ ⎥ ⎢ ⎥− − − +⎣ ⎦ ⎣ ⎦ ⎣ ⎦

F = Af

1 1 1 1 1 0⎡ ⎤ ⎡ ⎤ ⎡ ⎤

C. Nikou – Digital Image Processing (E12)

1 1 1 1 1 01 1 1 11 1 1 1 0 21 1 0 1

j j j

j j j

⎡ ⎤ ⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥ ⎢ ⎥− − − +⎢ ⎥ ⎢ ⎥ ⎢ ⎥= =⎢ ⎥ ⎢ ⎥ ⎢ ⎥− −⎢ ⎥ ⎢ ⎥ ⎢ ⎥− − −⎣ ⎦ ⎣ ⎦ ⎣ ⎦

H = Ah

38 DFT and convolution (cont.)

[ ] [ ] [ ]G k F k H k=

Element-wise multiplication

5 0 0( 1 2) (1 ) 1 3j j j

×⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥− − × + −⎢ ⎥ ⎢ ⎥G F H

C. Nikou – Digital Image Processing (E12)

( ) ( )1 2 2

( 1 2) (1 ) 1 3

j j j

j j j

⎢ ⎥ ⎢ ⎥× = =⎢ ⎥ ⎢ ⎥×⎢ ⎥ ⎢ ⎥− + × − +⎣ ⎦ ⎣ ⎦

G = F H

Page 20: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

20

39 DFT and convolution (cont.)

Inverse DFT of the result

( )1 *

1 1 1 1 0 11 1 1 3 111 1 1 1 2 041 1 1 3 2

T j j j

j j j

⎡ ⎤ ⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥ ⎢ ⎥− − −⎢ ⎥ ⎢ ⎥ ⎢ ⎥=⎢ ⎥ ⎢ ⎥ ⎢ ⎥− −⎢ ⎥ ⎢ ⎥ ⎢ ⎥− − + −⎣ ⎦ ⎣ ⎦ ⎣ ⎦

g = A G = A

C. Nikou – Digital Image Processing (E12)

j j j⎣ ⎦ ⎣ ⎦ ⎣ ⎦

The same result as their linear convolution.

40 2D continuous signals

g (2

002) 0 0

0 0

, ,( , )

0 otherwisex x y y

x x y yδ+∞ = =⎧

− − = ⎨⎩

& W

oods

, Dig

ital I

mag

e P

roce

ssin 0 otherwise⎩

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

0 0 0 0( , ) ( ) ( )x x y y x x y yδ δ δ− − = − −Separable:

0 0 0 0( , ) ( , ) ( , )f x y x x y y dydx f x yδ+∞ +∞

−∞ −∞

− − =∫ ∫

Page 21: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

21

41 2D continuous signals (cont.)g

(200

2)&

Woo

ds, D

igita

l Im

age

Pro

cess

in

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

The 2D impulse train is also separable:

( , ) ( ) ( ) ( , )X Y X Yn m

S x y S x S y x n X y n Yδ+∞ +∞

Δ Δ Δ Δ=−∞ =−∞

= = − Δ − Δ∑ ∑

42 2D continuous signals (cont.)

g (2

002) • The Fourier transform of a continuous 2D

signal f (x y)

& W

oods

, Dig

ital I

mag

e P

roce

ssin signal f (x,y).

2 ( )( , ) ( , ) j x vyF f x y e dydxπ μμ ν+∞ +∞

− +

−∞ −∞

= ∫ ∫

+∞ +∞

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

2 ( )( , ) ( , ) j x vyf x y F e d dπ μμ ν ν μ+∞ +∞

+

−∞ −∞

= ∫ ∫

Page 22: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

22

43 2D continuous signals (cont.)g

(200

2) • Example: FT of f (x,y)=δ(x)y f (x,y)=δ(x)

& W

oods

, Dig

ital I

mag

e P

roce

ssin

2 ( )( , ) ( ) j x vyF x e dydxπ μμ ν δ+∞ +∞

− +

−∞ −∞

= ∫ ∫

2 2( ) j x j vyx e dx e dyπμ πδ+∞ +∞

− −

−∞ −∞

= ∫ ∫

x

ν F(μ,ν)=δ(ν)

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

2j vye dyπ+∞

−∞

= ∫ ( )δ ν= μ

44 2D continuous signals (cont.)

g (2

002) • Example: FT of f (x,y)=δ(x-y)

yf (x,y)=δ(x-y)

& W

oods

, Dig

ital I

mag

e P

roce

ssin

2 ( )( , ) ( ) j x vyF x y e dydxπ μμ ν δ+∞ +∞

− +

−∞ −∞

= −∫ ∫

2 2( ) j x j vyx y e dx e dyπμ πδ+∞ +∞

− −

−∞ −∞

⎡ ⎤= −⎢ ⎥

⎣ ⎦∫ ∫

x

ν F(μ,ν)=δ(μ+ν)

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & ⎣ ⎦

2 2j y j ye e dyπμ πν+∞

− −

−∞

= ∫( )δ μ ν= +

μ2 ( )j ye dyπ μ ν+∞

− +

−∞

= ∫

Page 23: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

23

45 2D continuous signals (cont.)g

(200

2)&

Woo

ds, D

igita

l Im

age

Pro

cess

in

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

2/ 2, / 2

sin( ) sin( )( , ) ( , ) ( , )( ) ( )W W

W Wf x y P x y F WW Wπμ πνμ ν

πμ πν= Α ↔ = Α

46 2D continuous signals (cont.)

g (2

002) • 2D continuous convolution

+∞ +∞

& W

oods

, Dig

ital I

mag

e P

roce

ssin

( , )* ( , ) ( , ) ( , )f x y h x y f x y h d dα β α β α β+∞ +∞

−∞ −∞

= − −∫ ∫

• We will examine the discrete convolution in more detail.C l i

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

( , )* ( , ) ( , ) ( , )f x y h x y F Hμ ν μ ν↔

• Convolution property

Page 24: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

24

47 2D continuous signals (cont.)g

(200

2) • 2D sampling is accomplished by+∞ +∞

& W

oods

, Dig

ital I

mag

e P

roce

ssin ( , ) ( , )X Y

n m

S x y x n X y n YδΔ Δ=−∞ =−∞

= − Δ − Δ∑ ∑

• The FT of the sampled 2D signal consists of repetitions of the spectrum of the 1D continuous signal.

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & g

1 1( , ) ,n

m nF FX Y X Y

μ ν μ ν+∞

=−∞

⎛ ⎞= − −⎜ ⎟Δ Δ Δ Δ⎝ ⎠∑

48 2D continuous signals (cont.)

g (2

002) • The Nyquist theorem involves both the

horizontal and vertical frequencies.

& W

oods

, Dig

ital I

mag

e P

roce

ssin

q

max max1 12 , 2vX Y

μ≥ ≥Δ Δ

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

Over-sampled Under-sampled

Page 25: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

25

49 Aliasingg

(200

2)&

Woo

ds, D

igita

l Im

age

Pro

cess

in

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

50 Aliasing

g (2

002)

& W

oods

, Dig

ital I

mag

e P

roce

ssin

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

The difference is more pronounced in the area inside the bottle

Page 26: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

26

51 Aliasing - Moiré Patterns

• Effect of sampling a scene with periodic or nearly periodic components (e.g. y p p ( goverlapping grids, TV raster lines and stripped materials).

• In image processing the problem arises when scanning media prints (e.g.

C. Nikou – Digital Image Processing (E12)

magazines, newspapers).• The problem is more general than

sampling artifacts.

52 Aliasing - Moiré Patterns (cont.)

• Superimposed grid drawings (not digitized) produce the effect of new frequencies not existing in the original components.

C. Nikou – Digital Image Processing (E12)

Page 27: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

27

53 Aliasing - Moiré Patterns (cont.)

• In printing industry the problem comes when scanning photographs from the g p g psuperposition of:

• The sampling lattice (usually horizontal and vertical).

• Dot patterns on the newspaper image.

C. Nikou – Digital Image Processing (E12)

54 Aliasing - Moiré Patterns (cont.)

C. Nikou – Digital Image Processing (E12)

Page 28: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

28

55 Aliasing - Moiré Patterns (cont.)

• The printing industry uses halftoning to cope with the problem.

• The dot size is inversely

ti l t

C. Nikou – Digital Image Processing (E12)

proportional to image intensity.

56 2D discrete convolution

g (2

002) m f [m,n] m h [m,n]

& W

oods

, Dig

ital I

mag

e P

roce

ssin

n3 2 n

1 11 -1

[ , ] [ , ]* [ , ] [ , ] [ , ]k l

g m n f m n h m n f k l h m k n l+∞ +∞

=−∞ =−∞

= = − −∑ ∑

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & k l=−∞ =−∞

• Take the symmetric of one of the signals with respect to the origin.

• Shift it and compute the sum at every position [m,n].

Page 29: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

29

57 2D discrete convolution (cont.)g

(200

2) n f [m,n] n h [m,n]

& W

oods

, Dig

ital I

mag

e P

roce

ssin

m3 2 m

1 11 -1

llg [0 0]=0 g [1 1]=0

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

k

h [1-k,1-l]

-1 11 1

3 2kh [-k,-l]

-1 11 1

3 2

g [0,0]=0 g [1,1]=0

58 2D discrete convolution (cont.)

g (2

002) n f [m,n] n h [m,n]

& W

oods

, Dig

ital I

mag

e P

roce

ssin

m3 2 m

1 11 -1

llg [2 2]=3 g [3 2]=-1

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

k

h [3-k,2-l]-1 11 13 2k

h [2-k,2-l]-1 11 1

3 2

g [2,2]=3 g [3,2] -1

Page 30: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

30

59 2D discrete convolution (cont.)g

(200

2) n f [m,n] n h [m,n]

& W

oods

, Dig

ital I

mag

e P

roce

ssin

m3 2 m

1 11 -1

n g[m,n]3 5 2

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z &

m3 -1 -3

M1+M2-1=3N1+N2-1=2

60 The 2D DFT

g (2

002) • 2D DFT pair of image f [m,n] of size MxN.

& W

oods

, Dig

ital I

mag

e P

roce

ssin

1 1 2

0 0

1 1 2

[ , ] [ , ]

1[ , ] [ , ]

km lnM N jM N

m n

km lnM N jM N

F k l f m n e

f m n F k l eMN

π

π

⎛ ⎞− − − +⎜ ⎟⎝ ⎠

= =

⎛ ⎞− − +⎜ ⎟⎝ ⎠

=

=

∑∑

∑∑

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & 0 0m nMN = =

0 1 0 1

0 1 0 1,

k M m M

l N n N

≤ ≤ − ≤ ≤ −

≤ ≤ − ≤ ≤ −

⎧ ⎧⎨ ⎨⎩ ⎩

Page 31: Chapter 04a Frequency Filtering (Fundamentals)cnikou/Courses/Digital_Image_Processing/...3/20/2012 1 Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros

3/20/2012

31

61 The 2D DFT (cont.)g

(200

2) • All of the properties of 1D DFT hold.• Particularly:

& W

oods

, Dig

ital I

mag

e P

roce

ssin • Particularly:

– Let f [m,n] be of size M1xN1 and h[m,n] of size M2xN2 .

– If the signals are zero-padded to size (M1+M2-1)x(N1+N2-1) then their circular convolution will be the same as their linear convolution and:

C. Nikou – Digital Image Processing (E12)

Imag

es ta

ken

from

Gon

zale

z & be the same as their linear convolution and:

[ , ] [ , ]* [ , ] [ , ] [ , ] [ , ]g m n f m n h m n G k l F k l H k l= ↔ =