17
Chapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and the 2D projective plane, as well as projective transformations. The set of tools we obtain through this discussion will enable a natural and very convenient way of modelling the process of image formation with pinhole cameras. 3.1 Planar geometry and the 2D projective plane We usually represent a point in the plane by a pair of coordinates x = x 1 x 2 T , thus we often identify the plane with R 2 . In this section we introduce homoge- neous coordinates as a representation of points in a plane. This unifies the concept of the intersection of two lines (even parallel lines will be shown to intersect in a well-defined point) and leads us straight into the projective plane, P 2 , with its well-defined geometric computations. 3.1.1 Homogeneous representation of lines A line in the plane is represented by an equation of the form ax + by + c = 0, (3.1) with different choices of a, b and c yielding different lines. For example, the lines 2x + y - 1 = 0, with a = 2, b = 1 and c =-1, and x - 1 = 0, with a = 1, b = 0 and c =-1, are illustrated in Figure 3.1. A line can be uniquely represented by the coefficient vector l = a b c T . Using this representation, the lines in Figure 3.1 are given by l = 2 1 -1 T and l 0 = 1 0 -1 T . 24

Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

  • Upload
    lambao

  • View
    248

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

Chapter 3

Projective geometry

This chapter is devoted to the theory of planar geometry and the 2D projectiveplane, as well as projective transformations. The set of tools we obtain throughthis discussion will enable a natural and very convenient way of modelling theprocess of image formation with pinhole cameras.

3.1 Planar geometry and the 2D projective plane

We usually represent a point in the plane by a pair of coordinates x =[x1 x2

]T ,thus we often identify the plane with R2. In this section we introduce homoge-neous coordinates as a representation of points in a plane. This unifies the conceptof the intersection of two lines (even parallel lines will be shown to intersect ina well-defined point) and leads us straight into the projective plane, P2, with itswell-defined geometric computations.

3.1.1 Homogeneous representation of lines

A line in the plane is represented by an equation of the form

ax+ by+ c = 0, (3.1)

with different choices of a, b and c yielding different lines. For example, the lines2x + y − 1 = 0, with a = 2, b = 1 and c = −1, and x − 1 = 0, with a = 1, b = 0and c = −1, are illustrated in Figure 3.1.

A line can be uniquely represented by the coefficient vector l =[a b c

]T . Usingthis representation, the lines in Figure 3.1 are given by l =

[2 1 −1

]T and l ′ =[1 0 −1

]T .

24

Page 2: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

−1 −0.5 0 0.5 1 1.5 2−2

−1.5

−1

−0.5

0

0.5

1

y-a

xis

x-axis

x = 1

y = 1 − 2x

Figure 3.1: Two lines in the plane R2.

In this notation, the line represented by kl =[ka kb kc

]T , with k any nonzeroconstant, is the same as the line represented by l =

[a b c

]T , since x and ysatisfy (3.1) if and only if they satisfy kax + kby + kc = 0. For this reason weconsider the vectors

[a b c

]T and k[a b c

]T (k 6= 0) to be equivalent. Anequivalence class of vectors under this equivalence relationship is known as ahomogeneous vector, where any particular vector

[a b c

]T is a representative ofa whole class of equivalent vectors. The set of equivalence classes in R3 \ {03} (thevector space R3 with the zero vector 03 removed) forms the projective space P2.

3.1.2 Homogeneous representation of points

A point[x y

]T lies on the line l =[a b c

]T if and only if ax + by + c = 0,which can be written in terms of an inner product[

x y 1]l = 0. (3.2)

Here the point[x y

]T in R2 is represented by a 3-vector by adding a third coor-dinate of 1. Note that, for any nonzero constant k, we have[

kx ky k]l = 0 (3.3)

if and only if (3.2) holds. It is therefore natural to consider the vector[kx ky k

]T(with k 6= 0) equivalent to

[x y 1

]T .

We therefore have, similar to the case of lines, an equivalence class where thevector

[x y 1

]T represents the entire class. Here, an arbitrary homogeneous

vector[x1 x2 x3

]T represents the point[x1x3

x2x3

]Tin R2. Points, written as ho-

mogeneous vectors, are also elements of P2.

25

Page 3: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

Homogeneous vector representations of lines and points allow us to simply ex-press some previously clumsy concepts, as the following theorem illustrates (theproof is easy and left as an exercise).

Theorem 3.1.1. The intersection point of lines l =[a b c

]T and l ′ =[a ′ b ′ c ′

]Tis x = l× l ′, where × represents the vector cross product. The line joining two points xand x ′ is given by l = x× x ′.

As an example, suppose we wish to determine the intersection point of the linesx = 1 and y = x + 1. The line x = 1 is written as −x + 0y + 1 = 0, and thushas the homogeneous representation l =

[−1 0 1

]T , while the line y = x + 1is written as −x + y − 1 = 0, and thus has the homogeneous representation l ′ =[−1 1 −1

]T . Then, from Theorem 3.1.1, we calculate the intersection point as

x = l× l ′ =

∣∣∣∣∣∣i j k

−1 0 1−1 1 −1

∣∣∣∣∣∣ =−1−2−1

,

which is the homogeneous representation of the point[1 2

]T , consistent withthe intersection obtained in Figure 3.2(a).

Now suppose we want to determine the line joining points (0, 1) and (1, 0). Thehomogeneous representation of (0, 1) is x =

[0 1 1

]T , and of (1, 0) is x ′ =[1 0 1

]T . From Theorem 3.1.1 we calculate the homogeneous representationof the line joining the two points as

l = x× x ′ =

∣∣∣∣∣∣i j k

0 1 11 0 1

∣∣∣∣∣∣ = 1

1−1

.

The inhomogeneous representation of this line is then x + y − 1 = 0 or, equiva-lently, y = −x+ 1. Figure 3.2(b) illustrates.

−1 0 1 2−1

0

1

2

3

y-a

xis

x-axis

x = 1

y = x+ 1

−1 0 1 2−1

0

1

2

3

y-a

xis

x-axis

y = −x+ 1

(0,1)

(1,0)

Figure 3.2: (a) intersecting lines and (b) a line joining two points in the plane R2.

26

Page 4: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

3.1.3 Intersection of parallel lines

Consider two parallel lines ax+ by+ c = 0 and ax+ by+ c ′ = 0. These linesare represented by the vectors l =

[a b c

]T and l ′ =[a b c ′

]T . Althoughthese lines are parallel, we can compute their intersection x using Theorem 3.1.1:

x = l× l ′ =

bc ′ − bcac− ac ′

0

= (c ′ − c)

b−a0

=

b−a0

.

The last step follows from the fact that we are working in homogeneous coordi-nates. If we now try to find the inhomogeneous version of x, we would divideby zero to get

[b0 −a

0

]T , which makes no sense, unless to suggest that the pointof intersection has infinitely large coordinates. This observation agrees with theusual idea, that parallel lines intersect at infinity.

Consider for example the parallel lines x = 1 and x = 2, that is l =[−1 0 1

]Tand l ′ =

[−1 0 2

]T . The intersection point of these two lines is x = l × l ′ =[0 1 0

]T , which is the point at infinity in the direction of the y-axis.

In general, points with homogeneous coordinates[x y 0

]T do not correspondto any finite point in R2.

3.1.4 Ideal points and the line at infinity

The projective space P2 consists of all homogeneous vectors x =[x1 x2 x3

]T ,where x represents a finite point in R2 if x3 6= 0. If x3 = 0 we say x is an ideal point(or a point at infinity).

The set of all ideal points may be written as[x1 x2 0

]T . Note that this set lieson a single line l =

[0 0 1

]T , since

[x1 x2 0

] 001

= 0. (3.4)

We call this line the line at infinity and denote it by l∞ =[0 0 1

]T .

The line l =[a b c

]T intersects the line at infinity l at l × l∞ =[b −a 0

]T ,which is an ideal point. The line l ′ =

[a b c ′

]T , parallel to l, intersects l∞ at thesame point. In inhomogeneous coordinates, the vector

[b −a

]T is tangent to theline ax + by + c = 0, and orthogonal to the line’s normal, and so represents theline’s direction. If we were to vary the line’s direction, the ideal point

[b −a 0

]Twould also vary over l∞. Thus the line at infinity can be thought of as a set ofdirections of lines in the plane.

27

Page 5: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

3.1.5 A useful way to think of P2

A useful way of thinking of P2 is as a set of rays in R3; see Figure 3.3. The setof vectors k

[x1 x2 x3

]T (with k varying) forms a ray through the origin. Sucha ray can be thought of as representing a single point in P2. The correspondingpoint in R2 may be obtained by intersecting a particular ray with the plane x3 = 1,thus effectively scaling the ray so that its third component is 1.

x2

x1

x3

X

x

ideal point

Figure 3.3: A model of the projective plane.

3.2 Projective transformations

A projective transformation is an invertible map h from P2 to P2 such that straightlines are mapped to straight lines or, equivalently, such that three points u, v andw lie on a straight line if and only if the three points h(u), h(v) and h(w) lie on astraight line. It is also called a collineation, a projectivity or a homography.

Theorem 3.2.1. A mapping h : P2 → P2 is a projective transformation if and only ifthere exists a nonsingular, homogeneous 3 × 3 matrix H such that for any point in P2

represented by a vector x it is true that h(x) = Hx.

This theorem allows us to define a projective transformation in terms of matrixmultiplication. A projective transformation is a linear transformation on homo-geneous 3-vectors represented by a nonsingular, homogeneous 3× 3 matrix,x ′1x ′2

x ′3

=

h11 h12 h13

h21 h22 h23

h31 h32 h33

x1

x2

x3

, (3.5)

or more briefly, x ′ = Hx.

28

Page 6: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

Note that, since the vectors x and x ′ are homogeneous, the projective transfor-mation x ′ = kHx, for any nonzero k, is equivalent to x ′ = Hx, i.e. an arbitraryscale factor does not change the projective transformation. Consequently, H is ahomogeneous matrix since, as in the case of the homogeneous representation ofa point, any nonzero multiple of H is equivalent to H.

There are 8 independent elements in the homogeneous matrixH, and so it followsthat there are 8 degrees of freedom in a projective transformation.

3.2.1 Transformation of lines

By the definition of a projective transformation we know that if the n pointsx1, x2, . . . , xn lie on a line l, i.e. xTi l = 0, i = 1, . . . ,n, then the transformed pointsx ′1, x ′2, . . . , x ′n, where x ′i = Hxi, i = 1, . . . ,n, lie on a line, say l ′. We claim that theline l ′ is given by l ′ = H−T l. This claim is easily verified, since

(x ′i)T (l ′) = (Hxi)

T (H−T l) = xTi (HTH−T )l = xTi l = 0. (3.6)

3.2.2 The hierarchy of transformations

The most general form of a projective transformation is given in matrix form by

x ′ =

h11 h12 h13

h21 h22 h23

h31 h32 h33

x. (3.7)

In this section, we consider special cases of the projective transformation, start-ing with the most restricted case, an isometry, and ending with the most generalprojective transformation.

Isometric transformations

An isometric transformation (or isometry) of the plane R2 preserves Euclideandistance (iso = same, metric = measure), e.g. a rotation. The most general isometryis represented by the matrix equationx ′1x ′2

1

=

ε cos θ − sin θ txε sin θ cos θ ty

0 0 1

x1

x2

1

. (3.8)

where ε = ±1. If ε = 1, then the isometry is orientation-preserving and is a Eu-clidean transformation (a composition of a rotation and a translation). If ε = −1the isometry reverses orientation, for example, a composition of a reflection and

29

Page 7: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

a translation. We focus on Euclidean transformations, as they are predominant inapplications. We can write a Euclidean transformation in block form as

x ′ = HEx =

[R t

0T 1

]x, (3.9)

where R is a 2×2 rotation matrix (an orthogonal matrix, satisfying RTR = RRT = I,with determinant 1), t is a translation 2-vector and 0T =

[0 0

].

Degrees of freedom: a Euclidean transformation has 3 degrees of freedom: 1 forrotation and 2 for translation. Thus 3 parameters must be specified, and we cancompute the transformation from two point correspondences.

Invariants: length, angles, area, parallel lines.

Similarity transformations

A similarity transformation (or a similarity) is an isometry together with an iso-tropic scaling (isotropic means equal in all directions). In the case of a Euclideantransformation composed with an isotropic scaling, the form of the similarity isx ′1x ′2

1

=

s cos θ −s sin θ txs sin θ s cos θ ty

0 0 1

x1

x2

1

, (3.10)

where the scaling factor s is a scalar. In block form:

x ′ = HSx =

[s R t

0T 1

]x. (3.11)

Degrees of freedom: a similarity has 4 degrees of freedom (3 for the isometry plus 1for the scaling) and we can compute a similarity from two point correspondences.

Invariants: ratio of two lengths, angles, ratio of areas, parallel lines.

Affine transformations

An affine transformation (or an affinity) is a non-singular linear transformationfollowed by a translation. In matrix form:x ′1x ′2

1

=

a11 a12 txa21 a22 ty0 0 1

x1

x2

1

, (3.12)

or more compactly in block form, with A a nonsingular 2× 2 matrix:

x ′ = HAx =

[A t

0T 1

]x. (3.13)

30

Page 8: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

Using the singular value decomposition (SVD) of the matrix A, we can develop anunderstanding of the geometric effects of A as the composition of a scaling androtations. Suppose the SVD of A is A = UΣVT , where U and V are orthogonalmatrices and Σ = diag(σ1,σ2). We regroup this factorization as follows:

A = UΣVT = U(VTV

)ΣVT =

(UVT

)VΣVT , (3.14)

since V is an orthogonal matrix. With P = UVT we note that P is also orthogonal,so that multiplication with P is equivalent to a rotation. Suppose P represents arotation by φ and V a rotation by θ, then

A = PVΣVT = R(φ)R(−θ)ΣR(θ), (3.15)

where R(φ) and R(θ) represent rotations by φ and θ, respectively. The matrix Ais therefore a composition of a rotation (by θ); a non-isotropic scaling by σ1 andσ2 respectively in the x- and y-directions; a rotation (by −θ); and finally anotherrotation (by φ). The essence of an affinity is the scaling in orthogonal directions,oriented at a particular angle.

Degrees of freedom: the SVD argument above leads to the understanding that anaffinity has two more degrees of freedom when compared to a similarity, due tothe non-isotropic scaling at a particular angle, making the total degrees of free-dom for an affinity 6.

Invariants:

• ratio of areasArea is scaled by detA = σ1σ2, i.e. the ratio of areas is preserved.

• parallel linesTwo parallel lines meet at

[x1 x2 0

]T . An affinity maps this ideal point to

x ′ =

[A t

0T 1

]x1

x2

0

=

A [xy]

0

.

Since the last element of x ′ is zero, it is also an ideal point and the trans-formed lines are still parallel to each other.

Projective transformations

A projective transformation (or projectivity) as defined in (3.5) is a general non-singular linear transformation of homogeneous coordinates, and generalizes anaffinity even more. It is given in block form as

x ′ = HPx =

[A t

vT v

]x, (3.16)

where v is not necessarily zero and v not necessarily nonzero.

31

Page 9: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

Degrees of freedom: the matrixHP has nine elements, but since it is a homogeneousmatrix, any nonzero multiple of HP is equivalent to HP and we therefore onlyhave 8 degrees of freedom. We can compute the matrix HP from a four pointcorrespondence (with no three points being collinear).

Invariants: cross ratio of four points (ratio of ratios of lengths on a line).

Note that if a projective transformation preserves parallel lines, it is an affinity.To prove this, suppose a projective transformation is such that parallel lines aremapped to parallel lines, i.e.

[A t

vT v

] [x

0

]=

[Ax

vTx

]=

x ′1x ′20

. (3.17)

Then it must hold that vTx = 0 for all x, so that v must necessarily be equal tothe zero vector. Since the matrix must be non-singular, it must then also hold thatv 6= 0, so that the transformation matrix is of the form[

A t

0T c

](3.18)

for a nonzero constant c. The transformation is therefore an affinity.

3.2.3 Applying projective transformations to images

Since projective transformations map points in the 2D plane to points in the 2Dplane, they can be used to geometrically transform images in much the same wayas the mappings we’ve seen in section 1.7 of these notes. We would essentiallymap every pixel’s 2D location in a given image to a new 2D location, by multiply-ing a homogeneous representation of the input (x,y)-coordinate with the givenprojective transformation matrix, to create a new image.

Of course, in practice we would first initialize the output image, loop through itspixels, apply the inverse transformation

x = H−1x ′, (3.19)

convert x to (x,y) coordinates in the input image through division of the thirdelement of x, and perform interpolation over the pixels surrounding (x,y).

A few examples of an image transformed in this way are shown in Figure 3.4.See if you can convince yourself of the invariants of the various transformations,as listed in the previous section. For example, do straight lines remain straightunder all of these transformations; are angles and lengths preserved in the caseof the isometry; do parallel lines remain parallel under the affinity; etc.

32

Page 10: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

input image

isometrysimilarity

affinityprojectivity

Figure 3.4: Different types of projective transformations on an input image.

3.3 Removing perspective distortion from a plane

Consider the central projection in Figure 3.5. Projection along rays through a com-mon point (the centre of the projection) defines a mapping from one plane toanother, say the world plane to the image plane. It maps lines to lines, and sois a projective transformation. If a coordinate system is defined in each of theplanes, say world coordinates and image coordinates, and points are representedin homogeneous coordinates then the mapping may be expressed as

x ′ = Hx, (3.20)

where H is a non-singular 3× 3 matrix. This transformation is called a perspectivetransformation (or plane-to-plane homography).

Shape is distorted under such a perspective transformation but, since the imageplane is related to the world plane via a projective transformation, we can undothis distortion. This is done by computing the inverse projective transformationand applying it to the image, resulting in an image where the objects have theircorrect geometric shape.

33

Page 11: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

x2

x1

x3

x′

x′y′

x

xy

image plane

world plane

Figure 3.5: Transforming from a world plane to the image plane.

In order to compute this inverse transformation, we choose local inhomogeneouscoordinates x = (x,y) and x ′ = (x ′,y ′) known to correspond, both measureddirectly from the world and the image plane respectively. Then the projectivetransformation x ′1x ′2

x ′3

=

h11 h12 h13

h21 h22 h23

h31 h32 h33

xy1

(3.21)

can be written in inhomogeneous form as

x ′ =x ′1x ′3

=h11x+ h12y+ h13

h31x+ h32y+ h33, y ′ =

x ′2x ′3

=h21x+ h22y+ h23

h31x+ h32y+ h33. (3.22)

Each point correspondence leads to two linear equations (linear in the unknowncoefficients hij) of the form

x ′ (h31x+ h32y+ h33) = h11x+ h12y+ h13

y ′ (h31x+ h32y+ h33) = h21x+ h22y+ h23

or equivalently,

[x y 1 0 0 0 −x ′x −x ′y −x ′

0 0 0 x y 1 −y ′x −y ′y −y ′

]h11

h12...h33

=

[00

]. (3.23)

Since H has eight degrees of freedom and each point correspondence results intwo linear equations, we need four point correspondences of the form x ↔ x ′ tosolve for H. Of course, if one has more than four point correspondences it is evenbetter. The resulting overdetermined system for the null space can then be solvedin a least-squares sense. Since measurement errors corrupt the system, the rankof the coefficient matrix will now be 9, but with a small 9th singular value. The9th singular vector is therefore used as an approximation for the null space.

34

Page 12: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

From four point correspondences we get the system of equations Ah = 0, whereA is an 8× 9 matrix of the form

A =

x1 y1 1 0 0 0 −x ′1x1 −x ′1y1 −x ′10 0 0 x1 y1 1 −y ′

1x1 −y ′1y1 −y ′

1x2 y2 1 0 0 0 −x ′2x2 −x ′2y2 −x ′20 0 0 x2 y2 1 −y ′

2x2 −y ′2y2 −y ′

2x3 y3 1 0 0 0 −x ′3x3 −x ′3y3 −x ′30 0 0 x3 y3 1 −y ′

3x3 −y ′3y3 −y ′

3x4 y4 1 0 0 0 −x ′4x4 −x ′4y4 −x ′40 0 0 x4 y4 1 −y ′

4x4 −y ′4y4 −y ′

4

, (3.24)

and h =[h11 h12 · · · h33

]T . Choosing points so that A has full rank, i.e A is ofrank 8, implies that no three points can be collinear. The vector h is a vector in thenull space of the matrix A, or any nonzero multiple of it. One way of obtaining his to compute the SVD of the matrix A, i.e. A = UΣVT . Then the last column of Vwill be a basis for the null space of A, so that we can choose h as the last columnof V .

Applying this to a perspective distorted image, we can correct the distortion.For example in Figure 3.6(a) we recognise that the four corners of the windoware the corners of a rectangle in world coordinates. We then choose the pointsxi = (xi,yi), i = 1, . . . , 4, as the four corners of the window and map them to thefour corners of a rectangle to get the projective transformation H. Once we haveH, we apply its inverse to the entire distorted image (following the procedurein section 3.2.3) to obtain the rectified image shown in Figure 3.6(b). A secondexample is shown in Figure 3.6(c) and (d).

(a) distorted image

(b) corrected image(c) distorted image (d) corrected image

Figure 3.6: Removing perspective distortion with plane-to-plane homographies.

35

Page 13: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

Note that the computation of the matrixH does not require any knowledge of thecamera’s parameters (such as the focal length), or the orientation of the plane.

3.4 Recovering affine properties of images

In the previous section we corrected a perspectively distorted image up to a sim-ilarity. Suppose now that we are given less information and asked to correct theimage up to an affinity (such that parallel lines are restored).

We may accomplish this task by identifying the image of the line at infinity (whereparallel lines meet), and mapping it to infinity.

3.4.1 Affinities and the line at infinity

Under a projective transformation ideal points may be mapped to finite points,since [

A t

vT v

]x1

x2

0

=

[Ay

vTy

], (3.25)

where y =[x1 x2

]T . If vTy 6= 0, this point is finite. Consequently, a projective

transformation may map the line at infinity l∞ =[0 0 1

]T to a finite line. Wehave already witnessed this phenomenon: parallel lines in the distorted imagesin Figure 3.6 intersect at finite points.

However, if the transformation is an affinity, say

HA =

[A t

0T 1

], (3.26)

then l∞ is mapped to l∞, and not a finite line. To prove this, we use the fact thatif the line l is mapped to l ′ under the transformation H, then the line l ′ is givenby H−T l (refer to section 3.2.1). Then

l ′ = H−TA l∞ =

[A−T 0

−tTA−T 1

]001

=

001

= l∞. (3.27)

The converse is also true, i.e. an affine transformation is the most general lineartransformation that maps l∞ to l∞. This can be justified as follows. If an idealpoint, say x =

[1 0 0

]T , is mapped to another ideal point, then the first elementof v must be zero. Similarly, the second element of v must be zero. Therefore thetransformation is an affinity.

36

Page 14: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

Note that the line l∞ is not fixed point-wise under an affinity. For example, theaffinity

HA =

1 2 −12

−1 12 1

0 0 1

,

maps the ideal point[1 1 0

]T to another ideal point, namely 1 2 −12

−1 12 1

0 0 1

110

=

3120

.

We will use this property of affinities to recover affine properties by identifyingthe line at infinity l∞.

3.4.2 Using the line at infinity to recover affine properties

Once the image of the line at infinity has been identified, say l =[`1 `2 `3

]T , it ispossible to construct a projectivity that will project it back to l∞. Since an affinitymaps l∞ to itself, this transformation is only defined up to an affinity.

It is straightforward to verify that, if `3 6= 0, the projective map

H =

1 0 00 1 0`1 `2 `3

(3.28)

maps l to l∞, since

H−T l =

1 0 −`1`3

0 1 −`2`3

0 0 1`3

`1`2`3

=

001

. (3.29)

This prescription does not work if `3 = 0. We leave it as an exercise to verify thatif `3 = 0 and `1 6= 0 we may choose

H =

0 1 −10 0 1`1 `2 0

, (3.30)

or if `3 = 0 and `1 = 0 (implying that `2 6= 0),

H =

0 0 11 0 −10 `2 0

. (3.31)

Once a mappingH is specified, we may transform the image accordingly (follow-ing the procedure discussed in section 3.2.3).

37

Page 15: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

It remains to identify the image of the line at infinity. One way to do this isto identify lines that were parallel on the original (world) plane. Their point ofintersection provides an image of a point on l∞. If we can find a second suchpoint, then the image of l∞ is the line through these two points. Let’s illustratewith an example.

For the image in Figure 3.7(a), we notice that the frame of the window should berectangular, so that the top and bottom of the window frame should be paralleland the two sides should be parallel. We identify the four corners of the windowframe, and then use them to calculate the lines that run with the sides of theframe, labelled l and l ′ in Figure 3.7(b). We know that these lines are the imagesof parallel lines, so that their intersection point, labelled x in Figure 3.7(c), is theimage of an ideal point. Similarly, we calculate the intersection point of the twolines running with the top and bottom of the window frame, to get x ′. Now thatwe have two points, that are each the image of an ideal point, we can calculatethe imaged line at infinity as l ′∞ = x × x ′. We construct the matrix H that mapsthis imaged line at infinity to the canonical form of the line at infinity, i.e. l∞ =[0 0 1

]T , and apply the transformation H to the entire image to get the imagein Figure 3.7(d), where the sides of the window frame are parallel.

(a) distorted image (b) imaged parallel lines identified

l l′

(c) intersection points of parallel linesand imaged l ′∞ identified

(d) image corrected up to an affinity:parallel lines are parallel

x

x′

l ′∞

−→

image

Figure 3.7: Recovering affine properties from a distorted image using l∞.

38

Page 16: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

3.5 Cross ratios and vanishing points

Let us now consider the projective geometry of a line, P1, which proceeds muchthe same as that of a plane. A point x on a line is represented by homogeneouscoordinates

[x1 x2

]T , and a point for which x2 = 0 is an ideal point of the line. Aprojective transformation of a line is represented by a non-singular 2 × 2 homo-geneous matrix H2, so that x ′ = H2x, and has three degrees of freedom.

The cross ratio is the basic projective invariant of P1. Given four points on a line,say a, b, c and d, then the cross ratio is defined as

Cross(a,b, c,d) =|ab| |c d|

|a c| |bd|, (3.32)

where

|ab| = det[a1 b1

a2 b2

], (3.33)

and similarly for the other points.

Cross ratios have the following important properties:

• The value of the cross ratio does not depend on which homogeneous repre-sentative of a point is used, since the scale cancels between the numeratorand denominator.

• The definition of the cross ratio is still valid if one of the points is an idealpoint.

• The value of the cross ratio is invariant under any projective transformationof the line (see Figure 3.8) since if x ′ = Hx, then

Cross(a ′,b ′, c ′,d ′) =|a ′ b ′| |c ′ d ′|

|a ′ c ′| |b ′ d ′|

=|(λ1Ha) (λ2Hb)| |(λ3Hc) (λ4Hd)|

|(λ1Ha) (λ3Hc)| |(λ2Hb) (λ4Hd)|

=(λ1λ2 |H| |ab|) (λ3λ4 |H| |c d|)

(λ1λ3 |H| |a c|) (λ2λ4 |H| |bd|)

=|ab| |c d|

|a c| |bd|

= Cross(a,b, c,d).

Suppose a, b and c are collinear points in the world reference frame, i.e. they fallon a line in R3, and suppose further that the ratio of the two intervals definedby these three points is known. If the images of these points, a ′, b ′ and c ′ canbe identified, the projective map between the two lines can be calculated. Usingthis map, the point at infinity on the line is mapped to its image. More specif-ically, if the length ratio is given by d(a,b)

d(b,c) = mn

(where d(a,b) is the Euclidean

39

Page 17: Chapter 3 Projective geometry - Applied mathematicsappliedmaths.sun.ac.za/TW792/chapter3.pdfChapter 3 Projective geometry This chapter is devoted to the theory of planar geometry and

a

b

cd

a′

b′

c′

d′

Figure 3.8: Invariance of the cross ratio under a projective transformation.

distance between a and b), one calculates the image of the point at infinity usingthe following procedure.

1. Measure the distance ratio in the image, d(a ′,b ′)d(b ′,c ′)

= m ′

n ′ .

2. Represent the points a, b and c as 0, m and m + n in a coordinate frameon the line going through a, b and c. These points may be represented byhomogeneous 2-vectors

[0 1

]T ,[m 1

]T and[m+ n 1

]T . Similarly, a ′, b ′

and c ′ can be represented by the homogeneous 2-vectors[0 1

]T ,[m ′ 1

]Tand

[m ′ + n ′ 1

]T .

3. Relative to these coordinate frames, compute the 1D projective transforma-tion H2 that maps a to a ′, b to b ′, and c to c ′.

4. Calculate the image of the ideal point[1 0

]T under H2. It is the image ofthe vanishing point on the line through a ′, b ′ and c ′.

How would you find the image of a point at infinity using the cross ratio, as-suming you know the world coordinates of three collinear points, as well as theirimages, as above?

40