Lecture 1.3 Basic projective geometry. Thomas Opsahl

Lecture 1.3 Basic projective geometry Thomas Opsahl Motivation • For the pinhole camera, the correspondence between observed 3D points in the world...
51 downloads 0 Views 1MB Size
Lecture 1.3 Basic projective geometry Thomas Opsahl

Motivation

• For the pinhole camera, the correspondence between observed 3D points in the world and 2D points in the captured image is given by straight lines through a common point (pinhole) • This correspondence can be described by a mathematical model known as “the perspective camera model” or “the pinhole camera model” • This model can be used to describe the imaging geometry of many modern cameras, hence it plays a central part in computer vision 2

Motivation

• Before we can study the perspective camera model in detail, we need to expand our mathematical toolbox • We need to be able to mathematically describe the position and orientation of the camera relative to the world coordinate frame • Also we need to get familiar with some basic elements of projective geometry, since this will make it MUCH easier to describe and work with the perspective camera model 3

Introduction 𝐴

𝐴

𝑇𝐵

𝐴

𝐵

𝜉𝐵

• We have seen that the pose of a coordinate frame 𝐵 relative to a coordinate frame 𝐴 , denoted 𝐴𝜉𝐵 , can be represented as a homogeneous transformation 𝐴𝑇𝐵 in 2D

 r11 A A  RB tB   A A ξ B=  TB =   r21 1   0 0 

r12 r22 0

t Bx   A t Bx  ∈ SE ( 2 ) 1  A

Introduction 𝐴

𝐴

𝑇𝐵

𝐴

𝜉𝐵

𝐵

• We have seen that the pose of a coordinate frame 𝐵 relative to a coordinate frame 𝐴 , denoted 𝐴𝜉𝐵 , can be represented as a homogeneous transformation 𝐴𝑇𝐵 in 2D and 3D  r11 r12 r13 At Bx    A A A   R r r r t t A B B By   21 22 23 ξ B= ∈ SE ( 3)  ATB =   A  1  r31 r32 r33 t Bz  0   0 0 0 1  

Introduction • And we have seen how they can transform points from one reference frame to another if we represent points in homogeneous coordinates  x x   p = =  p  y      y  1 

 x  x  y y   p   p = =   z    z  1 

• The main reason for representing pose as homogeneous transformations, was the nice algebraic properties that came with the representation

Introduction A

• Euclidean geometry



𝜉𝐵 ⟼ 𝑇𝐵 =

𝐴

– Simple algebra

𝑅𝐵 𝟎

A RB B p + A t B p=

A

 Aξ B

• Projective geometry 𝐴

A

A ξC = ξ B ⊕ BξC  ( A RC , A tC ) = ( A RB B RC , A RB B tC + At B )

– 𝐴𝜉𝐵 ⟼ 𝐴𝑅𝐵 , 𝐴𝒕𝐵 – Complicated algebra

𝐴

A ξB ⋅ B p  p=

𝐴

𝒕𝐵 1

A p= ξB ⋅ B p  A A ξC = ξ B ⊕ BξC   Aξ B  A

(



A

RC T , − A RC T A tC )

A TB B p p = A A TC = TB BTC A

TB −1

A

• In the following we will take a closer look at some basic elements of projective geometry that we will encounter when we study the geometrical aspects of imaging – Homogeneous coordinates, homogeneous transformations

The projective plane Points How to describe points in the plane?

The projective plane Points How to describe points in the plane?

y

x

x 2

Euclidean plane ℝ2 • Choose a 2D coordinate frame • Each point corresponds to a unique pair of Cartesian coordinates 𝑥 2 𝒙 = 𝑥, 𝑦 ∈ ℝ ⟼ 𝒙 = 𝑦

The projective plane Points How to describe points in the plane? x

2 

 w

y

x

x 2

y

1

x

Euclidean plane ℝ2 • Choose a 2D coordinate frame • Each point corresponds to a unique pair of Cartesian coordinates 𝑥 2 𝒙 = 𝑥, 𝑦 ∈ ℝ ⟼ 𝒙 = 𝑦 Projective plane  2 • Expand coordinate frame to 3D • Each point corresponds to a triple of homogeneous coordinates 𝑥� � = 𝑥�, 𝑦�, 𝑤 � = 𝑦� 𝒙 � ∈ ℝ2 ⟼ 𝒙 𝑤 � s.t. 𝑥�, 𝑦�, 𝑤 � = 𝜆 𝑥�, 𝑦�, 𝑤 � ∀𝜆 ∈ ℝ\ 0

The projective plane Points

x

2

 w

y

Observations 1. Any point 𝒙 = 𝑥, 𝑦 in the Euclidean plane has a corresponding � = 𝑥, 𝑦, 1 in the homogeneous point 𝒙 projective plane 2. Homogeneous points of the form 𝑥�, 𝑦�, 0 does not have counterparts in the Euclidean plane

x

x 2

y

They correspond to points at infinity and are called ideal points

1

x

The projective plane Points

x

2

 w

y

Observations 3. When we work with geometrical problems in the plane, we can swap between the Euclidean representation and the projective representation  x x =  y  ∈  2    1   x   x  w =  x   2  2 ∋ x  y =    y   w   w   x 2  ∋ x=     y

x

x 2

y

1

x

Example 1. These homogeneous vectors are different numerical representations of the same point in the plane 3 x =  2  =   1 

6 4 =    2 

 −30   −20  ∈  2    −10 

2. The homogeneous point 1,2,3 ∈  2 represents the same point as

1 2 , 3 3

∈ ℝ2

The projective plane Lines How to describe lines in the plane?

The projective plane Lines How to describe lines in the plane?

y

Euclidean plane ℝ2 • 3 parameters 𝑎, 𝑏, 𝑐 ∈ ℝ 𝑙 = 𝑥, 𝑦 | 𝑎𝑎 + 𝑏𝑏 + 𝑐 = 0 l

x 2

The projective plane Lines How to describe lines in the plane? Euclidean plane ℝ2 • Triple 𝑎, 𝑏, 𝑐 ∈ ℝ3 \ 𝟎 𝑙 = 𝑥, 𝑦 | 𝑎𝑎 + 𝑏𝑏 + 𝑐 = 0

2 

 w

y

Projective plane  2 • Homogeneous vector 𝒍̃ = 𝑎, 𝑏, 𝑐 � ∈  2 | 𝒍̃𝑻 𝒙 �=0 𝑙= 𝒙

l

x 2

1

y l

x

𝑇

The projective plane Lines Observations 1. Points and lines in the projective plane have the same representation, we say that points and lines are dual objects in 2

2 

 w

y

2.

All lines in the Euclidean plane have a corresponding line in the projective plane

3.

The line 𝒍̃ = 0,0,1 𝑇 in the projective plane does not have an Euclidean counterpart

l

x 2

1

y l

x

This line consists entirely of ideal points, and is know as the line at infinity

The projective plane Lines Properties of lines in the projective plane 1. In the projective plane, all lines intersect, parallel lines intersect at infinity

2

 w

y

l

x 2

1

2.

y l

x

Two lines 𝒍̃1 and 𝒍̃2 intersect in the point � = 𝒍̃1 ×𝒍̃2 𝒙 �1 and The line passing through points 𝒙 � 𝒙2 is given by �2 𝒍̃ = � 𝒙1 ×𝒙

Example Determine the line passing through the two points 𝟐, 𝟒 and 𝟓, 𝟏𝟏 Homogeneous representation of points 2 4 ∈  2 x1 =   1 

5 13 ∈  2 x 2 =    1 

Homogeneous representation of line  0 −1 4   5   −9   −3 l = x1 × x 2 =[ x1 ]× x 2 =  1 0 −2  13 =  3  =  1          −4 2 0   1   6   2 

Equation of the line −3 x + y + 2 = 0 ⇔

y = 3x − 2

Matrix representation of the cross product 𝒖 × 𝒗 ⟼ 𝒖 ×𝒗 where

 0 = [ u]×  u3  −u2 def

−u3 0 u1

u2  −u1   0 

Example A point at infinity

https://en.wikipedia.org/wiki/Projective_plane 21

The projective plane Transformations • Some important transformations – like the action of a pose 𝜉 on points in the plane – happen to be linear in the projective plane and non-linear in the Euclidean plane • The most general invertible transformations of the projective plane are known as homographies –

or projective transformations / linear projective transformations / projectivities / collineations

Definition A homography of  2 is a linear transformation on homogeneous 3-vectors represented by a homogeneous, non-singular 3 × 3 matrix 𝐻 ℎ11 ℎ12 ℎ13 𝑥� 𝑥�′ 𝑦�′ = ℎ21 ℎ22 ℎ23 𝑦� ℎ31 ℎ32 ℎ33 𝑤 � 𝑤 �′ So 𝐻 is unique up to scale, i.e. 𝐻 = 𝜆𝜆 ∀ 𝜆 ∈ ℝ\ 0

The projective plane Transformations • One characteristic of homographies is that they preserve lines, in fact any invertible transformation of  2 that preserves lines is a homography • Examples – Central projection from one plane to another is a homography Hence if we take an image with a perspective camera of a flat surface from an angle, we can remove the perspective distortion with a homography

𝒙

𝒙𝒙

Perspective distortion

Without distortion

Images from http://www.robots.ox.ac.uk/~vgg/hzbook.html

The projective plane Transformations • One characteristic of homographies is that they preserve lines, in fact any invertible transformation of  2 that preserves lines is a homography • Examples – Central projection from one plane to another is a homography – Two images, captured by perspective cameras, of the same planar scene is related by a homography

Image 1 Image 2

The projective plane Transformations • One characteristic of homographies is that they preserve lines, in fact any invertible transformation of  2 that preserves lines is a homography • Examples – Central projection from one plane to another is a homography – Two images, captured by perspective cameras, of the same planar scene is related by a homography

• One can show that the product of two homographies also must be a homography We say that the homographies constitute a group – the projective linear group 𝑃𝑃 3 • Within this group there are several more specialized subgroups

Transformations of the projective plane Transformation of 2

Matrix

Euclidean

𝑅 𝟎𝑻

Translation

Similarity Affine

Homography /projective

#DoF

Preserves

𝐼 𝟎𝑻

𝒕 1

2

Orientation + all below

3

Lengths + all below

𝑠𝑅 𝟎𝑻

𝒕 1

4

Angles + all below

6

Parallelism, line at infinity + all below

8

Straight lines

𝒕 1

𝑎11 𝑎12 𝑎13 𝑎21 𝑎22 𝑎23 0 0 1 ℎ11 ℎ12 ℎ13 ℎ21 ℎ22 ℎ23 ℎ31 ℎ32 ℎ33

Visualization

26

The projective space • The relationship between the Euclidean space ℝ3 and the projective space 3 is much like the relationship between ℝ2 and  2 • In the projective space

– We represent points in homogeneous coordinates 𝑥� 𝜆𝑥� 𝑦� 𝜆𝑦� �= = ∀𝜆 ∈ ℝ\ 0 𝒙 𝑧̃ 𝜆𝑧̃ 𝑤 � 𝜆𝑤 �

– Points at infinity have last homogeneous coordinate equal to zero – Planes and points are dual objects �= 𝒙 � ∈ 3 | 𝝅 �=0 �𝑇𝒙 Π

 x  x  y  3 ∋ x =  y   x =   ∈  3   z  z    1   x   x   w   y    = 3 ∋ x  =   x  y   3 w  z   z      w   w

– The plane at infinity are made up of all points at infinity 27

Transformations of the projective space Transformation of 𝟑

Matrix

#DoF

Preserves

3

Orientation + all below

Euclidean

𝐼 𝒕 𝟎𝑻 1 𝑅 𝒕 𝟎𝑻 1

6

Volumes, volume ratios, lengths + all below

𝑠𝑅 𝟎𝑻

7

Angles + all below

Translation

Similarity

𝒕 1

Affine

 a11 a  21  a31   0

a12 a22 a32 0

a13 a23 a33 0

a14  a24   a34   1 

12

Parallelism of planes, The plane at infinity + all below

Homography /projective

 h11 h  21  h31   h41

h12 h22 h32 h42

h13 h23 h33 h43

h14  h24   h34   h44 

15

Intersection and tangency of surfaces in contact, straight lines

Summary • The projective plane  2

– Homogeneous coordinates – Line at infinity – Points & lines are dual

• Additional reading – Szeliski: 2.1.2, 2.1.3,

• The projective space 3

– Homogeneous coordinates – Plane at infinity – Points & planes are dual

• Linear transformations of  2 and  3

– Represented by homogeneous matrices – Homographies ⊃ Affine ⊃ Similarities ⊃ Euclidean ⊃ Translations 29

Summary • The projective plane  2

• Additional reading

– Homogeneous coordinates – Line at infinity – Points & lines are dual

– Szeliski: 2.1.2, 2.1.3, MATLAB WARNING When we work with linear transformations, we represent them as matrices that act on points by right multiplication

• The projective space 3

– Homogeneous coordinates – Plane at infinity – Points & planes are dual

• Linear transformations of

2

T : n x

and 

3

– Represented by homogeneous matrices – Homographies ⊃ Affine ⊃ Similarities ⊃ Euclidean ⊃ Translations

→ 

n y = MRx

Matlab seem to prefer left multiplication instead T : n xT

→ 

n yT = xT M L

So if you use built in matlab functions when you work with transformations, be careful!!! 30

Suggest Documents