What is the difference between projective geometry and affine geometry?
I recently started reading the book Multiple View Geometry by Hartley and Zisserman. In the first chapter, I came across the following concepts.
Projective geometry is an extension of Euclidean geometry with two lines always meeting at a point.
In perspective, geometry parallelism does not exist.
Then he goes on to explain how the points at infinity in the world like the points at the horizon appear as a line in the image of the world taken by a camera. Then he says a line which I cannot relate is the following..
The geometry of the projective plane and a distinguished line is known as Affine Geometry and any projective transformation that maps the distinguished line in one space to the distinguished line of the other space is known as an Affine transform.
I have the following questions
- Is the camera plane the projective space of the real world?
- Is the line which is the image of the horizon the distinguished line?
- Whenever we do an Affine transform do we need to look out for a distinguished line?
- Why does just a distinction of the geometry a line in the perspective plane make the geometry an Affine geometry?
Is the camera plane the projective space of the real world?
It depends.
Usually a physical camera has a limited sensor, so the thing where the image appears is too bounded to be an affine or projective plane. You can say “well, simply extend that plane infinitely”. Then it depends on how exactly you define that extension, whether you end up with an affine or a projective space. If you say “well, take any line on it, and for any distance $d\in\mathbb R$ take the point at position $d$ along that line to be a point of my plane as well” then the result is affine. If you say “well, take any pair of lines on it, and include their point of intersection as well” then it's projective.
And for something planar to be “the projective space” of “the real world”, that real world has to be planar, too. So if you have a camera image of things happening on the flat surface spanned by your table top, then yes, you could obtain an image of that surface in your projective camera plane. But if you take a camera image of a 3d scene, you get a projection, which is a reduction of information and usually not what projective geometry describes. Usually, a projective space is used as something more complete than the underlying affine space: you add points (at infinity), you don't remove them (by combining multiple points in the line of projection into a single point on the image plane).
Is the line which is the image of the horizon the distinguished line?
If you have your geometry sketched on a real paper lying on your real (horizontal) table, then the horizon of your real world is the distinguished line. You draw two parallel lines on your table, you look from an angle and you can almost see them converging on the horizon. Of course, that horizon is infinitely far away, so if you were to go there, the fact that the earth is not flat may break the simile.
If you take a camera image of that situation, then your projective camera sensor plane has its own distinguished line at infinity, namely where two parallel lines in the camera sensor plane intersect. If the image of one distinguished line is the other distinguished line, then your camera plane is parallel to the real world table plane, and the resulting transformation would be called affine. Otherwise it's a generic projective transformation.
Whenever we do an Affine transform do we need to look out for a distinguished line?
It depends on how and why you do affine transformations.
If you do an affine transformation via a multiplication of a matrix of the form $$\begin{pmatrix}*&*&*\\*&*&*\\0&0&1\end{pmatrix}$$ then the form of the matrix already guarantees that points with a $z$ coordinate of zero will get mapped to points which again have a $z$ coordinate of zero, i.e. using the $z=0$ line as the distinguished line in both your spaces is already implied by the form of the transformation.
If you do affine transformations as $$\begin{pmatrix}x\\y\end{pmatrix}\mapsto\begin{pmatrix}ax+by+c\\dx+ey+f\end{pmatrix}$$ then you are using the same scheme computation as above, plus you are using non-homogeneous coordinates, so you might not even see what this $z$ coordinate is about since the 2d affine coordinates don't even allow you to express points at infinity.
If, on the other hand, you have some weird choice of coordinate systems where the distinguished line has a more complicated form, and that form perhaps isn't the same for source and target space of your transformation, and you need to ensure that your transformations are indeed affine, then yes, you need to be explicit about the lines at infinity, and verify that they get mapped correctly. One common example would be trilinear coordinates, where $x+y+z=0$ represents the line at infinity. Mapping from carthesian to trilinear coordinates and back is a situation where you want to make sure that the line at infinity gets transformed correctly.
Why does just a distinction of the geometry a line in the perspective plane make the geometry an Affine geometry?
As the other answers by Joseph Malkevitch and by AdiPiratla have already indicated, there are different ways to treat the relation between affine and projective geometry. One is to say that you get projective geometry from affine geometry if you add a point at infinity for every bundle of parallel lines, and a line at infinity made up from all these points. In this sense, a projective space is an affine space with added points.
Reversing that process, you get an affine geometry from a projective geometry by removing one line, and all the points on it. By convention, one uses the line $z=0$ for this, but it doesn't really matter: the projective space does not depend on the choice of coordinates, and removing any line will turn it into an affine space.
But often one wants to exploit the machinery from projective geometry to perform affine operations. Perhaps you want to combine affine and projective transformations, or some such. In such a setup, you can say that as long as you keep track of which line is the line at infinity, you know how to get from there to affine geometry, so you are already doing affine geometry in a different representation. Affine geometry is like projective geometry with one line (the “distinguished line”) labeled “remove this to obtain an affine plane”. In this sense, an affine space is a projective space with additional information.
Loosely speaking when one is looking at geometries from an axiomatic point of view projective geometries are ones where every pair of lines meet at a point and affine geometries are ones where given a point P not on a line l there is a unique parallel to l through P. Affine geometries with additional structure lead to the Euclidean plane. If one has a projective plane, and one singles out some particular line m and deletes this line (sometimes thought of as the line at "infinity") the lines that used to meet at a fixed point Q on the line you threw away (line m) now can be thought of as parallel. So all the lines that met at Q are now "parallel" in the new geometry. Lines that used to meet at points not on m still intersect.