© University of Wisconsin, CS559 Spring 2004

Slides:



Advertisements
Similar presentations
Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Advertisements

Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
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.
Compositing and Blending Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Compositing and Blending - Chapter 8 modified by Ray Wisman Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Image Compositing Angel 8.11 Angel: Interactive Computer Graphics5E © Addison-Wesley
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.
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F(  ) is the spectrum of the function.
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.
1Notes. 2Atop  The simplest (useful) and most common form of compositing: put one image “atop” another  Image 1 (RGB) on top of image 2 (RGB)  For.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 6: Image Compositing, Morphing Ravi Ramamoorthi
CS5520 Image-Based Rendering © Chun-Fa Chang, Spring 2003 Sampling Theorem & Antialiasing April 15, 2003.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Graphics and Still Images John H. Krantz Hanover College.
CS248 Midterm Review Michael Green and Sean Walker (based on the work of previous TAs)
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 6: Image Compositing, Morphing (brief discussion of reconstruction) Ravi Ramamoorthi
CS248 Midterm Review. CS248 Midterm Mon, November 5, 7-9 pm, Terman Aud Mon, November 5, 3-5 pm, Gates 392 Mostly “short answer” questions Covers through.
Vector vs. Bitmap SciVis V
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.
V Obtained from a summer workshop in Guildford County July, 2014
02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.
© Chun-Fa Chang Sampling Theorem & Antialiasing. © Chun-Fa Chang Motivations “ My ray traced images have a lot more pixels than the TV screen. Why do.
Digital Images The digital representation of visual information.
COMP Bitmapped and Vector Graphics Pages Using Qwizdom.
Vector vs. Bitmap
CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
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.
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Digital Image Compositing. Compositing for volume rendering c1 c2 c3 The initial pixel color = Black opaque Back-to-Front compositing: use ‘under’ operator.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS559: Computer Graphics Lecture 4: Compositing and Resampling Li Zhang Spring 2008.
Compositing and Blending
2/17/04© University of Wisconsin, CS559 Spring 2004 Last Time Resampling –Ideal reconstruction –You can only ideally reconstruct band-limited functions.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
9/30/04© University of Wisconsin, CS559 Fall 2004 Last Time Reconstruction Aliasing Compositing Intro.
02/05/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Mach Banding –Humans exaggerate sharp boundaries, but not fuzzy ones.
UniS CS297 Graphics with Java and OpenGL Blending.
Sampling Theorem & Antialiasing
(c) 2002 University of Wisconsin, CS 559
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.
Guilford County SciVis V104.03
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Computer Graphics I, Fall 2008 Compositing and Blending.
ITEC2110, Digital Media Chapter 2 Fundamentals of Digital Imaging 1 GGC -- ITEC Digital Media.
Vector vs. Bitmap. Vector Images Vector images (also called outline images) are images made with lines, text, and shapes. Test type is considered to be.
Compositing and Rendering
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
… Sampling … … Filtering … … Reconstruction …
Week 7 - Monday CS361.
Introduction to Computer Graphics with WebGL
Vector vs. Bitmap.
Advanced Computer Graphics
Adobe Photoshop CS4 – Illustrated Unit B: Selecting Pixels
Sampling Theorem & Antialiasing
(C) 2002 University of Wisconsin, CS 559
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F() is the spectrum of the function.
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
(c) 2002 University of Wisconsin, CS 559
Distributed Ray Tracing
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Lecture 5: Resampling, Compositing, and Filtering Li Zhang Spring 2008
Lecture 8: 3D Transforms Li Zhang Spring 2008
Last Time Dithering Introduction to signal processing Filtering
Filtering Images Work in the spatial domain
Computer Graphics Image processing 紀明德
Presentation transcript:

© University of Wisconsin, CS559 Spring 2004 Last Time Filtering Box filter Bartlett filter Gaussian Filter Edge-detect (high-pass) filter Enhancement filters Resampling Map the point from the new image back into the old image Locally reconstruct the function using a filter Today we’ll see why this is the right thing to do 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Today Ideal reconstruction and aliasing Compositing 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Ideal Reconstruction When you display an image, ideally you would like to reconstruct the original (ideal) picture When you resample, you would like to draw new samples from the perfect original function Last time we saw you generally can’t do this because you need infinitely dense samples to reconstruct sharp edges What’s the math? 2/12/04 © University of Wisconsin, CS559 Spring 2004

Sampling in Spatial Domain Sampling in the spatial domain is like multiplying by a spike function You take some ideal function and get data for a regular grid of points  2/12/04 © University of Wisconsin, CS559 Spring 2004

Sampling in Frequency Domain Sampling in the frequency domain is like convolving with a spike function Follows from the convolution theory: multiplication in spatial equals convolution in frequency Spatial spike function in the frequency domain is also the spike function  2/12/04 © University of Wisconsin, CS559 Spring 2004

Reconstruction (Frequency Domain) To reconstruct, we must restore the original spectrum That can be done by multiplying by a square pulse  2/12/04 © University of Wisconsin, CS559 Spring 2004

Reconstruction (Spatial Domain) Multiplying by a square pulse in the frequency domain is the same as convolving with a sinc function in the spatial domain  2/12/04 © University of Wisconsin, CS559 Spring 2004

Aliasing Due to Under-sampling If the sampling rate is too low, high frequencies get reconstructed as lower frequencies High frequencies from one copy get added to low frequencies from another   2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 More Aliasing Poor reconstruction also results in aliasing Consider a signal reconstructed with a box filter in the spatial domain (which means using a sinc in the frequency domain):   2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Aliasing in Practice We have two types of aliasing: Aliasing due to insufficient sampling frequency Aliasing due to poor reconstruction You have some control over reconstruction If resizing, for instance, use an approximation to the sinc function to reconstruct (instead of Bartlett, as we used last time) Gaussian is closer to sinc than Bartlett But note that sinc function goes on forever (infinite support), which is inefficient to evaluate You have some control over sampling if creating images using a computer Remove all sharp edges (high frequencies) from the scene before drawing it That is, blur character and line edges before drawing 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Compositing Compositing combines components from two or more images to make a new image The basis for film special effects (even before computers) Create digital imagery and composite it into live action Important part of animation – even hand animation Background change more slowly than foregrounds, so composite foreground elements onto constant background 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Very Simple Example = over 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 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? 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 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 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 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 There are many interpretations of alpha Is there anything in the image at that point (web graphics) Transparency (real-time OpenGL) 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 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 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 2/12/04 © University of Wisconsin, CS559 Spring 2004

Compositing Assumptions We will combine two images, f and g, to get a third composite image Not necessary that one be foreground and background Background can remain unspecified Both images are the same size and use the same color representation Multiple images can be combined in stages, operating on two at a time 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Image Decomposition The composite image can be broken into regions Parts covered by f only Parts covered by g only Parts covered by f and g Parts covered by neither f nor g Compositing operations define what should happen in each region: who (f or g) owns each region 2/12/04 © University of Wisconsin, CS559 Spring 2004

Basic Compositing Operation At each pixel, combine the pixel data from f and the pixel data from g with the equation: F and G describe how much of each input image survives, and cf and cg are pre-multiplied pixels, and all four channels are calculated To define a compositing operation, define F and G 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Sample Images Image Alpha 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Over” Operator 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Over” Operator Computes composite with the rule that f covers g 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Inside” Operator 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Inside” Operator Computes composite with the rule that only parts of f that are inside g contribute 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Outside” Operator 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Outside” Operator Computes composite with the rule that only parts of f that are outside g contribute 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Atop” Operator 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Atop” Operator Computes composite with the over rule but restricted to places where there is some g 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Xor” Operator Computes composite with the rule that f contributes where there is no g, and g contributes where there is no f 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Xor” Operator 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Clear” Operator Computes a clear composite Note that (0,0,0,>0) is a partially opaque black pixel, whereas (0,0,0,0) is fully transparent, and hence has no color 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “Set” Operator Computes composite by setting it to equal f Copies f into the composite 2/12/04 © University of Wisconsin, CS559 Spring 2004

Compositing Operations F and G describe how much of each input image survives, and cf and cg are pre-multiplied pixels, and all four channels are calculated Operation F G Over Inside Outside Atop Xor Clear Set 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Unary Operators Darken: Makes an image darker (or lighter) without affecting its opacity Dissolve: Makes an image transparent without affecting its color 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 “PLUS” Operator Computes composite by simply adding f and g, with no overlap rules Useful for defining cross-dissolve in terms of compositing: 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Obtaining  Values Hand generate (paint a grayscale image) Automatically create by segmenting an image into foreground background: Blue-screening is the analog method Remarkably complex to get right “Lasso” is the Photoshop operation With synthetic imagery, use a special background color that does not occur in the foreground Brightest blue or green is common 2/12/04 © University of Wisconsin, CS559 Spring 2004

Compositing With Depth Can store pixel “depth” instead of alpha Then, compositing can truly take into account foreground and background Generally only possible with synthetic imagery Image Based Rendering is an area of graphics that, in part, tries to composite photographs taking into account depth 2/12/04 © University of Wisconsin, CS559 Spring 2004

© University of Wisconsin, CS559 Spring 2004 Where to now… We are now almost done with images Still have to take a quick look at painterly rendering We will spend several weeks on the mechanics of 3D graphics Coordinate systems and Viewing Clipping Drawing lines and polygons Lighting and shading We will finish the semester with modeling and some additional topics 2/12/04 © University of Wisconsin, CS559 Spring 2004