Warping and Morphing.

Slides:



Advertisements
Similar presentations
Digital Image Processing
Advertisements

QR Code Recognition Based On Image Processing
Medical Image Registration Kumar Rajamani. Registration Spatial transform that maps points from one image to corresponding points in another image.
Morphing & Warping 2D Morphing Involves 2 steps 1.Image warping “get features to line up” 2.Cross-dissolve “mix colors” (fade-in/fadeout transition)
Mapping: Scaling Rotation Translation Warp
With support from: NSF DUE in partnership with: George McLeod Prepared by: Geospatial Technician Education Through Virginia’s Community Colleges.
2-D IMAGE MORPHING.
2D preobrazba (morphing). 2D preobrazba dekle-tiger.
Feature-Based Image Metamorphosis Thaddeus Beier Shawn Neely SIGGRAPH 1992.
Motion Analysis (contd.) Slides are from RPI Registration Class.
1 Computer Science 631 Lecture 2: Morphing Ramin Zabih Computer Science Department CORNELL UNIVERSITY.
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.
COMP322/S2000/L221 Relationship between part, camera, and robot (cont’d) the inverse perspective transformation which is dependent on the focal length.
Image Morphing : Rendering and Image Processing Alexei Efros.
Image Morphing Tong-Yee Lee. Image Morphing Animate transitions between two images Specify Correspondence Warping Blending.
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 Morphing : Computational Photography Alexei Efros, CMU, Fall 2005 © Alexey Tikhonov.
Image warping/morphing Digital Video Special Effects Fall /10/17 with slides by Y.Y. Chuang,Richard Szeliski, Steve Seitz and Alexei Efros.
Face Recognition Using Neural Networks Presented By: Hadis Mohseni Leila Taghavi Atefeh Mirsafian.
Image Stitching Ali Farhadi CSE 455
CSC 589 Lecture 22 Image Alignment and least square methods Bei Xiao American University April 13.
Image Registration January 2001 Gaia3D Inc. Sanghee Gaia3D Seminar Material.
COMP 175: Computer Graphics March 24, 2015
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.
Geometric transformations Affine transformations Forward mapping Interpolations schemes.
CS 551/651 Advanced Computer Graphics Warping and Morphing Spring 2002.
Course 12 Calibration. 1.Introduction In theoretic discussions, we have assumed: Camera is located at the origin of coordinate system of scene.
Geometric Operations and Morphing.
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.
Digital Image Processing Lecture 6: Image Geometry
Elementary Linear Algebra Anton & Rorres, 9th Edition
Image Warping and Morphing cs195g: Computational Photography James Hays, Brown, Spring 2010 © Alexey Tikhonov.
AS-RIGID-AS-POSSIBLE SHAPE MANIPULATION
GEOMETRIC OPERATIONS. Transformations and directions Affine (linear) transformations Translation, rotation and scaling Non linear (Warping transformations)
Advanced Multimedia Warping & Morphing Tamara Berg.
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
Image 2013, Fall. Image Processing Quantization  Uniform Quantization  Halftoning & Dithering Pixel Operation  Add random noise  Add luminance  Add.
Graphics Graphics Korea University cgvr.korea.ac.kr Image Processing 고려대학교 컴퓨터 그래픽스 연구실.
Image warping Li Zhang CS559
Krivljenje slike - warping. Princip 2D krivljenja Demo.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
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.
Krivljenje slike - warping
Image warping/morphing Digital Visual Effects, Spring 2006 Yung-Yu Chuang 2005/3/15 with slides by Richard Szeliski, Steve Seitz and Alexei Efros.
Geometric Preprocessing
2D preobrazba (morphing)
CS1315: Introduction to Media Computation
Image 2016, Fall.
Motion and Optical Flow
Computational Photography Derek Hoiem, University of Illinois
Lecture 7: Image alignment
Outline Announcement Local operations (continued) Linear filters
Image Stitching Slides from Rick Szeliski, Steve Seitz, Derek Hoiem, Ira Kemelmacher, Ali Farhadi.
CSCE 441: Computer Graphics Image Warping
Morphing WU PO-HUNG.
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Graphics Laboratory Korea University
Image Stitching Linda Shapiro ECE/CSE 576.
Computer Graphics: Image Warping/Morphing
Image Morphing using mesh warp and feature based warp
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Image Stitching Linda Shapiro ECE P 596.
Presentation transcript:

Warping and Morphing

Warping There are two ways to warp an image. The first, called forward mapping, scans through the source image pixel by pixel, and copies them to the appropriate place in the destination image. The second, reverse mapping, goes through the destination image pixel by pixel, and samples the correct pixel from the source image. The most important feature of inverse mapping is that every pixel in the destination image gets set to something appropriate. In the forward mapping case, some pixels in the destination might not get painted, and would have to be interpolated. We calculate the image deformation as a reverse mapping. The problem can be stated "Which pixel coordinate in the source image do we sample for each pixel in the destination image?"

Image Warping Move pixels of image Mapping Resampling

Mapping Define transformation Describe the destination (x, y) for every location (u, v) in the source image(or vice-versa, if invertible)

Example Mappings Scale by factor x = factor * u y = factor * v

Example Mappings Rotate by  degrees x = ucos - vsin y = usin + vcos

Other Mappings Any function of u and v x = fx(u, v) y = fy(u, v)

Forward Mapping Traverse input pixels Miss/overlap output pixels W

Forward Mapping Iterate over source image Some destination pixels may not be covered Many source pixels can map to the same destination pixel

Inverse Mapping Traverse output pixels Does not waste work W-1

Reverse Mapping Iterate over destination image Must resample source May oversample, but much simpler!

Resampling Evaluate source image at arbitrary (u, v) (u, v) does not usually have integer coordinates Some kinds of resampling Point resampling Triangle filter Gaussian filter Source Image Destination Image

Point Sampling Take value at closest pixel Simple, but causes aliasing int iu = trunc(u + 0.5); int iv = trunc(v + 0.5); dst(x, y) = src(iu, iv); Simple, but causes aliasing

Triangle Filter Convolve with triangle filter

Triangle Filter Bilinearly interpolate four closest pixels a = linear interpolation of src(u1, v2) and src(u2, v2) b = linear interpolation of src(u1, v1) and src(u2, v1) dst(x, y) = linear interpolation of ‘a’ and ‘b’

Gaussian Filter Convolve with Gaussian filter Width of Gaussian kernel affects bluriness

Filtering Method Comparison Trade-offs Aliasing versus blurring Computation speed

Image Warping Implementation Reverse mapping for (int x = 0; x < xmax; x++) { for (int y = 0; y < ymax; y++) { float u = fx-1(x, y); float v = fy-1(x, y); dst(x, y) = resample_src(u, v, w); } Source Image Destination Image

Polynomial Transformation Geometric correction requires a spatial transformation to invert an unknown distortion function. The mapping functions, U and V , have been universally chosen to be global bivariate polynomial transformations of the form: (20) where aij and bij are constant polynomial coefficients A first degree ( N=1) bivariate polynomial defines those mapping functions that are exactly given by a general 3 x 3 affine transformation matrix .

Polynomial Warping In the remote sensing, the polynomial coefficients are not given directly. Instead spatial information is supplied by means of control points, corresponding positions in the input and output images whose coordinates can be defined precisely. In these cases, the central task of the spatial transformation stage is to infer the coefficients of the polynomial that models the unknown distortion. Once these coefficients are known, Eq.20 is fully specified and it is used to map the observed (x,y) points onto the reference ( u,v) coordinate system. This is also called polynomial warping. It is practical to use polynomials up to the fifth order for the transformation function.

Least – Squares with Ordinary Polynomials From Equation (20) with N=2, coefficients aij can be determined by minimizing This is achieved by determining the partial derivatives of E with respect to coefficients aij, and equating them to zero. For each coefficient aij, we have : By considering the partial derivative of E with respect to all six coefficients, we obtain the system of linear equations.

Weighted Least Squares As you see the least-squares formulation is global error measure - distance between control points ( xk, yk) and approximation points ( x,y). The least –squares method may be localized by introducing a weighting function Wk that represents the contribution of control point (xk,yk) on point (x,y) where  determines the influence of distant control points and approximating points

Pseudoinverse Solution Let a correspondence be established between M points in the observed and reference images. The spatial transformation that approximates this correspondence is chosen to be a polynomial of degree N. In two variables ( x and y) , such a polynomial has K coefficients where For example, a second-degree approximation requires only six coefficients to be solved. In this case , N=2 and K=6. In matrix form: U=WA ; V=WB  WTU = WTWA A = (WTW)-1WTU ; B =(WTW)-1WTV

Warping Summary Reverse mapping is simpler to implement Different filters trade-off speed and aliasing/blurring Fun and creative warps are easy to implement

Image Morphing Animate transition between two images

Cross-Dissoving Blend images blend(i, j) = (1-t)src(i, j) + tdst(i, j)

Image Morphing Combines warping and cross-dissolving

Image Morphing Warping step is the hard one Aim to align features in images

Image Morphing There are two necessary components to morphing algorithms: the user must have a mechanism to establish correspondence between the two images - perhaps as simple as silhouettes from this correspondence, the algorithm must determine a dense pixel correspondence which is the warp algorithm A common technique often used for facial morphing is named feature-based morphing. Important feature are chosen rather than a grid of points that must cover "unimportant" areas. Typical features might be ears, nose, and eyebrows. Lines are drawn in each image and are associated with each other. If there is only one pair of lines, the algorithm produces a purely local change. Therefore, a high spatial density is achieved in areas of interest.

Feature-based Morphing Beier & Neeley use pairs of lines to specify warp Given p in dst image, where is p’ in source image? u is a fraction v is a length(in pixels)

Feature-based Morphing The mapping function is simple. An inverse mapping function is used.                                                                   

Feature-based Morphing If more than one pair of lines is used, the transformations must be blended. Beier and Neeley of Pacific Data Images who developed the technique suggested the use of weight. (NOTE: Beier-92.pdf work).

Warping with One Line Pair What happens to the ‘F’?

Warping with Multiple Line Pairs Use weighted combination of points defined by each pair of corresponding lines p’ is a weighted average

Weighting Effect of Each Line Pair To weight the contribution of each line pair where Length[i] is the length of L[i] dist[i] is the distance from X to L[i] a, b, p are constants that control the warp

Warping Pseudocode WarpImage(Image, L’[], L[]) begin foreach destination pixel p do psum = (0, 0) wsum = (0, 0) foreach line L[i] in destination do p’[i] = p transformed by (L[i], L’[i]) psum = psum + p’[i] * weight[i] wsum += weight[i] end p’ = psum / wsum Result(p) = Image(p’)

Morphing Pseudocode GenerateAnimation(Image0, L0[], Image1, L1[]) begin foreach intermediate frame time t do for i = 1 to number of line pairs do L[i] = line t-th of the way from L0[i] to L1[i] end Warp0 = WarpImage(Image0, L0, L) Warp1 = WarpImage(Image1, L1, L) foreach pixel p in FinalImage do Result(p) = (1-t)Warp0 + tWarp1

Morphing Summary Specifying correspondences Warping Blending

Graphical Objects and Metamorphosis Object O1 Object O2 Metamorphosis Geometric Data Set Geometric Data Set Geometry Alignment Attributes Attributes Attribute Interpolation

Warping Pipeline Generation of attributes Deform Adjust Transformation of geometry Generation of attributes

Morphing Pipeline Deform Adjust Blend Adjust Deform

Warping Morphing Warping and Morphing Single object Specification of original and deformed states Morphing Two objects Specification of initial and final states

Warping and Morphing http://www-2.cs.cmu.edu/~seitz/vmorph/vmorph.html http://pen-web.com/rainyday/alexwarp/alexwarp.htm http://www-graphics.stanford.edu/cgi-bin/alumni/tolis/personal/getpage.cgi?morph.html http://www.css.tayloru.edu/~btoll/s99/424/res/model/morph/morph.html