34
University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process Real world: continuous Digital world: discrete Basic signal processing Fourier transforms The convolution theorem The sampling theorem Aliasing and antialiasing Uniform supersampling Nonuniform supersampling

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

Embed Size (px)

Citation preview

Page 1: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling and Reconstruction

The sampling and reconstruction processReal world: continuous

Digital world: discrete

Basic signal processingFourier transforms

The convolution theorem

The sampling theorem

Aliasing and antialiasingUniform supersampling

Nonuniform supersampling

Page 2: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Camera Simulation

Sensor response

Lens

Shutter

Scene radiance

λ ω ω λ λ ω λΩ Λ

= •′ ′ ′ ′ ′ ′ ′∫∫∫∫r r

( , ) ( , , ) ( ( , , ), , ) ( )A T

R P x S x t L T x t dA x d dt d

ω ω λ= ′ ′( , ) ( , , )x T x

λ′( , )P x

( , , , )L x tω λω′ ′( , , )S x t

ω λ′ ′( , , , )L x tω λ( , , , )L x tA

Ω

Page 3: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Imagers = Signal Sampling

All imagers convert a continuous image to a discrete sampled image by integrating over the active “area” of a sensor.

Examples:Retina: photoreceptorsCCD array

Virtual CG cameras do not integrate, they simply sample radiance along rays …

( , , ) ( ) ( )cosT A

R L x t P x S t dAd dtω θ ωΩ

=∫∫∫∫∫

Page 4: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Displays = Signal Reconstruction

All physical displays recreate a continuous image from a discrete sampled image by using a finite sized source of light for each pixel.

Examples:DACs: sample and hold

Cathode ray tube: phosphor spot and grid

DAC CRT

Page 5: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling in Computer Graphics

Artifacts due to sampling - AliasingJaggies

Moire

Flickering small objects

Sparkling highlights

Temporal strobing

Preventing these artifacts - Antialiasing

Page 6: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Jaggies

Retort sequence by Don Mitchell

Staircase pattern or jaggies

Page 7: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

Basic Signal Processing

Page 8: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Fourier Transforms

Spectral representation treats the function as a weighted sum of sines and cosines

Each function has two representationsSpatial domain - normal representation

Frequency domain - spectral representation

The Fourier transform converts between the spatial and frequency domain

SpatialDomain

FrequencyDomain

( ) ( )

1( ) ( )

2

i x

i x

F f x e dx

f x F e d

ω

ω

ω

ω ωπ

∞−

−∞

−∞

=

=

Page 9: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Spatial and Frequency DomainSpatial Domain Frequency Domain

Page 10: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Convolution

Definition

Convolution Theorem: Multiplication in the frequency domain is equivalent to convolution in the space domain.

Symmetric Theorem: Multiplication in the space domain is equivalent to convolution in the frequency domain.

f g F G⊗ ↔ ×

f g F G× ↔ ⊗

( ) ( ) ( )h x f g f x g x x dx′ ′ ′= ⊗ = −∫

Page 11: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

The Sampling Theorem

Page 12: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling: Spatial Domain

× =

III( ) ( )n

n

x x nTδ=∞

=−∞

= −∑

Page 13: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling: Frequency Domain

III( ) ( )n

sn

nω δ ω ω=∞

=−∞

= −∑

=

1 22s s sf f

T T

πω π= = =

Page 14: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Reconstruction: Frequency Domain

× =

12

12

1II( )

0

xx

x

⎧ ≤⎪=⎨ >⎪⎩

Page 15: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Reconstruction: Spatial Domain

=⊗

sinsinc

xx

x

ππ

=

Page 16: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling and Reconstruction

×⊗

= =

Page 17: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling Theorem

This result if known as the Sampling Theorem and is due to Claude Shannon who first discovered it in 1949

A signal can be reconstructed from its sampleswithout loss of information, if the original signal has no frequencies above 1/2 the Sampling frequency

For a given bandlimited function, the rate at which it must be sampled is called the Nyquist Frequency

Page 18: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

Aliasing

Page 19: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Undersampling: Aliasing

⊗ ×

= =

Page 20: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling a “Zone Plate”

2 2sin x y+y

x

Zone plate:

Sampled at 128x128Reconstructed to 512x512 Using a 30-wide Kaiser windowed sinc

Left rings: part of signalRight rings: prealiasing

Page 21: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Ideal Reconstruction

Ideally, use a perfect low-pass filter - the sinc function - to bandlimit the sampled signal and thus remove all copies of the spectra introduced by sampling

Unfortunately, The sinc has infinite extent and we must use simpler filters with finite extents. Physical processes in particular do not reconstruct with sincs

The sinc may introduce ringing which are perceptually objectionable

Page 22: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Sampling a “Zone Plate”

2 2sin x y+y

x

Zone plate:

Sampled at 128x128Reconstructed to 512x512Using optimal cubic

Left rings: part of signalRight rings: prealiasingMiddle rings: postaliasing

Page 23: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Mitchell Cubic Filter3 2

3 2

(12 9 6 ) ( 18 12 6 ) (6 2 ) 11

( ) ( 6 ) (6 30 ) ( 12 48 ) (8 24 ) 1 26

0

B C x B C x B x

h x B C x B C x B C x B C x

otherwise

⎧ − − + − + + + − <⎪= − − + + + − − + + < <⎨⎪⎩

Properties:

( ) 1n

n

h x=∞

=−∞

=∑

From Mitchell and Netravali

B-spline: (1,0)

Catmull-Rom: (0,1/ 2)

Good: (1/ 3,1/ 3)

Page 24: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

Antialiasing

Page 25: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Antialiasing by Prefiltering

⊗×

= =

Frequency Space

Page 26: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Antialiasing

Antialiasing = Preventing aliasing

Analytically prefilter the signalSolvable for points, lines and polygonsNot solvable in general

e.g. procedurally defined images

Uniform supersampling and resample

Nonuniform or stochastic sampling

Page 27: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Uniform Supersampling

Increasing the sampling rate moves each copy of the spectra further apart, potentially reducing the overlap and thus aliasing

Resulting samples must be resampled (filtered) to image sampling rate

Samples Pixel

s ss

Pixel w Sample= ⋅∑

Page 28: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Point vs. Supersampled

Point 4x4 Supersampled

Checkerboard sequence by Tom Duff

Page 29: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Analytic vs. Supersampled

Exact Area 4x4 Supersampled

Page 30: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Distribution of Extrafoveal Cones

Monkey eye cone distribution

Fourier transform

Yellot theory Aliases replaced by noise Visual system less sensitive to high freq noise

Page 31: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Non-uniform Sampling

Intuition Uniform sampling

The spectrum of uniformly spaced samples is also a set of uniformly spaced spikesMultiplying the signal by the sampling pattern corresponds to placing a copy of the spectrum at each spike (in freq. space)Aliases are coherent, and very noticable

Non-uniform samplingSamples at non-uniform locations have a different spectrum; a single spike plus noiseSampling a signal in this way converts aliases into broadband noiseNoise is incoherent, and much less objectionable

Page 32: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Jittered Sampling

Add uniform random jitter to each sample

Page 33: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Jittered vs. Uniform Supersampling

4x4 Jittered Sampling 4x4 Uniform

Page 34: University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell Sampling and Reconstruction The sampling and reconstruction process

University of Texas at Austin CS395T - Advanced Image Synthesis Fall 2007 Don Fussell

Poisson Disk Sampling

Dart throwing algorithm