Last TimeTodayIdeal ReconstructionSampling in Spatial DomainSampling in Frequency DomainReconstruction (Frequency Domain)Reconstruction (Spatial Domain)Aliasing Due to Under-samplingMore AliasingAliasing in PracticeCompositingVery Simple ExampleMattesWorking with MattesAlphaPre-Multiplied AlphaCompositing AssumptionsImage DecompositionBasic Compositing OperationSample Images“Over” OperatorSlide 22“Inside” OperatorSlide 24“Outside” OperatorSlide 26“Atop” OperatorSlide 28“Xor” OperatorSlide 30“Clear” Operator“Set” OperatorCompositing OperationsUnary Operators“PLUS” OperatorObtaining ValuesCompositing With DepthWhere to now…2/12/04 © University of Wisconsin, CS559 Spring 2004Last 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 do2/12/04 © University of Wisconsin, CS559 Spring 2004Today•Ideal reconstruction and aliasing•Compositing2/12/04 © University of Wisconsin, CS559 Spring 2004Ideal 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 2004Sampling 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 points2/12/04 © University of Wisconsin, CS559 Spring 2004Sampling 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 function2/12/04 © University of Wisconsin, CS559 Spring 2004Reconstruction (Frequency Domain)•To reconstruct, we must restore the original spectrum•That can be done by multiplying by a square pulse2/12/04 © University of Wisconsin, CS559 Spring 2004Reconstruction (Spatial Domain)•Multiplying by a square pulse in the frequency domain is the same as convolving with a sinc function in the spatial domain2/12/04 © University of Wisconsin, CS559 Spring 2004Aliasing 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 another2/12/04 © University of Wisconsin, CS559 Spring 2004More 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 2004Aliasing 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 drawing2/12/04 © University of Wisconsin, CS559 Spring 2004Compositing•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 background2/12/04 © University of Wisconsin, CS559 Spring 2004Very Simple Exampleover=2/12/04 © University of Wisconsin, CS559 Spring 2004Mattes•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 2004Working 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 background2/12/04 © University of Wisconsin, CS559 Spring 2004Alpha•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 format2/12/04 © University of Wisconsin, CS559 Spring 2004Pre-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 problem2/12/04 © University of Wisconsin, CS559 Spring 2004Compositing 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 time2/12/04 © University of Wisconsin, CS559 Spring
View Full Document