Geometric Operations and Morphing.

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.
Mapping: Scaling Rotation Translation Warp
2-D IMAGE MORPHING.
2D preobrazba (morphing). 2D preobrazba dekle-tiger.
Feature-Based Image Metamorphosis Thaddeus Beier Shawn Neely SIGGRAPH 1992.
1 Computer Graphics Chapter 6 2D Transformations.
Lecture 11: Transformations CS4670/5760: Computer Vision Kavita Bala.
Motion Analysis (contd.) Slides are from RPI Registration Class.
CSci 6971: Image Registration Lecture 4: First Examples January 23, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart, RPI Dr.
Lecture 8: Geometric transformations CS4670: Computer Vision Noah Snavely.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz
CSCE 641:Computer Graphics Image Warping/Registration Jinxiang Chai.
8. Geometric Operations Geometric operations change image geometry by moving pixels around in a carefully constrained way. We might do this to remove distortions.
CSCE 641:Computer Graphics Image Warping/Morphing Jinxiang Chai.
CS485/685 Computer Vision Prof. George Bebis
Image Morphing : Rendering and Image Processing Alexei Efros.
Computational Photography Image Warping/Morphing Jinxiang Chai.
Lecture 9: Image alignment CS4670: Computer Vision Noah Snavely
1 Computer Science 631 Lecture 3: Morphing, Sampling Ramin Zabih Computer Science Department CORNELL UNIVERSITY.
Image warping/morphing Digital Video Special Effects Fall /10/17 with slides by Y.Y. Chuang,Richard Szeliski, Steve Seitz and Alexei Efros.
Image Stitching Ali Farhadi CSE 455
Image Warping (Szeliski 3.6.1) cs129: Computational Photography James Hays, Brown, Fall 2012 Slides from Alexei Efros and Steve Seitz
MORPHING Presentation By: SWARUP DEEPIKA JAGMOHAN Date: 22 OCT 2002 Course: COMPUTER GRAPHICS.
CSCE 441: Computer Graphics Image Warping/Morphing Jinxiang Chai.
Chapter 3: Image Restoration Geometric Transforms.
Warping CSE 590 Computational Photography Tamara Berg.
Cartographic Applications
CS 551/651 Advanced Computer Graphics Warping and Morphing Spring 2002.
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.
Image Preprocessing: Geometric Correction Image Preprocessing: Geometric Correction Jensen, 2003 John R. Jensen Department of Geography University of South.
Digital Image Processing Lecture 7: Geometric Transformation March 16, 2005 Prof. Charlene Tsai.
Image warping/morphing Digital Visual Effects Yung-Yu Chuang with slides by Richard Szeliski, Steve Seitz, Tom Funkhouser and Alexei Efros.
Digital Image Processing Lecture 6: Image Geometry
Course 13 Curves and Surfaces. Course 13 Curves and Surface Surface Representation Representation Interpolation Approximation Surface Segmentation.
Computational Photography Derek Hoiem, University of Illinois
GEOMETRIC OPERATIONS. Transformations and directions Affine (linear) transformations Translation, rotation and scaling Non linear (Warping transformations)
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.
1 Chapter 2: Geometric Camera Models Objective: Formulate the geometrical relationships between image and scene measurements Scene: a 3-D function, g(x,y,z)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Multimedia Programming 07: Image Warping Keyframe Animation Departments of Digital Contents Sang Il Park.
Image warping Li Zhang CS559
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
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.
Image Warping 2D Geometric Transformations
Arithmetic and Geometric Transformations (Chapter 2) CS474/674 – Prof. Bebis.
Image warping/morphing Digital Visual Effects, Spring 2006 Yung-Yu Chuang 2005/3/15 with slides by Richard Szeliski, Steve Seitz and Alexei Efros.
3. Transformation
2D preobrazba (morphing)
CS1315: Introduction to Media Computation
Image warping/morphing
Computational Photography Derek Hoiem, University of Illinois
Homogeneous Coordinates (Projective Space)
Lecture 7: Image alignment
Image warping/morphing
CSCE 441: Computer Graphics Image Warping
Recap from Friday Image Completion Synthesis Order Graph Cut Scene Completion.
Lecture 3: Camera Rotations and Homographies
2D transformations (a.k.a. warping)
Feature-Based Warping
Feature-Based Warping
TWO DIMENSIONAL TRANSFORMATION
Image Stitching Linda Shapiro ECE/CSE 576.
Computer Graphics: Image Warping/Morphing
Image Stitching Linda Shapiro ECE P 596.
Presentation transcript:

Geometric Operations and Morphing

Geometric Transformation Operations depend on pixel’s Coordinates. Context free. Independent of pixel values. (x,y) (x’,y’) I(x,y) I’(x’,y’)

Example: Translation (x’,y’) (x,y) I(x,y) I’(x’,y’)

Forward Mapping Forward mapping: Source Target Forward Mapping

Forward vs. Inverse Mapping Forward mapping: Problems with forward mapping due to sampling: Holes (some target pixels are not populated) Overlaps (some target pixels assigned few colors) Source Target Forward mapping

Each target pixel assigned a single color. Inverse mapping: Each target pixel assigned a single color. Color Interpolation is required. Source Target Inverse Mapping

Example: Scaling along X Forward mapping: Inverse mapping: Source Target (0,0) (0,0) Source Target

Interpolation What happens when a mapping function calculates a fractional pixel address? Interpolation: generates a new pixel by analyzing the surrounding pixels.

Interpolation Good interpolation techniques attempt to find an optimal balance between three undesirable artifacts: edge halos, blurring and aliasing. x4 scaling N.N Bilinear Bicubic

Nearest Neighbor Interpolation The assign value is taken from the pixel closest to the generated location: Advantage: Fast Disadvantage: Jagged results Discontinues results

Nearest N. Interpolation Original Image

Original Image Nearest N. Interpolation

Bilinear Interpolation The assigned value is an intermediate value between the four nearest pixels:

Linear Interpolation ve v vw xw x xe Isolating v in the above equation:

Bilinear Interpolation The assign value is a weighted sum of the four nearest pixels. Each weight is proportional to the distance from each existing pixel.

N NW V NE S SE SW The bilinear interpolation is the best fit low-degree polynomial of the form: The pixel’s boundaries are C0 continuous (continuous values across boundaries).

Bilinear example s t s z=15 z=7 v t 1 z=2 z=3

Nearest N. Interpolation Bilinear Interpolation

Nearest N. Interpolation Bilinear Interpolation

Bicubic Interpolation The assign value is a weighted sum of the 4x4 nearest pixels:

How can we find the right coefficients? Denote the pixel values Vpq {p,q=0..3} The unknown coefficients are aij {i,j=0..3} s We have a linear system of 16 equations with 16 coefficients. The pixel’s boundaries are C1 continuous (continuous derivatives across boundaries). t

N.N Bilinear Bicubic

N.N

Bilinear

Bicubic

Applying the Transformation T = …… % 2x2 transformation matrix [r,c] = size(img) % create array of destination x,y coordinates [X,Y]=meshgrid(1:c,1:r); % calculate source coordinates sourceCoor = inv(T) * [X(:) Y(:) ] ‘ ; % calculate nearest neighbor interpolation Xs = round(sourceCoor(1,:)); Ys = round(sourceCoor(2,:)); indx=find(Xs<1 | Xs>r); %out of range pixels Xs(indx)=1; Ys(indx)=1; indy=find(Ys<1 | Ys>c); %out of range pixels Xs(indy)=1; Ys(indy)=1; % calculate new image newImage = img((Xs-1).*r+Ys); newImage(indx)=0; newImage(indx)=0; newImage = reshape(newImage,r,c);

Types of linear 2D transformations Rigid (Euclidean) transformation: Translation + Rotation (distance preserving). Similarity transformation: Translation + Rotation + Uniform Scale (angle preserving). Affine transformation: Translation + Rotation + Scale + Shear (parallelism preserving). Projective transformation Cross-ratio preserving All above transformations are groups where Rigid  Similarity  Affine  Projective

Homogeneous Coordinates Homogeneous Coordinates is a mapping from Rn to Rn+1: Note: (tx,ty,t) all correspond to the same non-homogeneous point (x,y). E.g. (2,3,1)(6,9,3) (4,6,2). Inverse mapping:

Some 2D Transformations Translation : Affine transformation: Projective transformation:

Hierarchy of Linear 2D Transformations

Non Linear 2D Transformations Non linear transformations do not necessarily preserve straight lines. Methods: Piecewise linear transformations Non linear parametric mapping

Non linear mapping: Example: non linear (radial) lens distortions:

Transformation Estimation Let: x’=fx(x,y,px) ; y’=fy(x,y,py), where px and py are vector of parameters. If the mappings are linear in px and py the parameters can be estimated using linear regression.

Example: Affine transformation Alternative representation:

Given k points (P1,P2,..Pk) in 2D that have been transformed to (P'1,P'2,..,P'k) by affine transformation: How many points uniquely define the affine (projective) transformation? How can we find the affine transformation? What if we have more points? What can be done if points coordinates are inaccurate?

Image Warping and Morphing Image rectification. Key frame animation. Image Synthesis Facial expression Viewing positions Image Metamorphosis.

Image Metamorphosis

Cross Dissolve (pixel operations) Source Image Destination Image t cross dissolve warp + dissolve

Warping + Cross Dissolve Warp source image towards intermediate image. Warp destination image towards intermediate image. Cross-dissolve the two images by taking the weighted average at each pixel. time Cross-dissolve warping images source destination

warp Cross-dissolve Cross-dissolve warp

Image Metamorphosis Let S,T be the source and the target images Let G(p) be the transformation from S towards T, where G(0)=I the identity transformation Let t[0,1] the time step to be synthesized Algorithm: Warp S towards T: Warp T toward S: Cross dissolve:

I(t)=(1-t)S(t)+t(T(t)) sourse S(t)=G(tp){S} I(t)=(1-t)S(t)+t(T(t)) target T(t)=G((1-t)p)-1{T}

Feature Based Morphing Morph one shape into another shape Use local features to define the geometric warping

Q Q’ P P’

Q Q’ P’ P

Q Q’ P’ P

Q Q’ P’ P

Q Q’ P’ P

Q Q’ P’ P

[0,1] is the relative position along the segment (P’,Q’).  is the actual perpendicular distance to the segment. (u’,v’) is the local coordinates of the segment (P’,Q’): u’ is a unit vector parallel to Q’-P’ v’ is the unit vector perpendicular to Q’-P’ One Segment Warping  P Q R  P’ Q’ R’ Source Image Dest Image v u u’ v’

 P’ Q’ R’  u’ v’ The point R’ is mapped into (,) : where

P Q R P’ Q’ R’ Source Image Dest Image Inverse Mapping:  P Q R  P’ Q’ R’ Source Image Dest Image v u u’ v’ Inverse Mapping: where (u,v) is the local coordinates of the segment (P,Q):

Multiple Segment Warping Q2 Q2’ Q1’ R1 Q1  2 1 R’ R2 ’2 ’1 P2 P1 P1’ P2’ In multiple segment warping the point R’ is influenced by multiple segments. The influence strength of each segments is proportional to: Segment length The distance from the point R’

The influence of each segments is: The value p[0,1] controls the influence of the line length. The value a is a small number avoiding division by zero. The value b determines how the relative weight diminish as the  increases The final mapping is:

Example: Example images from: http://www.cc.gatech.edu/classes/AY2001/cs4451_spring/projects/Seven/ For more details see: Thaddeus Beier & Shawn Neely  / Feature-Based Image Metamorphosis Siggraph '92 http://www.hammerhead.com/thad/morph.html

Another Example:

T H E E N D