Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi...

32
Advanced Computer Graphics Advanced Computer Graphics (Spring 2006) (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi http://www.cs.columbia.edu/~cs4162
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    214
  • download

    0

Transcript of Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi...

Advanced Computer Graphics Advanced Computer Graphics (Spring 2006) (Spring 2006)

COMS 4162, Lecture 3: Sampling and Reconstruction

Ravi Ramamoorthi

http://www.cs.columbia.edu/~cs4162

To Do To Do

Assignment 1, Due Feb 16. Anyone need help finding partners? Start thinking about written part based on this lecture

OutlineOutline

Basic ideas of sampling, reconstruction, aliasing

Signal processing and Fourier analysis

Implementation of digital filters (second part of assn) next week

Section 14.10 of textbook (you really should read it)

Some slides courtesy Tom Funkhouser

Sampling and ReconstructionSampling and Reconstruction An image is a 2D array of samples

Discrete samples from real-world continuous signal

Sampling and ReconstructionSampling and Reconstruction

(Spatial) Aliasing(Spatial) Aliasing

(Spatial) Aliasing(Spatial) Aliasing

Jaggies probably biggest aliasing problem

Sampling and AliasingSampling and Aliasing

Artifacts due to undersampling or poor reconstruction

Formally, high frequencies masquerading as low

E.g. high frequency line as low freq jaggies

Image Processing pipelineImage Processing pipeline

OutlineOutline

Basic ideas of sampling, reconstruction, aliasing

Signal processing and Fourier analysis

Implementation of digital filters (second part of assn) next week

Section 14.10 of textbook

MotivationMotivation

Formal analysis of sampling and reconstruction

Important theory (signal-processing) for graphics

Mathematics tested in written assignment

Will implement some ideas in project

IdeasIdeas

Signal (function of time generally, here of space)

Continuous: defined at all points; discrete: on a grid

High frequency: rapid variation; Low Freq: slow variation

Images are converting continuous to discrete. Do this sampling as best as possible.

Signal processing theory tells us how best to do this

Based on concept of frequency domain Fourier analysis

Sampling TheorySampling TheoryAnalysis in the frequency (not spatial) domain

Sum of sine waves, with possibly different offsets (phase) Each wave different frequency, amplitude

Fourier TransformFourier Transform

Tool for converting from spatial to frequency domain

Or vice versa

One of most important mathematical ideas

Computational algorithm: Fast Fourier Transform One of 10 great algorithms scientific computing Makes Fourier processing possible (images etc.) Not discussed here, but see extra credit on assignment 1

Fourier TransformFourier Transform

Simple case, function sum of sines, cosines

Continuous infinite case

2

2 2

0

( ) ( )

( ) ( )

iux

u

iux

f x F u e

F u f x e dx

2Forward Transform:

2Inverse Transform:

( ) ( )

( ) ( )

iux

iux

F u f x e dx

f x F u e du

Fourier TransformFourier Transform

Simple case, function sum of sines, cosines

Discrete case

2

2 2

0

( ) ( )

( ) ( )

iux

u

iux

f x F u e

F u f x e dx

1

0

1

0

( ) ( ) cos 2 / sin 2 / , 0 1

1( ) ( ) cos 2 / sin 2 / , 0 1

x N

x

u N

u

F u f x ux N i ux n u N

f x F u ux N i ux n x NN

Fourier Transform: Examples 1Fourier Transform: Examples 1

2

2 2

0

( ) ( )

( ) ( )

iux

u

iux

f x F u e

F u f x e dx

Single sine curve (+constant DC term)

Fourier Transform Examples 2Fourier Transform Examples 22

Forward Transform:

2Inverse Transform:

( ) ( )

( ) ( )

iux

iux

F u f x e dx

f x F u e du

Common examples

0

2 2 2

20

/

( )

1 ( )

iux

ax u a

x x e

u

e ea

( ) ( )f x F u

Fourier Transform PropertiesFourier Transform Properties2

Forward Transform:

2Inverse Transform:

( ) ( )

( ) ( )

iux

iux

F u f x e dx

f x F u e du

Common properties Linearity:

Derivatives: [integrate by parts]

2D Fourier Transform

Convolution (next)

2( '( )) '( )

2 ( )

iuxF f x f x e dx

iuF u

( ( ) ( )) ( ( )) ( ( ))F af x bg x aF f x bF g x

2 2Forward Transform:

2 2Inverse Transform:

( , ) ( , )

( , ) ( , )

iux ivy

iux ivy

F u v f x y e e dxdy

f x y F u v e e dudv

Sampling Theorem, BandlimitingSampling Theorem, Bandlimiting

A signal can be reconstructed from its samples, if the original signal has no frequencies above half the sampling frequency – Shannon

The minimum sampling rate for a bandlimited function is called the Nyquist rate

Sampling Theorem, BandlimitingSampling Theorem, Bandlimiting

A signal can be reconstructed from its samples, if the original signal has no frequencies above half the sampling frequency – Shannon

The minimum sampling rate for a bandlimited function is called the Nyquist rate

A signal is bandlimited if the highest frequency is bounded. This frequency is called the bandwidth

In general, when we transform, we want to filter to bandlimit before sampling, to avoid aliasing

AntialiasingAntialiasing

Sample at higher rate Not always possible Real world: lines have infinitely high frequencies, can’t

sample at high enough resolution

Prefilter to bandlimit signal Low-pass filtering (blurring) Trade blurriness for aliasing

Ideal bandlimiting filterIdeal bandlimiting filter

Formal derivation is homework exercise

OutlineOutline

Basic ideas of sampling, reconstruction, aliasing

Signal processing and Fourier analysis Convolution

Implementation of digital filters (second part of assn) next week

Section 14.10 of textbook

Convolution 1Convolution 1

Convolution 2Convolution 2

Convolution 3Convolution 3

Convolution 4Convolution 4

Convolution 5Convolution 5

Convolution in Frequency DomainConvolution in Frequency Domain2

Forward Transform:

2Inverse Transform:

( ) ( )

( ) ( )

iux

iux

F u f x e dx

f x F u e du

Convolution (f is signal ; g is filter [or vice versa])

Fourier analysis (frequency domain multiplication)

( ) ( ) ( ) ( ) ( )

*

h y f x g y x dx g x f y x dx

h f g or f g

( ) ( ) ( )H u F u G u

Practical Image ProcessingPractical Image Processing Discrete convolution (in spatial domain) with filters for

various digital signal processing operations

Easy to analyze, understand effects in frequency domain E.g. blurring or bandlimiting by convolving with low pass filter

OutlineOutline

Basic ideas of sampling, reconstruction, aliasing

Signal processing and Fourier analysis

Implementation of digital filters (second part of ass) next week

Section 14.10 of textbook