CSCE 441: Computer Graphics Image Warping/Morphing Jinxiang Chai.

Slides:



Advertisements
Similar presentations
Morphing & Warping 2D Morphing Involves 2 steps 1.Image warping “get features to line up” 2.Cross-dissolve “mix colors” (fade-in/fadeout transition)
Advertisements

Warping and Morphing.
Morphing CSE 590 Computational Photography Tamara Berg.
2-D IMAGE MORPHING.
2D preobrazba (morphing). 2D preobrazba dekle-tiger.
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 2005 Some slides from Steve Seitz
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 5: Image Processing 2: Warping Ravi Ramamoorthi
CSCE 641:Computer Graphics Image Warping/Registration Jinxiang Chai.
CSCE 641:Computer Graphics Image Warping/Morphing Jinxiang Chai.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 5: Image Processing 2: Warping Ravi Ramamoorthi
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.
Scale-Invariant Feature Transform (SIFT) Jinxiang Chai.
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.
Image Stitching Ali Farhadi CSE 455
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
Warping CSE 590 Computational Photography Tamara Berg.
CS 551/651 Advanced Computer Graphics Warping and Morphing Spring 2002.
Image Warping / Morphing
Image warping/morphing Digital Visual Effects Yung-Yu Chuang with slides by Richard Szeliski, Steve Seitz, Tom Funkhouser and Alexei Efros.
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.
Image warping/morphing Digital Visual Effects Yung-Yu Chuang with slides by Richard Szeliski, Steve Seitz, Tom Funkhouser and Alexei Efros.
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.
CSCE 643 Computer Vision: Extractions of Image Features Jinxiang Chai.
Advanced Multimedia Warping & Morphing Tamara Berg.
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.
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.
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 Stitching Computer Vision CS 691E Some slides from Richard Szeliski.
Image Warping 2D Geometric Transformations
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.
Jeremy Bolton, PhD Assistant Teaching Professor
Image warping/morphing
Computational Photography Derek Hoiem, University of Illinois
Computational Photography Derek Hoiem, University of Illinois
Image Warping and Morphing
Image warping/morphing
Image Stitching Slides from Rick Szeliski, Steve Seitz, Derek Hoiem, Ira Kemelmacher, Ali Farhadi.
CSCE 441: Computer Graphics Image Warping
Recap from Friday Image Completion Synthesis Order Graph Cut Scene Completion.
2D transformations (a.k.a. warping)
Feature-Based Warping
Image Stitching Computer Vision CS 678
Morphing WU PO-HUNG.
Feature-Based Warping
Image Stitching Linda Shapiro ECE/CSE 576.
Computer Graphics: Image Warping/Morphing
Image Stitching Linda Shapiro ECE P 596.
Presentation transcript:

CSCE 441: Computer Graphics Image Warping/Morphing Jinxiang Chai

Outline Image warping Image morphing

Required Readings Section 3.6 (Szeliski book) Image morphing paperImage morphing

Image Warping Image filtering: change range of image g(x) = h(f(x)) f x h f x f x h f x Image warping: change domain of image g(x) = f(h(x))

Image Warping Image filtering: change range of image g(x) = h(f(x)) Image warping: change domain of image g(x) = f(h(x)) h fg h f g

Image Warping Why? - texture mapping - image processing (rotation, zoom in/out, etc) - image morphing/blending - image editing - image based-modeling & rendering

Parametric (global) Warping Examples of image warps: translation rotation aspect affineperspective cylindrical

Transformation Function f, g Transform the geometry of an image to a desired geometry

Definition: Image Warping Source Image: Image to be used as the reference. The geometry of this image is no changed Target Image: this image is obtained by transforming the reference image. (x,y): coordinates of points in the reference image (u,v): coordinates of points in the target image f,g or F,G: x and y components of a transformation function

Definition: Image Warping Control points: Unique points in the reference and target images. The coordinates of corresponding control points in images are used to determine a transformation function. Source ImageTarget Image

A Transformation Function Used to compute the corresponding points Source Image S(x,y)Target Image T(u,v) u = f(x,y) v = g(x.y) x = F(u,v) y = G(x.v)

Warping Types Simple mappings: - Similarity - Affine mapping - Projective mapping These can be applied globally over a subdivision of the plane: - Piecewise affine over triangulation - Piecewise projective over quadrilaterization - Piecewise bilinear over a rectangular grid Or other, arbitrary functions can be used, e.g. - Bieer-neely warp (popular for morphs) - Store u(x,y) and v(x,y) in large arrays

Similarity Transform A combination of 2-D scale, rotation, and translation transformations. Allows a square to be transformed into any rotated rectangle. Angle between lines is preserved 5 degrees of freedom (s x,s y,θ,t x,t y ) Inverse is of same form (is also similarity). Given by inverse of 3X3 matrix above Have the form: In matrix notation:

Affine Transform A combination of 2-D scale, rotation, shear, and translation transformations. Allows a square to be distorted into any parallelogram. 6 degrees of freedom (a,b,c,d,e,f) Inverse is of same form (is also affine). Given by inverse of 3X3 matrix above Good when controlling a warp with triangles, since 3 points in 2D determined the 6 degrees of freedom Have the form: In matrix notation:

Projective Transform (a.k.a “perspective”) Linear numerator & denominator If g=h=0, then you get affine as a special case Allow a square to be distorted into any quadrilateral 8 degrees of freedom (a-h). We can choose i=1, arbitrarily Inverse is of same form (is also projective). Good when controlling a warp with quadrilaterals, since 4 points in 2D determine the 8 degrees of freedom Have the form: In matrix notation:

Image Warping x y u v Given a coordinate transform function f,g or F,G and source image S(x,y), how do we compute a transformed image T(u,v)? S(x,y) T(u,v)

Forward Warping x y u v S(x,y) T(u,v) Forward warping algorithm: for y = y min to y max for x = x min to x max u = f(x,y); v = g(x,y) copy pixel at source S(x,y) to T(u,v)

Forward Warping x y u v S(x,y) T(u,v) Forward warping algorithm: for y = y min to y max for x = x min to x max u = f(x,y); v = g(x,y) copy pixel at source S(x,y) to T(u,v) - Any problems for forward warping?

Forward Warping x y u v S(x,y) T(u,v) Q: What if the transformed pixel located between pixels?

Forward Warping x y u v S(x,y) T(u,v) Q: What if the transformed pixel located between pixels? A: Distribute color among neighboring pixels - known as “splatting”

Forward Warping Iterate over source, sending pixels to destination Some source pixels maps to the same dest. pixel Some dest. pixels may have no corresponding source Holes in reconstruction Must splat etc. for y = y min to y max for x = x min to x max u = f(x,y); v = g(x,y) copy pixel at source S(x,y) to T(u,v) x y u v

Forward Warping Iterate over source, sending pixels to destination Some source pixels map to the same dest. pixel Some dest. pixels may have no corresponding source Holes in reconstruction Must splat etc. for y = y min to y max for x = x min to x max u = f(x,y); v = g(x,y) copy pixel at source S(x,y) to T(u,v) x y u v - How to remove the holes?

Forward Warping Iterate over source, sending pixels to destination Some source pixels map to the same dest. pixel Some dest. pixels may have no corresponding source Holes in reconstruction Must splat etc. for y = y min to y max for x = x min to x max u = f(x,y); v = g(x,y) copy pixel at source S(x,y) to T(u,v) x y u v - How to remove the holes?

Inverse Warping x y u v S(x,y) T(u,v) Inverse warping algorithm: for v = v min to v max for u = u min to u max x = F(u,v); y = G(u,v) copy pixel at source S(x,y) to T(u,v)

Inverse Warping x y u v S(x,y)T(u,v) Q: What if pixel comes from “between” two pixels? A: Interpolate color values from neighboring pixels

Inverse Warping Iterate over dest., finding pixels from source Non-integer evaluation source image, resample May oversample source But no holes Simpler, better than forward mapping for v = v min to v max for u = u min to u max x = F(u,v); y = G(u,v) copy pixel at source S(x,y) to T(u,v) x y u v

Resampling Filter

Resampling x y u v This is a 2D signal reconstruction problem!

Point Sampling Nearest neighbor x y u v - Copies the color of the pixel with the closest integer coordinate - A fast and efficient way to process textures if the size of the target is similar to the size of the reference - Otherwise, the result can be a chunky, aliased, or blurred image.

Bilinear Filter Weighted sum of four neighboring pixels x y u v

Bilinear Filter Sampling at S(x,y): (i+1,j) (i,j) (i,j+1) (i+1,j+1) S(x,y) = (1-a)*(1-b)*S(i,j) + a*(1-b)*S(i+1,j) + (1-a)*b*S(i,j+1) + a*b*S(i+1,j+1) u v y x

Bilinear Filter Sampling at S(x,y): (i+1,j) (i,j) (i,j+1) (i+1,j+1) S(x,y) = a*b*S(i,j) + a*(1-b)*S(i+1,j) + (1-a)*b*S(i,j+1) + (1-a)*(1-b)*S(i+1,j+1) S i = S(i,j) + a*(S(i,j+1)-S(i)) S j = S(i+1,j) + a*(S(i+1,j+1)-S(i+1,j)) S(x,y) = S i +b*(S j -S i) To optimize the above, do the following u v y x

Bilinear Filter (i+1,j) (i,j) (i,j+1) (i+1,j+1) y x

Inverse Warping and Resampling Inverse warping algorithm: for v = v min to v max for u = u min to u max float x = F(u,v); float y = G(u,v); T(u,v) = resample_souce(x,y,w); x y u v (u,v) (x,y)

Outline Image warping Image 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

Averaging Points P Q v = Q - P P + 0.5v = P + 0.5(Q – P) = 0.5P Q P + 1.5v = P + 1.5(Q – P) = -0.5P Q (extrapolation) Linear Interpolation (Affine Combination): New point aP + bQ, defined only when a+b = 1 So aP+bQ = aP+(1-a)Q P and Q can be anything : –points on a plane (2D) or in space (3D) –Colors in RGB or HSV (3D) –Whole images (m-by-n D)… etc. What’s the average of P and Q?

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

Dog Averaging What to do? –Cross-dissolve doesn’t work –Any ideas?

Dog Averaging What to do? –Cross-dissolve doesn’t work –Any ideas? Feature matching! –Nose to nose, tail to tail, etc. This is a local (non-parametric) warp

Idea #2: Local Warping 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

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) –Will it work for these dogs? –Probably not… Need user control.

Warp Specification How can we specify the warp? –Specify corresponding points interpolate to a complete warping function How do we do it?

Finding Transformation Function Generally this is a 2D scattered data interpolation problem - radial basis function, etc

Finding Transformation Function Generally this is a 2D scattered data interpolation problem - radial basis function, etc Piecewise affine transformation

Finding Transformation Function Generally this is a 2D scattered data interpolation problem - radial basis function, etc Piecewise affine transformation

Finding Transformation Function Generally this is a 2D scattered data interpolation problem - radial basis function, etc Piecewise affine transformation

Triangular Mesh Input correspondences at key feature points Define a triangular mesh over the points (Delaunay triangulation) –Same mesh in both images! –Now we have triangle-to-triangle correspondences Warp each triangle separately from source to destination –How do we warp a triangle? –3 points = affine warp! –Just like texture mapping

Warp Specification How can we specify the warp? –Specify corresponding vectors interpolate to a complete warping function The Beier & Neely Algorithm

Beier&Neely (SIGGRAPH 1992) Single line-pair PQ to P’Q’:

Algorithm (single line-pair) For each X in the destination image: –Find the corresponding u,v –Find X’ in the source image for that u,v –destinationImage(X) = sourceImage(X’) Examples:

Multiple Lines Length: length of the line segment, Dist: distance to line segment a, p, b: constants specified by the user

Resulting Warp

Full Algorithm

Results

Morph Sequences

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

Morphing Video Click here!here

Summary Image warping Image morphing