Advanced Multimedia Warping & Morphing Tamara Berg.

Slides:



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

Morphing CSE 590 Computational Photography Tamara Berg.
Lecture 11: Transformations CS4670/5760: Computer Vision Kavita Bala.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
CSCE 641:Computer Graphics Image Warping/Morphing Jinxiang Chai.
Lecture 8: Geometric transformations CS4670: Computer Vision Noah Snavely.
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
CSCE 641:Computer Graphics Image Warping/Morphing Jinxiang Chai.
Lecture 6: Image transformations and alignment CS6670: Computer Vision Noah Snavely.
Image Morphing : Rendering and Image Processing Alexei Efros.
Computational Photography Image Warping/Morphing Jinxiang Chai.
Lecture 9: Image alignment CS4670: Computer Vision Noah Snavely
Image Morphing : Computational Photography Alexei Efros, CMU, Fall 2005 © Alexey Tikhonov.
Image Morphing, Triangulation CSE399b, Spring 07 Computer Vision.
Image warping/morphing Digital Video Special Effects Fall /10/17 with slides by Y.Y. Chuang,Richard Szeliski, Steve Seitz and Alexei Efros.
Introduction to Computer Graphics CS 445 / 645 Lecture 5 Transformations Transformations M.C. Escher – Smaller and Smaller (1956)
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/27/11 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
CSE 185 Introduction to Computer Vision
Image Morphing CSC320: Introduction to Visual Computing
Image Warping (Szeliski 3.6.1) cs129: Computational Photography James Hays, Brown, Fall 2012 Slides from Alexei Efros and Steve Seitz
CSCE 441: Computer Graphics Image Warping/Morphing Jinxiang Chai.
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 / Morphing
Image warping/morphing Digital Visual Effects Yung-Yu Chuang with slides by Richard Szeliski, Steve Seitz, Tom Funkhouser and Alexei Efros.
Homogeneous Coordinates (Projective Space) Let be a point in Euclidean space Change to homogeneous coordinates: Defined up to scale: Can go back to non-homogeneous.
Geometric Operations and Morphing.
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/23/10 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
Computational Photography Derek Hoiem, University of Illinois
Image Morphing Computational Photography Derek Hoiem, University of Illinois 10/02/12 Many slides from Alyosha Efros.
Image Warping and Morphing cs195g: Computational Photography James Hays, Brown, Spring 2010 © Alexey Tikhonov.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Image Morphing ( Computational Photography) Jehee Lee Seoul National University With a lot of slides stolen from Alexei Efros and Seungyong Lee.
Image Morphing Computational Photography Derek Hoiem, University of Illinois 9/29/15 Many slides from Alyosha Efros.
Multimedia Programming 07: Image Warping Keyframe Animation Departments of Digital Contents Sang Il Park.
Image warping Li Zhang CS559
Image Warping and Morphing : Computational Photography Alexei Efros, CMU, Fall 2011 © Alexey Tikhonov.
Image Warping and Morphing © Alexey Tikhonov CS194: Image Manipulation & Computational Photography Alexei Efros, UC Berkeley, Fall 2015.
Multimedia Programming 10: Image Morphing
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Recap from Monday DCT and JPEG Point Processing Histogram Normalization Questions: JPEG compression levels Gamma correction.
Image Warping Many slides from Alyosha Efros + Steve Seitz + Derek oeim Photo by Sean Carroll.
Example: warping triangles Given two triangles: ABC and A’B’C’ in 2D (12 numbers) Need to find transform T to transfer all pixels from one to the other.
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.
Lecture 15: Transforms and Alignment 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.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Image warping/morphing Digital Visual Effects, Spring 2006 Yung-Yu Chuang 2005/3/15 with slides by Richard Szeliski, Steve Seitz and Alexei Efros.
Image Morphing © Zooface Many slides from Alexei Efros, Berkeley.
University of Ioannina
Jeremy Bolton, PhD Assistant Teaching Professor
Computational Photography Derek Hoiem, University of Illinois
Computational Photography Derek Hoiem, University of Illinois
Computational Photography Derek Hoiem, University of Illinois
Image Warping (Szeliski Sec 2.1.2)
Image Warping and Morphing
Image Warping (Szeliski Sec 2.1.2)
Image warping/morphing
Image Warping : Computational Photography
Recap from Friday Image Completion Synthesis Order Graph Cut Scene Completion.
Image Warping : Computational Photography
2D transformations (a.k.a. warping)
Image Warping (Szeliski Sec 2.1.2)
Computer Graphics: Image Warping/Morphing
Computational Photography Derek Hoiem, University of Illinois
Presentation transcript:

Advanced Multimedia Warping & Morphing Tamara Berg

Reminder Project updates next week. Prepare a 10 minute presentation and submit a 4 paragraph summary to by midnight Monday, April

Image Warping Slides from: Alexei Efros & Steve Seitz

D'Arcy Thompson Importance of shape and structure in evolution Slide by Durand and Freeman Image Warping in Biology

Image Transformations image filtering: change range of image g(x) = T(f(x)) f x T f x f x T f x image warping: change domain of image g(x) = f(T(x))

Image Transformations TT f f g g image filtering: change range of image g(x) = T(f(x)) image warping: change domain of image g(x) = f(T(x))

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

Parametric (global) warping Transformation T is a coordinate-changing machine: p’ = T(p) What does it mean that T is global? Is the same for any point p can be described by just a few numbers (parameters) Let’s represent T as a matrix: p’ = Mp T p = (x,y)p’ = (x’,y’)

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

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?

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 x = r cos (  ) y = r sin (  ) x’ = r cos (  +  ) y’ = r sin (  +  )  (x, y) (x’, y’) 

2-D Rotation x = r cos (  ) y = r sin (  ) x’ = r cos (  +  ) y’ = r sin (  +  ) Trig Identity… x’ = r cos(  ) cos(  ) – r sin(  ) sin(  ) y’ = r sin(  ) cos(  ) + r cos(  ) sin(  )  (x, y) (x’, y’) 

2-D Rotation x = r cos (  ) y = r sin (  ) x’ = r cos (  +  ) y’ = r sin (  +  ) Trig Identity… x’ = r cos(  ) cos(  ) – r sin(  ) sin(  ) y’ = r sin(  ) cos(  ) + r cos(  ) sin(  ) Substitute… x’ = x cos(  ) - y sin(  ) y’ = x sin(  ) + y cos(  )  (x, y) (x’, y’) 

2-D Rotation This is easy to capture in matrix form: What is the inverse transformation? R

2-D Rotation This is easy to capture in matrix form: What is the inverse transformation? Rotation by –  For rotation matrices R

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Identity?

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Identity?

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 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?

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Mirror about Y axis?

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Mirror about Y axis?

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

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

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Translation?

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Translation? Only linear 2D transformations can be represented with a 2x2 matrix NO!

All 2D Linear Transformations Linear transformations are combinations of … Scale, Rotation, Shear, and Mirror Properties of linear transformations: Origin maps to origin Lines map to lines Parallel lines remain parallel Ratios are preserved Closed under composition

Homogeneous Coordinates Q: How can we represent translation as a 3x3 matrix?

Homogeneous Coordinates Homogeneous coordinates represent coordinates in 2 dimensions with a 3-vector

Homogeneous Coordinates Q: How can we represent translation as a 3x3 matrix?

Homogeneous Coordinates Q: How can we represent translation as a 3x3 matrix? A: Using the rightmost column:

Translation Example of translation t x = 2 t y = 1 Homogeneous Coordinates

Translation Example of translation t x = 2 t y = 1 Homogeneous Coordinates

Basic 2D Transformations Basic 2D transformations as 3x3 matrices Translate RotateShear Scale

Matrix Composition Transformations can be combined by matrix multiplication p’ = T(t x,t y ) R(  ) S(s x,s y ) p

Affine Transformations Affine transformations are combinations of … Linear transformations, and Translations Properties of affine transformations: Origin does not necessarily map to origin Lines map to lines Parallel lines remain parallel Ratios are preserved Closed under composition Models change of basis

Projective Transformations Projective transformations … Affine transformations, and Projective warps Properties of projective transformations: Origin does not necessarily map to origin Lines map to lines Parallel lines do not necessarily remain parallel Ratios are not preserved Closed under composition Models change of basis

Recovering Transformations What if we know f and g and want to recover the transform T? willing to let user provide correspondences –How many do we need? xx’ T(x,y) yy’ f(x,y)g(x’,y’) ?

Translation: # correspondences? How many correspondences needed for translation? xx’ T(x,y) yy’ ?

Translation: # correspondences? How many correspondences needed for translation? How many Degrees of Freedom? xx’ T(x,y) yy’ ?

Translation: # correspondences? How many correspondences needed for translation? How many Degrees of Freedom? What is the transformation matrix? xx’ T(x,y) yy’ ?

Euclidian: # correspondences? How many correspondences needed for translation+rotation? How many DOF? xx’ T(x,y) yy’ ?

Affine: # correspondences? How many correspondences needed for affine? How many DOF? xx’ T(x,y) yy’ ?

Affine: # correspondences? How many correspondences needed for affine? How many DOF? xx’ T(x,y) yy’ ?

Projective: # correspondences? How many correspondences needed for projective? How many DOF? xx’ T(x,y) yy’ ?

Example: warping triangles Given two triangles: ABC and A’B’C’ in 2D (12 numbers) Need to find transform T to transfer all pixels from one to the other. How can we compute the transformation matrix: T(x,y) ? A B C A’ C’ B’ SourceDestination

Example: warping triangles Given two triangles: ABC and A’B’C’ in 2D (12 numbers) Need to find transform T to transfer all pixels from one to the other. How can we compute the transformation matrix: T(x,y) ? A B C A’ C’ B’ SourceDestination cp2transform in matlab! input – correspondences. output – transformation.

Image warping Given a coordinate transform (x’,y’) = T(x,y) and a source image f(x,y), how do we compute a transformed image g(x’,y’) = f(T(x,y))? xx’ T(x,y) f(x,y)g(x’,y’) yy’

f(x,y)g(x’,y’) Forward warping Send each pixel f(x,y) to its corresponding location (x’,y’) = T(x,y) in the second image xx’ T(x,y) Q: what if pixel lands “between” two pixels? yy’

f(x,y)g(x’,y’) Forward warping Send each pixel f(x,y) to its corresponding location (x’,y’) = T(x,y) in the second image xx’ T(x,y) Q: what if pixel lands “between” two pixels? yy’ A: distribute color among neighboring pixels (x’,y’) –Known as “splatting”

Image warping Given a coordinate transform (x’,y’) = T(x,y) and a source image f(x,y), how do we compute a transformed image g(x’,y’) = f(T(x,y))? xx’ T(x,y) f(x,y)g(x’,y’) yy’ imtransform in matlab! input – transform and source image output – transformed image.

Image Warping in practice HP commercial

Image warping + TargetSource

Image warping + TargetSource User clicks on 4 points in target, 4 points in source.

Image warping + TargetSource User clicks on 4 points in target, 4 points in source. Find best affine transformation between source subimg and target subimg.

Image warping + TargetSource User clicks on 4 points in target, 4 points in source. Find best affine transformation between source subimg and target subimg. Transform the source subimg accordingly.

Image warping + TargetSource User clicks on 4 points in target, 4 points in source. Find best affine transformation between source subimg and target subimg. Transform the source subimg accordingly. Insert the transformed source subimg into the target image.

Image warping + TargetSource User clicks on 4 points in target, 4 points in source. Find best affine transformation between source subimg and target subimg. Transform the source subimg accordingly. Insert the transformed source subimg into the target image. Useful matlab functions: ginput, cp2transform, imtransform.

Image warping + TargetSource = Result

Image warping in video Do the same thing, but for a bunch of frames in a video!

Image Morphing - Women in Art video

Morphing

Morphing = Object Averaging The aim is to find “an average” between two objects Not an average of two images of objects… …but an image of the average object! How can we make a smooth transition in time? –Do a “weighted average” over time t How do we know what the average object looks like? We haven’t a clue! But we can often fake something reasonable –Usually required user/artist input

Idea #1: Cross-Dissolve Interpolate whole images: Image halfway = (1-t)*Image 1 + t*image 2 This is called cross-dissolve in film industry But what if the images are not aligned?

Idea #2: Align, then cross-disolve Align first, then cross-dissolve Alignment using global warp – picture still valid

Dog Averaging What to do? Cross-dissolve doesn’t work Global alignment doesn’t work –Cannot be done with a global transformation (e.g. affine) Any ideas? Feature matching! Nose to nose, tail to tail, etc. This is a local (non-parametric) warp

Idea #3: Local warp, then cross-dissolve Morphing procedure: for every t, 1.Find the average shape (the “mean dog” ) local warping 2.Find the average color Cross-dissolve the warped images

Warp specification - sparse How can we specify the warp? Specify corresponding points interpolate to a complete warping function How do we do it? How do we go from feature points to pixels?

Triangular Mesh 1.Input correspondences at key feature points

Triangular Mesh 1.Input correspondences at key feature points 2.Define a triangular mesh over the points Same mesh in both images! Now we have triangle-to-triangle correspondences

Triangular Mesh 1.Input correspondences at key feature points 2.Define a triangular mesh over the points Same mesh in both images! Now we have triangle-to-triangle correspondences 3.Warp each triangle separately from source to destination How do we warp a triangle? 3 points = affine warp!

Warp interpolation How do we create an intermediate warp at time t? Assume t = [0,1] Simple linear interpolation of each feature pair (1-t)*p1+t*p0 for corresponding features p0 and p1

Image Morphing We know how to warp one image into the other, but how do we create a morphing sequence? 1.Create an intermediate shape (by interpolation) 2.Warp both images towards it 3.Cross-dissolve the colors in the newly warped images

Morphing & matting Extract foreground first to avoid artifacts in the background Slide by Durand and Freeman

Warp specification - dense How can we specify the warp? Specify corresponding spline control points interpolate to a complete warping function But we want to specify only a few points, not a grid

Local (non-parametric) Image Warping Need to specify a more detailed warp function Global warps were functions of a few (2,4,8) parameters Non-parametric warps u(x,y) and v(x,y) can be defined independently for every single location x,y! Once we know vector field u,v we can easily warp each pixel (use backward warping with interpolation)

Image Warping – non-parametric Move control points to specify a spline warp Spline produces a smooth vector field