Successfully reported this slideshow.
Upcoming SlideShare
×

# Lecture 1

759 views

Published on

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

### Lecture 1

1. 1. C OMPUTER V ISION : P ROJECTIVE G EOMETRY IIT Kharagpur Computer Science and Engineering, Indian Institute of Technology Kharagpur.(IIT Kharagpur) Projective Geometry Jan ’10 1 / 40
2. 2. Planar Geometry Geometry is the study of points and lines and their relationships. Geometry can be studied in terms of properties of geometric primitives. An algebraic approach to studying geometry involves establishing a coordinate system.Algebraic geometry Points and lines are represented as vectors. A conic section is represented by a symmetric matrix. Results derived using algebraic geometry are very useful for developing practical computation methods. (IIT Kharagpur) Projective Geometry Jan ’10 2 / 40
3. 3. The 2D projective plane Notation A point (x, y ) can be considered as a vector in the vector space IR2 Geometric entities can be represented by a column vector. Generally x represents a column vector and xT represents a row vector. A point x gets represented by a column vector: x x= = (x, y )T y (IIT Kharagpur) Projective Geometry Jan ’10 3 / 40
4. 4. Homogeneous representation of lines Equation of a line: ax + by + c = 0 Line as a vector: (a, b, c)T Vectors (a, b, c)T and k (a, b, c)T represent the same line. For different values of scalar k , we get an equivalence class of vectors. Any particular vector (a, b, c)T is a representative of the equivalence class.Projective space The set of equivalence classes of vectors in IR3 forms the projective space IP2 . The vector (0, 0, 0)T is excluded from the projective space since it does not correspond to any line. (IIT Kharagpur) Projective Geometry Jan ’10 4 / 40
5. 5. Homogeneous representation of points A point x = (x, y )T lies on the line l = (a, b, c)T if    a    (x, y , 1)  b   ax + by + c = 0    =0    c   The point (x, y )T in IR2 is represented as a 3-vector by adding a ﬁnal coordinate of 1. Since (kx, ky , k )l = 0, the set of vectors (kx, ky , k )T for varying values of k would represent the same point (x, y T ) in IR2 . A homogeneous vector of general form x = (x1 , x2 , x3 )T represents the point (x1 /x3 , x2 /x3 )T in IR2 .Points as homogeneous vectors are also elements of IP2 . (IIT Kharagpur) Projective Geometry Jan ’10 5 / 40
6. 6. Homogeneous coordinate Point x lies on line l if and only if xT l = 0 xT l = lT x = x.l Homogeneous coordinate (3-vector) x = (x1 , y1 , z1 )T . Inhomogeneous coordinate (2-vector) x = (x, y )T . Two lines l = (a, b, c)T and l = (a , b , c )T intersect at a point x. x=l×l The line through two points x and x is l=x×x (IIT Kharagpur) Projective Geometry Jan ’10 6 / 40
7. 7. Ideal Points Line at ∞ Consider two parallel lines l = (a, b, c)T and l = (a, b, c )T . Intersection of l and l is given by l × l .    b    l × l = (c − c )  −a          0   The inhomogeneous representation of the point of intersection b/0 −a/0 Parallel lines meet at inﬁnity. (IIT Kharagpur) Projective Geometry Jan ’10 7 / 40
8. 8. Ideal points and the line at inﬁnity All homogeneous 3-vectors form the projective space IP2 . The points for which the last coordinate x3 = 0 are the ideal points    x1     x    2      0   The set of all ideal points (x1 , x2 , 0)T lie on a single line, the Line at Inﬁnity, denoted l∞ = (0, 0, 1)T A line l = (a, b, c)T intersects l∞ in the ideal point (b, −a, 0)T . The vector (b, −a)T is tangent to the line and orthogonal to the line normal (a, b) and so represents the line’s direction. (IIT Kharagpur) Projective Geometry Jan ’10 8 / 40
9. 9. Advantage of projective geometryProjective plane IP2 In IP2 , two distinct lines meet in a single point and two points lie on a single line. In the standard Euclidean geometry of IR2 , parallel lines form a special case. The study of the geometry of IP2 is known as projective geometry. In the purely geometric study of projective geometry, one does not make any distinction between points at inﬁnity (ideal points) and ordinary points. (IIT Kharagpur) Projective Geometry Jan ’10 9 / 40
10. 10. A model for projective plane Points in IP2 correspond to rays in IR3 . The set of all vectors k (x1 , x2 , x3 )T as k varies forms a ray through origin. The lines in IP2 are planes passing through origin in IR3 Getting inhomogeneous representation: Points and lines may be obtained by intersecting this set of of rays and planes with the plane x3 = 1 (IIT Kharagpur) Projective Geometry Jan ’10 10 / 40
11. 11. Duality The role of points and lines can be interchanged in statements concerning the properties of lines and points. E.g. lT x = 0 also implies xT l = 0To any theorem of 2-dimensional projective geometry therecorresponds a dual theorem, which may be derived by interchangingthe roles of points and lines in the original theorem. A line through 2 points is dual to the point of intersection of the two lines. (IIT Kharagpur) Projective Geometry Jan ’10 11 / 40
12. 12. Conics and Dual Conics A conic is a curve described by a second-degree equation in the plane. E.g. hyperbola, ellipse, parabola. Inhomogeneous coordinates → equation of a conic: ax 2 + bxy + cy 2 + dx + ey + f = 0 Homogenizing this by replacements x1 → x1 /x3 , y → x2 /x3 2 2 2 ax1 + bx1 x2 + cx2 + dx1 x2 + ex2 x3 + fx3 (IIT Kharagpur) Projective Geometry Jan ’10 12 / 40
13. 13. Conic in matrix form    a b/2 d/2    xT Cx = 0 C =  b/2 c e/2          d/2 e/2 f   The matrix C is a homogeneous representation of the conic. The conic has 5 degrees of freedom, i.e. the ratios: {a : b : c : d : e : f } Five points are required to deﬁne a conic.Tangent to the conicThe line l tangent to the conic C is given by l = Cx (IIT Kharagpur) Projective Geometry Jan ’10 13 / 40
14. 14. Conic in matrix form    a b/2 d/2    xT Cx = 0 C =  b/2 c e/2          d/2 e/2 f   The matrix C is a homogeneous representation of the conic. The conic has 5 degrees of freedom, i.e. the ratios: {a : b : c : d : e : f } (IIT Kharagpur) Projective Geometry Jan ’10 14 / 40
15. 15. Projective Transformations 2D projective geometry is the study of properties of the projective plane IP2 that are invariant under a group of transformations known as projectivities. A projectivity is an invertible mapping from points in IP2 to points in IP2 . A projectivity is an invertible mapping h from IP2 to itself such that three points x1 , x2 and x3 lie on the same line if and only if h(x1 ), h(x2 ) and h(x3 ) do. Also called as: collineation, projective transformation or a homography. (IIT Kharagpur) Projective Geometry Jan ’10 15 / 40
16. 16. Homography Projective TransformationAlgebraic deﬁnition:A mapping h : P2 → IP2 is a projectivity if and only if there exists anon-singular 3 × 3 matrix H such that for any point in P2 represented byvector x it is true that h(x) = Hx.H is a linear transformation       x1   h11 h12 h13      x1    x = Hx  x = h  2   21 h22 h23     x    2             x3 h31 h32 h33 x3     H is a homogeneous matrixOnly ratios of the matrix elements is signiﬁcant.There are 8 degrees of freedom. (IIT Kharagpur) Projective Geometry Jan ’10 16 / 40
17. 17. Projective Transformation A projective transformation leaves the projective properties invariant. A projective transformation in P2 is simply a linear transformation of R3 . (IIT Kharagpur) Projective Geometry Jan ’10 17 / 40
18. 18. Transformation of Lines Points xi get transformed as xi = Hxi If these points xi lie on a line l, then lT xi = 0 The transformed points xi would lie on a line l . l = H−T l (IIT Kharagpur) Projective Geometry Jan ’10 18 / 40
19. 19. Transformation of Conics Points x get transformed as x = Hx If the point x lies on a conic C, then xT Cx = 0 xT Cx = x T [H−1 ]T C H−1 x = x T H−T C H−1 xUnder a point transformation x = Hx, a conic C transforms to C = H−T C H−1 (IIT Kharagpur) Projective Geometry Jan ’10 19 / 40
20. 20. Hierarchy of Transformations General linear group: GL(n) −→ Group of invertible n × n matrices with real elements. Projective linear group: PL(n) −→ Matrices are related by a scalar multiplier. Quotient group of GL(n).Projective Linear Group Subgroups Afﬁne group: −→ Matrices for which the last row is (0, 0, 1) Euclidean group: −→ Additionally, the upper left hand 2 × 2 matrix is orthogonal. Oriented Euclidean group: PL(n) −→ Additionally, the upper left hand 2 × 2 matrix has determinant 1. (IIT Kharagpur) Projective Geometry Jan ’10 20 / 40
21. 21. Invariants A transformation can be described in terms of those elements or quantities that are preserved or invariant. A (scalar) invariant of a geometric conﬁguration is a function of the conﬁguration whose value is unchanged by a particular transformation.Euclidean invariants Similarity invariants Distance between two points. Distance Angle between two lines. Angle between two lines. (IIT Kharagpur) Projective Geometry Jan ’10 21 / 40
22. 22. Examples of Projective transformations (IIT Kharagpur) Projective Geometry Jan ’10 22 / 40
23. 23. Examples of Projective transformations (IIT Kharagpur) Projective Geometry Jan ’10 23 / 40
24. 24. Example of Projective Correction (IIT Kharagpur) Projective Geometry Jan ’10 24 / 40
25. 25. Isometries        x      cosθ − sinθ tx   x      y  =        sinθ cosθ ty   y        where = ±1             1 0 0 1 1       Isometries are transformations of the plane R2 that preserve Euclidean distance. If = 1, the isometry is orientation-preserving and is a Euclidean transformation. Euclidean transformation is a composition of translation and rotation. If = −1, the isometry reverses orientation. (IIT Kharagpur) Projective Geometry Jan ’10 25 / 40
26. 26. Isometries In short form R t x = HE x = x 0T 1 R is a 2 × 2 rotation matrix. RT R = RRT = I t is a translation 2-vector. 0 is a null 2-vector. It has 3 degrees of freedom: 1 for rotation, 2 for translation.Invariants Isometry Length Angle Area (IIT Kharagpur) Projective Geometry Jan ’10 26 / 40
27. 27. Similarity Transformation      x    s cosθ −s sinθ tx   x      y  =  s sinθ s cosθ t   y       where s = scaling       y          1 0 0 1 1      It is an isometry composed with an isotropic scaling. Preserves the shape. Has 4 degrees of freedom −→ scaling(1), rotation(1), translation(2). (IIT Kharagpur) Projective Geometry Jan ’10 27 / 40
28. 28. Similarity Transformation In short form sR t x = HS x = x 0T 1 R is a 2 × 2 rotation matrix. RT R = RRT = I t is a translation 2-vector. 0 is a null 2-vector.Invariants Isometry Angle Parallel lines remain as parallel. Length: Ratio of two lengths is preserved. Area: Ratio of two areas is preserved. (IIT Kharagpur) Projective Geometry Jan ’10 28 / 40
29. 29. Metric StructureMetric Structure implies that the structure is deﬁned up to a similarity. (IIT Kharagpur) Projective Geometry Jan ’10 29 / 40
30. 30. Afﬁne Transformation (Afﬁnity)        x     a11 a12 tx   x       y  =  a21 a22 ty   y                          1 0 0 1 1       A t x = HA x = x 0T 1 A is a 2 × 2 non-singular matrix. Has 6 degrees of freedom −→ 6 matrix elements. The transformation can be computed using 3 point correspondences. (IIT Kharagpur) Projective Geometry Jan ’10 30 / 40
31. 31. Decomposition of an Afﬁne transform A = R(θ) R(−φ) D R(φ) λ1 0 D is a diagonal matrix. D = 0 λ2 R(θ) and R(φ) are rotations by θ and φ respectively. (IIT Kharagpur) Projective Geometry Jan ’10 31 / 40
32. 32. Afﬁne transform Non-isotropic scaling Non-isotropic scaling means there is a scaling direction (angle φ), and a ratio of scaling parameters λ1 : λ2 in orthogonal directions. It has 2 extra degrees of freedom compared to a similarity transform.Invariants Afﬁne Transform Angle Parallel lines remain as parallel. Length: Ratio of two lengths is preserved for parallel lines. Area: Ratio of two areas is preserved. In fact areas are scaled by factor λ1 λ2 .There can be orientation preserving and orientation reversing afﬁnitiesdepending on the sign of detA (IIT Kharagpur) Projective Geometry Jan ’10 32 / 40
33. 33. Projective Transformation A t x = HP x = x where v = (v1 , v2 )T vT v Has 8 degrees of freedom −→ 9 elements with only ratio signiﬁcant. The transformation can be computed using 4 point correspondences, with no 3 collinear on either plane.InvariantsA ratio of ratios (cross ratio) of lengths on a line is a projectiveinvariant. (IIT Kharagpur) Projective Geometry Jan ’10 33 / 40
34. 34. Similarity (4 dof) ↓ Afﬁnity (6 dof) Afﬁnity: Scaling of area is the same all over the ↓ plane. Orientation of a transformed line does notProjectivity (8 dof) depend on its position on the plane. Projectivity: Area scaling varies with position. Orientation of a transformed line depends on its initial orientation and position.The vector v is responsible for non-linear effects.      x1   A x1  A t      x2  =  x2          0T 1         0 0          x1  x1 A t    x  =  A x        2    2 vT   v         0 v1 x1 + v2 x2     (IIT Kharagpur) Projective Geometry Jan ’10 34 / 40
35. 35. Decomposition of a Projective Transform sR t K 0 I 0 A t H = HS HA HP = = 0T 1 0T 1 vT v vT v A = sRK + tvT K is an upper-triangular matrix normalized as det K = 1 The decomposition is valid if v 0, is unique if s is positive.    1.707 0.586 1.0    H =  2.707 8.242 2.0          1.0 2.0 1.0    2cos45o −2sin45o 1   0.5 1 0   1 0 0          =  2sin45o 2cos45o 2   0 2 0   0 1 0                  0 0 1 0 0 1 1 2 1     (IIT Kharagpur) Projective Geometry Jan ’10 35 / 40
36. 36. Rectifying a Projective Transform Afﬁne rectiﬁcation Similarity rectiﬁcation (Metric structure) Euclidean rectiﬁcation (IIT Kharagpur) Projective Geometry Jan ’10 36 / 40
37. 37. Number of Invariants The number of functionally independent invariants ≥ the number of degrees of freedom of the conﬁguration − the number of degrees of freedom of the transformation (IIT Kharagpur) Projective Geometry Jan ’10 37 / 40
38. 38. Projective (8 dof) Invariants    h11 h12 h13 Concurrency, collinearity     h21 h22 h23      Order of contact     h31 h32 h33   Cross ratiosAfﬁne (6 dof) Invariants    a11 a12 tx    Parallelism  a21 a22 ty      Ratios of areas, ratio of     0 0 1   lengths on parallel lines The line at ∞ (IIT Kharagpur) Projective Geometry Jan ’10 38 / 40
39. 39. Similarity (4 dof) Invariants    sr11 sr12 tx    sr  Ratio of lengths,  21 sr22 ty     Angles     0 0 1   The circular pointsEuclidean (3 dof) Invariants    r11 r12 tx    r  Lengths,  21 r22 ty     Area     0 0 1   (IIT Kharagpur) Projective Geometry Jan ’10 39 / 40
40. 40. The projective geometry of 1D (IIT Kharagpur) Projective Geometry Jan ’10 40 / 40