Conceptintro
Homogeneous coordinates
Also called projective coordinates.
Represent a point of the plane by a 3-vector up to scale, so that projective maps are linear, points at infinity are finite vectors and lines are vectors too.
Homogeneous coordinates write a point of the plane as any vector with , so that a point is a 3-vector up to a nonzero scale. With this one extra coordinate, translations, perspective projections and other projective maps all become products with a matrix, a point "at infinity" (a direction) is the ordinary vector , and a line is also a 3-vector. The same idea in 3D writes as . This page is about the coordinates themselves and the rules for points, lines and maps in the plane. Two close pages use them for one purpose each: the robotics page homogeneous transformation matrix is about the matrix of a rigid motion, which always keeps the last coordinate equal to 1, and the graphics page pinhole camera model is about the camera that maps a 3D point to an image point. That graphics page looks along , as is usual in graphics. The computer vision pages look along .
In plain words
A point on a sheet of paper has two numbers, and . Add a third number, and agree that , and all name the same point. To get the ordinary point back, divide by the last number.
Why do this? First, a vector whose last number is 0 now names a direction, a point infinitely far away where parallel lines meet. Second, a straight line also becomes three numbers, and one cross product gives the line through two points or the point where two lines cross. Third, moves, turns and the picture a camera takes all become a multiplication by a matrix. So the geometry of images turns into simple linear algebra.
The idea
Points. A vector is a homogeneous vector of a point. Two vectors name the same point if one is a nonzero multiple of the other; we write . If , the point is the ordinary point . If , it is an ideal point, or point at infinity, in the direction . The zero vector names no point. The set of all classes is the projective plane , which is the ordinary plane plus one point at infinity for each direction. In code, to_h appends a 1, and from_h divides by the last entry and refuses a zero last entry. Vectors are column vectors.
Lines. The line has the homogeneous vector , also up to scale. A point lies on if and only if . This test does not depend on the two scales, so it is well defined. The vector is the line at infinity: it holds exactly the ideal points.
Join and meet. The line through two different points and is , the cross product. The proof is short: , and the same holds for ; and because the two vectors are not proportional. By the same argument with the roles swapped, two different lines and meet at the point . Two parallel lines meet at an ideal point, so in any two different lines meet in exactly one point. Each statement about points and lines has a dual statement with the two words swapped (HZ chapter 2).
Maps. A map of the plane that sends lines to lines is a product with a nonsingular matrix : . This is a homography, with 8 degrees of freedom because the scale of does not matter. The affine map is the special case
so a translation, which is not linear in two coordinates, is linear in three. Lines map with the inverse transpose: if , then , because . An affine map keeps fixed, so it keeps parallel lines parallel. A general homography moves to a finite line, the horizon of a plane in a photograph.
Space and cameras. A point of 3D space is a 4-vector up to scale, and the ideal point is the direction . A rigid motion is the matrix of the homogeneous transformation matrix page. A camera is a matrix , and the image of is (see camera projection matrix). The division by the last entry at the end is the perspective division: it is the only step that is not linear, and homogeneous coordinates put it off to the very end.
Distances need the scale. Incidence () does not depend on the scales, but a distance does. The distance from the ordinary point to the line is . To compare two homogeneous vectors numerically, first scale both to unit norm and fix the sign, for example so that the entry of largest size is positive.
The sign. In the vectors and are the same point. A camera does keep one more piece of information: for with the last row of equal to , the last entry of is the depth of the point, so its sign says whether the point is in front of the camera or behind it (HZ chapter 6). Code that tests visibility must keep the last entry of equal to 1, or at least positive, and must not throw the sign away.
Examples
All numbers below can be checked by hand.
- One point, many vectors. has the homogeneous vectors , and . Dividing any of them by its last entry gives back.
- The line through two points. For and : . This is the line , that is . Both points satisfy it.
- Parallel lines meet at infinity. The lines and are and . Their cross product is : the ideal point in the direction of the axis, which is the direction of both lines.
- Two lines that meet. is and is . The cross product is , the point .
- Translation keeps directions. The translation by is . It moves to , but leaves the ideal point where it is: a direction does not move when the plane slides.
- A distance. The distance from to , with , is .
- A vanishing point. Take the camera with . The 3D direction is the ideal point , and . So every 3D line with this direction has an image that runs toward the pixel . For the line , the image is , which tends to as grows. The ideal point of 3D space has a finite image.
Where it is used
- Camera models. The camera projection matrix , the camera intrinsic matrix and the camera extrinsic parameters are all written in homogeneous coordinates, and calibration methods such as DLT resectioning are linear only in this form.
- Two-view and plane geometry. A homography maps points of a plane between two images. In epipolar geometry, the fundamental matrix maps a point of one image to a line of the other, and the epipole is a null vector. The cross ratio is the basic number that a homography keeps.
- Robotics. Chains of rigid motions multiply as homogeneous transformation matrices.
- Graphics. The graphics pipeline carries vertices as 4-vectors through the model, view and projection matrices, and divides by the last entry after clipping.
- Computational geometry. Points with integer homogeneous coordinates give predicates, such as the side of a line, as signs of determinants with no division. The sign rule above matters there too.
References
- Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Chapter 2, Projective geometry and transformations of 2D (points and lines, ideal points and the line at infinity, duality, projective transformations); Chapter 3 for the same ideas in 3D
- Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Chapter 2, Image formation (geometric primitives and 2D and 3D transformations in homogeneous coordinates)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag CXYFKE Edit this page History Report an error Markdown