Homography

A homography (or projective transformation) is a matrix that maps points between two planes in homogeneous coordinates, such that , where

The lecture writes the same matrix as acting on . The bottom row is general, so (for ) varies from point to point. The image point is found by dividing:

Since is defined up to scale ( and give the same map for ), is conventionally set to to remove the scale ambiguity. Therefore has degrees of freedom.

Homographies capture all affine transformations and add perspective distortion, which makes objects appear smaller when farther away and is not affine. The lecture lists six properties. The origin does not necessarily map to the origin, and lines map to lines. Parallel lines do not necessarily remain parallel, and ratios are not preserved. The class is closed under composition and models a change of coordinates.

In practice, the exact transformation between two images (or between a scene plane and the image) is unknown. We estimate from point correspondences between the two planes, with at least correspondences for the unknowns. With fixed, the unknowns solve a linear least-squares problem with . Without fixing , the equations read with , and is the right singular vector of for its smallest singular value (SVD).

Common applications are rectification, inverse rectification, and image mosaicing. Rectification warps an image so that a planar surface appears fronto-parallel, which removes its perspective distortion. Inverse rectification applies to map rectified coordinates back to the original image, which is useful for overlays and texture mapping. Mosaicing stitches overlapping images into a panorama by warping each one into a common coordinate frame.

Intuition

A homography is the most general transformation between two images of the same plane. It also relates two images taken from the same camera center, with pure rotation and no translation. In both cases there is no parallax, and a projective map fully accounts for the geometric relationship.

The key geometric fact is that homographies preserve straight lines but not parallelism or angles. A straight edge in one image stays straight in the warped image, but a pair of rails that were parallel in the world converge to a vanishing point. This is the phenomenon of perspective. Inverting it, called rectification, is the primary use of homographies outside of stitching.

Properties

(Degrees of freedom) A homography has 8 DoF: 9 matrix entries minus 1 for the scale ambiguity.

Equivalently, is defined up to scalar multiplication, and fixing (or ) removes the ambiguity. Four point correspondences, no three of them collinear, give 8 linear constraints and determine uniquely. Fixing fails in the rare case where the true is , which the normalization avoids.

(Division by ) The per-point division is what bends parallel lines together and breaks ratios, while collinearity survives.

An affine map has everywhere, so equal steps along a line stay equal. A homography divides by , which changes along the line, so equal steps in the source become unequal steps in the image. A point at infinity maps to a point whose last coordinate is . When that is nonzero, the point maps to a finite vanishing point, where the images of all lines with direction meet. Incidence is preserved: if three points are collinear, so are their images, and the intersection of two lines maps to the intersection of their images. So the center of a square, where its diagonals cross, maps to the crossing of the image diagonals. It does not map to the average of the four image corners. The figure shows a square tile and its photo from the example below. The images of the tile’s vertical edges (blue) meet at a vanishing point, and the midpoint of the left edge (red) no longer sits halfway.

\usepackage{tikz}
\begin{document}
\definecolor{hot}{HTML}{D9483B}
\definecolor{cold}{HTML}{2F80ED}
\definecolor{mid}{HTML}{8A8A8A}
\begin{tikzpicture}[x=0.8cm,y=0.8cm,>=latex]
\draw[thick] (0,0) -- (2,0);
\draw[thick] (0,2) -- (2,2);
\draw[very thick,cold] (0,0) -- (0,2);
\draw[very thick,cold] (2,0) -- (2,2);
\draw[mid] (0,0) -- (2,2);
\draw[mid] (2,0) -- (0,2);
\fill[hot] (0,1) circle (2.5pt) node[left] {$(0, 0.5)$};
\fill (1,1) circle (2pt);
\node at (1,-0.6) {tile};
\draw[->,thick] (2.6,1) -- (3.8,1) node[midway,above] {$H$};
\begin{scope}[shift={(4.5,0)}]
\draw[thick] (0,0) -- (4,0);
\draw[thick] (1,2) -- (3,2);
\draw[very thick,cold] (0,0) -- (1,2);
\draw[very thick,cold] (4,0) -- (3,2);
\draw[cold,dashed] (1,2) -- (2,4);
\draw[cold,dashed] (3,2) -- (2,4);
\fill[cold] (2,4) circle (2.5pt) node[above] {vanishing point $(2,4)$};
\draw[mid] (0,0) -- (3,2);
\draw[mid] (4,0) -- (1,2);
\fill[hot] (0.667,1.333) circle (2.5pt) node[above left] {$(\frac{2}{3}, \frac{4}{3})$};
\fill (2,1.333) circle (2pt) node[below] {\small $(2, \frac{4}{3})$};
\node at (2,-0.6) {photo};
\end{scope}
\end{tikzpicture}
\end{document}

(Applicable cases) A homography exactly relates two images when (a) the scene is planar, or (b) the camera rotates purely about its optical center.

In any other case (a 3D scene viewed from distinct optical centers), a single homography cannot align the entire image, and the fundamental matrix is needed. For mosaicing, condition (b) is typically arranged by having the photographer rotate in place.

(Hierarchy of transformations) Translation ⊂ Euclidean (rigid) ⊂ Similarity ⊂ Affine ⊂ Projective (homography).

Each step adds degrees of freedom: , , , , then . The classes form a nested set of groups, each closed under composition and containing its inverses. The leap from affine to homography adds perspective foreshortening. The two extra parameters and control how quickly lines converge toward vanishing points.

(Estimation from correspondences) Given point correspondences, is recovered by the Direct Linear Transform (DLT).

Each correspondence gives two independent linear constraints from . Stacking correspondences into , where , and taking the right singular vector of for its smallest singular value yields . Robust estimation wraps the DLT in RANSAC.

(Forward vs. inverse warping) Applying to sample pixels is best done in the inverse direction.

For each output pixel , compute , divide by its third coordinate, and sample the source image at with bilinear interpolation. Forward-mapping each source pixel leaves holes in the output, because the mapping is not surjective onto the pixel lattice.

Mosaicing Workflow

Image mosaicing (also panorama stitching) is the canonical multi-image application of homographies. The standard pipeline:

  1. Acquire overlapping images. The photographer rotates about the optical center (a tripod minimizes translation).
  2. Detect and match features. Use SIFT or ORB keypoints, then match descriptors across adjacent image pairs.
  3. Estimate pairwise homographies using RANSAC with the DLT as the minimal-sample solver (4 correspondences per sample).
  4. Choose a reference frame, typically the central image of the sequence.
  5. Compose homographies along paths to the reference: .
  6. Warp and blend. Inverse-warp each image into the reference frame, then blend overlapping regions (feathering, multi-band blending, or Poisson compositing) to hide seams.

A naive averaging blend produces visible seams wherever exposure or alignment differ. Multi-band blending decomposes each image into Laplacian pyramid bands and blends each band with a different feather width, producing seamless results.

Examples

(Medium) A Square Floor Tile Seen at an Angle

A square floor tile with corners , , , appears in a photo as the trapezoid , , , , in that order. Coordinates use a -up frame, so the far edge of the tile is on top.

See Also