Lecture 1.
3
Basic projective geometry
Thomas Opsahl
TEK5030
Motivation
• Projective geometry is an alternative to
Euclidean geometry
• Many results, derivations and expressions
in computer vision are easiest described in
the projective framework
– The perspective camera model Projective representation versus Euclidean
fu s cu 1 0 0 0
u = 0 fv cv 0 1 0 0 x
0 0 1 0 0 1 0
“Equal up to scale”
2
TEK5030
Motivation
• Projective geometry is an alternative to
Euclidean geometry
• Many results, derivations and expressions
in computer vision are easiest described in
the projective framework
– The perspective camera model Projective representation versus Euclidean
fu s cu
1 0 0
cv x
1
u= 0 fv
0 1 0 0 0 z
1
x y
f
uz + s + cu
z
u=
f +c y
v
z
v
3
TEK5030
Motivation
2
−1
• Projective geometry is an alternative to R t
Euclidean geometry x x = y
0 1
• Many results, derivations and expressions
in computer vision are easiest described in LINEAR
the projective framework
– The perspective camera model
– Transformations R t
2
y y = x
0 1
Projective representation versus Euclidean
4
TEK5030
Motivation
2
• Projective geometry is an alternative to
Euclidean geometry x =x R −1 ( y − t )
• Many results, derivations and expressions
in computer vision are easiest described in NON LINEAR
the projective framework
– The perspective camera model
– Transformations
2
y =
y Rx + t
Projective representation versus Euclidean
5
TEK5030
Points in the projective plane ℙ2
How to describe points in the plane?
6
TEK5030
Points in the projective plane ℙ2
How to describe points in the plane?
Euclidean plane ℝ2
• Choose a 2D coordinate frame
• Points have 2 unique coordinates
x
=
x ∈ 2
y x y
x
2
7
TEK5030
Points in the projective plane ℙ2
How to describe points in the plane?
Euclidean plane ℝ2
x • Choose a 2D coordinate frame
2 • Points have 2 unique coordinates
w
x
=
x ∈ 2
y x y
x
Projective plane 2
2 • Expand coordinate frame to 3D
y • Points have 3 homogeneous coordinates
x
w = 1 x y ∈ 2
=
x
w
where
x λ x ∀λ ∈ \ {0}
=
8
TEK5030
Points in the projective plane ℙ2
Observations
1. Any point 𝐱𝐱 = 𝑥𝑥, 𝑦𝑦 𝑇𝑇 in the Euclidean
plane has a corresponding
x homogeneous point 𝐱𝐱� = 𝑥𝑥, 𝑦𝑦, 1 𝑇𝑇 in the
2 projective plane
w
y 2. Homogeneous points of the form
x 𝑥𝑥�, 𝑦𝑦�, 0 𝑇𝑇 does not have counterparts in
x the Euclidean plane
2
y They correspond to points at infinity
w = 1
x
9
TEK5030
Points in the projective plane ℙ2
Observations
3. When we work with geometrical
problems in the plane, we can swap
x between the Euclidean representation
2 and the projective representation
w
2 → 2
y x
x
x x y
y
2 1
y
2 → 2
w = 1
x x x
y w
y
w
w 10
TEK5030
Lines in the projective plane ℙ2
How to describe lines in the plane?
11
TEK5030
Lines in the projective plane ℙ2
How to describe lines in the plane?
Euclidean plane ℝ2
• 3 parameters 𝑎𝑎, 𝑏𝑏, 𝑐𝑐 ∈ ℝ
𝑙𝑙 = 𝑥𝑥, 𝑦𝑦 | 𝑎𝑎𝑎𝑎 + 𝑏𝑏𝑏𝑏 + 𝑐𝑐 = 0
y
l
x
2
12
TEK5030
Lines in the projective plane ℙ2
How to describe lines in the plane?
Euclidean plane ℝ2
• 3 parameters 𝑎𝑎, 𝑏𝑏, 𝑐𝑐 ∈ ℝ
2 𝑙𝑙 = 𝑥𝑥, 𝑦𝑦 | 𝑎𝑎𝑎𝑎 + 𝑏𝑏𝑏𝑏 + 𝑐𝑐 = 0
w
y Projective plane 2
l • Homogeneous vector 𝐥𝐥̃ = 𝑎𝑎, 𝑏𝑏, 𝑐𝑐 𝑇𝑇
x 𝑙𝑙 = 𝐱𝐱� ∈ 2 | ̃𝐥𝐥𝑇𝑇 𝐱𝐱� = 0
2
y
w = 1 l
x
13
TEK5030
Lines in the projective plane ℙ2
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
l corresponding line in the projective
x plane
2
y 3. The line 𝐥𝐥̃ = 0,0,1 𝑇𝑇 in the projective
plane does not have an Euclidean
w = 1 l counterpart
x This line consists entirely of ideal
points, and is know as the line at infinity
14
TEK5030
Lines in the projective plane ℙ2
Properties of lines in the projective plane
1. In the projective plane, all lines
intersect, parallel lines intersect at
infinity
2
w
Two lines 𝐥𝐥̃1 and 𝐥𝐥̃2 intersect in the point
y 𝐱𝐱� = 𝐥𝐥̃1 ×𝐥𝐥̃2
l
x 2. The line passing through points 𝐱𝐱�1 and
2 𝐱𝐱� 2 is given by
y 𝐥𝐥̃ = 𝐱𝐱�1 ×𝐱𝐱� 2
w = 1 l
x
15
TEK5030
Example 1
x1 = ( 2, 4 )
x2 = ( 5,13)
Determine the line passing through the two points 𝐱𝐱 𝟏𝟏 and 𝐱𝐱 𝟐𝟐
16
TEK5030
Matrix representation of
the cross product
Example 1 u × v u∧ v
x1 = ( 2, 4 )
x2 = ( 5,13) where
∧
Determine the line passing through the two points 𝐱𝐱 𝟏𝟏 and 𝐱𝐱 𝟐𝟐 u1 def 0 −u3 u2
u
= u 0 −u1
2 3
Homogeneous representation of the points u3 −u2 u1 0
2 5
x 1 = 4 ∈ 2 x 2 = 13 ∈ 2
1 1
Homogeneous representation of line
0 −1 4 5 −9 −3
l = x × x = x ∧ x = 1 0 −2 13 = 3 = 1
1 2 1 2
−4 2 0 1 6 2
Equation of the line
−3 x + y + 2 = 0 ⇔ y = 3 x − 2
17
TEK5030
Example 2
y= x − 2
y= −2 x + 3
At which point does these two lines intersect?
18
TEK5030
Example 2
y= x − 2
y= −2 x + 3
At which point does these two lines intersect?
1 −2
y =x − 2 l1 = −1 ∈ 2 y=−2 x + 3 l2 =− 1 ∈ 2
−2 3
Point of intersection
0 2 −1 −2 −5 −5
−3 1.67
x =l1 × l2 =l1∧ l2 = −2 0 −1 −1 = 1 ⇒ =x ≈
−
1 0.33
1 1 0 3 −3 −3
19
TEK5030
Example 3
y= x − 2
y= x + 3
At which point does these two lines intersect?
20
TEK5030
Example 3
y= x − 2 Euclidean geometry
y= x + 3 Parallel lines never intersect!
At which point does these two lines intersect?
21
TEK5030
Example 3
y= x − 2 Euclidean geometry
y= x + 3 Parallel lines never intersect!
At which point does these two lines intersect?
1 1
y =x − 2 l1 = −1 ∈ 2 y =x + 3 l2 = −1 ∈ 2
−2 3
Point of intersection
0 2 −1 1 −5 Projective geometry
x =l1 × l2 =l1∧ l2 = −2 0 −1 −1 = −5
All lines intersect!
1 1 0 3 0 Parallel lines intersect at infinity
22
TEK5030
Example 4
Cameras can observe points that are
“infinitely” far away
x
fu s cu 1 0 0 0
u = 0 cv 0 1 0 0
y
fv
z
0 0 1 0 0 1 0
0
In images of planar surfaces we can see
how the surface converges towards a line
Any two parallel lines in the plane will
appear to intersect on this line
Image: Flicker.com (Melita)
23
TEK5030
Example 4
Cameras can observe points that are
“infinitely” far away
x
fu s cu 1 0 0 0
u = 0 cv 0 1 0 0
y
fv
z
0 0 1 0 0 1 0 The line at infinity
0
In images of planar surfaces we can see
how the surface converges towards a line
Any two parallel lines in the plane will
appear to intersect on this line
Image: Flicker.com (Melita)
24
TEK5030
Example 4
Different directions correspond to different
points at infinity
The set of all infinite points constitute the
line at infinity
25
TEK5030
Linear transformations of the projective plane ℙ2
• A linear transformation of ℙ2 can be represented by a invertible homogeneous 3 × 3 matrix
H : 2 → 2
x Hx
where
H λ H ∀λ ∈ \ {0}
=
• Important groups of linear projective transformations
Homographies
• Each group is closed under
– Matrix multiplication
Affine Similarities Euclidean
– Matrix inverse
26
TEK5030
Linear transformations of the projective plane ℙ2
Transformation Matrix #DoF Preserves Visualization
Euclidean R t 3 Lengths
0T 1
+ all below
Similarity sR t 4 Angles
0T 1 s∈ + all below
Affine a11 a12 a13 6 Parallelism, line at
a a22 a23 infinity
21 + all below
0 0 1
Homography h11 h12 h13 8 Straight lines
h h22 h23
21
h31 h32 h33
27
TEK5030
Linear transformations of the projective plane ℙ2
• Several image operations correspond to a linear projective transformation
– Rotation
– Translation
– Resizing
R t
H= T
0 1
t=0
28
TEK5030
Linear transformations of the projective plane ℙ2
• Several image operations correspond to a linear projective transformation
– Rotation
– Translation
– Resizing
R t
H= T
0 1
t≠0
29
TEK5030
Linear transformations of the projective plane ℙ2
• Several image operations correspond to a linear projective transformation
– Rotation
– Translation
– Resizing
sR t
H= T
0 1
t=0
s <1
R=I
30
TEK5030
Linear transformations of the projective plane ℙ2
• Perspective imaging of a flat surface can be described by a homography
Hx surface = u image surface
image u x
c
u 𝑥𝑥 𝑧𝑧
v
Flat surface with a 2D
𝑦𝑦 coordinate frame
31
TEK5030
Linear transformations of the projective plane ℙ2
• The central projection between two planes corresponds to a homography
Hx 1 = y 2
1
2
c x
y
𝑥𝑥 𝑧𝑧
𝑦𝑦
32
TEK5030
Linear transformations of the projective plane ℙ2
• For images of a flat surface, a homography can be used to «change» the camera position
http://www.robots.ox.ac.uk/~vgg/hzbook.html http://www.robots.ox.ac.uk/~vgg/hzbook.html
33
TEK5030
The projective space ℙ3
• The relationship between the Euclidean space ℝ3 and the projective space 3 is much like
the relationship between ℝ2 and 2
– We represent points in homogeneous coordinates
x x
y y
x =
= λ ∀λ ∈ \ {0}
z z
w w
– Points at infinity have 𝑤𝑤
�=0 3 → 3 3 → 3
x x x x
– We can transform between ℝ3 and 3 x x x
x y w
y y
y
z z w
z z
1 w
w
34
TEK5030
Linear transformations of the projective space ℙ3
Transformation of 𝟑𝟑 Matrix #DoF Preserves
Euclidean R t 6 Volumes, volume ratios, lengths
T + all below
0 1
Similarity sR t 7 Angles
0T 1 s ∈ + all below
Affine a11 a12 a13 a14 12 Parallelism of planes,
a a a23 a24 The plane at infinity
21 22
a31 a32 a33 a34 + all below
0 0 0 1
Homography h11 h12 h13 h14 15 Intersection and tangency of
h h h23 h24 surfaces in contact, straight lines
21 22
h31 h32 h33 h34
h41 h42 h43 h44
35
TEK5030
Summary
• Projective plane ℙ2 and space ℙ3
– Alternative representation of points
– Homogeneous coordinates
– Can swap between ℝ𝑛𝑛 and ℙ𝑛𝑛
• Linear projective transformations
– Homogeneous matrices
– Several groups
2 → 2 2 → 2
x x x x
Homographies
x x x
y w x y
y y
Affine Similarities Euclidean w w 1
36
TEK5030
Further reading
• Do you want to know more?
• Online book by Richard Szeliski: Computer Vision: Algorithms and Applications
http://szeliski.org/Book/drafts/SzeliskiBook_20100903_draft.pdf
– Chapter 2 is about “image formation” and covers some projective geometry, focusing on
transformations, in section 2.1.1-2.1.4
37
TEK5030