Introduction Homogeneous coordinates are an augmented representation of points and lines in R n spaces, embedding them in R n+1, hence using n + 1 parameters. This representation is useful in dealing with perspective and projective transformation (computer graphics, etc.) and for rigid displacement representation. We start introducing the concept on 2D spaces. p 2 T its homoge- Given a point p in R 2, represented as P = (p 1, p 2 ), i.e., the vector p = p 1 neous representation (using homogeneous coordinates) is p = p 1 p 2 p 3 T ; with T not allowed The vector representation is obtained dividing the first n homogeneous components by the (n + 1)- th, that is often called scale. p 1 = p 1 / p 3 ; p 2 = p 2 / p 3 A geometric interpretation of the homogeneous coordinates is given in the following Figure. Figure 1: Geometric interpretation of homogeneous coordinates. We embed the plane π : z = 1 in a 3D space and we consider the planar coordinates as the intersection of a projection line that goes through the origin of the RF {i,j,k}. As z goes to we can represent the origin, while as z goes to, we can represents points at infinity, along a well defined direction. The set of all points at infinity represents the line at infinity. Figure 2: Points at. The same approach is valid for 3D homogeneous coordinates: given a point p in R 3, represented as P = (p 1, p 2, p 3 ), or else by a vector p = p 1 p 2 p 3 T
its homogeneous representation is p = p 1 p 2 p 3 p 4 T Hence p 1 = p 1 / p 4 ; p 2 = p 2 / p 4 ; p 3 = p 3 / p 4 In robotics it is common to set p 4 = 1. We will adhere to this convention. Some author treats differently the homogeneous representation of a point (geometric vector v p ) by that of an oriented segment (physical vector v ab ). In the first case while in the second case ṽ ab = ṽ p = vp 1 vb va = 1 1 vab Not all textbooks adhere to this convention, since in this case the sum of two geometric vectors produces v ṽ p + ṽ q = p v + q v = p + v q 1 1 2 This sum, once transformed back in 3D space, becomes not the usual parallelogram sum of segments, but the midpoint of the parallelogram (see also Affine Spaces). Figure 3: Homogeneous sum of two geometric vectors. Affine spaces Briefly, affine spaces are spaces where the origin is not considered to be a special point, and homogeneous coordinates are used to characterize the affine elements (points and planes). Rigid displacements and homogeneous coordinates Using homogeneous representation, the generic displacement (R, t) is given by the following homogeneous transformation matrix R t H H (R,t) = T 1 since v R t Hṽ = = Rv + t T 1 1 2
Figure 4: Linear and affine subspaces. Hence, the SE(3) group transformation g = (R, t) SE(3), is represented by the 4 4 homogeneous matrix H through the use of homogeneous coordinates: p a = g ab p b p a = H ab (R ab,t ab ) p b Transformation composition g ab g bc is obtained by the homogeneous matrix product H ab (R ab,t ab )H bc (R bc,t bc ) i.e., Rab t ab Rbc t bc Rab R bc R ab t bc + t ab = T 1 T 1 T 1 Often it is convenient to write the time derivative of a homogeneous vector as p = ṗ 1 ṗ2 This notation will prove useful when dealing with twists. ṗ3 Introduction to projective/perspective geometry n. Homogeneous coordinates p are used for describing point in projective spaces P n of dimension Two points ã and b are equal (ã b) if there exist a real λ such that ã = λ b b λ b collinear points are equal this also means that vectors are equal up to a scale factor. We say that ã and b belong to the same line, i.e., to the same affine subspace of R n+1. Consider the planar (2D) projection through a pinhole camera of a 3D point P,p = x y z T. The ray of light intercepts the image plane in the 2D image point P i, whose homogeneous coordinates on the image plane are where f is the focal distance p i = x y f p i = T x/f = 1 T x y/f f y 3
Figure 5: Example of projection through a pinhole camera. Considering the similar triangles in Figure, we have: x f = X Z ; y f = Y Z If we set λ = Z/f, where f is known and the distance Z from π of the point p is unknown, we have X = λx, Y = λy, Z = λf Hence, if we compute the cartesian coordinates of p i on π from homogeneous coordinates, we have fx x x x/f p i = p y/f i = fy λ y y Z 1 f and every 3D point with homogeneous coordinates λx y f T is projected onto the same point p i of the image plane π. Notice that the above transformation is a nonlinear one. The nonlinear mapping R 3 R 2 can be expressed as a (linear) matrix transformation between the homogeneous spaces R 4 R 3 as X fx x f Y p fy λ y = f Z λ p i = P 1 Z 1 1 }{{} 1 P Nonsingular (i.e., invertible) mappings between projective spaces are described by products of full rank square matrices T by homogeneous coordinates, p a = T ab p b An invertible mapping from P n onto itself preserves collinearities, i.e., if two points belong to a line, also the transformed points will belong to a line. Affine transformations preserve not only collinearities, but also parallelism between lines and ratios of distances. Similarity transformations preserves also angles, but not scales, while Euclidean (rigid) transformations preserve also scales 4
Figure 6: Examples of different mappings. Hyperplanes A hyperplane in R n is defined by the equation between a set of points p i and a set of (real) coefficients l i l 1 p 1 + l 2 p 2 + + l n p n + l n+1 = Using the homogeneous coordinates we obtain an homogeneous linear equation in P n where l = l 1. l n l n+1 lt p = ; p = p 1. p n1 The two homogeneous vectors can exchange their roles; we say that they are dual. Remember that, given a vector p V(F), the set of all linear transformations f(p) : V R 1 form another vector space V, and f V are called dual vectors or 1 forms. For example, the total time derivative of a scalar function f(p) on R 3 is df(p(t)) dt = p φ(p)ṗ(t) is a dual vector wrt ṗ. Another dual vector is the divergence p = p 1 p n T p 1. p n 5
or the Laplacian (gradient of the divergence) 2 f = f = p 1 f T p 1 p n. f p n Duality in projective spaces The space of all hyperplanes in R n defines another perspective space, called the dual of the original P n Duality principle: for all projective results established using points and planes, a symmetrical result holds interchanging the role of planes and points. Example: two points define a line two lines define a point Notice that the projective plane P 2 whose point are defined by homogeneous coordinates, has more point that the usual R 2 plane, since it includes also points at. A collineation given by a full rank matrix T transforms points as A hyperplane l T b p b = is transformed as p a = T ab p b lt b p b = l T a p a = hence yielding lt a T ab p b l T b = l T a T ab la = T ab T lt b Matrix T ab T is called the dual of T ab Comparing this last equation with the first one, we conclude that points and lines can be transformed, but using different (dual) collineation matrices T ab and T ab T. Points and lines We restrict our analysis on the 2D projective space P 2 ; for the sake of clarity, we drop the sign on top of the homogeneous vectors, i.e., ã is now indicated as a. A line l = l 1 l 2 l 3 can be characterized by three parameters: 1. the slope l 1 /l 2 2. the x-intercept l 3 /l 1 3. the y-intercept l 3 /l 2 Points p and lines l are related by l T p = in the sense that a point is on a line or a line include a point iff the previous relation holds. Duality 6
A line l passing for two points p 1 and p 2 is defined as l = p 1 p 2 = S(p 1 )p 2 A point p belonging to two lines (intercept) l 1 and l 2 is defined as p = l 1 l 2 = S(l 1 )l 2 Points at infinity or ideal points have the following representation p = p 1 p 2 T All ideal points lie on the ideal line, represented by l = 1 T Three points p 1,p 2,p 3 lie on the same line (they are collinear) iff det p 1 p 2 p 3 = Since the duality principle holds, three lines l 1, l 2, l 3 meet at the same point (they are concurrent) iff detl 1 l 2 l 3 = Parallelism Two lines m = m1 m 2 m 3 ; n = are parallel when the intersection point is at infinity, i.e., p = m n = p1 p 2 n1 This reduces to the conditions m 1 = n 1 m1 n or det 1 = m 2 n 2 m 2 n 2 p1 The direction k points toward the point at infinity. p 2 n 2 n 3 Summary point p = p 1 p 2 p 3 T line l = l 1 l 2 l 3 T incidence p T l = incidence l T p = line l = p 1 p 2 point p = l 1 l 2 collinearity detp 1 p 2 p 3 = collinearity detl 1 l 2 l 3 = point p 1 p 2 T line l 3 T 7
Transformations in P 2 The generic projective transformation (also called homographies) in P 2 is represented by a non singular 3 3 matrix (acting on homogeneous vectors), whose elements are t11 t 12 t 13 T = t 21 t 22 t 23 t 31 t 32 t 33 Since the transformations are equivalent up to a scale factor, the number of dof in T is 8. According to structural constraint, we have a hierarchy of transformations, from the most general to the least one; in particular Transformations in P 2 (most general) projective affine similarity Euclidean (rigid) The affine transformation must preserve the ideal line and the ideal points (as well as parallelism); hence, for any arbitrary scaling factor λ λ p1 p 2 = T p1 p 2 that implies T = t11 t 12 t 13 t 21 t 22 t 23 t 33 dof=6 The similarity transformation must preserve angles and ratios of lengths; that implies cosθ sinθ t13 T = sin θ cosθ t 23 dof=3 t 33 with t 33 1. The effects of the last column in T is to produce a shear i.e., a scale variation that is non uniform in all directions. The Euclidean (rigid) transformation must preserve also lengths; that implies cosθ sinθ t13 T = sin θ cosθ t 23 dof=3 1 Historical notes Homogeneous coordinates were introduced in 1827 by Möbius in the context of barycentric coordinates. Given a triangle, the barycentric coordinates of a point P are the weights required at the triangle vertices such that P become the center of gravity of the triangle. The point is computed as p = w a x w b y w c z T, with w a + w b + w c = 1 From homogeneous coordinates to quaternions There exist a link between homogeneous coordinates and quaternions that goes through the Möbius transformation. Given two complex numbers x = x 1 + jx 2, y = y 1 + jy 2 C, the ordered pair of complex numbers z = x y T C 2, z T 8
Figure 7: Example of barycentric coordinates. are the homogeneous coordinates of z = z 1 + jz 2 z = x y = z 1 + jz 2 = x 1 + jx 2 y 1 + jy 2 To every pair of complex numbers (x, y) a unique complex numbers z corresponds, while for every complex number z there is an infinite number of complex pairs (projective transformation). Transformation between homogeneous representations x u u a b x z = w = where = = y v v c d y where a, b, c, d are complex numbers. We can compute the transformed complex number as ax + by cx + dy w = u v ax + by = cx + dy = a x y + b c x y + d = az + b cz + d This is nothing else that the Möbius transformation. Möbius transformation w = az + b cz + d ; a, b, c, d, w, z C If we take a particular form of the Möbius transformation, due to Gauss: w = az + b b z + a we know that every rotation of the sphere can be expressed by a complex function as the one above, and we notice that it can be represented by the matrix of its coefficients a b α + jβ γ + jδ b a = γ + jβ α jβ 1 j 1 j = α + β + γ + δ 1 j 1 j = α1 + βi + γj + δk = a quaternion For further details see: T. Needham, Visual Complex Analysis, OUP, 1997. 9