TEK5030
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
2
1 0 0 00 0 1 0 00 0 1 0 0 1 0
u u
v v
f s cf c
=
u x
Projective representation versus Euclidean
“Equal up to scale”
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
3
1 0 0 100 1 0
0 0 1
u u
v v
u u
v v
f s cf c
z
x yf s cz z
yf cz
= + +
= +
u x
u
Projective representation versus Euclidean
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 – Transformations
4
2
2
x
y 0 1
=
R ty x
1
0 1
−
=
R tx y
LINEAR
Projective representation versus Euclidean
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 – Transformations
5
NON LINEAR
2
2
x
y = +y Rx t
( )1−= −x R y t
Projective representation versus Euclidean
TEK5030
Points in the projective plane ℙ2 How to describe points in the plane?
6
TEK5030
Points in the projective plane ℙ2
xy x
2
How to describe points in the plane? Euclidean plane ℝ2 • Choose a 2D coordinate frame • Points have 2 unique coordinates
7
2xy
= ∈
x
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
Projective plane 2 • Expand coordinate frame to 3D • Points have 3 homogeneous coordinates
where
w
x
y
x2
xy x
2
1w =
8
2
xyw
= ∈
x
{ }\ 0λ λ= ∀ ∈x x
2xy
= ∈
x
TEK5030
Points in the projective plane ℙ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
w
x
y
x2
xy x
2
1w =
9
TEK5030
Points in the projective plane ℙ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
1
xx
yy
→
w
x
y
x2
xy x
2
1w =
10
2 2
xxwyy
ww
→
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
lx
y
2
12
TEK5030
Lines in the projective plane ℙ2 How to describe lines in the plane? Euclidean plane ℝ2 • 3 parameters 𝑎𝑎, 𝑏𝑏, 𝑐𝑐 ∈ ℝ
𝑙𝑙 = 𝑥𝑥,𝑦𝑦 | 𝑎𝑎𝑥𝑥 + 𝑏𝑏𝑦𝑦 + 𝑐𝑐 = 0 Projective plane 2 • Homogeneous vector 𝐥𝐥 = 𝑎𝑎, 𝑏𝑏, 𝑐𝑐 𝑇𝑇
𝑙𝑙 = 𝐱𝐱� ∈ 2 | �̃�𝐥𝑇𝑇𝐱𝐱� = 0
l
l
w
x
y
1w =
2
xy
2
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. 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
l
l
w
x
y
1w =
2
xy
2
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 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
l
l
w
x
y
1w =
2
xy
2
15
TEK5030
Example 1
Determine the line passing through the two points 𝐱𝐱𝟏𝟏 and 𝐱𝐱𝟐𝟐
( )( )
1
2
2,4
5,13
x
x
=
=
16
TEK5030
Example 1
Determine the line passing through the two points 𝐱𝐱𝟏𝟏 and 𝐱𝐱𝟐𝟐 Homogeneous representation of the points Homogeneous representation of line Equation of the line
2 21 2
2 54 131 1
= ∈ = ∈
x x
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− + + = ⇔ = −
Matrix representation of the cross product where
1 3 2
2 3 1
3 2 1
00
0
defu u uu u uu u u
∧ − = − −
( )( )
1
2
2,4
5,13
x
x
=
=
∧×u v u v
17
TEK5030
Example 2
At which point does these two lines intersect?
22 3
y xy x= −= − +
18
TEK5030
Example 2
At which point does these two lines intersect? Point of intersection
22 3
y xy x= −= − +
21
12 1
2y x
= − = − ∈ −
l 22
22 3 1
3y x
− = − + = − ∈
l
1 2 1 2
0 2 1 2 52 0 1 1 1
1 1 0 3 3
∧
− − − = × = = − − − =
−
x l l l l
51.673
1 0.333
− −= ≈ − −
x⇒
19
TEK5030
Example 3
At which point does these two lines intersect?
23
y xy x= −= +
20
TEK5030
Example 3
At which point does these two lines intersect?
23
y xy x= −= +
Euclidean geometry Parallel lines never intersect!
21
TEK5030
Example 3
At which point does these two lines intersect? Point of intersection
21
12 1
2y x
= − = − ∈ −
l 22
13 1
3y x
= + = − ∈
l
1 2 1 2
0 2 1 1 52 0 1 1 5
1 1 0 3 0
∧
− − = × = = − − − = −
x l l l l
23
y xy x= −= +
Euclidean geometry Parallel lines never intersect!
Projective geometry All lines intersect! Parallel lines intersect at infinity
22
TEK5030
Example 4
23
Image: Flicker.com (Melita)
Cameras can observe points that are “infinitely” far away 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
1 0 0 00 0 1 0 00 0 1 0 0 0
01
u u
v v
xf s c
yf c
z
=
u
TEK5030
Example 4
24
Cameras can observe points that are “infinitely” far away 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)
The line at infinity
1 0 0 00 0 1 0 00 0 1 0 0 0
01
u u
v v
xf s c
yf c
z
=
u
TEK5030
Example 4
25
Different directions correspond to different points at infinity The set of all infinite points constitute the line at infinity
TEK5030
Linear transformations of the projective plane ℙ2
• A linear transformation of ℙ2 can be represented by a invertible homogeneous 3 × 3 matrix where
• Important groups of linear projective transformations
• Each group is closed under – Matrix multiplication – Matrix inverse
26
2 2:H →
x Hx
{ }0\λ λ= ∀ ∈H H
Euclidean Similarities Affine
Homographies
TEK5030
Transformation Matrix #DoF Preserves Visualization
Euclidean
3 Lengths + all below
Similarity
4 Angles + all below
Affine 6 Parallelism, line at infinity + all below
Homography 8 Straight lines
Linear transformations of the projective plane ℙ2
27
1T
R t0
1T
ss ∈
R t0
11 12 13
21 22 23
0 0 1
a a aa a a
11 12 13
21 22 23
31 32 33
h h hh h hh h h
TEK5030
Linear transformations of the projective plane ℙ2
• Several image operations correspond to a linear projective transformation – Rotation – Translation – Resizing
28
1T
=
R tH
0
=t 0
TEK5030
Linear transformations of the projective plane ℙ2
• Several image operations correspond to a linear projective transformation – Rotation – Translation – Resizing
29
1T
=
R tH
0
≠t 0
TEK5030
Linear transformations of the projective plane ℙ2
• Several image operations correspond to a linear projective transformation – Rotation – Translation – Resizing
30
1T
s =
R tH
0
1s=<=
t 0
R I
TEK5030
Linear transformations of the projective plane ℙ2
• Perspective imaging of a flat surface can be described by a homography
31
𝑥𝑥 𝑧𝑧 c
𝑦𝑦
surface
image u
vFlat surface with a 2D
coordinate frame
surface image=Hx u
x
u
TEK5030
Linear transformations of the projective plane ℙ2
• The central projection between two planes corresponds to a homography
32
1 2=Hx y
𝑥𝑥 𝑧𝑧 c
𝑦𝑦
y
1
2
x
TEK5030
Linear transformations of the projective plane ℙ2
• For images of a flat surface, a homography can be used to «change» the camera position
33
http://www.robots.ox.ac.uk/~vgg/hzbook.html http://www.robots.ox.ac.uk/~vgg/hzbook.html
H
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
– Points at infinity have 𝑤𝑤� = 0 – We can transform between ℝ3 and 3
34
{ }\ 0
x xy yz zw w
λ λ
= = ∀ ∈
x
3 3
xx wy y
wzzw w
→
x x
3 3
1
xx
yy
zz
→
x x
TEK5030
Linear transformations of the projective space ℙ3 Transformation of 𝟑𝟑 Matrix #DoF Preserves
Euclidean
6 Volumes, volume ratios, lengths + all below
Similarity
7 Angles + all below
Affine 12 Parallelism of planes, The plane at infinity + all below
Homography 15 Intersection and tangency of surfaces in contact, straight lines
1T
R t0
1T
ss ∈
R t0
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
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
36
2 2
x xwy
yw w
→
x x
2 2
1
xx
yy
→
x x
Euclidean Similarities Affine
Homographies
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