sampling and reconstruction - tu wien

58
Institute of Computer Graphics and Algorithms Vienna University of Technology Sampling and Reconstruction Peter Rautek, Eduard Gröller, Thomas Theußl

Upload: others

Post on 29-Dec-2021

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sampling and Reconstruction - TU Wien

Institute of Computer Graphics and Algorithms

Vienna University of Technology

Sampling and Reconstruction

Peter Rautek, Eduard Gröller, Thomas Theußl

Page 2: Sampling and Reconstruction - TU Wien

Motivation

Theory and practice of sampling and reconstructionAliasing

Understanding the problem Handling the problem

Examples:Photography/VideoRenderingComputed TomographyCollision detection

Eduard Gröller, Thomas Theußl, Peter Rautek 1

Page 3: Sampling and Reconstruction - TU Wien

OverviewIntroductionTools for Sampling and Reconstruction

Fourier TransformConvolution (dt.: Faltung)Convolution TheoremFiltering

SamplingThe mathematical model

Reconstruction Sampling TheoremReconstruction in Practice

Eduard Gröller, Thomas Theußl, Peter Rautek 2

Page 4: Sampling and Reconstruction - TU Wien

Image Data

Eduard Gröller, Thomas Theußl, Peter Rautek 3

Demo - Scan Lines- Sampling

http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/applets/sampling/introduction_to_sampling_java_browser.html

Page 5: Sampling and Reconstruction - TU Wien

Image Storage and Retrieval

Eduard Gröller, Thomas Theußl, Peter Rautek 4

Page 6: Sampling and Reconstruction - TU Wien

Sampling Problems

Eduard Gröller, Thomas Theußl, Peter Rautek 5

Page 7: Sampling and Reconstruction - TU Wien

OverviewIntroductionTools for Sampling and Reconstruction

Fourier TransformConvolution (dt.: Faltung)Convolution TheoremFiltering

SamplingThe mathematical model

Reconstruction Sampling TheoremReconstruction in Practice

Eduard Gröller, Thomas Theußl, Peter Rautek 6

Page 8: Sampling and Reconstruction - TU Wien

Sampling Theory

Relationship between signal and samples View image data as signals Signals are plotted as intensity vs. spatial

domain Signals are represented as sum of sine waves

- frequency domain

Eduard Gröller, Thomas Theußl, Peter Rautek 7

Page 9: Sampling and Reconstruction - TU Wien

Square Wave Approximation

Eduard Gröller, Thomas Theußl, Peter Rautek 8

Page 10: Sampling and Reconstruction - TU Wien

Fourier Series

Eq1:

Eq2:

Eq3:

Euler’s identity: Eduard Gröller, Thomas Theußl, Peter Rautek 9

1

0 )cos(2

)f(n

nn xnAax

xixeix sincos

1

0 )sin()cos(2

)f(n

nn xnbxnaax

n

xinnecx )f(

Page 11: Sampling and Reconstruction - TU Wien

Fourier Transform

Link between spatial and frequency domain

Eduard Gröller, Thomas Theußl, Peter Rautek 10

dex

dxex

xi

i

ωπ2

ωxπ2

)ωF()f(

)f()ωF(

Page 12: Sampling and Reconstruction - TU Wien

Box & Tent

Eduard Gröller, Thomas Theußl, Peter Rautek 11

Page 13: Sampling and Reconstruction - TU Wien

Square Wave & Scanline

Eduard Gröller, Thomas Theußl, Peter Rautek 12

Page 14: Sampling and Reconstruction - TU Wien

Fourier Transform

Yields complex functions for frequency domain

Extends to higher dimensions Complex part is phase information - usually

ignored in explanation and visual analysis

Alternative: Hartley transformWavelet transform

Eduard Gröller, Thomas Theußl, Peter Rautek 13

Page 15: Sampling and Reconstruction - TU Wien

Discrete Fourier Transform

For discrete signals (i.e., sets of samples)

Complexity for N samples: DFT O(N²)Fast FT (FFT): O(N log N)

Eduard Gröller, Thomas Theußl, Peter Rautek 14

N2-1-N

N21-N

)xf(N1)ωF(

)ωF()f(

xj

xj

e

ex

Demo - Fast Fourier Transform- Different Frequencies

http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/applets/fft1DApp/1d_fast_fourier_transform_java_browser.html

Page 16: Sampling and Reconstruction - TU Wien

OverviewIntroductionTools for Sampling and Reconstruction

Fourier TransformConvolution (dt.: Faltung)Convolution TheoremFiltering

SamplingThe mathematical model

Reconstruction Sampling TheoremReconstruction in Practice

Eduard Gröller, Thomas Theußl, Peter Rautek 15

Page 17: Sampling and Reconstruction - TU Wien

Convolution

Operation on two functions Result: Sliding weighted average of a function

The second function provides the weights

Eduard Gröller, Thomas Theußl, Peter Rautek 16

dgxfxgf )()())((

Demo - Copying (Dirac Pulse)- Averaging (Box Filter)

http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/applets/convolution/convolution_java_browser.html

Page 18: Sampling and Reconstruction - TU Wien

Convolution - Examples

Eduard Gröller, Thomas Theußl, Peter Rautek 17

Page 19: Sampling and Reconstruction - TU Wien

Convolution Theorem

The spectrum of the convolution of two functions is equivalent to the product of the transforms of both input signals, and vice versa.

Eduard Gröller, Thomas Theußl, Peter Rautek 18

2121

2121

ffFFFFff

Page 20: Sampling and Reconstruction - TU Wien

Example - Low-Pass

Low-pass filtering performed on Mandrill scanline

Spatial domain: convolution with sincfunctionFrequency domain: cutoff of high frequencies - multiplication with box filter

Sinc function corresponds to box function and vice versa!

Eduard Gröller, Thomas Theußl, Peter Rautek 19

Page 21: Sampling and Reconstruction - TU Wien

Low-Pass in Spatial Domain 1

Eduard Gröller, Thomas Theußl, Peter Rautek 20

Page 22: Sampling and Reconstruction - TU Wien

Low-Pass in Spatial Domain 2

Eduard Gröller, Thomas Theußl, Peter Rautek 21

Page 23: Sampling and Reconstruction - TU Wien

OverviewIntroductionTools for Sampling and Reconstruction

Fourier TransformConvolution (dt.: Faltung)Convolution TheoremFiltering

SamplingThe mathematical model

Reconstruction Sampling TheoremReconstruction in Practice

Eduard Gröller, Thomas Theußl, Peter Rautek 22

Page 24: Sampling and Reconstruction - TU Wien

Sampling

The process of sampling is a multiplication of the signal with a comb function

The frequency response is convolved with a transformed comb function.

Eduard Gröller, Thomas Theußl, Peter Rautek 23

)(comb)()( T xxfxfs

)(comb)()( T1 FFs

Page 25: Sampling and Reconstruction - TU Wien

Base Functions

Eduard Gröller, Thomas Theußl, Peter Rautek 24

Comb FunctionDirac Pulse

Page 26: Sampling and Reconstruction - TU Wien

FT of Base Functions

Comb function:

Eduard Gröller, Thomas Theußl, Peter Rautek 25

ω)(comb)(comb T1T x

Page 27: Sampling and Reconstruction - TU Wien

OverviewIntroductionTools for Sampling and Reconstruction

Fourier TransformConvolution (dt.: Faltung)Convolution TheoremFiltering

SamplingThe mathematical model

Reconstruction Sampling TheoremReconstruction in Practice

Eduard Gröller, Thomas Theußl, Peter Rautek 26

Page 28: Sampling and Reconstruction - TU Wien

Reconstruction

Recovering the original functionfrom a set of samples

Sampling theorem Ideal reconstruction

Sinc function Reconstruction in practice

Eduard Gröller, Thomas Theußl, Peter Rautek 27

Page 29: Sampling and Reconstruction - TU Wien

Definitions

A function is called band-limited if it contains no frequencies outside the interval [-u,u]. u is called the bandwidth of the function

The Nyquist frequency of a function is twice its bandwidth, i.e., w = 2u

Eduard Gröller, Thomas Theußl, Peter Rautek 28

Page 30: Sampling and Reconstruction - TU Wien

Sampling Theorem

A function f(x) that isband-limited andsampled above the Nyquist frequency

is completely determined by its samples.

Eduard Gröller, Thomas Theußl, Peter Rautek 29

Page 31: Sampling and Reconstruction - TU Wien

Sampling at Nyquist Frequency

Eduard Gröller, Thomas Theußl, Peter Rautek 30

Page 32: Sampling and Reconstruction - TU Wien

Sampling Below Nyquist Frequency

Eduard Gröller, Thomas Theußl, Peter Rautek 31

Demo - Under sampling- Nyquist Frequency

http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/applets/nyquist/nyquist_limit_java_browser.html

Page 33: Sampling and Reconstruction - TU Wien

Ideal Reconstruction

Replicas in frequency domain must not overlap

Multiplying the frequency response with a box filter of the width of the original bandwidth restores original

Amounts to convolution with Sinc function

Eduard Gröller, Thomas Theußl, Peter Rautek 32

Page 34: Sampling and Reconstruction - TU Wien

Sinc Function

Infinite in extent Ideal reconstruction filter FT of box function

Eduard Gröller, Thomas Theußl, Peter Rautek 33

00

1)sinc( πx

x sin

xx

ifif

x

Page 35: Sampling and Reconstruction - TU Wien

Sinc & Truncated Sinc

Eduard Gröller, Thomas Theußl, Peter Rautek 34

Page 36: Sampling and Reconstruction - TU Wien

Reconstruction: Examples

Sampling and reconstruction of the Mandrill image scanline signal

with adequate sampling rate with inadequate sampling rate demonstration of band-limiting

With Sinc and tent reconstruction kernels

Eduard Gröller, Thomas Theußl, Peter Rautek 35

Page 37: Sampling and Reconstruction - TU Wien

Adequate Sampling Rate

Eduard Gröller, Thomas Theußl, Peter Rautek 36

Page 38: Sampling and Reconstruction - TU Wien

Adequate Sampling Rate

Eduard Gröller, Thomas Theußl, Peter Rautek 37

Page 39: Sampling and Reconstruction - TU Wien

Inadequate Sampling Rate

Eduard Gröller, Thomas Theußl, Peter Rautek 38

Page 40: Sampling and Reconstruction - TU Wien

Inadequate Sampling Rate

Eduard Gröller, Thomas Theußl, Peter Rautek 39

Page 41: Sampling and Reconstruction - TU Wien

Band-Limiting a Signal

Eduard Gröller, Thomas Theußl, Peter Rautek 40

Page 42: Sampling and Reconstruction - TU Wien

Band-Limiting a Signal

Eduard Gröller, Thomas Theußl, Peter Rautek 41

Page 43: Sampling and Reconstruction - TU Wien

Reconstruction in Practice

Problem: which reconstruction kernel should be used?

Genuine Sinc function unusable in practiceTruncated Sinc often sub-optimal

Various approximations exist; none is optimal for all purposes

Eduard Gröller, Thomas Theußl, Peter Rautek 42

Page 44: Sampling and Reconstruction - TU Wien

Tasks of Reconstruction Filters

Remove the extraneous replicas of the frequency response

Retain the original undistorted frequency response

Eduard Gröller, Thomas Theußl, Peter Rautek 43

Page 45: Sampling and Reconstruction - TU Wien

Used Reconstruction Filters

Nearest neighbour Linear interpolation Symmetric cubic filters Windowed Sinc

More sophisticated ways of truncating the Sincfunction

Eduard Gröller, Thomas Theußl, Peter Rautek 44

Page 46: Sampling and Reconstruction - TU Wien

Box & Tent Responses

Eduard Gröller, Thomas Theußl, Peter Rautek 45

Page 47: Sampling and Reconstruction - TU Wien

Windowed Sinc Responses

Eduard Gröller, Thomas Theußl, Peter Rautek 46

Page 48: Sampling and Reconstruction - TU Wien

Sampling & Reconstruction Errors

Aliasing: due to overlap of original frequency response with replicas - information loss

Truncation Error: due to use of a finite reconstruction filter instead of the infinite Sincfilter

Non-Sinc error: due to use of a reconstruction filter that has a shape different from the Sincfilter

Eduard Gröller, Thomas Theußl, Peter Rautek 47

Page 49: Sampling and Reconstruction - TU Wien

Interpolation - Zero Insertion

Operates on series of n samplesTakes advantage of DFT properties

Algorithm:Perform DFT on seriesAppend zeros to the sequencePerform the inverse DFT

Eduard Gröller, Thomas Theußl, Peter Rautek 48

Page 50: Sampling and Reconstruction - TU Wien

Zero Insertion - Properties

Preserves frequency spectrum Original signal has to be sampled above

Nyquist frequency Values can only be interpolated at evenly

spaced locations The whole series must be accessible, and it is

always completely processed

Eduard Gröller, Thomas Theußl, Peter Rautek 49

Page 51: Sampling and Reconstruction - TU Wien

Zero Insertion - Original Series

Eduard Gröller, Thomas Theußl, Peter Rautek 50

Page 52: Sampling and Reconstruction - TU Wien

Zero Insertion - Interpolation

Eduard Gröller, Thomas Theußl, Peter Rautek 51

Page 53: Sampling and Reconstruction - TU Wien

ConclusionSampling

Going from continuous to discrete signalMathematically modeled with a multiplication with comb functionSampling theorem: How many samples are needed

Reconstruction Sinc is the ideal filter but not practicableReconstruction in practiceAliasing

Eduard Gröller, Thomas Theußl, Peter Rautek 52

Page 54: Sampling and Reconstruction - TU Wien

Summary (1)

Eduard Gröller, Thomas Theußl, Peter Rautek 53

Page 55: Sampling and Reconstruction - TU Wien

Summary (2)

Eduard Gröller, Thomas Theußl, Peter Rautek 54

Page 56: Sampling and Reconstruction - TU Wien

Summary (3)

Eduard Gröller, Thomas Theußl, Peter Rautek 55

Page 57: Sampling and Reconstruction - TU Wien

Sampling and Reconstruction

References:Computer Graphics: Principles and Practice, 2nd Edition, Foley, vanDam, Feiner, Hughes, Addison-Wesley, 1990What we need around here is more aliasing, Jim Blinn, IEEE Computer Graphics and Applications, January 1989Return of the Jaggy, Jim Blinn, IEEE Computer Graphics and Applications, March 1989Demo Applets, Brown University, Rhode Island, USAhttp://www.cs.brown.edu/exploratories/freeSoftware/home.html

Eduard Gröller, Thomas Theußl, Peter Rautek 56

Page 58: Sampling and Reconstruction - TU Wien

Questions

Eduard Gröller, Thomas Theußl, Peter Rautek 57