Homographies, or projective transformations, project points from a plane onto another plane and is defined by an invertible matrix transformation from to . Specifically, the 3x3 transformation matrix with maps

Note that and are the same transformation.

Applied to a line , we have

so the projection of the line is

Computing Homography

We need four points to find the homography between two planes. Intuitively, has degrees of freedom, and each point gives us equations, so we need four of them. We also need the points to be collinear since otherwise we have redundant information.

From Canonical Points

Weโ€™ll first cover a special case where the first plane is a unit square. We can then use two of its corners as well as the points at infinity:

Note that the first three points, when multiplied with , gives us the three columns of . Let the projections of our points be . Then, has the form

where are our scaling coefficients from .

Our fourth point sums the columns of , so it maps

Since is the same as , we can let and solve

which is a system of three equations with three unknowns, thus giving a unique solution

Composing Homographies

If our first plane isnโ€™t a square, we can find homographies and that go from canonical points to the first and second planes respectively. The homography that goes between them is then .

From General Points

We can generalize this solution to any number of points. Weโ€™re given correspondences of the form , and weโ€™ll find .

First, consider a single correspondence. We have

which gives us the following equations:

Solving for , we get

Rearranging terms, we get

Putting this in matrix form, we have

We can do the same for ,

Then, we can apply the same idea to all correspondences and stack the rows together to form a general equation

where each is a row from above.

The vertical vector form of can then be interpreted as the null space of our stacked matrix. To find it, we calculate the ๐Ÿ“Ž Singular Value Decomposition of the stacked matrix, and is given by the last column of .