CS559: Computer Graphics Lecture 4: Compositing and Resampling Li Zhang Spring 2008.

Slides:



Advertisements
Similar presentations
Sampling and Reconstruction
Advertisements

Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 4 Ravi Ramamoorthi
Image Interpolation CS4670: Computer Vision Noah Snavely.
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 5 Ravi Ramamoorthi
School of Computing Science Simon Fraser University
CS248 Midterm Review. CS248 Midterm Mon, November 4, 7-9 pm, Terman Aud Mostly “short answer” questions – Keep your answers short and sweet! Covers lectures.
Image Filtering, Part 2: Resampling Today’s readings Forsyth & Ponce, chapters Forsyth & Ponce –
Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
Image transformations, Part 2 Prof. Noah Snavely CS1114
Image Sampling Moire patterns
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CS248 Midterm Review. CS248 Midterm Mon, November 3, 7-9 pm, Gates B01 Mostly “short answer” questions – Keep your answers short and sweet! Covers lectures.
CSCE 641 Computer Graphics: Fourier Transform Jinxiang Chai.
Lecture 4: Image Resampling CS4670: Computer Vision Noah Snavely.
CS248 Midterm Review Michael Green and Sean Walker (based on the work of previous TAs)
Lecture 3: Image Resampling CS4670: Computer Vision Noah Snavely Nearest-neighbor interpolation Input image 3x upsample hq3x interpolation (ZSNES)
CPSC 641 Computer Graphics: Fourier Transform Jinxiang Chai.
1 Images and Transformations Images by Pawan SinhaPawan Sinha.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Computational Photography: Fourier Transform Jinxiang Chai.
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 6: Image Compositing, Morphing (brief discussion of reconstruction) Ravi Ramamoorthi
Image Sampling Moire patterns -
Fourier Analysis : Rendering and Image Processing Alexei Efros.
02/14/02(c) University of Wisconsin 2002, CS 559 Last Time Filtering Image size reduction –Take the pixel you need in the output –Map it to the input –Place.
02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.
Image Sampling CSE 455 Ali Farhadi Many slides from Steve Seitz and Larry Zitnick.
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
Tips for Photography Assignment FYS100 Creative Discovery in Digital Art Forms Spring 2007 Burg.
Digital Images The digital representation of visual information.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.
Image Resampling CS4670: Computer Vision Noah Snavely.
Filtering and Color To filter a color image, simply filter each of R,G and B separately Re-scaling and truncating are more difficult to implement: –Adjusting.
Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
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.
Image as a linear combination of basis images
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Image Processing.
(c) 2002 University of Wisconsin, CS 559
Lecture 5: Fourier and Pyramids
Projects Project 1a due this Friday Project 1b will go out on Friday to be done in pairs start looking for a partner now.
Last Lecture photomatix.com. Today Image Processing: from basic concepts to latest techniques Filtering Edge detection Re-sampling and aliasing Image.
CS559: Computer Graphics Lecture 7: Image Warping and Morphing Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
9/28/04© University of Wisconsin, CS559 Fall 2004 Last Time Filtering –Box –Bartlett –Gaussian –Edge Detect (High-Pass) –Edge Enhance –How to apply filters.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Sampling and Reconstruction.
Advanced Computer Graphics
Image Resampling & Interpolation
Advanced Computer Graphics
Image Sampling Moire patterns
Sampling rate conversion by a rational factor
(C) 2002 University of Wisconsin, CS 559
Image Sampling Moire patterns
Sampling and Reconstruction
© University of Wisconsin, CS559 Spring 2004
Samuel Cheng Slide credits: Noah Snavely
Filtering Part 2: Image Sampling
Image Sampling Moire patterns
Lecture 5: Resampling, Compositing, and Filtering Li Zhang Spring 2008
Image Resampling & Interpolation
Resampling.
Last Time Dithering Introduction to signal processing Filtering
Samuel Cheng Slide credits: Noah Snavely
Presentation transcript:

CS559: Computer Graphics Lecture 4: Compositing and Resampling Li Zhang Spring 2008

Compositing Compositing combines components from two or more images to make a new image – Special effects are easier to control when done in isolation – Even many all live-action sequences are more safely shot in different layers

Compositing Compositing combines components from two or more images to make a new image – Special effects are easier to control when done in isolation – Even many all live-action sequences are more safely shot in different layers

Perfect Storm

Animated Example over =

Mattes A matte is an image that shows which parts of another image are foreground objects Term dates from film editing and cartoon production How would I use a matte to insert an object into a background? How are mattes usually generated for television?

Working with Mattes To insert an object into a background – Call the image of the object the source – Put the background into the destination – For all the source pixels, if the matte is white, copy the pixel, otherwise leave it unchanged To generate mattes: – Use smart selection tools in Photoshop or similar They outline the object and convert the outline to a matte – Blue Screen: Photograph/film the object in front of a blue background, then consider all the blue pixels in the image to be the background

Compositing Compositing is the term for combining images, one over the other – Used to put special effects into live action Or live action into special effects

Alpha Basic idea: Encode opacity information in the image Add an extra channel, the alpha channel, to each image – For each pixel, store R, G, B and Alpha – alpha = 1 implies full opacity at a pixel – alpha = 0 implies completely clear pixels Images are now in RGBA format, and typically 32 bits per pixel (8 bits for alpha) All images in the project are in this format

Pre-Multiplied Alpha Instead of storing (R,G,B,  ), store (  R,  G,  B,  ) The compositing operations in the next several slides are easier with pre-multiplied alpha To display and do color conversions, must extract RGB by dividing out  –  =0 is always black – Some loss of precision as  gets small, but generally not a big problem

Basic Compositing Operation At each pixel, combine the pixel data from f and the pixel data from g with the equation: “Over” Operator

If there’s some f, get f, otherwise get g over=

Reconstruction theorem T2T-3T3T-2T-T

Reconstruction theorem

Reconstruction filters The sinc filter, while “ideal”, has two drawbacks: – It has large support (slow to compute) – It introduces ringing in practice We can choose from many other filters…

Cubic filters Mitchell and Netravali (1988) experimented with cubic filters of the following form: The choice of B or C trades off between being too blurry or having too much ringing. B=C=1/3 was their “visually best” choice. The resulting reconstruction filter is often called the “Mitchell filter.”

Practical upsampling When resampling a function (e.g., when resizing an image), you do not need to reconstruct the complete continuous function. For zooming in on a function, you need only use a reconstruction filter and evaluate as needed for each new sample. Here’s an example using a cubic filter:

Practical upsampling This can also be viewed as: 1.putting the reconstruction filter at the desired location 2.evaluating at the original sample positions 3.taking products with the sample values themselves 4.summing it up

2D Fourier transform Spatial domainFrequency domain High frequency coefficients are small.

We can also perform reconstruction in 2D… Reconstruction filters in 2D

1D example: nn+1n+2n-1 x g[n] g[n+1] g[n,m] g[n+1,m] g[n,m+1] g[n+1,m+1] (x,y) 2D example:

Reconstruction filters in 2D We’ve been looking at separable filters: How might you use this fact for efficient resampling in 2D?

Image Downsampling Throw away every other row and column to create a 1/2 size image - called image sub-sampling 1/4 1/8

Image sub-sampling 1/4 (2x zoom) 1/8 (4x zoom) Why does this look so crufty? 1/2 Minimum Sampling requirement is not satisfied – resulting in Aliasing effect

Practical downsampling Downsampling is similar, but filter has larger support and smaller amplitude. Operationally: – given the downsampling rate, d, ratio of new sampling rate to old sampling rate 1.Choose reconstruction filter 2.Stretch the filter by 1/d and scale it down by d 3.Follow upsampling procedure (previous slides) to compute new values

Subsampling with Gaussian pre-filtering G 1/4G 1/8Gaussian 1/2 Solution: filter the image, then subsample

Compare with... 1/4 (2x zoom) 1/8 (4x zoom) 1/2

Explanation using Fourier Transform Convolution

Explanation using Fourier Transform * f(x,y)f(x,y) h(x,y)h(x,y) g(x,y)g(x,y) |F(s x,s y )| |H(s x,s y )| |G(s x,s y )|

Convolution Definition

9/23/04 © University of Wisconsin, CS559 Spring 2004 Convolution Example Result FilterFunction lets/specialFunctionConvolution/special_function_convolution_java_browser.html

Convolution theorem: Convolution in the spatial domain is equivalent to multiplication in the frequency domain. Symmetric theorem: Convolution in the frequency domain is equivalent to multiplication in the spatial domain. Convolution theorems

Explanation using Fourier Transform Convolution