72
1 Photogrammetry & Robotics Lab Homogeneous Coordinates Cyrill Stachniss The slides have been created by Cyrill Stachniss.

Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

1

Photogrammetry & Robotics Lab

Homogeneous Coordinates

Cyrill Stachniss

The slides have been created by Cyrill Stachniss.

Page 2: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

2

5 Minute Preparation for Today

https://www.ipb.uni-bonn.de/5min/

Page 3: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

3

A Point in the 3D Euclidean World

Is this always the best representation of geometric object in the 3D world?

Page 4: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

4

Pinhole Camera §  Popular model to approximate the imaging

process of a perspective camera

virtual image

pinhole

image plane

Image Courtesy: Forsyth and Ponce

Page 5: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

5

Pinhole Camera Model

§  A box with an infinitesimal small hole

§  Camera center is the intersection point of the rays

§  The back wall is the image plane §  The distance between the camera

center and image plane is the camera constant

Page 6: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

6

Geometry and Images

Image courtesy: Förstner What can we say about the geometry?

Page 7: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

7

Pinhole Camera Properties

§  Line-preserving: straight lines are mapped to straight lines

§  Not length-preserving: size of objects is inverse proportional to the distance

§  Not angle-preserving: Angles between lines change

Page 8: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

8

Perspective Projection

§  Straight lines stay straight §  Parallel lines may not remain parallel

Image courtesy: Förstner

Page 9: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

9

Vanishing Point (DE: Fluchtpunkt)

Image Courtesy: J. Jannene

Page 10: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

10

Vanishing Points

§  Parallel lines are not parallel anymore §  All mapped parallel lines intersect in a

vanishing point §  The vanishing point is the “point at

infinity” for the parallel lines §  Every direction has exactly one

vanishing point

How to describe “points at infinity”?

Page 11: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

11

Projective Geometry Motivation

§  Euclidian geometry is suboptimal to describe the central projection

§  In Euclidian geometry, the math can get difficult

§  Projective geometry is an alternative algebraic representation of geometric objects and transformations

Page 12: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

12

Homogeneous Coordinates

§  H.C. are a system of coordinates used in projective geometry

§  Formulas involving H.C. are often simpler than in the Cartesian world

§  Points at infinity can be represented using finite coordinates

§  A single matrix can represent affine and projective transformations

Page 13: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

13

Notation

Point (or or ) §  in homogeneous coordinates §  in Euclidian coordinates Line (or ) §  in homogeneous coordinates Plane §  in homogeneous coordinates 2D vs. 3D space §  lowercase = 2D; capitalized = 3D

Page 14: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

14

Homogeneous Coordinates

Definition The representation of a geometric object is homogeneous if and represent the same object for

Example

homogeneous Euclidian

Page 15: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

15

Homogeneous Coordinates

§  H.C. use a n+1 dimensional vector to represent the n-dimensional Euclidian point

§  Set dimension n+1 to the value 1 §  Example for

Page 16: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

16

Homogeneous Coordinates

Definition The representation of a geometric object is homogeneous if and represent the same object for

Example

homogeneous Euclidian

Page 17: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

17

Definition

§  Homogeneous Coordinates of a point in the plane is a 3-dim. vector

§  it corresponds to Euclidian coordinates

Page 18: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

18

Example: Projective Plane

The projective plane or contains §  All points of the Euclidian plane

with expressed through the 3-valued vector (e.g., )

§  and all points at infinity, i.e.,

§  except

Page 19: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

19

From Homogeneous to Euclidian Coordinates

homogeneous Euclidian

Page 20: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

20

From Homogeneous to Euclidian Coordinates

Image courtesy: Förstner

Page 21: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

21

3D Points

Analogous for points in 3D Euclidian space

homogeneous Euclidian

Page 22: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

22

Origin of the Euclidian Coordinate System in H.C.

Page 23: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

23

Transformations

Page 24: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

24

Transformations

§  A projective transformation is an invertible linear mapping

homogeneous vector

homogeneous vector

homogeneous matrix

Page 25: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

25

Fundamental Theorem of Projective Geometry §  Every one-to-one, straight-line

preserving mapping of a projective space onto itself is a homography (projectivity) for

§  Implies that all one-to-one, straight-line preserving transformations are linear if we use projective coordinates

Page 26: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

26

§  General projective mapping

§  Question: How should look like to realize relevant transformation?

§  Eg, translation, rotation, scale change, rigid-body, similarity, affine, projective

3D Transformations

Page 27: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

27

§  General projective mapping §  Translation: 3 parameters

(3 translations)

Important 3D Transformations

homogeneous property

Page 28: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

28

Important 3D Transformations

§  Rotation: 3 parameters (3 rotation)

rotation matrix

Page 29: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

29

Recap – Rotation Matrices §  2D:

§  3D:

Page 30: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

30

Important 3D Transformations

§  Rotation: 3 parameters (3 rotation)

§  Rigid body transformation: 6 params (3 translation + 3 rotation)

Page 31: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

31

Important 3D Transformations

§  Similarity transformation: 7 params (3 trans + 3 rot + 1 scale)

§  Affine transformation: 12 parameters (3 trans + 3 rot + 3 scale + 3 sheer)

(not angle-preserving but parallel lines remain parallel)

(angle-preserving)

Page 32: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

32

Important 3D Transformations

§  Projective transformation: 15 params.

§  These 3 parameters are the projective part and they are the reason that parallel lines may not stay parallel

affine transformation + 3 parameters

Page 33: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

33

Transformations for 2D

Image courtesy: Schindler

Page 34: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

34

Transformations Hierarchy projective transformation

(8/15 parameters)

affine transformation (6/12 parameters)

similarity transformation (4/7 parameters)

rigid body/motion transformation (3/6 parameters)

translation (2/3 parameters)

rotation (1/3 parameters)

Page 35: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

35

Inverting and Chaining

§  Inverting a transformation

§  Chaining transformations via matrix products (not commutative)

Page 36: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

36

Chaining and Inverting Transformations §  Chaining transformations via matrix

products (not commutative)

§  Inverting a transformation

Page 37: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

37

Homogeneous Lines (Images, 2D)

Page 38: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

38

Representations of Lines

§  Hesse normal form (angle , distance )

§  Intercept form

§  Standard form

Page 39: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

39

Representations of Lines

§  Hesse normal form

§  Intercept form

§  Standard form

All form linear equations that are equal to zero

Page 40: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

40

Representations of Lines

Hesse

intercept

standard

Page 41: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

41

Line Equation Can be Expressed by the Dot-Product

point

Hesse

intercept

standard

Page 42: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

42

Definition

§  Homogeneous Coordinates of a line in the plane is a 3-dim. vector

§  Corresponds to the Euclidian representation

Page 43: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

43

Test If a Point Lies on a Line

§  A point

§  lies on a line

§  if

Page 44: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

44

Intersecting Lines

§  Given two lines expressed in H.C., we look for the intersection

How to find the intersection of two lines?

Page 45: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

45

Intersecting Lines

§  Given two lines expressed in H.C., we look for the intersection

§  Find the point through the following system linear equations

Page 46: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

46

Reminder: Cramer’s rule

§  A system of linear equations can be solved via Cramer’s rule

§  with being the matrix in which the ith column is replaced by

§  Easily applicable for 2 by 2 systems

Page 47: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

47

Intersecting Lines

§  Solution of

§  through Cramer’s rule

Page 48: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

48

Intersecting Lines

§  Solution from Cramer’s rule

§  can be homogenously rewritten as

Page 49: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

49

Intersecting Lines

§  Thus, the solution of

§  can be expressed in vector form as

§  This is the cross product of the lines!

Page 50: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

50

Intersecting Lines

§  The intersection of two lines in H.C. is

§  Simple way for computing the intersection of two lines using H.C.

Page 51: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

51

Line Between Two Points

§  H.C. also offer a simple way for computing a line through two points

§  Given two points , find the line connecting both points

How to find a line that connects two given points?

Page 52: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

52

Line Between Two Points

§  H.C. also offer a simple way for computing a line through two points

§  Given two points , find the line connecting both points

§  We write that as (“wedge”) §  Solution via a system of linear eqns.

Page 53: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

53

Line Between Two Points

§  Cramer’s rule again solves

§  by

§  with

Page 54: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

54

Line Between Two Points

§  Cramer’s leads to

§  and we use

§  which results in

Page 55: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

55

Line Between Two Points

§  We again exploit the cross product and the homogeneous property

§  Thus we obtain

Page 56: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

56

Typical Line Operations

§  A point lies on a line if

§  Intersection of two lines

§  A line through two given points

Page 57: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

57

Points and Lines at Infinity

Page 58: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

58

Points at Infinity

§  It is possible to explicitly model infinitively distant points with finite coordinates

§  We can maintain the direction to that infinitively distant point

§  Great tool when working with cameras as they are bearing-only sensors

Page 59: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

59

Intersection at Infinity

§  All lines with pass through §  We can interpret as a line in Hesse

form

§  First two dimensions determine the direction of the line

§  This means

Hesse

Page 60: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

60

Intersection at Infinity

§  All lines with pass through §  This means §  This hold for any line parallel to ,

i.e. for any line

All parallel lines meet at one point at infinity!

Page 61: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

61

Intersection at Infinity

§  All lines with pass through §  This means §  This hold for any line parallel to ,

i.e. for any line §  This can also be seen by

All parallel lines meet at one point at infinity!

Page 62: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

62

Parallel Lines Meet at Infinity

Image Courtesy: J. Jannene

Page 63: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

63

Infinitively Distant Objects

§  Infinitively distant point

§  The infinitively distant line is the ideal line

§  can be interpreted as the horizon

Page 64: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

64

Infinitively Distant Objects

§  All points at infinity lie on the line at infinity called the ideal line given by

§  The ideal line can be seen as the horizon

Page 65: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

65

Analogous for 3D Objects

§  3D point

§  Plane

Page 66: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

66

Point on a Plane

§  Via the scalar product, we can again test if a point lies on a plane

§  which is based on

or

Page 67: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

67

3D Objects at Infinity

§  3D point

§  Plane

Page 68: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

68

Conclusion

§  Homogeneous coordinates are an alternative representation for geometric objects

§  They can simplify mathematical expressions

§  They can model points at infinity §  Easy chaining and inversion of

transformations §  Uses an extra dimension (n+1) §  Equivalence up to scale

Page 69: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

69

5 Minute Summary

https://www.youtube.com/watch?v=PvEl63t-opM

Page 70: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

70

Being Familiar with Homogeneous Coordinates is Key for the Remaining Course

Page 71: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

71

Literature

§  Förstner & Wrobel: Photogrammetric Computer Vision, Springer, 2016 § Chapter 5.1 – 5.3: H.C., points & lines § Chapter 6.1 – 6.4: transformations

Page 72: Homogeneous Coordinates...Homogeneous Coordinates H.C. are a system of coordinates used in projective geometry Formulas involving H.C. are often simpler than in the Cartesian world

72

Slide Information §  The slides have been created by Cyrill Stachniss as part of the

photogrammetry and robotics courses. §  I tried to acknowledge all people from whom I used

images or videos. In case I made a mistake or missed someone, please let me know.

§  The photogrammetry material heavily relies on the very well written lecture notes by Wolfgang Förstner and the Photogrammetric Computer Vision book by Förstner & Wrobel.

§  Parts of the robotics material stems from the great Probabilistic Robotics book by Thrun, Burgard and Fox.

§  If you are a university lecturer, feel free to use the course material. If you adapt the course material, please make sure that you keep the acknowledgements to others and please acknowledge me as well. To satisfy my own curiosity, please send me email notice if you use my slides. Cyrill Stachniss, [email protected]