omogeneous coordinates in the plane Homogeneous coordinates in the plane A line in the plane a + by + c is represented as (a, b, c). A line is a subset of points in the plane. All vectors (ka, kb, kc) k(a, b, c), k represent the same line as (a, b, c). Two vectors k (a, b, c) and k (a, b, c), k, k are said to be equivalent. The equivalence class k(a, b, c), k is called homogeneous vectors. The vector (,, ) does not represent any line. The set of homogeneous vectors R (,, ) forms the projective space P. A point (, y) is on the line l (a, b, c) iff a + by + c. The line equation may be written as (, y, )(a, b, c) (, y, )l, where the vector (, y, ) corresponds to the D Cartesian point (, y). If (, y, )l and k then k(, y, )l. Any vector (k, ky, k), k is a homogeneous representation of the D point (, y). An arbitrary homogeneous vector (,, ),, represents the point ( /, / ) in R. A homogeneous vector has degrees of freedom, it is represented by elements but has arbitrary scale. Lines and points A point is on a line l iff l. A line l intersects a point iff l. An intersection point between two lines l and l satisfies l and l, i.e. is orthogonal to l and l. E. The lines l (,, ) and l (,, ) T have intersection (,, ) T since T l and T l. Similarly, a line l through two points and satisfies l T and l T. E. The points (,, ) T and (,, ) T are intersected by the line l (,, ) T, + y since l T and l T. D homographies p. Lines and points Let L l l. The null-space N of L is defined as N(L ) { : L }. For l,l R this is satisfied by e.g. v l l, where the cross product is defined as where a b i j k a a a b b b a a b a b a b a b a b a b a a a a a a. a b, D homograp Similarly, a line through the points and may be calculated as l. D homographies p. D homograp
The intersection of parallel lines The line at infinity Two parallel lines l (a, b, c) and l (a, b, c ) intersect each other at the point l l (c c)(b, a, ). The point (b, a, ) does not have a finite representation since (b/, a/) is not defined. This corresponds to the interpretation that parallel lines have no intersection in the Euclidean plane. However, if we study with Cartesian representation lim(b, a, k) k lim (b/k, k a/k), Homogeneous vectors (,, ) with correspond to finite points in the real space R or the set of intersections between non-parallel lines. If we etend R with points having (but (, ) (, ) ) we get the projective space P. Points with are called ideal point or points at infinity. All ideal points (,, ) are on the line at infinity l (,, ), since (,, )(,, ). In the projective plane P two distinct lines have eactly one intersection point, independently of if they are parallel or not. The geometry of P n is called projective geometry. we may interpret the vector (b, a, ) as being infinitely far away in the direction of (b, a). D homographies p. D homograp nterpretation of the projective plane Duality A useful interpretation of P is as a set of rays in R. A homogeneous vector k(,, ), k corresponds to a ray though the origin. The inhomogeneous representation is given from its intersection with the plane. ideal point O l π Since l l, the meaning of lines and points are interchangeable. Thus, for any relation in P there is a dual relation where the meaning of lines and points are interchanged. The equation l may be interpreted as that the point is on the line l, but also that the point l is on the line. The equations l l may be interpreted as that the point is on the lines l and l, but also that the line intersects the points l and l. Rays for ideal points lie within the plane and have no (Euclidean) intersection with the plane. D homographies p. D homograp
Conics The conic equation A conic (section) is a second order curve in the plane. In Euclidean space there are three types of conics: ellipses, parabolas, and hyperbolas. Degenerate conics consist of a point or one or two lines. The equation for a conic in Euclidean coordinates is a + by + cy + d + ey + f. In homogeneous coordinate /, y / it becomes a + b + c + d + e + f or in matri form where C C, a b/ d/ b/ c e/ d/ e/ f. A conic has degrees of freedom since it defined by parameters but has arbitrary scale. D homographies p. 9 D homograph Five points define a conic Five points define a conic Every point on a conic gives one equation for the coefficients since any point ( i, y i, z i ) intersected by the conic has to satisfy This may be written as a i + b iy i + cy i + d iz i + ey i z i + fz i. h i i y i y i i z i y i z i z i where c (a, b, c, d, e, f) is the conic C as a -vector. With points we get y y z y z z y y z y z z y y z y z z y y z y z z y y z y z z i c, c Xc, Given the points (,, ), (,,), (,,), (,, ), (,,) we get X 8 with null-vector c or y. and conic C where c is obtained as a null-vector to the matri X. D homographies p. D homograph
Conic tangents Dual conics The tangent l to a conic C in a point on C is given by l C. Eample: The conic (/) + (y/) or 9 C intersects the points (,, ) and (,,). The tangents are The equation C defines a subset of points in P. The conic C is called a point conic. There is a corresponding second order epression for lines. A line conic (dual conic) is denoted C, where C is the adjoint matri to C and the equation l C l define the subset of all lines in P that are tangent to the point conic C. l C (/,, ) or, and l C (,/, ) or y. D homographies p. C l C l D homograph Dual conics Projective transformations If C is symmetric with full rank then C C up to scale. This means that all points on C have unique tangents l C and all tangents l have unique tangency points C l. In this case the the point conic C corresponds to the line conic C since C (C l) C(C l) l C l. Should the matri C be rank deficient the conic is degenerate. Degenerate point conics include two lines (rank ) and one line (rank ). E. the point conic C lm + ml consists of the lines l and m. The null-vector l m on both lines l and m does not have a unique tangent. Degenerate line conics include two points (rank ) and one point (rank ). E. The line conic C y + y has rank and consists of all lines intersecting and/or y. All lines have unique tangency points ecept l y. Definition: A projectivity (or projective transformation or homography) is an invertible mapping h from P onto itself such that three points,, and are collinear iff h( ), h( ), and h( ) also are collinear. Thus: Lines are mapped onto lines. O / y / / π / All projective transformations of homogeneous points may be written as h() H, where H is a non-singular -matri. The matri H has 8 degrees of freedom (9 elements, arbitrary scale). y π D homographies p. D homograph
Rectification of plane perspective Rectification of plane perspective If the coordinates for points i and their mappings i in the image are known, we may calculate the homography H. Each point pair (, y) and (,y ) has to satisfy Given H we may apply H to remove the effect of the perspective transformation. h + h y + h h + h y + h y h + h y + h h + h y + h or (h + h y + h ) h + h y + h y (h + h y + h ) h + h y + h. The latter equations are linear in h ij. Given points we get 8 equations, enough to uniquely determine H assuming the points are in standard position, i.e. no points are collinear. D homographies p. D homograph normhomo.m and linespt.m drawhomoline.m function Xhomonorm(X) %HOMONORM Normalize homogenous points. % %Xhomonorm(X); % v. --9. Niclas Borlin, niclas@cs.umu.se. m,nsize(x); XX./X(m*ones(,n),:); function linespt(l,l) %LINESPT Find homogenous intersection of two homogenous lines. % %linespt(l,l) %l,l - lines in homogenous coordinates. % - intersection in homogenous coordinates. % v. --9. Niclas Borlin, niclas@cs.umu.se. null(l,l ); function hdrawhomoline(l,varargin) %DRAWHOMOLINE Draw homogenous line. % %hdrawhomoline(l,line attributes) %L - matri with homogenous lines in % each column. %h - graphic handles. % v. --. Niclas Borlin, % niclas@cs.umu.se. % Get aes scaling. aais; lima(:); ylima(:); % Construct lines for each side of % the ais. al,,,;,,,; -lim,-ylim; % Preallocate handle vector for lines. hzeros(size(l,),); for i:size(l,) ll(:,i); % Determine if line is more vertical or % horizontal. if (abs(l())<abs(l())) % More horizontal. Calculate intersection to % left/right sides. normhomo(linespt(l,al(:,))); normhomo(linespt(l,al(:,))); else % More vertical. Calculate intersection to % upper/lower sides. normhomo(linespt(l,al(:,))); normhomo(linespt(l,al(:,))); end h(i)line((),(),(),(),varargin{:} end D homographies p. 9 D homograph
nsformation of points, lines, and conics Transformations of points, lines, and con Consider a point homography H. If and are on the line l then the points and will also be on a line l H l since l i (H l) i l H H i l i. Under the same point mapping H a conic C is mapped to C H CH since C ( H ) CH } H {{ CH }. C A line conic C is mapped to C HC H since l C l (H l ) C (H l ) l HC }{{ H } l. C, l, C H, l H l, C H CH D homographies p. D homograph Line conics and angles Line conics and angles Line conics are needed to describe angles between lines in projective geometry. In Euclidean geometry, angles between lines are calculated from the inner product between their normals, e.g. if l (l, l, l ) and m (m, m, m ) with normals (l, l ) and (m,m ), then the angle θ between the lines is calculated from cosθ l m + l m p (l + l )(m + m ). The epression l C m is invariant under a homography H since l H l and C HC H means that l C m (H l) HC H H m l H HC H H m l C m. Thus, if we know the projection C of C in an image, we can determine if two lines l and m in the image are orthogonal by calculating l C m. The corresponding well-defined epression in projective geometry is cos θ l C m p (l C l)(m C m), where C. Especially we have that l and m are orthogonal if l C m. D homographies p. D homograph
A transformation hierarchy for P Class I: Isometry Homographies may be divided into different subgroups with different level of generality. The four subgroups we will talk about are the following, in order of increasing level of generality Isometry. Similarity. Affinity. Projectivity. An isometry is a transformation of the plane R that preserves the Euclidean distance. y, ɛ cos θ sin θ t ɛ sin θ cos θ t y where ɛ ±. If ɛ +, the transformation is called orientation preserving and is a Euclidean transformation composed by a rotation and a translation. If ɛ, the transformation contains a mirroring. An isometry may be written as H E R t, y where R is an orthogonal matri and t is a -vector. An isometry has degrees of freedom; rotation () and translation (). Invariants: lengths, angles, areas, etc. D homographies p. D homograph Class II: Similarity A similarity is an isometry plus isotropic scaling. For orientation-preserving isometries, the similarity has the matri form y, or s cosθ s sinθ t s sinθ s cosθ t y H S sr t where the scalar s represents the scaling. A similarity has degrees of freedom; rotation (), translation () and scaling (). Invariants: angles, parallelity, length ratios, area ratios, shape. A similarity is also called a metric transformation., y Class III: Affinity An affine transformation (affinity) is a non-singular transformation followed by a translation and is represented by or y H A a a t a a t y A t where A is a non-singular matri., y, An affinity has degrees of freedom; the elements of A and t. Invariants: parallelity, length ration for parallel lines, area ratios. D homographies p. D homograph
erpretation of an affine transformation Class IV: Projectivity If we factor the transformation matri A into A R(θ)R( φ)dr(φ), where R(θ) and R(φ) are rotation matrices and D is a diagonal matri D λ λ then the transformation A may be interpreted as a sequence of rotations and (anisotropic) scaling. θ φ, Thus the two etra degrees of freedom may be interpreted as the scaling λ /λ and the anisotropy angle φ. This kind of factorization is always possible from the singular value decomposition (SVD) A UDV (UV )(VDV ) R(θ)(R( φ)dr(φ)). A projective transformation (projectivity) is a general linear mapping of homogeneous coordinates and is written H P A t v v, where v (v, v ) and v is a scalar. A projectivity has 8 degrees of freedom; 9 elements in H P and arbitrary scale. Invariants: Cross ratios of line lengths. The most important different between a projectivity and an affinity is the vector v and its effect on the mapping of ideal points. Study the mapping of an ideal point (,, ) : A t v v A v + For an affinity, v and all ideal points are mapped to ideal points. For a projectivity with v, some ideal points are mapped to finite points. rotation deformation D homographies p. 9 D homograph he effect of different transformations Decomposition of a projective transforma Similarity Affinity Projectivity A projective transformation may be decomposed into a sequence of transformations on different levels in the hierarchy: H H S H A H P sr t K I v v A vt v v, where A srk + tv is a non-singular matri and K is an upper triangular matri with K. The decomposition is valid if v and unique if s is chosen to be positive. Since H H P H A H S and H P, H A, H P are projective, affine, and similar, respectively, it is possible to decompose the transformation in the opposite direction, i.e. there eists also a factorization such that H H P H A H S I v v with different values for K, R, t and v. K sr t D homographies p. D homograph
Reconstruction of affine properties Affine rectification An affine transformation maps the line at infinity onto itself since l H A l A t A l. If we know the projection l of l in a projective mapping of a plane we may perform affine measurements. E.g. parallel lines in the plane should intersect on l. HP l H P( l ) / HP We may also transform the image such that l is transformed back to l. If l is the line l (l, l, l ) we may (assuming l ) construct the following transformation H H A l l l, where H A is an arbitrary affine transformation. If we apply H on the image, the line at infinity will be mapped to its canonical positions since H (l, l, l ) (,, ) l. π π π HA D homographies p. D homograph The circular points and their dual There are two points on l that are mapped onto each other under a similarity. They are called circular or absolute points and are denoted I i, J Under an orientation-preserving similarity I H S I scos θ s sin θ t s sin θ s cos θ t y s cos θ si sin θ s sin θ + sicos θ s i i. (cos θ isin θ) (cos θ isin θ) i se iθ i I. The circular points The circular points are intersection points between a circle and the line at infinity. The equation for a circle has a c and b a + a + d + e + f and intersects l where or a( + ), with solution I (, i, ) and J (, i, ). Since I are J are on all circles, we only need more points to uniquely determine the equation of the circle, something already known in Euclidean geometry. D homographies p. D homograph
Calculation of the circle equation The dual conic to the circular points Which circle intersects the points (,, ), (,,) and (,,)? If we add the circular points, the -point algorithm gives us the matri X i i with null-space C corresponding to or + y y ( ( + y ) ).. The line conic C IJ + JI is dual to the circular points. In Euclidean coordinates it is given by C i i + i i I The conic C is invariant under a similarity transformation H S since C H S C H S sr t sr t I sr t sr s RR C.. and conic c,,,,,. The conic C has degrees of freedom (symmetric matri with arbitrary scale and C )..... D homographies p. D homograph The information content ofc The effect of a homography onc Study the line conic C under a projective transformation: (H P H A H S )C (H P H A H S ) (H P H A ) ( ) ( ) H S C H S H A H P KK KK v v KK v KK. v C The (projection of the) conic C contains all information needed to perform a metric rectification, i.e. to determine the affine and projective properties of the transformation. Assume we have two lines l (,,.), m (,,.) and the transformation s., R v. H H P H A H S cos sin sin cos, v., or...8..899.8.., K....8, Then l H l.., m H m.9., D homographies p. 9 and HC H C.8.8..9.9 D homograph
etermination of orthogonality withc If we know the image (projection) of C C.8.8..9.9 Metric rectification withc Given C we can calculate the affine and projective properties K and v: KK.8.8.99 K 9.98.9.9...8 we are able to determine if the lines. l., m.9. in the image are orthogonal in the world plane. l C m...8.8.99.8.8.9., and KK v.8 v.8.8.99.8. D homographies p. D homograph Metric rectification withc Metric rectification by orthogonal line Given K and v we may eliminate the affine and projective component of the transformation by applying H M (H P H A ) on the points and H M on the lines..8 If an images has been affinely rectified we need equations to determine the degrees of freedom in K. We may get these equation from pairs of imaged orthogonal lines. Assume l and m in the affinely rectified image correspond to two orthogonal lines l and m in the world plane. which is a linear equation in S KK s s s s ˆl m, l m + l m, l m s,,. Since v we have where s (s, s, s ). 8....8 l l l KK m m m Given the image of two pairs of orthogonal lines we may determine s and therefore K and H A up to an unknown scale. The application of H A on the image will do a metric rectification... 8.....8.... H M D homographies p. D homograph