Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen...

30

Transcript of Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen...

Page 1: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables

Extension to Two Variables

Dr. Praveen Sankaran

Department of ECE

NIT Calicut

January 16, 2013

Dr. Praveen Sankaran DIP Winter 2013

Page 2: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables

Outline

1 Functions on Two Variables

2D Impulse and Sifting

2D Discrete Fourier Transform

DFT Properties

Dr. Praveen Sankaran DIP Winter 2013

Page 3: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Outline

1 Functions on Two Variables

2D Impulse and Sifting

2D Discrete Fourier Transform

DFT Properties

Dr. Praveen Sankaran DIP Winter 2013

Page 4: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

2D Impulse

δ (t,z) =

{∞ if t = z = 0

0 otherwise(1)

∫∞

−∞

∫∞

−∞

δ (t,z)dt dz = 1 (2)

Discrete Equivalent

δ [x ,y ] =

{1 x = y = 0

0 otherwise(3)

δ [x− x0,y − y0]?

Dr. Praveen Sankaran DIP Winter 2013

Page 5: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Sifting Property

Sifting Property∫∞

−∞

∫∞

−∞

f (t,z)δ (t− t0,z− z0)dt dz = f (t0,z0) (4)

∑x=−∞

∑y=−∞

f [x ,y ]δ [x− x0,y − y0] = f [x0,y0] (5)

Dr. Praveen Sankaran DIP Winter 2013

Page 6: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Outline

1 Functions on Two Variables

2D Impulse and Sifting

2D Discrete Fourier Transform

DFT Properties

Dr. Praveen Sankaran DIP Winter 2013

Page 7: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

2D Continuous Fourier Transform

F (µ,ν) =∫

−∞

∫∞

−∞

f (t,z)e−j2π(µt+νz)dt dz (6)

f (t,z) =∫

−∞

∫∞

−∞

F (µ,ν)e j2π(µt+νz)dµ dν (7)

Dr. Praveen Sankaran DIP Winter 2013

Page 8: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Example

Dr. Praveen Sankaran DIP Winter 2013

Page 9: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

2D Sampling

2D Impulse Train

s [t,z ] =∞

∑m=−∞

∑n=−∞

δ [t−m∆T , z−n∆Z ] (8)

f (t,z)s [t,z ]⇒ sampled function.

Dr. Praveen Sankaran DIP Winter 2013

Page 10: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

2D Sampling Theorem

1

∆T <1

2µmax(9)

and,2

∆Z <1

2νmax(10)

We have a problem here. A camera would have a �xed sampling

system that is trying to match all sorts of visual frequencies. Also

we want to limit the input signal to a speci�c spatial band. This

involves multiplying the signal with another function such as the

box we discussed earlier. But the box has wide frequency and

product in space equates to convolution in frequency. That means

the space limited signal would have wide frequency components in

practice.Dr. Praveen Sankaran DIP Winter 2013

Page 11: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Aliasing

Anyway for the sake of explaining it,

Dr. Praveen Sankaran DIP Winter 2013

Page 12: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Spatial Aliasing in Images

What we can do is to device ways to reduce the visual e�ect of

violating the sampling theorem.

Sampling is kept constant. The image taken is changed with

square size reduced from `a' through `d'. `c', `d' have square

size < one pixel and aliasing is visually evident.Dr. Praveen Sankaran DIP Winter 2013

Page 13: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Another Example

Dr. Praveen Sankaran DIP Winter 2013

Page 14: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

2D DFT

F [u,v ] =M−1

∑m=0

N−1

∑n=0

f [m,n]e−j2π(um/M+vn/N) (11)

f [.] is a digital image of size M×N.

u = 0,1, · · ·M−1 and v = 0,1, · · ·N−1.

Inverse DFT

f [m,n] =1

MN

M−1

∑u=0

N−1

∑v=0

F [u,v ]e j2π(um/M+vn/N) (12)

m = 0,1, · · ·M−1 and n = 0,1, · · ·N−1.

Dr. Praveen Sankaran DIP Winter 2013

Page 15: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Outline

1 Functions on Two Variables

2D Impulse and Sifting

2D Discrete Fourier Transform

DFT Properties

Dr. Praveen Sankaran DIP Winter 2013

Page 16: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Spatial and Frequency Intervals

∆u =1

M∆T(13)

∆v =1

N∆Z(14)

We have seen this before.

Dr. Praveen Sankaran DIP Winter 2013

Page 17: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Periodicity

F [u,v ] = F [u+k1M,v ] = F [u,v +k2N] = F [u+k1M,v +k2N](15)

f [m,n] = f [m+k1M,n] = f [m,n+k2N] = f [m+k1M,n+k2N](16)

Dr. Praveen Sankaran DIP Winter 2013

Page 18: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Shifting

F [u−u0,v − v0]⇐⇒ f [m,n]e−j2π(u0m/M+v0n/N)

Multiplying f [m,n] by the modi�ed exponential term shifts the

data so that the origin is now at F [u−u0,v − v0]. Hence,

f [m,n] (−1)m+n⇐⇒ F [u−M/2, v −N/2]

Also,

f [m−m0,n−n0]⇐⇒ F [u,v ]e j2π(um0/M+vn0/N)

Dr. Praveen Sankaran DIP Winter 2013

Page 19: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Illustration & Shifting

f [m,n] (−1)m+n⇐⇒F [u−M/2, v −N/2]

Dr. Praveen Sankaran DIP Winter 2013

Page 20: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Even/Odd Functions

Any function w (x ,y) = we (x ,y) +wo (x ,y),

we (x ,y) =w (x ,y) +w (−x ,−y)

2(17)

wo (x ,y) =w (x ,y)−w (−x ,−y)

2(18)

Even

we (x ,y) = we (−x ,−y)

Symmetric

we (x ,y) =we (M− x ,N− y)

Odd

wo (x ,y) =−wo (−x ,−y)

Antisymmetric

wo (x ,y) =−wo (M− x ,N− y)

What about f = {2 1 1 1}?

Dr. Praveen Sankaran DIP Winter 2013

Page 21: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Some more properties

Dr. Praveen Sankaran DIP Winter 2013

Page 22: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

How do the values shape up?

F [0,0] =M−1

∑m=0

N−1

∑n=0

f [m,n]e0⇒

F [0,0] = MN1

MN

M−1

∑m=0

N−1

∑n=0

f [m,n]⇒

F [0,0] = MNf̃ [m,n] (19)

A scaled average intensity value of the image gives the origin

point in the spectrum!

Dr. Praveen Sankaran DIP Winter 2013

Page 23: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Spectrum and Phase Angle

F [u,v ] = |F [u,v ]|e jφ(u,v)

Fourier Spectrum,

|F [u,v ]|=[R [u,v ]2 + I [u,v ]2

]1/2(20)

even

Phase angle,

φ (u,v) = arctan

([I [u,v ]

R [u,v ]

])(21)

odd

Dr. Praveen Sankaran DIP Winter 2013

Page 24: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Illustration - Spectrum Centering and Log Operation

Dr. Praveen Sankaran DIP Winter 2013

Page 25: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Illustration - Change e�ect in Spectrum

Dr. Praveen Sankaran DIP Winter 2013

Page 26: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Illustration - Phase changes

Though seemingly �lled with varying values that give no information

about the underlying image, phase is really important. The Fourier

spectrum and phase angle can be obtained by taking DFT of an

image. Now consider the case where two images are involved and

you mix the spectrum and phase information of the two for IDFT.

Dr. Praveen Sankaran DIP Winter 2013

Page 27: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Reconstruction Illustration - Phase Dominates!

Dr. Praveen Sankaran DIP Winter 2013

Page 28: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

2D Convolution Theorem

f [m,n]?h [m,n] =M−1

∑j=0

N−1

∑k=0

f [j ,k]h [m− j ,n−k] (22)

f [m,n]?h [m,n]⇐⇒ F [u,v ]H [u,v ] (23)

f [m,n]h [m,n]⇐⇒ F [u,v ]?H [u,v ] (24)

Equation 23 is of particular importance to us. A spatial convolution

can be expressed as a product in frequency domain. This means

that all the linear �ltering we discussed before as convolutions can

now be easily understood as products.

Dr. Praveen Sankaran DIP Winter 2013

Page 29: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Summary

2D extension of ideas we discussed in 1D.

Concepts of sampling, aliasing in images.

2D DFT.

Properties

2D Convolution.

Dr. Praveen Sankaran DIP Winter 2013

Page 30: Extension to wTo Variables - National Institute of ... · Extension to wTo Variables Dr. Praveen Sankaran Department of ECE NIT Calicut January 16, 2013 Dr. Praveen Sankrana DIP Winter

Functions on Two Variables2D Impulse and Sifting2D Discrete Fourier TransformDFT Properties

Questions

4.4, 4.6, 4.7, 4.12, 4.13, 4.15, 4.17(look at 4.3 as reference).

Dr. Praveen Sankaran DIP Winter 2013