CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.

Slides:



Advertisements
Similar presentations
CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Advertisements

Edge Detection CSE P 576 Larry Zitnick
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
Announcements Mailing list: –you should have received messages Project 1 out today (due in two weeks)
Lecture 8: Geometric transformations CS4670: Computer Vision Noah Snavely.
Lecture 2: Edge detection and resampling
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz
Edge Detection Today’s reading Forsyth, chapters 8, 15.1
Lecture 3: Edge detection, continued
Lecture 2: Image filtering
Edge Detection Today’s readings Cipolla and Gee –supplemental: Forsyth, chapter 9Forsyth Watt, From Sandlot ScienceSandlot Science.
Edge Detection.
Image warping/morphing Digital Video Special Effects Fall /10/17 with slides by Y.Y. Chuang,Richard Szeliski, Steve Seitz and Alexei Efros.
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/27/11 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
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.
CSE 185 Introduction to Computer Vision
Computer Vision - Fitting and Alignment
Computer Vision Spring ,-685 Instructor: S. Narasimhan WH 5409 T-R 10:30 – 11:50am.
Image Warping (Szeliski 3.6.1) cs129: Computational Photography James Hays, Brown, Fall 2012 Slides from Alexei Efros and Steve Seitz
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
Multimedia Programming 06: Image Warping Departments of Digital Contents Sang Il Park.
Warping CSE 590 Computational Photography Tamara Berg.
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/24/15 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/23/10 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
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.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Image processing.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection From Sandlot ScienceSandlot Science.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection Szeliski, Ch 4.1.2, From Sandlot.
Instructor: S. Narasimhan
Many slides from Steve Seitz and Larry Zitnick
Advanced Multimedia Warping & Morphing Tamara Berg.
CS559: Computer Graphics Lecture 4: Compositing and Resampling Li Zhang Spring 2008.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Edge Detection and Geometric Primitive Extraction Jinxiang Chai.
2/17/04© University of Wisconsin, CS559 Spring 2004 Last Time Resampling –Ideal reconstruction –You can only ideally reconstruct band-limited functions.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Computer Vision - Fitting and Alignment (Slides borrowed from various presentations)
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.
Recap from Monday DCT and JPEG Point Processing Histogram Normalization Questions: JPEG compression levels Gamma correction.
Announcements Project 0 due tomorrow night. Edge Detection Today’s readings Cipolla and Gee (handout) –supplemental: Forsyth, chapter 9Forsyth For Friday.
Image Warping Many slides from Alyosha Efros + Steve Seitz + Derek oeim Photo by Sean Carroll.
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.
CS559: Computer Graphics Lecture 7: Image Warping and Panorama Li Zhang Spring 2008 Most slides borrowed from Yungyu ChuangYungyu Chuang.
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.
Lecture 14: Feature matching and Transforms CS4670/5670: Computer Vision Kavita Bala.
Image Warping 2D Geometric Transformations
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Image warping/morphing Digital Visual Effects, Spring 2006 Yung-Yu Chuang 2005/3/15 with slides by Richard Szeliski, Steve Seitz and Alexei Efros.
Edge Detection slides taken and adapted from public websites:
Computational Photography Derek Hoiem, University of Illinois
Image Warping (Szeliski Sec 2.1.2)
Image Warping (Szeliski Sec 2.1.2)
Image Warping : Computational Photography
Jeremy Bolton, PhD Assistant Teaching Professor
Recap from Friday Image Completion Synthesis Order Graph Cut Scene Completion.
Edge Detection Today’s reading
© University of Wisconsin, CS559 Spring 2004
Image Warping : Computational Photography
Edge Detection Today’s reading
(c) 2002 University of Wisconsin, CS 559
Lecture 2: Edge detection
Image Warping (Szeliski Sec 2.1.2)
Edge Detection Today’s reading
Edge Detection Today’s readings Cipolla and Gee Watt,
Lecture 2: Edge detection
Computational Photography Derek Hoiem, University of Illinois
Presentation transcript:

CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010

Last time: Image Resampling and Painterly Rendering

Properties of Kernels Filter, Impulse Response, or kernel function, same concept but different names Degrees of continuity Interpolating or no Ringing or overshooting Interpolating filter for reconstruction

Reconstruction filter Examples in 2D g[n,m] g[n+1,m] g[n,m+1] g[n+1,m+1] (x,y) 2D example: How to simplify the calculation?

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

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

Results in the paper OriginalBiggest brush Medium brush addedFinest brush added

Changing Parameters

Impressionist, normal painting style Expressionist, elongated stroke Colorist wash, semitransparent stroke with color jitter Densely-placed circles with random hue and saturation

Another type of painterly rendering Line Drawing

Another type of painterly rendering Line Drawing

Another type of painterly rendering Line Drawing

Another type of painterly rendering Line Drawing

Edge Detection Convert a 2D image into a set of curves – Extracts salient features of the scene

Edge detection One of the most important uses of image processing is edge detection: – Really easy for humans – Not that easy for computers – Fundamental in computer vision – Important in many graphics applications

What is an edge? Q: How might you detect an edge in 1D?

Image gradient The gradient of an image: The gradient direction is given by: The gradient points in the direction of most rapid change in intensity –how does the gradient relate to the direction of the edge? The edge strength is given by the gradient magnitude

Gradients How can we approximate the gradient in a discrete image? gx[i,j] = f[i+1,j] – f[i,j] and gy[i,j]=f[i,j+1]-f[i,j] Can write as mask [-1 1] and [1 –1]’

Less than ideal edges

Results of Sobel edge detection

Edge enhancement A popular gradient magnitude computation is the Sobel operator: We can then compute the magnitude of the vector (s x, s y ).

Results of Sobel edge detection

Non-maximum Suppression Check if pixel is local maximum along gradient direction – requires checking interpolated pixels p and r The Canny Edge Detector

Steps in edge detection Edge detection algorithms typically proceed in three or four steps: – Filtering: cut down on noise – Enhancement: amplify the difference between edges and non-edges – Detection: use a threshold operation – Localization (optional): estimate geometry of edges, which generally pass between pixels

The Canny Edge Detector original image (Lena)

The Canny Edge Detector magnitude of the gradient

The Canny Edge Detector After non-maximum suppression

Canny Edge Detector Canny with original The choice of depends on desired behavior –large detects large scale edges –small detects fine features : Gaussian filter parameter

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

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

Why do we need pre-multiplied alpha? “Over” Operator

Why do we need pre-multiplied alpha? “Over” Operator

Why do we need pre-multiplied alpha? “Over” Operator

Why do we need pre-multiplied alpha? “Over” Operator

Why do we need pre-multiplied alpha? “Over” Operator

Why do we need pre-multiplied alpha? “Over” Operator

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

Changing pixel values Moving pixels around Image Manipulation h f g h([x,y])=[x,y/2]

Parametric (global) warping translation rotation aspect affine perspective cylindrical Examples of parametric warps:

Application of Image Warp Creating virtual wide-angle camera Mosaics: stitching images together

Application of Image Warp Creating realistic surface appearance Texture mapping

Application of Image Warp Morphing morphing image #1image #2

Parametric (global) warping Transformation T is a coordinate-changing machine: p ’ = T(p) What does it mean that T is global? – can be described by just a few numbers (parameters) – the parameters are the same for any point p Represent T as a matrix: p ’ = Mp T p = (x,y)p’ = (x’,y’) h([x,y])=[x,y/2]

Scaling Scaling a coordinate means multiplying each of its components by a scalar Uniform scaling means this scalar is the same for all components:  2 2 f g

Non-uniform scaling: different scalars per component: Scaling x  2, y  0.5

Scaling Scaling operation: Or, in matrix form: scaling matrix S What’s inverse of S?

2-D Rotation  (x, y) (x’, y’) x’ = x cos(  ) - y sin(  ) y’ = x sin(  ) + y cos(  )

2-D Rotation This is easy to capture in matrix form: How can I remember this? Even though sin(  ) and cos(  ) are nonlinear to , – x ’ is a linear combination of x and y – y ’ is a linear combination of x and y What is the inverse transformation? – Rotation by –  – For rotation matrices, det(R) = 1 R x’ = x cos(  ) - y sin(  ) y’ = x sin(  ) + y cos(  )

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Identity? 2D Scale around (0,0)?

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Rotate around (0,0)? 2D Shear?

What types of transformations can be represented with a 2x2 matrix? 2x2 Matrices 2D Shear? (1,1) x y x’ y’ sh y sh x

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Mirror about Y axis? 2D Mirror over (0,0)?

Linear transformations are combinations of … – Scale, – Rotation, – Shear, and – Mirror Any 2D transform can be decomposed into the product of a rotation, scale, and a rotation All 2D Linear Transformations

Linear transformations are combinations of … – Scale, – Rotation, – Shear, and – Mirror A symmetric 2D transform can be decomposed into the product of a rotation, scale, and the inverse rotation All 2D Linear Transformations