A Primer on Projective Geometry
Understanding the basics behind 2D projections
Projective Geometry 1 is a term used to describe properties of projections of a given geometric shape. When a shape is projected onto (commonly known as the 2D real space), it is called a Planar Projection. This idea can be extended to a shape being projected as where is a homogenous matrix. To understand concepts, we’ll use Planar geometry because that is the easiest to visualize.
Homogenous Representation of Points and Lines
From elementary geometry, we know that a line in the plane is represented by . In vector form, a line can also be written as . As can be easily seen, any multiple of this vector will also represent the same line. Hence, we can define the equivalence: . The class of such vectors is know as the homogenous vector. The set of all such equivalence classes in form the Projective Space with excluded because it does not represent a line.
From the same equation above, the point lies on the line and hence can be rewritten as
Now, observe here that for convenience we represent in as in . Generalizing it further, let us say we represent points in as , which when accounted for scale (read equivalence class), can be rewritten as the homogenous vector in and represents in .
Now that we have basic definitions in place, let us see how this representation helps.
Intersection of Lines
Let us consider two lines and .
The point of intersection of two lines is given by
It is easy to see why the above formula works. But, in , there is one special case - parallel lines. We know about the notion that parallel lines meets at infinity but infinity is just another way of saying that something is not defined. Instead in , we’ll see that there exists no such special case.
Consider lines and in . These are represented by lines and in . The point of intersection will be given by the cross product -
The vector is very well defined and hence we did not need to handle parallel lines as a special case in . But what point does this homogenous vector describe in ? By definition, it should be which is not defined and hence, the lines meet at infinity as expected. So, we satisfy definitions of parallel lines and their intersection in both spaces.
We define such points where as ideal points and belong to the line at infinity. For any general ideal point , it is easy to see that the equivalence class of the line at infinity can be represented by . This fact that parallel lines do intersect at well-defined points in will have a very important implication in projections.
Projective Transformations
Geometry is the study of properties invariant under a given set of transformation. For the purpose of this illustration, we will see 2D projective geometry, which is the study of properties of the projective plane .
Definition 1: We define a projectivity as an invertible mapping such that three points are collinear iff are collinear. It is alternatively known as homography.
There is an alternative algebraic way to write this.
Definition 2: A mapping is called a projectivity iff there exists a non-invertible matrix such that .
To see how both of these definitions are equivalent, consider points on line , which by definition would imply -
Introducing and some manipulations,
Hence, the matrix transforms the set of collinear points on to points on proving the equivalence of Definition 1 and Definition 2.
Class of Projections
Now that we have convinced ourselves about the algebraic nature of projections, let us take a look some special cases of Projective Transformations. Note that each transformation discussed below has a given set of invariants. The ability to assess and reconstruct such patterns is the essence of scene geometry understanding in Computer Vision.
Isometries
These are transformations of the plane that preserve the Euclidean distance.
This transformation can be written in block form as:
where for orientation preservation, is the orthogonal rotation matrix and is the translation vector.
Similarity Transformations
This transformation is an extension of isometry with scaling involved. Hence, instead of the Euclidean distance being preserved, the ratios like between two lengths or two areas are preserved. In essence, shapes are preserved.
This transformation can be written in block form as:
where represents the scaling factor.
Affine Transformations
Affine transformations are an extension to the similarity transform but with an added deformity factor. This preserves parallelism.
This transformation can be written in block form as:
where represents a general linear part. It is easy to observe that lines at infinity remain at infinity.
Projective Transformations
These are the most generalized set of transformations and can be written in block form as:
The invariant property here, other than the previously discussed collinearity is something known as a cross-ratio which is defined as a ratio of ratios -
where in (can be extended). Note that the order of the points will change the ratio (which have a simple relationship) but as long as the definition is consistent, it is an invariant.
Coming back to an earlier discussion on homogenous points, consider an ideal point transformed by a Projective Transformation.
where . It can be observed that lines at infinity DONOT remain at infinity.
which will not remain an ideal point anymore due to the component and hence helps model vanishing points - imagine two parallel rail tracks meeting at the edge of the horizon as seen by the eyes.
Application
A projective transformation can be decomposed into the following set of transformations -
moves the line at infinity, makes an affine transformation and preserves the invariants of , and is the similarity transform and preserves the invariants of both and .
All the above equips us with a fundamental understanding of what matrices need to be computed when trying to reconstruct geometry from given scene and keypoints. I will discuss one of the simpler rectification problems here in theory.
Affine Rectification of images
We will see that identifying the line at infinity will allow us to recover the affine properties of an image. Remember from the above discussion, that
and that a line at infinity is only preserved when H is an affinity. Effectively, what we need to find a projective matrix which transforms an identified in the image to the canonical position of .
Consider a given image where we have identified 2 pairs of parallel lines in homogenous coordinates - and . To calculate the line of infinity in the image space,
where and are the ideal points from respective pair of parallel lines. is the line of infinity constructed via the ideal points. Using this line, we need to find a projective matrix which converts it into the canonical line at infinity .
where . It is verifiable that .
If we now apply the same transformation matrix to all points on the image, the image will be rectified to actually show parallel edges as parallel.
The above discussion introduces the basic matrices and invariant properties which we look for while processing images for geometric scene understanding. A more practical approach to the rectification problem above and more complex problems like 2D Homography and Stereo Matching will be discussed in another post.
Footnotes
-
Harltey, A., & Zisserman, A. (2003). Multiple view geometry in computer vision (2. ed.). ↩