Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅...

29
Lecture 1.3 Basic projective geometry Thomas Opsahl

Transcript of Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅...

Page 1: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Lecture 1.3 Basic projective geometry

Thomas Opsahl

Page 2: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Motivation

2

β€’ 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

Page 3: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Motivation

3

β€’ 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

Page 4: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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

( )11 12

21 22 21

0 0 1

ABxA A

A A AB BB B Bx

r r tR

T r r t SEΞΎ

= = ∈

t0

𝐴 𝐡

πœ‰π΅π΄

𝑇𝐡𝐴

Page 5: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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

( )11 12 13

21 22 23

31 32 33

31

0 0 0 1

ABx

A A AA A B B By

B B ABz

r r r tR r r r t

T SEr r r t

ΞΎ

= = ∈

t0

𝐴 𝐡

πœ‰π΅π΄

𝑇𝐡𝐴

Page 6: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Introduction

β€’ And we have seen how they can transform points from one reference frame to another if we represent points in homogeneous coordinates

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

1

xx

yy

= =

p p

1

xx

yy

zz

= =

p p

Page 7: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Introduction

β€’ Euclidean geometry – πœ‰π΅π΄ ⟼ 𝑅𝐡𝐴 , 𝒕𝐡𝐴 – Complicated algebra

β€’ Projective geometry

– πœ‰π΅π΄ ⟼ 𝑇𝐡𝐴 = 𝑅𝐡𝐴 𝒕𝐡𝐴

𝟎 1

– Simple algebra

β€’ 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

( ) ( )( )

, ,

,

A A B A A B AB B B

A A B A A A B A B AC B C C C B C B C B

A A T A T AB C C C

R

R R R R

R R

ΞΎ

ΞΎ ΞΎ ΞΎ

ΞΎ

= β‹… = +

= βŠ• = +

βˆ’

p p p p t

t t t

t

1

A A B A A BB B

A A B A A BC B C C B C

A AB B

TT T T

T

ΞΎΞΎ ΞΎ ΞΎ

ΞΎ βˆ’

= β‹… == βŠ• =

p p p p

Page 8: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Points

How to describe points in the plane?

Page 9: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Points

xy x

2

How to describe points in the plane? Euclidean plane ℝ2 β€’ Choose a 2D coordinate frame β€’ Each point corresponds to a unique pair

of Cartesian coordinates 𝒙 = π‘₯,𝑦 ∈ ℝ2 ⟼ 𝒙 =

π‘₯𝑦

Page 10: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Points

xy

w

x

y

1

x

x

2

How to describe points in the plane? 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

2

Page 11: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Points

xy

w

x

y

1

x

x

2

Observations 1. Any point 𝒙 = π‘₯,𝑦 in the Euclidean

plane has a corresponding homogeneous point 𝒙� = π‘₯,𝑦, 1 in the projective plane

2. Homogeneous points of the form π‘₯οΏ½,𝑦�, 0 does not have counterparts in the Euclidean plane They correspond to points at infinity and are called ideal points

2

Page 12: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Points

xy

w

x

y

1

x

x

2

Observations 3. When we work with geometrical

problems in the plane, we can swap between the Euclidean representation and the projective representation

2

2 2

2 2

1

xx

yy

x xwy

yw w

βˆ‹ = = ∈ βˆ‹ = =

x x

x x

Page 13: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Example

1. These homogeneous vectors are different numerical representations of the same point in the plane

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

, 23 ∈ ℝ2

2

3 6 302 4 201 2 10

βˆ’ = = = βˆ’ ∈ βˆ’

x

Page 14: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Lines

How to describe lines in the plane?

Page 15: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Lines

xy l

2

How to describe lines in the plane? Euclidean plane ℝ2 β€’ 3 parameters π‘Ž, 𝑏, 𝑐 ∈ ℝ

𝑙 = π‘₯,𝑦 | π‘Žπ‘₯ + 𝑏𝑦 + 𝑐 = 0

Page 16: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Lines

How to describe lines in the plane? Euclidean plane ℝ2 β€’ Triple π‘Ž, 𝑏, 𝑐 ∈ ℝ3\ 𝟎

𝑙 = π‘₯,𝑦 | π‘Žπ‘₯ + 𝑏𝑦 + 𝑐 = 0 Projective plane 2 β€’ Homogeneous vector οΏ½ΜƒοΏ½ = π‘Ž, 𝑏, 𝑐 𝑇

𝑙 = 𝒙� ∈ 2 | �̃�𝑻𝒙� = 0

xy

w

x

y

1

l

l

2

2

Page 17: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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. 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 This line consists entirely of ideal points, and is know as the line at infinity

xy

w

x

y

1

l

l

2

2

Page 18: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

The projective plane Lines

Properties of lines in the projective plane 1. In the projective plane, all lines

intersect, parallel lines intersect at infinity Two lines οΏ½ΜƒοΏ½1 and οΏ½ΜƒοΏ½2 intersect in the point

𝒙� = οΏ½ΜƒοΏ½1Γ—οΏ½ΜƒοΏ½2

2. The line passing through points 𝒙�1 and 𝒙�2 is given by

οΏ½ΜƒοΏ½ = 𝒙�1×𝒙�2

xy

w

x

y

1

l

l

2

2

Page 19: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Matrix representation of the cross product

𝒖 Γ— 𝒗 ⟼ 𝒖 ×𝒗 where

Example

Determine the line passing through the two points 𝟐,πŸ’ and πŸ“,𝟏𝟏 Homogeneous representation of points Homogeneous representation of line Equation of the line

2 21 2

2 54 131 1

= ∈ = ∈

x x

[ ]3 2

3 1

2 1

00

0

defu u

u uu u

Γ—

βˆ’ = βˆ’ βˆ’

u[ ]1 2 1 2

0 1 4 5 9 31 0 2 13 3 14 2 0 1 6 2

Γ—

βˆ’ βˆ’ βˆ’ = Γ— = = βˆ’ = = βˆ’

l x x x x

3 2 0 3 2x y y xβˆ’ + + = ⇔ = βˆ’

Page 20: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Example

21

A point at infinity

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

Page 21: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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

Page 22: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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

𝒙 𝒙′ Without distortion Perspective distortion

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

Page 23: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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

Page 24: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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

Page 25: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Transformations of the projective plane

26

Transformation of 2 Matrix #DoF Preserves Visualization

Translation

𝐼 π’•πŸŽπ‘» 1

2 Orientation + all below

Euclidean

𝑅 π’•πŸŽπ‘» 1

3 Lengths + all below

Similarity

𝑠𝑅 π’•πŸŽπ‘» 1

4 Angles + all below

Affine π‘Ž11 π‘Ž12 π‘Ž13π‘Ž21 π‘Ž22 π‘Ž230 0 1

6 Parallelism,

line at infinity + all below

Homography /projective

β„Ž11 β„Ž12 β„Ž13β„Ž21 β„Ž22 β„Ž23β„Ž31 β„Ž32 β„Ž33

8 Straight lines

Page 26: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

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

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

27

3 3

3 3

1

xx

yy

zz

xx wy y

wzzw w

βˆ‹ = = ∈

βˆ‹ = =

x x

x x

Page 27: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Transformations of the projective space Transformation of 𝟏 Matrix #DoF Preserves

Translation

𝐼 π’•πŸŽπ‘» 1 3 Orientation

+ all below Euclidean

𝑅 π’•πŸŽπ‘» 1 6 Volumes, volume ratios, lengths

+ all below Similarity

𝑠𝑅 π’•πŸŽπ‘» 1 7 Angles

+ all below Affine 12 Parallelism of planes,

The plane at infinity + all below

Homography /projective

15 Intersection and tangency of surfaces in contact, straight lines

11 12 13 14

21 22 23 24

31 32 33 34

0 0 0 1

a a a aa a a aa a a a

11 12 13 14

21 22 23 24

31 32 33 34

41 42 43 44

h h h hh h h hh h h hh h h h

Page 28: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Summary

β€’ The projective plane 2 – Homogeneous coordinates – Line at infinity – Points & lines are dual

β€’ 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

β€’ Additional reading – Szeliski: 2.1.2, 2.1.3,

29

Page 29: Lecture 1.3 Basic projective geometry...Introduction β€’ Euclidean geometry – π΄πœ‰π΅ 𝐴𝑅𝐡, 𝐴𝒕𝐡 – Complicated algebra β€’ Projective geometry – π΄πœ‰π΅

Summary

β€’ The projective plane 2 – Homogeneous coordinates – Line at infinity – Points & lines are dual

β€’ 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

β€’ Additional reading – Szeliski: 2.1.2, 2.1.3,

30

MATLAB WARNING When we work with linear transformations, we represent them as matrices that act on points by right multiplication Matlab seem to prefer left multiplication instead So if you use built in matlab functions when you work with transformations, be careful!!!

: n n

R

TM

β†’=x y x

: n n

T T TL

TM

β†’=x y x