Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 1 Sampling and reconstruction CS 465 Lecture 5.

Slides:



Advertisements
Similar presentations
Motion illusion, rotating snakes. Slide credit Fei Fei Li.
Advertisements

Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 4 Ravi Ramamoorthi
15-463: Computational Photography Alexei Efros, CMU, Spring 2010 Most slides from Steve Marschner Sampling and Reconstruction.
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Computational Photography: Sampling + Reconstruction Connelly Barnes Slides from Alexei Efros and Steve Marschner.
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Computational Photography CSE 590 Tamara Berg Filtering & Pyramids.
First color film Captured by Edward Raymond Turner Predates Prokudin-Gorskii collection Like Prokudin-Gorskii, it was an additive 3-color system.
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi Some slides.
Recap from Monday Spectra and Color Light capture in cameras and humans.
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Lecture 1: Images and image filtering
Linear filtering. Overview: Linear filtering Linear filters Definition and properties Examples Gaussian smoothing Separability Applications Denoising.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
15-463: Computational Photography Alexei Efros, CMU, Fall 2011 Many slides from Steve Marschner Sampling and Reconstruction.
Comp 665 Convolution. Questions? Ask here first. Likely someone else has the same question.
Introduction to Wavelets
Lecture 2: Image filtering
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Linear filtering.
Slides from Alexei Efros, Steve Marschner Filters & fourier theory.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 4 Image Enhancement in the Frequency Domain Chapter.
Most slides from Steve Seitz
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 3 Ravi Ramamoorthi
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
… Representation of a CT Signal Using Impulse Functions
Antialiasing CptS 548 Advanced Computer Graphics John C. Hart.
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
Filtering Robert Lin April 29, Outline Why filter? Filtering for Graphics Sampling and Reconstruction Convolution The Fourier Transform Overview.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
Linear Filters Monday, Jan 24 Prof. Kristen Grauman UT-Austin …
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
Image Filtering Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/02/10.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
CMSC 635 Sampling and Antialiasing. Aliasing in images.
Linear filtering. Motivation: Noise reduction Given a camera and a still scene, how can you reduce noise? Take lots of images and average them! What’s.
CSE 473/573 Computer Vision and Image Processing (CVIP) Ifeoma Nwogu Lecture 7 – Linear Filters 1.
CS 691B Computational Photography
(c) 2002 University of Wisconsin, CS 559
CS559: Computer Graphics Lecture 3: Image Sampling and Filtering Li Zhang Spring 2010.
Continuous-time Signal Sampling
Lecture 3: Filtering and Edge detection
Lecture 5: Fourier and Pyramids
Reconnaissance d’objets et vision artificielle
Linear filtering. Motivation: Image denoising How can we reduce noise in a photograph?
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Last Lecture photomatix.com. Today Image Processing: from basic concepts to latest techniques Filtering Edge detection Re-sampling and aliasing Image.
CSE 185 Introduction to Computer Vision Image Filtering: Spatial Domain.
Lecture 1: Images and image filtering CS4670/5670: Intro to Computer Vision Noah Snavely Hybrid Images, Oliva et al.,
IS502:M ULTIMEDIA D ESIGN FOR I NFORMATION S YSTEM D IGITAL S TILL I MAGES Presenter Name: Mahmood A.Moneim Supervised By: Prof. Hesham A.Hefny Winter.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Sampling and Reconstruction.
Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)
Advanced Computer Graphics
- photometric aspects of image formation gray level images
Sampling and reconstruction
All about convolution.
Joshua Barczak CMSC435 UMBC
Recap from Wednesday Spectra and Color Light capture in cameras and humans.
Sampling and Reconstruction
Sampling and Reconstruction
Motion illusion, rotating snakes
Linear filtering.
Lecture 5: Resampling, Compositing, and Filtering Li Zhang Spring 2008
Linear Filtering CS 678 Spring 2018.
Lecture 2: Image filtering
Lecture 1: Images and image filtering
Lecture 7 Spatial filtering.
All about convolution.
Presentation transcript:

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 1 Sampling and reconstruction CS 465 Lecture 5

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 2 Sampled representations How to store and compute with continuous functions? Common scheme for representation: samples –write down the function’s values at many points [FvDFH fig.14.14b / Wolberg]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 3 Reconstruction Making samples back into a continuous function –for output (need realizable method) –for analysis or processing (need mathematical method) –amounts to “guessing” what the function did in between [FvDFH fig.14.14b / Wolberg]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 4 Filtering Processing done on a function –can be executed in continuous form (e.g. analog circuit) –but can also be executed using sampled representation Simple example: smoothing by averaging

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 5 Roots of sampling Nyquist 1928; Shannon 1949 –famous results in information theory 1940s: first practical uses in telecommunications 1960s: first digital audio systems 1970s: commercialization of digital audio 1982: introduction of the Compact Disc –the first high-profile consumer application This is why all the terminology has a communications or audio “flavor” –early applications are 1D; for us 2D (images) is important

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 6 Sampling in digital audio Recording: sound to analog to samples to disc Playback: disc to samples to analog to sound again –how can we be sure we are filling in the gaps correctly?

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 7 Undersampling What if we “missed” things between the samples? Simple example: undersampling a sine wave –unsurprising result: information is lost –surprising result: indistinguishable from lower frequency –also was always indistinguishable from higher frequencies –aliasing: signals “traveling in disguise” as other frequencies

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 8 Preventing aliasing Introduce lowpass filters: –remove high frequencies leaving only safe, low frequencies –choose lowest frequency in reconstruction (disambiguate)

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 9 Linear filtering: a key idea Transformations on signals; e.g.: –bass/treble controls on stereo –blurring/sharpening operations in image editing –smoothing/noise reduction in tracking Key properties –linearity: filter(f + g) = filter(f) + filter(g) –shift invariance: behavior invariant to shifting the input delaying an audio signal sliding an image around Can be modeled mathematically by convolution

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 10 Convolution warm-up basic idea: define a new function by averaging over a sliding window a simple example to start off: smoothing

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 11 Convolution warm-up Same moving average operation, expressed mathematically:

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 12 Discrete convolution Simple averaging: –every sample gets the same weight Convolution: same idea but with weighted average –each sample gets its own weight (normally zero far away) Sequence of weights c i is called a filter –support, symmetry

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 13 Discrete convolution Notation: Convolution is a multiplication-like operation –commutative –associative –distributes over addition –scalars factor out –identity: unit impulse e = […, 0, 0, 1, 0, 0, …] Conceptually no distinction between filter and signal

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 14 Convolution and filtering Can express sliding average as convolution with a box filter c box = […, 0, 1, 1, 1, 1, 1, 0, …]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 15 Convolution and filtering Convolution applies with any sequence of weights Example: bell curve (gaussian-like) […, 1, 4, 6, 4, 1, …]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 16 Discrete filtering in 2D Same equation, one more index –now the filter is a rectangle you slide around over a grid of numbers Commonly applied to images –blurring (using box, using gaussian, …) –sharpening (impulse minus blur) –usefulness of associativity

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 17 original | box blursharpened | gaussian blur [Philip Greenspun]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 18 Optimization: separable filters basic alg. is O(r 2 ): large filters get expensive fast! definition: h(x,y) is separable if it can be written as: –this is a useful property for filters because it allows factoring:

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 19 Separable filtering first, convolve with this second, convolve with this

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 20 Continuous convolution: warm-up Can apply sliding-window average to a continuous function just as well –output is continuous –integration replaces summation

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 21 Continuous convolution Sliding average expressed mathematically: –note difference in normalization (only for box) Convolution just adds weights –weighting is now by a function –weighted integral is like weighted average –again bounds are set by support of h(x)

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 22 One more convolution Continuous–discrete convolution –used for reconstruction and resampling

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 23 Continuous-discrete convolution

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 24 Resampling Changing the sample rate –in images, this is enlarging and reducing Creating more samples: –increasing the sample rate –“upsampling” –“enlarging” Ending up with fewer samples: –decreasing the sample rate –“downsampling” –“reducing”

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 25 Resampling Reconstruction creates a continuous function –forget its origins, go ahead and sample it

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 26 Cont.–disc. convolution in 2D same convolution—just two variables now –loop over nearby pixels, average using filter weight –looks like convolution filter, but offsets are not integers and filter is continuous –remember placement of filter relative to grid is variable

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 27 Separable filters for resampling just as in filtering, separable filters are useful –separability in this context is a statement about a continuous filter, rather than a discrete one: resample in two passes, one resampling each row and one resampling each column intermediate storage required: product of one dimension of src. and the other dimension of dest. same yucky details about boundary conditions

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 28 two-stage resampling using a separable filter [Philip Greenspun]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 29 A gallery of filters Box filter –Simple and cheap Tent filter –Linear interpolation Gaussian filter –Very smooth antialiasing filter B-spline cubic –Very smooth Catmull-rom cubic –interpolating Mitchell-Netravali cubic –Good for image upsampling

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 30 Properties of filters Degree of continuity Impulse response Interpolating or no Ringing, or overshoot

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 31 Yucky details What about near the edge? –the filter window falls off the edge of the image –need to extrapolate –methods: clip filter (black) wrap around copy edge reflect across edge vary filter near edge

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 32 Reducing and enlarging very common operation –devices have differing resolutions –applications have different memory/quality tradeoffs also very commonly done poorly simple approach: drop/replicate pixels

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner pixel width [Philip Greenspun]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner pixel width by dropping pixels gaussian filter [Philip Greenspun]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner pixel width box reconstruction filterbicubic reconstruction filter [Philip Greenspun]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 36 Types of artifacts garden variety –what we saw in this natural image –fine features become jagged or sparkle moiré patterns

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner ppi scan of a color halftone image [Hearn & Baker cover]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 38 downsampling a high resolution scan by dropping pixelsgaussian filter [Hearn & Baker cover]

Cornell CS465 Fall 2004 Lecture 5© 2004 Steve Marschner 39 Types of artifacts garden variety –what we saw in this natural image –fine features become jagged or sparkle moiré patterns –caused by repetitive patterns in input –produce low-frequency artifacts; highly visible these artifacts are called aliasing –why is beyond our scope for now find out in CS467 or a signal processing class