Вы находитесь на странице: 1из 40

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


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


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


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


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


final 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


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 l0 = (a0 , b0 , c 0 )T intersect at a point x.

x = l × l0

The line through two points x and x0 is

l = x × x0

(IIT Kharagpur) Projective Geometry Jan ’10 6 / 40


Ideal Points Line at ∞
Consider two parallel lines l = (a, b, c)T and l0 = (a, b, c 0 )T .
Intersection of l and l0 is given by l × l0 .
 
 b 
l × l0 = (c − c 0 )  −a
 


0

The inhomogeneous representation of the point of intersection


!
b/0
−a/0

Parallel lines meet at infinity.

(IIT Kharagpur) Projective Geometry Jan ’10 7 / 40


Ideal points and the line at infinity
All homogeneous 3-vectors form the projective space IP2 .
The points for which the last coordinate x3 = 0 are the ideal points
 
 x1 
 x2 
 
 
0

The set of all ideal points (x1 , x2 , 0)T lie on a single line, the Line
at Infinity, 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


Advantage of projective geometry
Projective 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 infinity (ideal points) and
ordinary points.

(IIT Kharagpur) Projective Geometry Jan ’10 9 / 40


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


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 = 0

To any theorem of 2-dimensional projective geometry there


corresponds a dual theorem, which may be derived by interchanging
the 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


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

ax12 + bx1 x2 + cx22 + dx1 x2 + ex2 x3 + fx32

(IIT Kharagpur) Projective Geometry Jan ’10 12 / 40


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 define a conic.

Tangent to the conic


The line l tangent to the conic C is given by l = Cx

(IIT Kharagpur) Projective Geometry Jan ’10 13 / 40


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


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


Homography Projective Transformation
Algebraic definition:
A mapping h : P2 → IP2 is a projectivity if and only if there exists a
non-singular 3 × 3 matrix H such that for any point in P2 represented by
vector x it is true that h(x) = Hx.

H is a linear transformation
 0    
 x1   h11 h12 h13   x1 
x0 = Hx
 0  
 x2  =  h21 h22 h23   x2 
  
 0     
x3 h31 h32 h33 x3

H is a homogeneous matrix
Only ratios of the matrix elements is significant.
There are 8 degrees of freedom.

(IIT Kharagpur) Projective Geometry Jan ’10 16 / 40


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


Transformation of Lines
Points xi get transformed as x0i = Hxi
If these points xi lie on a line l, then lT xi = 0
The transformed points x0i would lie on a line l0 .

l0 = H−T l

(IIT Kharagpur) Projective Geometry Jan ’10 18 / 40


Transformation of Conics
Points x get transformed as x0 = Hx
If the point x lies on a conic C, then xT Cx = 0

xT Cx = x0T [H−1 ]T C H−1 x0


= x0T H−T C H−1 x0

Under a point transformation x0 = Hx, a conic C transforms to

C0 = H−T C H−1

(IIT Kharagpur) Projective Geometry Jan ’10 19 / 40


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


Affine 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


Invariants
A transformation can be described in terms of those elements or
quantities that are preserved or invariant.
A (scalar) invariant of a geometric configuration is a function of the
configuration 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


Examples of Projective transformations

(IIT Kharagpur) Projective Geometry Jan ’10 22 / 40


Examples of Projective transformations

(IIT Kharagpur) Projective Geometry Jan ’10 23 / 40


Example of Projective Correction

(IIT Kharagpur) Projective Geometry Jan ’10 24 / 40


Isometries
  cosθ − sinθ tx   x 
 0     
 x 
 y  =   sinθ  cosθ ty   y  where  = ±1
 0     
     
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


Isometries " #
In short form
R t
x0 = 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


Similarity Transformation
 0     
 x   s cosθ −s sinθ tx   x 
 0 
 y  =  s sinθ s cosθ ty   y 
   
      where s = scaling
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


Similarity Transformation In short form
" #
0 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


Metric Structure
Metric Structure implies that the structure is defined up to a similarity.

(IIT Kharagpur) Projective Geometry Jan ’10 29 / 40


Affine Transformation (Affinity)
 0     
 x   a11 a12 tx   x 
 0 
 y  =  a21 a22 ty  y 
   

     
1 0 0 1 1
" #
A t
x0 = 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


Decomposition of an Affine 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


Affine 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 Affine 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 affinities
depending on the sign of detA

(IIT Kharagpur) Projective Geometry Jan ’10 32 / 40


Projective Transformation
" #
A t
x 0
= HP x = x where v = (v1 , v2 )T
vT v

Has 8 degrees of freedom −→ 9 elements with only ratio


significant.
The transformation can be computed using 4 point
correspondences, with no 3 collinear on either plane.

Invariants
A ratio of ratios (cross ratio) of lengths on a line is a projective
invariant.

(IIT Kharagpur) Projective Geometry Jan ’10 33 / 40


Similarity (4 dof)

Affinity (6 dof) Affinity: Scaling of area is the same all over the
↓ plane. Orientation of a transformed line does not
Projectivity (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  x1 
A t

   A
 x2  =  x2 
  
0T 1   
0 0

   ! 
" #  x1  x1
A t
 
   A
 x2  =  x2
  
vT

v    
0 v1 x1 + v2 x2
 

(IIT Kharagpur) Projective Geometry Jan ’10 34 / 40


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 
2.707 8.242 2.0 
 
H = 
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
Rectifying a Projective Transform
Affine rectification
Similarity rectification (Metric structure)
Euclidean rectification

(IIT Kharagpur) Projective Geometry Jan ’10 36 / 40


Number of Invariants
The number of functionally independent invariants

the number of degrees of freedom of the configuration

the number of degrees of freedom of the transformation

(IIT Kharagpur) Projective Geometry Jan ’10 37 / 40


Projective (8 dof) Invariants
 
 h11 h12 h13
Concurrency, collinearity

 h21 h22 h23
 


h31 h32 h33
 Order of contact
Cross ratios

Affine (6 dof) Invariants


 
 a11 a12 tx 
Parallelism
 a21 a22 ty 
 

0 0 1
 Ratios of areas, ratio of
lengths on parallel lines
The line at ∞

(IIT Kharagpur) Projective Geometry Jan ’10 38 / 40


Similarity (4 dof) Invariants
 
 sr11 sr12 tx 
Ratio of lengths,
 sr21 sr22 ty 
 

0 0 1
 Angles
The circular points

Euclidean (3 dof) Invariants


 
 r11 r12 tx 
Lengths,
 r21 r22 ty 
 

0 0 1
 Area

(IIT Kharagpur) Projective Geometry Jan ’10 39 / 40


The projective geometry of 1D

(IIT Kharagpur) Projective Geometry Jan ’10 40 / 40

Вам также может понравиться