Image warping
Image warping image filtering: change range of image g() () = h(f()) h(f()) f h g h()=0.5+0.5 image warping: change domain of image g() = f(h()) f h g h([,])=[,/2]
Parametric (global) warping Eamples of parametric warps: translation rotation aspect affine perspective clindrical
Parametric (global) warping T p = (,) p = (, ) Transformation T is a coordinate-changing machine: p = T(p) What does it mean that T is global? Is the same for an point p can be described b just a few numbers (parameters) Represent T as a matri: p = M*p M
Scaling Scaling a coordinate means multipling each of its components b a scalar Uniform scaling means this scalar is the same for all components: f g 2 2 2
Scaling Non-uniform scaling: different scalars per component: component: g f 2 5 0. 2, 0.5
Scaling Scaling operation: Or, in matri form: a b a 0 0 b What s inverse of S? scaling matri S
2-D Rotation This is eas to capture in matri form: cos sin sin cos R Even though sin() and cos() are nonlinear to, is a linear combination of and is a linear combination of and What is the inverse transformation? Rotation b For rotation matrices, det(r) = 1 so 11 T R R
22 Matrices What tpes of transformations can be represented with a 22 matri? 2D Identit? 1 0 1 0 2D Scale around (0,0)? s * s * s 0 0 s
22 Matrices What tpes of transformations can be represented with a 22 matri? represented with a 22 matri? 2D Rotate around (0,0)? * i * i * cos * sin * sin * cos cos sin sin cos 2D Shear? sh sh * * sh sh 1 1 sh sh 1
22 Matrices What tpes of transformations can be represented with a 22 matri? 2D Mirror about Y ais? 1 0 0 1 2D Mirror over (0,0)? 1 0 0 1
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 a c b d
22 Matrices What tpes of transformations can not be represented with a 22 matri? 2D Translation? t t NO! Onl linear 2D transformations can be represented with a 222 matri
Translation Eample of translation Homogeneous Coordinates 1 1 1 0 0 1 0 0 1 1 t t t t 1 1 1 0 0 1 t = 2 t = 1
Affine Transformations Affine transformations are combinations of Li f i d Linear transformations, and Translations Properties of affine transformations: Origin does not necessaril map to origin Lines map to lines Parallel lines remain parallel Ratios are preserved Closed under composition f d c b a Models change of basis w f e d w 1 0 0
Projective Transformations Projective transformations Affine transformations, and Projective warps Properties of projective transformations: ti Origin does not necessaril map to origin Lines map to lines Parallel lines do not necessaril remain parallel Ratios are not preserved Closed under composition Models change of basis w a d g b e h c f i w
Image warping Given a coordinate transform = T() and a source image I(), how do we compute a transformed image I ( ) =I(T())? T() I() I ( ) )
Forward warping Send each piel I() to its corresponding location = T() in I ( ) T() I() I ( ) )
Inverse warping Get each piel I ( ) from its corresponding location = T -1 ( ) in I() T -1 ( ) I() I ( ) )
Non-parametric image warping Specif a more detailed warp function Splines, meshes, optical flow (per-piel motion)
Non-parametric image warping Mappings implied b correspondences Inverse warping? P
Non-parametric image warping P w A A w B B w C C P w A A w B B w C C Barcentric coordinate P P
Barcentric coordinates P t t A 1 1 1 t 2 t 3 t 2 A 1 2 t 3 A 3
Non-parametric image warping P w A A w B B w C C P w A A w B B w C C Barcentric coordinate
Image morphing
Image morphing The goal is to snthesize a fluid transformation from one image to another. Cross dissolving is a common transition between cuts, but it is not good for morphing because of the ghosting effects. image #1 dissolving i image #2
Image morphing Wh ghosting? Morphing = warping + cross-dissolving i shape (geometric) color (photometric)
Image morphing image #1 cross-dissolving image #2 warp morphing warp
Warp specification (mesh warping) How can we specif the warp? 1. Specif corresponding spline control points interpolate to a complete warping function eas to implement, but less epressive
Warp specification How can we specif the warp 2. Specif corresponding points interpolate to a complete warping function
Solution: convert to mesh warping 1. Define a triangular mesh over the points Same mesh in both images! Now we have triangle-to-triangle i l correspondences 2. Warp each triangle separatel from source to destination How do we warp a triangle? 3 points = affine warp! Just like teture mapping
Warp specification (field warping) How can we specif the warp? 3. Specif corresponding vectors interpolate to a complete warping function The Beier & Neel Algorithm
Beier&Neel (SIGGRAPH 1992) Single line-pair PQ to P Q :
Algorithm (single line-pair) For each X in the destination image: 1. Fi 1 Find d the th corresponding di u,v 2. Find X in the source image for that u,v 3 destinationimage(x) 3. d ti ti I (X) = sourceimage(x ) I (X ) Eamples: Affine transformation
Multiple Lines D i X i X i length = length of the line segment, dist = distance to line segment The influence of a, p, b. The same as the average of X i
Full Algorithm
Resulting warp
Results Michael Jackson s MTV Black or White