05.05.2015 Views

Projective geometry for Computer Vision

Projective geometry for Computer Vision

Projective geometry for Computer Vision

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong><br />

Subhashis Banerjee<br />

Department of <strong>Computer</strong> Science and Engineering<br />

IIT Delhi<br />

NIT, Rourkela<br />

March 27, 2010<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Overview<br />

◮ Pin-hole camera<br />

◮ Why projective <strong>geometry</strong>?<br />

◮ Reconstruction<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Computer</strong> vision <strong>geometry</strong>: main problems<br />

Correspondence problem: Match image projections of a 3D<br />

configuration.<br />

Reconstruction problem: Recover the structure of the 3D<br />

configuration from image projections.<br />

Re-projection problem: Is a novel view of a 3D configuration<br />

consistent with other views? (Novel view generation)<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


An infinitely strange perspective<br />

◮ Parallel lines in 3D space converge in images.<br />

◮ The line of the horizon is <strong>for</strong>med by ‘infinitely’ distant points<br />

(vanishing points).<br />

◮ Any pair of parallel lines meet at a point on the horizon<br />

corresponding to their common direction.<br />

◮ All ‘intersections at infinity’ stay constant as the observer<br />

moves.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


3D reconstruction from pin-hole projections<br />

La Flagellazione di Cristo (1460) Galleria Nazionale delle Marche<br />

by Piero della Francesca (1416-1492) (Robotics Research Group,<br />

Ox<strong>for</strong>d University, 2000)<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Pin-hole camera<br />

◮ The effects can be modelled mathematically using the ‘linear<br />

perspective’ or a ‘pin-hole camera’ (realized first by Leonardo?)<br />

◮ If the world coordinates of a point are (X , Y , Z) and the<br />

image coordinates are (x, y), then<br />

◮ The model is non-linear.<br />

x = fX /Z and y = fY /Z<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


In terms of projective coordinates<br />

where,<br />

⎡<br />

λ ⎣<br />

⎡<br />

⎣<br />

x<br />

y<br />

1<br />

x<br />

y<br />

1<br />

⎤<br />

⎡<br />

⎦ = ⎣<br />

⎤<br />

⎦ ∈ P 2 and<br />

are homogeneous coordinates.<br />

f 0 0 0<br />

0 f 0 0<br />

0 0 1 0<br />

⎡<br />

⎢<br />

⎣<br />

X<br />

Y<br />

Z<br />

1<br />

⎡<br />

⎤<br />

⎦ ⎢<br />

⎣<br />

⎤<br />

X<br />

Y<br />

Z<br />

1<br />

⎥<br />

⎦ ∈ P3<br />

⎤<br />

⎥<br />

⎦<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Euclidean and Affine geometries<br />

◮ Given a coordinate system, n-dimensional real affine space is<br />

the set of all points parameterized by x = (x 1 , . . . , x n ) t ∈ R n .<br />

◮ An affine trans<strong>for</strong>mation is expressed as<br />

x ′ = Ax + b<br />

where A is a n × n (usually) non-singular matrix and b is a<br />

n × 1 vector representing a translation.<br />

◮ By SVD<br />

A = UΣV T = (UV T )(VΣV T ) = R(θ)R(−φ)ΣR(φ)<br />

where where<br />

Σ =<br />

[ ]<br />

λ1 0<br />

0 λ 2<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Euclidean and Affine geometries<br />

◮ In the special case of when A is a rotation (i.e.,<br />

AA t = A t A = I, then the trans<strong>for</strong>mation is Euclidean.<br />

◮ An affine trans<strong>for</strong>mation preserves parallelism and ratios of<br />

lengths along parallel directions.<br />

◮ An Euclidean trans<strong>for</strong>mation, in addition to the above, also<br />

preserves lengths and angles.<br />

◮ Since an affine (or Euclidean) trans<strong>for</strong>mation preserves<br />

parallelism it cannot be used to describe a pinhole projection.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Spherical <strong>geometry</strong><br />

◮ The space S 2 :<br />

S 2 = { x ∈ R 3 : ||x|| = 1 }<br />

◮ lines in S 2 : Viewed as a set in R 3 this is the intersection of<br />

S 2 with a plane through the origin. We will call this great<br />

circle a line in S 2 . Let ξ be a unit vector. Then,<br />

l = { x ∈ S 2 : ξ t x = 0 } is the line with pole ξ.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Spherical <strong>geometry</strong><br />

◮ Lines in S 2 cannot be parallel. Any two lines intersect at a<br />

pair of antipodal points.<br />

◮ A point on a line:<br />

◮ Two points define a line:<br />

◮ Two lines define a point:<br />

l· x = 0 or l T x = 0 or x T l = 0<br />

l = p × q<br />

x = l × m<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Projective</strong> <strong>geometry</strong><br />

◮ The projective plane P 2 is the set of all pairs {x, −x} of<br />

antipodal points in S 2 .<br />

◮ Two alternative definitions of P 2 , equivalent to the preceding<br />

one are<br />

1. The set of all lines through the origin in R 3 .<br />

2. The set of all equivalence classes of ordered triples (x 1 , x 2 , x 3 )<br />

of numbers (i.e., vectors in R 3 ) not all zero, where two vectors<br />

are equivalent if they are proportional.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Projective</strong> <strong>geometry</strong><br />

The space P 2 can be thought of as the infinite plane tangent to<br />

the space S 2 and passing through the point (0, 0, 1) t .<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Projective</strong> <strong>geometry</strong><br />

◮ Let π : S 2 → P 2 be the mapping that sends x to {x, −x}.<br />

The π is a two-to-one map of S 2 onto P 2 .<br />

◮ A line of P 2 is a set of the <strong>for</strong>m πl, where l is a line of S 2 .<br />

Clearly, πx lies on πl if and only if ξ t x = 0.<br />

◮ Homogeneous coordinates: In general, points of real<br />

n-dimensional projective space, P n ,<br />

are represented by n + 1 component column vectors<br />

(x 1 , . . . , x n , x n+1 ) ∈ R n+1 such that at least one x i is non-zero<br />

and (x 1 , . . . , x n , x n+1 ) and (λx 1 , . . . , λx n , λx n+1 ) represent the<br />

same point of P n <strong>for</strong> all λ ≠ 0.<br />

◮ (x 1 , . . . , x n , x n+1 ) is the homogeneous representation of a<br />

projective point.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Canonical injection of R n into P n<br />

◮ Affine space R n can be embedded in P n by<br />

(x 1 , . . . , x n ) → (x 1 , . . . , x n , 1)<br />

◮ Affine points can be recovered from projective points with<br />

x n+1 ≠ 0 by<br />

(x 1 , . . . , x n ) ∼ ( x 1<br />

x n+1<br />

, . . . ,<br />

x n<br />

x n+1<br />

, 1) → ( x 1<br />

x n+1<br />

, . . . ,<br />

x n<br />

x n+1<br />

)<br />

◮ A projective point with x n+1 = 0 corresponds to a point at<br />

infinity.<br />

◮ The ray (x 1 , . . . , x n , 0) can be viewed as an additional ideal<br />

point as (x 1 , . . . , x n ) recedes to infinity in a certain direction.<br />

For example, in P 2 ,<br />

lim (X /T , Y /T , 1) = lim (X , Y , T ) = (X , Y , 0)<br />

T →0 T →0<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Lines in P 2<br />

◮ A line equation in R 2 is<br />

a 1 x 1 + a 2 x 2 + a 3 = 0<br />

◮ Substituting by homogeneous coordinates x i = X i /X 3 we get<br />

a homogeneous linear equation<br />

(a 1 , a 2 , a 3 )· (X 1 , X 2 , X 3 ) =<br />

3∑<br />

a i X i = 0, X ∈ P 2<br />

i=1<br />

◮ A line in P 2 is represented by a homogeneous 3-vector<br />

(a 1 , a 2 , a 3 ).<br />

◮ A point on a line: a· X = 0 or a T X = 0 or X T a = 0<br />

◮ Two points define a line: l = p × q<br />

◮ Two lines define a point: x = l × m<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


The line at infinity<br />

◮ The line at infinity (l ∞ ): is the line of equation X 3 = 0.<br />

Thus, the homogeneous representation of l ∞ is (0, 0, 1).<br />

◮ The line (u 1 , u 2 , u 3 ) intersects l ∞ at the point (−u 2 , u 1 , 0).<br />

◮ Points on l ∞ are directions of affine lines in the embedded<br />

affine space (can be extended to higher dimensions).<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Conics in P 2<br />

A conic in affine space (inhomogeneous coordinates) is<br />

ax 2 + bxy + cy 2 + dx + ey + f = 0<br />

Homogenizing this by replacements x = X 1 /X 3 and y = Y 1 /Y 3 , we<br />

obtain<br />

aX 2 1 + bX 1 X 2 + cX 2 2 + dX 1 X 3 + eX 2 X 3 + fX 2 3 = 0<br />

which can be written in matrix notation as X T CX = 0 where C is<br />

symmetric and is the homogeneous representation of a conic.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Conics in P 2<br />

◮ The line l tangent to a conic C at any point x is given by<br />

l = Cx.<br />

◮ x t Cx = 0 =⇒ (C −1 l) t C((C −1 l) = l t C −1 l = 0<br />

(because C −t = C −1 ). This is the equation of the dual conic.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Conics in P 2<br />

◮ The degenerate conic of rank 2 is defined by two line l and m<br />

as<br />

C = lm t + ml t<br />

Points on line l satisfy l t x = 0 and are hence on the conic<br />

because (x t l)(m t x) + (x t m)(l t x) = 0. (Similarly <strong>for</strong> m).<br />

The dual conic xy t + yx t represents lines passing through x<br />

and y.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Projective</strong> basis<br />

<strong>Projective</strong> basis: A projective basis <strong>for</strong> P n is any set of n + 2<br />

points no n + 1 of which are linearly dependent.<br />

Canonical basis:<br />

⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤<br />

1 0<br />

0 1<br />

0<br />

⎢ ⎥<br />

⎣ . ⎦ , 1<br />

⎢ ⎥<br />

⎣ . ⎦ , . . .<br />

0<br />

⎢ ⎥<br />

⎣ . ⎦ ,<br />

1<br />

⎢ ⎥<br />

⎣ . ⎦<br />

0 0<br />

1 1<br />

} {{ } } {{ } } {{ }<br />

points at infinity along each axis origin unit point<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Projective</strong> basis<br />

Change of basis: Let e 1 , e 2 , . . . , e n+1 , e n+2 be the standard basis<br />

and a 1 , a 2 , . . . , a n+1 , a n+2 be any other basis. There<br />

exists a non-singular trans<strong>for</strong>mation [T] (n+1)×(n+1)<br />

such that:<br />

Te i = λ i a i , ∀i = 1, 2. . . . , n + 2<br />

T is unique up to a scale.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Homography<br />

The invertible trans<strong>for</strong>mation T : P n → P n is called a projective<br />

trans<strong>for</strong>mation or collineation or homography or perspectivity<br />

and is completely determined by n + 2 point correspondences.<br />

◮ Preserves straight lines and cross ratios<br />

◮ Given four collinear points A 1 , A 2 ,A 3 and A 4 , their cross<br />

ratio is defined as<br />

A 1 A 3 A 2 A 4<br />

A 1 A 4 A 2 A 3<br />

◮ If A 4 is a point at infinity then the cross ratio is given as<br />

A 1 A 3<br />

A 2 A 3<br />

◮ The cross ratio is independent of the choice of the projective<br />

coordinate system.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Homography<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Homography<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Projective</strong> mappings of lines<br />

◮ If the points x i lie on the line l, we have l T x i = 0.<br />

◮ Since, l T H −1 Hx i = 0 the points Hx i all lie on the line H −T l.<br />

◮ Hence, if points are trans<strong>for</strong>med as x ′ i = Hx i , lines are<br />

trans<strong>for</strong>med as l ′ = H −T l.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


<strong>Projective</strong> mappings of conics<br />

◮ Note that a conic is represented (homogeneously) as<br />

x T Cx = 0<br />

◮ Under a point trans<strong>for</strong>mation x ′ = Hx the conic becomes<br />

x T Cx = x ′ T [H −1 ] T CH −1 x ′ = x ′ T H −T CH −1 x ′ = 0<br />

◮ This is the quadratic <strong>for</strong>m of x ′T C ′ x ′ with C ′ = H −T CH −1 .<br />

This gives the trans<strong>for</strong>mation rule <strong>for</strong> a conic.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


The affine subgroup<br />

In an affine space A n an affine trans<strong>for</strong>mation defines a<br />

correspondence X ↔ X ′ given by:<br />

X ′ = AX + b<br />

where X, X ′ and b are n-vectors, and A is an n × n matrix.<br />

Clearly this is a subgroup of the projective group. Its projective<br />

representation is<br />

[ ] C c<br />

T =<br />

0 T n t 33<br />

where A = 1<br />

t 33<br />

C and b = 1<br />

t 33<br />

c.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Affine trans<strong>for</strong>mations preserve the plane/line at infinity<br />

[ A b<br />

0 t 1<br />

] ⎛ ⎝<br />

x 1<br />

x 2<br />

0<br />

⎞ ⎛ ( ) ⎞<br />

⎠ = ⎝ A x1<br />

x 2<br />

⎠<br />

0<br />

A general projective trans<strong>for</strong>mation moves points at infinity to<br />

finite points.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


The Euclidean subgroup<br />

◮ The absolute conic: The conic Ω ∞ is intersection of the<br />

quadric of equation:<br />

∑<br />

n+1<br />

xi<br />

2<br />

i=1<br />

= x n+1 = 0 with π ∞<br />

◮ In a metric frame π ∞ = (0, 0, 0, 1) T , and points on Ω ∞ satisfy<br />

X1 2 + X 2 2 + X 3<br />

3 }<br />

= 0<br />

X 4<br />

◮ For directions on π ∞ (with X 4 = 0), the absolute conic Ω ∞<br />

can be expressed as<br />

(X 1 , X 2 , X 3 )I(X 1 , X 2 , X 3 ) T = 0<br />

◮ The absolute conic, Ω ∞ , is fixed under a projective<br />

trans<strong>for</strong>mation H if and only if H is an Euclidean<br />

trans<strong>for</strong>mation.<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Affine calibration of a plane<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Affine calibration of a plane<br />

If the imaged line at infinity is l = (l 1 , l 2 , l 3 ) t , then provided l 3 ≠ 0<br />

a suitable projective trans<strong>for</strong>mation that maps l back to l ∞ is<br />

⎡ ⎤<br />

1 0 0<br />

H = ⎣ 0 1 0 ⎦ H A<br />

l 1 l 2 l 3<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Reconstruction<br />

Camera recovery<br />

Metrology<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Surfaces of revolution<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


Modeling of structured scenes<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>


A walkthrough<br />

Subhashis Banerjee<br />

<strong>Projective</strong> <strong>geometry</strong> <strong>for</strong> <strong>Computer</strong> <strong>Vision</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!