# homography(3) — four point pairs, one plane ## NAME homography — the 3x3 matrix that maps one plane to another --- ## SYNOPSIS ``` x' = H x H in R^3x3, defined up to scale, 8 degrees of freedom ``` ## DESCRIPTION A homography is the complete answer to one question: given a flat thing photographed or projected from an angle, where does each of its points land? Not approximately. Exactly, if the thing is flat. Eight unknowns, and each point correspondence gives you two equations, so four point pairs determine H. That is the whole trick, and it is why a projector alignment can be finished with four thumbtacks and a tape measure rather than an afternoon of nudging. Build the system, solve it, and normalize: ``` | h1 h2 h3 | | u | | x | H = | h4 h5 h6 | | v | = H * | y | | h7 h8 1 | | w | | 1 | screen coords = (u/w, v/w) <- the divide is the perspective ``` The division by w is where the perspective lives. Everything else is linear algebra you can do in a spreadsheet. ## FIELD NOTES - **Four points is the minimum, not the goal.** Use eight or twelve and solve least-squares. The residual tells you which corner your assistant mismeasured, and it will tell you before the client does. - **Normalize your coordinates first.** Hartley normalization — center the points, scale so the mean distance from the origin is sqrt(2) — turns an ill-conditioned system into a stable one. Skipping it is the most common reason a solve that works on paper drifts on a floor. - **A homography cannot fix a curved surface.** If the wall bows, no H exists that maps the whole thing correctly. Split the surface into regions with a homography each, or move to a mesh warp. Pretending otherwise produces the alignment that looks perfect at the center and fails at both ends. - **A homography cannot undo lens distortion.** Undistort first, then solve. Distortion is not projective; see `man camera-parameters`. - **Degenerate configurations are silent.** Three collinear points among your four give a matrix that inverts to nonsense without complaining. Check the condition number, not your intuition. ## SEE ALSO `man projection`, `man camera-parameters`, `fencepost`