20
Sampling and Quantization Lecture #5 January 21, 2002

Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

  • Upload
    tranbao

  • View
    229

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Sampling and Quantization

Lecture #5January 21, 2002

Page 2: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 2

Sampling and Quantization

� Spatial Resolution (Sampling)� Determines the smallest perceivable image

detail.� What is the best sampling rate?

� Gray-level resolution (Quantization)� Smallest discernible change in the gray level

value.� Is there an optimal quantizer?

Page 3: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 3

Image sampling and quantization

In 1-D

f(x,y)

(Continuous image)

Samplerfs(m,n)

Quantizeru(m,n)

To Computer

Page 4: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 4

1-D1−D

x(t)

Time domain

X(u)

Frequency

Ts(t)

xs(t) = x(t) s(t) = Σ x(kt) δ (t-kT)

s(t)1/T

1/TXs(f)

Page 5: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 5

2-D: Comb function

ycomb(x,y;∆x,∆y)

x∆x

∆y

Comb( , ; , ) ( , )x y x y x m x y n ynm

∆ ∆ ∆ ∆≅ − −=−∞

=−∞

∑∑ δ

Page 6: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 6

Sampled Image

f x y f x y x y x y

f m x n y x m x y n y

x y x y u v

x yu v

x y

s

nm

( , ) ( , ) ( , ; , )

( , ) ( , )

( , ; , ) ( , )

, ; , )

=

= − −

← → ==−∞

=−∞

∑∑

comb

comb COMB

comb(

∆ ∆

∆ ∆ ∆ ∆

∆ ∆

∆ ∆ ∆ ∆

δ

1 1 1

Page 7: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 7

Sampled Spectrum

F u v F u v u v

x yF u v u k

xv l

y

x yF u k

xv l

y

s

k l

k l

( , ) ( , ) ( , )

( , ) ,

,

,

,

= ∗

= ∗ − −FHG

IKJ

= − −FHG

IKJ

∑∑

∑∑

=−∞

=−∞

COMB

1

1

∆ ∆ ∆ ∆

∆ ∆ ∆ ∆

δ

Page 8: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 8

Sampled Spectrum: Example

Page 9: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 9

Bandlimited Images

A function f(x,y) is said to be band limited if the Fourier transform

F(u,v) = 0 for | u | > u0, | v | > v0

u0, v0 Band width of the image in the x- and y- directions

v0

u0region of support

Page 10: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 10

Foldover Frequencies

Sampling frequencies:Let us and vs be the sampling frequencies

Then us > 2u0 ; vs > 2v0

or ∆ x <1/2u0 ; ∆ y <1/2v0

Frequencies above half the sampling frequencies are called fold over frequencies.

Page 11: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 11

Sampling Theorem

A band limited image f(x,y) with F(u,v) as its Fourier transform; and F(u,v) = 0 |u| > u0 |v| > v0 ; and sampled uniformly on a rectangular grid with spacing ∆∆∆∆x and ∆∆∆∆y, can be recovered without error from the sample values f(m ∆∆∆∆x, n ∆∆∆∆y) provided the sampling rate is greater than the nyquist rate.

i.e 1/ ∆∆∆∆x = us > 2 u0, 1/ ∆∆∆∆y = vs > 2 v0

The reconstructed image is given by the interpolation formula:

f x y f m x n y xu mxu m

y v ny v nm n

s

s

s

s

( , ) ( , ) ( )( )

( )( ),

= −−

−−∑∑

=−∞

∆ ∆ sin sinππ

ππ

Page 12: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 12

Reconstruction

0

R1

R2

δR

Page 13: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 13

Reconstruction via LPF

F(u,v) can be recovered by a LPF with

H u vx y u v R

R RR

R

F u v H u v F u v F u vf x y F u v

s

( , )( , )

~( , ) ( , ) ( , ) ( , )

( , ) [ ( , )]

=∈RST

= =

= ℑ −

∆ ∆0

1

2

1

Other wise is any region whose boundary is contained

within the annular ring between the rectangles and in the figure. Reconstructed signal is

Page 14: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 14

Aliasing

Note: If us and vs are below the Nyquist rate, the periodicreplications will overlap, resulting in a distorted spectrum.

This overlapping of successive periods of the spectrumcauses the foldover frequencies in the original image toappear as frequencies below us/2, vs/2 in the sampled image. This is called aliasing.

Page 15: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 15

Page 16: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 16

Example

there will be aliasing.

f x y x yF u v u v u v

u v

x y u v u vs s

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

,

. ,.

= += - - + + +

fi = =

= = fi = = = <

2 2 3 43 4 3 4

3 4

0 2 10 2

5 2

0 0

0 0

cos

Let ,< 2

pd d

D D

Page 17: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 17

Example:(contd.)

F

Let

Otherwise

cos

s ( , ) ( , )

[ ( , ) ( , )]

( , ). . , . .

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

~( , ) (2 (2 ))

,

,

u v F u ku v lv

u k v l u k v l

H u vu u

F u v H u v F u vu v u v

f x y x y

s sk l

k l

s

= − −

= − − − − + + − + −

=− ≤ ≤ − ≤ ≤RST

∴ == + + + − −

∴ = +

∑∑

∑∑

=−∞

=−∞

25

25 3 5 4 5 3 5 4 5

2 5 2 5 2 5 2 50

2 1 2 1

2

125

δ δ

δ δπ

Page 18: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 18

Examples

Original and the reconstructed image from samples.

Page 19: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 19

Another example

Sampling filter

sampled image

Page 20: Sampling and Quantization - UC Santa BarbaraSampling).pdf · Jan 21, 2003 Sampling 2 Sampling and Quantization Ł Spatial Resolution (Sampling) Œ Determines the smallest perceivable

Jan 21, 2003 Sampling 20

Aliasing Problems (real images!)