Top Banner
Sampling (Section 4.3) CS474/674 – Prof. Bebis
27

Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Sampling (Section 4.3)

CS474/674 – Prof. Bebis

Page 2: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Sampling

• How many samples should we obtain to minimize information loss during sampling?

• Hint: take enough samples to allow reconstructing the “continuous” image from its samples.

Page 3: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Example

Sampled signal looks like a sinusoidal of a lower frequency !

Page 4: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Definition: “band-limited” functions

• A function whose spectrum is of finite duration

• Are all functions band-limited?

max frequency

NO!!

Page 5: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Properties of band-limited functions

• Band-limited functions have infinite duration in the time domain.

• Functions with finite duration in the time domain have infinite duration in the frequency domain.

Page 6: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Sampling a 1D function

• Multiply f(x) with s(x)

sampled f(x)x

Hint: use convolution theorem!

Question: what is the DFT of f(x) s(x)?

Page 7: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Sampling a 1D function (cont’d)

• Suppose f(x) F(u)

• What is the DFT of s(x)?

Page 8: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Sampling a 1D function (cont’d)

* =

So:

x1

x

1

x1

x

1

Page 9: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Sampling a 2D function (cont’d)

s(x,y)

Δy Δxx y

• 2D train of impulses

Page 10: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Sampling a 2D function (cont’d)

• DFT of 2D discrete function (i.e., image)

f(x,y)s(x,y) F(u,v)*S(u,v)

Page 11: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Reconstructing f(x) from its samples

• Need to isolate a single period:

– Multiply by a window G(u)

x

Page 12: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Reconstructing f(x) from its samples (cont’d)

• Then, take the inverse FT:

Page 13: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

What is the effect of Δx?

• Large Δx (i.e., few samples) results to overlapping periods!

Page 14: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Effect of Δx (cont’d)

• But, if the periods overlap, we cannot anymore isolate a single period aliasing!

x

Page 15: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

What is the effect of Δx? (cont’d)

• Smaller Δx (i.e., more samples) alleviates aliasing!

Page 16: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

What is the effect of Δx? (cont’d)

• 2D case

u u

v v

umaxvmax

Page 17: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Example

• Suppose that we have an imaging system where the number of samples it can take is fixed at 96 x 96 pixels.

• Suppose we use this system to digitize checkerboard patterns.

• Such a system can resolve patterns that are up to 96 x 96 squares (i.e., 1 x 1 pixel squares).

• What happens when squares are less than 1 x 1 pixels?

Page 18: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Examplesquare size: 16 x 16 6 x 6

square size: 160.9174 0.4798

(same as12 x 12 squares)

Page 19: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

How to choose Δx?

• The center of the overlapped region is at

Page 20: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

How to choose Δx? (cont’d)

•Choose Δx as follows:

where W is the max frequency of f(x)

Page 21: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Practical Issues

• Band-limited functions have infinite duration in the time domain.

• But, we can only sample a function over a finite interval!

Page 22: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Practical Issues (cont’d)

• We would need to obtain a finite set of samples

by multiplying with a “box” function:

[s(x)f(x)]h(x)

x =

Page 23: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Practical Issues (cont’d)

• This is equivalent to convolution in the frequency domain! [s(x)f(x)]h(x) [F(u)*S(u)] * H(u)

Page 24: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Practical Issues (cont’d)

instead of this!

*

Page 25: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

How does this affect things in practice?

• Even if the Nyquist criterion is satisfied, recovering a function that has been sampled in a finite region is in general impossible!

• Special case: periodic functions– If f(x) is periodic, then a single period can be isolated

assuming that the Nyquist theorem is satisfied!

– e.g., sin/cos functions

Page 26: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Anti-aliasing

• In practice, aliasing in almost inevitable!

• The effect of aliasing can be reduced by smoothing the input signal to attenuate its higher frequencies.

• This has to be done before the function is sampled.– Many commercial cameras have true anti-aliasing filtering

built in the lens of the sensor itself.

– Most commercial software have a feature called “anti-aliasing” which is related to blurring the image to reduced aliasing artifacts (i.e., not true anti-aliasing)

Page 27: Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.

Example

50% less samples3 x 3 blurring and50% less samples