6.0 WARPING AND MORPHING⧉
A warp moves where pixels are, not what colour they carry. Print the image on a sheet of rubber and stretch it: every pixel slides to a new position and its colour rides along. Formally a warp applies a function $W:\mathbb{R}^2\to\mathbb{R}^2$ to the image domain while leaving the range (the colours) untouched — the exact mirror image of the point and tone operations of the BASIC part, which edit colours and leave positions fixed. That one idea is everywhere in this book: lens-distortion correction, video stabilisation, panorama reprojection, the cosmetic "liquify," morphing one face into another, and squaring up a tilted building are all warps. One primitive, reused constantly — which is why it gets its own part, ahead of the single-image, multiple-image, and video parts that lean on it.
Building the engine comes down to two decisions. Which direction do you transport pixels? Almost always inverse (output-driven): loop over the output pixels, push each one backward through the map to find where it came from, and read the colour there, $I_\text{out}(\mathbf x)=I_\text{in}(W^{-1}(\mathbf x))$. This covers every output exactly once — no holes, no pile-ups — and pushes the only hard part into a clean question: how do you read a colour at a fractional location? That is resampling — reconstruct the underlying continuous image (nearest, bilinear, bicubic, Lanczos) and evaluate it — with one discipline that never goes away: when the warp shrinks a region you are throwing samples away, so you must blur before you decimate or fine detail folds into moiré (L16). For strongly non-uniform warps the footprint of one output pixel back-projects to an ellipse, not a square, and must be filtered anisotropically — elliptical weighted average (EWA) and its fast approximation Feline.
The other question is how the map itself is specified. Two families. Parametric warps are a few numbers fit to a few correspondences and applied everywhere — the degrees-of-freedom ladder from translation (2) through affine (6) to the projective homography (8), each rung adding freedom and breaking a preserved property. Free-form warps build a dense field from sparse control: a triangulated mesh (piecewise-affine), a smooth thin-plate / RBF interpolant, Beier–Neely feature-line fields, and — when a dragged shape must bend without shearing — as-rigid-as-possible (ARAP) deformation and bounded biharmonic weights. Whatever specifies $W$, the application is identical: inverse-warp and resample.
On top of the engine sit the things you make with it. Morphing adds a blend to the warp — line two pictures up with a field, warp both toward an intermediate shape, then cross-dissolve, the move behind every face-to-face transformation (and, for two views of a 3-D scene, the geometrically-correct view morphing). Morphable models generalise that to a learned shape space — a family of faces or bodies as a mean plus a basis of deformations, so any instance is a point you can fit, re-pose, and edit. Shape-preserving warping is the deformation that refuses to distort. Video in-betweening carries morphing across time. And perspective correction is the engine's simplest application: keystoning is not a lens flaw but plain projection, so a single homography re-renders a tilted façade fronto-parallel — the "Upright" button, explained.
The roadmap, then: Warping and resampling builds the inverse-warp + resample engine and the ways to specify a warp; Resampling for complex spatial transforms adds anisotropic (EWA/Feline) filtering for hard warps; Morphing, Morphable models, Shape-preserving warping, and Video in-betweening are what the engine makes possible; Perspective distortion and its correction closes with the one-homography rectifier. Hold the one sentence and the part stops looking like a grab-bag of stretches: this is the transport half of correspondence-then-transport — one shared engine that moves pixels along a map. Where those maps come from — estimated from feature matches or dense optical flow rather than handed over by a user — is the sibling part, Matching pixels across space and time.
Contents of this part
- 6.1 Warping and resampling
- Warping is a domain transform — move where, not what
- Forward vs inverse warping — why output-driven wins
- Resampling — reading a value at a non-integer location
- Specifying the warp I — parametric models and the degrees-of-freedom (DOF) ladder
- Specifying the warp II — free-form warps from sparse correspondences
- 6.2 Resampling for complex spatial transforms
- 6.3 Morphing
- Why a cross-dissolve isn't enough — the ghosting motivation
- Two interpolations: domain (shape) and range (color)
- The morphing recipe (combine both)
- Field morphing: the Beier–Neely line-pair warp
- Mesh / triangulation morphing (the alternative warp)
- View morphing — the geometrically-correct in-between of two views
- Recap and significance
- 6.4 Morphable models
- 6.5 Shape-preserving warping
- 6.6 Video in-betweening
- 6.7 Perspective distortion and its correction
- Keystoning is projection, not a lens flaw
- The fix is a homography — re-render the façade fronto-parallel
- The optical alternative at capture — tilt-shift / Scheimpflug
- A different perspective distortion — wide-angle portraits, and a content-aware fix
- The catch — resampling cost, and "only a plane rectifies exactly"
- Where this sits — one map, then transport