A projective transformation maps points using homogeneous coordinates. Its practical payoff is that translation, rotation, scaling, shear, and perspective can share one matrix-based representation. Unlike affine transformations, it need not preserve parallel lines: a square can become an arbitrary convex quadrilateral. section 4.2.3 section 4.3.2
In homogeneous form, a point is represented by coordinates such as (x, y, w), where scaling every coordinate describes the same projective point: (1, 0, 1) and (2, 0, 2) coincide. A projective matrix transforms these coordinates in one multiplication, then the resulting ratio recovers Euclidean position when w is nonzero. section 4.3.2 section 4.7
This single representation makes several useful operations uniform:
- Compose several transformations by multiplying their matrices, producing one transformation matrix rather than applying each step per point. section 4.3.3
- Undo a transformation with an inverse; homogeneous-coordinate equivalence permits an inverse transformation wider than one particular inverse matrix. section 4.7
- Build a custom four-point transformation by solving linear equations for matrix coefficients. section 4.2.3 section 4.7
- Extend the same approach to 3D with four-coordinate points and 4 × 4 matrices. section 4.3.2
Flattening a photographed page
To undo a page’s perspective in a camera image, select its four photographed corners and map a target rectangle into that quadrilateral. For each target pixel, transform backward to locate the source pixel color. Using a standard unit square as an intermediate step makes the coefficient equations smaller; the direction matters because sampling needs target-to-source coordinates. section 4.4.1
The before-and-after image makes the core visual result concrete: a perspective-distorted photograph is remapped into a flat rectangular view. section 4.4.1
Projective transformations are powerful, but not automatically the best choice. They can reduce duplicated code, combine stages, and support fast robust workflows; when a simpler transformation meets the need, it may be faster and easier to implement. section 4.0 section 4.4.3
