AI Glossary / Computer vision and multimodal AI / Intermediate

Homography transformation

Definition

A homography transformation is a projective mapping between two planes, commonly represented by an invertible three-by-three matrix in homogeneous coordinates. In computer vision, it can relate different views of a planar surface or images taken under suitable pure-camera-rotation conditions.

What it means

A rectangular poster photographed at an angle may appear as a quadrilateral. A homography can map its image coordinates into a front-facing rectangular view. It handles perspective effects beyond simple translation, rotation and scaling. However, one homography does not generally align an arbitrary three-dimensional scene when the camera translates, because objects at different depths exhibit different parallax. The model's geometric assumptions matter as much as the number of matched points. A visually plausible warp can still be inaccurate for measurements outside the plane used to estimate it.

How it works

Represent a point as (x,y,1), multiply by the homography matrix H and divide the first two resulting components by the third to obtain ordinary coordinates. Multiplying all elements of H by the same nonzero scale leaves the mapping unchanged, giving eight independent degrees of freedom. Four point correspondences in a suitable nondegenerate arrangement can determine a homography in the ideal case.
Real correspondences contain noise and incorrect matches, so estimation often uses more points and robust fitting. Warping an image also requires interpolation, output bounds and handling of locations with no valid source sample. Lens distortion should be considered separately; a single projective mapping does not automatically model nonlinear lens effects.

Three practical examples

  • A document-scanning app rectifies a flat page photographed obliquely, using detected corners to estimate a projective mapping.
  • A panorama system aligns images captured approximately by rotation around the camera's optical center, while checking for parallax failures.
  • An inspection camera maps points on a known flat work surface into a common coordinate frame, with calibration and measurement limits documented.

Think of it this way

Think of viewing the same flat sign from two positions and translating locations between those views. Perspective changes the apparent shape while preserving straight lines under the ideal projective model. The analogy fails for objects that rise away from the sign's plane, curved pages or strong lens distortion, which need additional modeling.

Worked example

Take H=[[2,0,10],[0,2,5],[0,0,1]]. A point (3,4,1) maps to (16,13,1), giving ordinary coordinates (16,13). This is a simple affine case within the broader homography family.
Now use H=[[1,0,0],[0,1,0],[0.1,0,1]]. The same point maps to (3,4,1.3), so the output is approximately (2.308,3.077). The division by the third coordinate creates a position-dependent projective effect. These examples illustrate coordinate mapping only; they do not estimate H from data or specify how an output image should sample the original pixels.

Illustrative case study

Fictional example: Ash Design photographs a flat exhibition poster and uses its four corners to create a rectangular digital version. The result looks good until the team applies the same mapping to a brochure standing in front of the poster. The brochure distorts because it lies on a different plane. The team restricts measurements to the poster and uses a separate method for the three-dimensional display. The case illustrates the domain of a homography rather than a failure of perspective mathematics.

Common misconceptions and mistakes

Four correspondences are not sufficient when their arrangement is degenerate, such as unsuitable collinearity. A homography is not a universal three-dimensional motion model. Straight-line preservation does not mean lengths and angles are preserved. A low fitting error on selected points may conceal errors elsewhere or incorrect matches. The matrix's arbitrary scale does not change the mapping. Finally, obtaining a visually rectangular page does not establish metric accuracy without appropriate geometry, distortion handling and reference dimensions.

Business use

Businesses using perspective correction should identify the plane or motion assumption and test departures from it. For measurements, use suitable calibration and reference geometry rather than relying on appearance alone. Monitor corner detection or feature matching quality and reject unstable estimates. Preserve source images and transformation parameters for traceability. In panorama and compositing workflows, inspect parallax boundaries and moving objects. A robust process explains where the mapping is valid instead of applying one transformation indiscriminately to every visible object.

People also ask

Is a homography the same as an affine transform?

An affine transform is a special case; a general homography also represents perspective effects.

Does it preserve distances?

Not generally. It preserves projective relationships such as straight lines under the ideal model, not ordinary lengths or angles.

Can it align two views of any scene?

Not with one matrix in general. Planarity or suitable camera-motion conditions are needed for the usual image-to-image interpretation.

Check your understanding

A homography is estimated from a tabletop. Should a tall object standing on the table necessarily align correctly under the same mapping?

Answer: No. Its elevated points are outside the reference plane and can exhibit parallax that the tabletop homography does not describe.

Related terms

  • Image rectification
  • Image warping
  • projective transformation
  • homogeneous coordinates
  • perspective
  • RANSAC
  • camera calibration

Learn next

Learn homogeneous coordinates and affine transformations, then map a simple point through a homography. Study planar assumptions, correspondence degeneracy and robust estimation before using perspective correction for measurement.

More in Computer vision and multimodal AI

  • High-pass filter - A high-pass filter attenuates slowly varying components of a signal while retaining or emphasizing more rapidly varying components.
  • Histogram equalization - Histogram equalization remaps image intensities using their cumulative distribution to spread frequently occurring values across more of the available...
  • Histogram matching - Histogram matching remaps an image's intensity or color values so their distribution resembles a specified reference distribution.
  • Homomorphic filtering - Homomorphic filtering is a signal-processing approach that transforms a combination of signal components into a form where filtering is easier.
  • Horn - Schunck - Horn - Schunck is a classical method for estimating dense optical flow, the apparent motion of image brightness patterns between frames.
  • Hough transform - The Hough transform detects parameterized shapes by letting image evidence vote for possible shape parameters.

Sources

OpenCV, Basic concepts of the homography explained with code: https://docs.opencv.org/4.5.5/d9/dab/tutorial_homography.html Official geometry tutorial excerpts consulted; full calibration and editorial review remain pending. Matrix calculations and the fictional example are original.

Previous: Homogeneity of variance in arrays Next: Homomorphic filtering

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer