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 Today Ideal reconstruction and aliasing Compositing 2 12 04 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 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 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 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 Very Simple Example over 2 12 04 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 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 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 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 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 co Fc f Gcg 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 Sample Images Image Alpha 2 12 04 University of Wisconsin CS559 Spring 2004 Over Operator 2 12 04 University of Wisconsin CS559 Spring 2004 Over Operator Computes composite with the rule that f covers g F 1 G 1 f 2 12 04 University of Wisconsin CS559 Spring 2004 Inside Operator 2 12 04 University of Wisconsin CS559 Spring 2004 Inside Operator Computes
View Full Document
Unlocking...