liveBook · Manning

Convex quadrilateral

As explained in Geometry for Programmers

A quadrilateral is a polygon bounded by four line segments joining four vertices.

A convex quadrilateral is a four-sided polygon whose corners define a useful image boundary. In phone scanning, its four photographed corners can represent a flat rectangular page distorted by perspective. section 4.4.1

The scanning workflow treats the geometry as a sequence of simpler transformations:

  • Map each target-rectangle pixel to its source position rather than transforming the photographed quadrilateral directly into a rectangle. section 4.4.1
  • Scale the rectangle into a standard unit square with corners (0,0), (1,0), (1,1), and (0,1). section 4.4.1
  • Solve the four-point projective system in smaller stages instead of handling one large symbolic system. section 4.4.1

Undoing a photographed page

Given four corner correspondences between a rectangular target and a photographed convex quadrilateral, compute where every target pixel originated, then sample that source color to reconstruct the flat image. section 4.4.1

How Geometry for Programmers covers it

How deep it goes
Explains coordinate normalization and staged symbolic solving, but stops short of a complete numerical implementation.
Examples
Demonstrates phone-scanned pages, rectangular targets, unit-square coordinates, and four-point correspondence equations.
What it assumes
Assumes familiarity with coordinates and transformation matrices while supplying the unit-square normalization step.
What you can do after
Apply a rectangular-to-quadrilateral mapping to determine source pixels for perspective-corrected images.
How it connects
Connects quadrilaterals with projective transformations, perspective correction, scaling, and standard squares.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.