E1 216 Computer Vision: Lecture 02: Camera Geometry
E1 216 Computer Vision: Lecture 02: Camera Geometry
2021
From previous lecture:
• UG course approval
• Linear algebra, Probability, SP, Programming
• Timing ? Extra Classes
• Discuss model-algorithm distinction later
Szeliski 2nd Edition
Projection Models
Pinhole Camera
Pinhole Camera
Why ?
Camera = Pinhole
Camera = Pinhole
Recovering 3D Geometry
• Consider two cameras (one is never enough)
• Take pictures
• Maps to points on image planes
• Know linear constraint on 3D point from left camera
• Use right camera constraint to intersect
Camera Geometry
Recovering 3D Geometry
• Consider two cameras (one is never enough)
• Take pictures
• Maps to points on image planes
• Know linear constraint on 3D point from left camera
• Use right camera constraint to intersect
Camera Geometry
Recovering 3D Geometry
• Consider two cameras (one is never enough)
• Take pictures
• Maps to points on image planes
• Know linear constraint on 3D point from left camera
• Use right camera constraint to intersect
Camera Geometry
Recovering 3D Geometry
• Consider two cameras (one is never enough)
• Take pictures
• Maps to points on image planes
• Know linear constraint on 3D point from left camera
• Use right camera constraint to intersect
Camera Geometry
Recovering 3D Geometry
• Consider two cameras (one is never enough)
• Take pictures
• Maps to points on image planes
• Know linear constraint on 3D point from left camera
• Use right camera constraint to intersect
Camera Geometry
Many Considerations
• Do we know camera parameters ? (intrinsic calibration)
• Do we know orientations of cameras ? (extrinsic calibration)
• Match features (representation,matching,robustness)
• Do the backprojected rays intersect ? (structure estimation)
• Extend this principle to multiple images
• Non-trivial, but many important advances
• State-of-the-art can handle large datasets (> 104 images)
Camera Geometry
Many Considerations
• Do we know camera parameters ? (intrinsic calibration)
• Do we know orientations of cameras ? (extrinsic calibration)
• Match features (representation,matching,robustness)
• Do the backprojected rays intersect ? (structure estimation)
• Extend this principle to multiple images
• Non-trivial, but many important advances
• State-of-the-art can handle large datasets (> 104 images)
Camera Geometry
Many Considerations
• Do we know camera parameters ? (intrinsic calibration)
• Do we know orientations of cameras ? (extrinsic calibration)
• Match features (representation,matching,robustness)
• Do the backprojected rays intersect ? (structure estimation)
• Extend this principle to multiple images
• Non-trivial, but many important advances
• State-of-the-art can handle large datasets (> 104 images)
Camera Geometry
Many Considerations
• Do we know camera parameters ? (intrinsic calibration)
• Do we know orientations of cameras ? (extrinsic calibration)
• Match features (representation,matching,robustness)
• Do the backprojected rays intersect ? (structure estimation)
• Extend this principle to multiple images
• Non-trivial, but many important advances
• State-of-the-art can handle large datasets (> 104 images)
Camera Geometry
Many Considerations
• Do we know camera parameters ? (intrinsic calibration)
• Do we know orientations of cameras ? (extrinsic calibration)
• Match features (representation,matching,robustness)
• Do the backprojected rays intersect ? (structure estimation)
• Extend this principle to multiple images
• Non-trivial, but many important advances
• State-of-the-art can handle large datasets (> 104 images)
Camera Geometry
Many Considerations
• Do we know camera parameters ? (intrinsic calibration)
• Do we know orientations of cameras ? (extrinsic calibration)
• Match features (representation,matching,robustness)
• Do the backprojected rays intersect ? (structure estimation)
• Extend this principle to multiple images
• Non-trivial, but many important advances
• State-of-the-art can handle large datasets (> 104 images)
Camera Geometry
Many Considerations
• Do we know camera parameters ? (intrinsic calibration)
• Do we know orientations of cameras ? (extrinsic calibration)
• Match features (representation,matching,robustness)
• Do the backprojected rays intersect ? (structure estimation)
• Extend this principle to multiple images
• Non-trivial, but many important advances
• State-of-the-art can handle large datasets (> 104 images)
What’s a Good Camera Model ?
Camera Systems
• Camera imaging surface - typically a rectangular plane
• Human retina is closer to a spherical surface
• Vastly different image plane geometries
• Fundamental 3D-2D imaging model is the same
• Spatial sampling is uniform for typical cameras
• Omnidirectional cameras
Camera Model : Perspective Projection
Y
X X
y
x
x fY/Z
C Z C
p p Z
principal axis f
camera
centre image plane
Science for the Curious Photographer; Forstyh and Ponce 2nd Edition.
Camera Model : Perspective Projection
fX
x= Z
fY
y= Z
Implications
• Different points are scaled different according to depth
• Introduces non-linearities in the relationships
• Distant objects are smaller
• Cannot judge object size with a single image
Perspective projection
• Cannot judge object size with a single image
• Judgement of size can be wrong!
From twitter.com/rainmaker1973
Y
Y
X X
y
x
x fY/Z
C Z C
p p Z
principal axis f
camera
centre image plane
f
x X
=
y Z Y
Now let’s translate the frame of reference (or camera), new co-ordinates
0
f
x X + tx
0 =
y Z + tz Y + ty
Camera Model (contd.)
f
x X
=
y Z Y
Now let’s translate the frame of reference (or camera), new co-ordinates
0 (X + tx )
x = f
(Z + tz )
0 (Y + ty )
y = f
(Z + tz )
Camera Model (contd.)
Geometric approaches
• “Purist” view - co-ordinate free approach to geometry
• Classical theorems due to Euclid
• Since Descartes, there’s an algebraic view of geometric constructs
• Duality : Geometry ↔ Algebra
T
• Circle : Centre + Radius ↔ (p − p 0 ) (p − p 0 ) = r 2
Homogeneous Representations
Consider a line y = mx + c
Rewrite as mx − y + c = 0
or generally as
ax+by+c = 0
x
a b c y =0
1
Homogeneous Representation of a Line
p
z }| {
x
a b c y =0
| {z } 1
l
lT p = 0
m2
y = (y − c1 ) + c2
m1
m2 c1 m2
(1 − )y = c2 −
m1 m1
(c2 − c1mm12 )
y = =
(1 − mm21 )
Quite a mess!!
Homogeneous Representation of a Line
l 1T p = 0
l 2T p = 0
p = l1 × l2
Verify
• l 1 T (l 1 × l 2 ) = 0
• l 2 T (l 1 × l 2 ) = 0
• Much cleaner way of solving
Homogeneous Representation of a Line
Consider the line through two given points
(X1,Y1)
Line : Y=mX+c
(X2,Y2)
Line : l = p 1 × p 2
p
z }| {
x
a b c y =0
| {z } 1
l
lT p = 0
Homogeneous Inhomogeneous
Rn 7→ Rn+1 Rn 7→ Rn−1
u
u u
u w
7 v
→ v 7→ v
v w
1 w 1
Homogeneous Forms
• Embed in higher dimensions by appending a 1 (canonical)
• Homogeneous forms are equivalent upto scale
• Only ratios matter
• [u, v, w] = λ [u, v, w] , ∀λ 6= 0
• Notice [0, 0, 0] is not admissible
Homogeneous Representation
Homogeneous Inhomogeneous
Rn 7→ Rn+1 Rn 7→ Rn−1
u
u u
u w
7 v
→ v 7→ v
v w
1 w 1
Homogeneous Forms
• Embed in higher dimensions by appending a 1 (canonical)
• Homogeneous forms are equivalent upto scale
• Only ratios matter
• [u, v, w] = λ [u, v, w] , ∀λ 6= 0
• Notice [0, 0, 0] is not admissible
Geometries in Computer Vision
Axioms of incidence
• Familiar concepts from Euclidean geometry
• Length is a fundamental property of Euclidean Geometry
• Construction with straightedge and compass
• Axioms of Euclid
Parallel Lines
T
• Recall line equation: l p = 0
T
• l and p upto scale factor l T p = (λl) (λ p) = 0
0
• Intersection point p ?
Homogeneous Forms
Parallel Lines
T
• Recall line equation: l p = 0
T
• l and p upto scale factor l T p = (λl) (λ p) = 0
0
• Intersection point p ?
Homogeneous Forms
Parallel Lines
T
• Recall line equation: l p = 0
T
• l and p upto scale factor l T p = (λl) (λ p) = 0
0
• Intersection point p ?
Homogeneous Forms
Parallel Lines
T
• Recall line equation: l p = 0
T
• l and p upto scale factor l T p = (λl) (λ p) = 0
0
• Intersection point p ?
Homogeneous Forms
Parallel Lines
T
• Recall line equation: l p = 0
T
• l and p upto scale factor l T p = (λl) (λ p) = 0
0
• Intersection point p ?
Homogeneous Forms
Parallel Lines
T
• Recall line equation: l p = 0
T
• l and p upto scale factor l T p = (λl) (λ p) = 0
0
• Intersection point p ?
Homogeneous Forms
Parallel Lines
T
• Recall line equation: l p = 0
T
• l and p upto scale factor l T p = (λl) (λ p) = 0
0
• Intersection point p ?
Homogeneous Forms
0 0
(c − c)b (c − c )a 0
p = l1 × l2 =
= [b, −a, 0]
Parallel Lines
• Recall line equation: l = p 1 × p 2
• l and p upto scale factor
• Intersection of two lines p = l 1 × l 2
• When are lines parallel ?
• l1 = a b c
0
• l2 = a b c
• Intersection point p ?
Homogeneous Forms
0 0
(c − c)b (c − c )a 0
p = l1 × l2 =
= [b, −a, 0]
Parallel Lines
• Recall line equation: l = p 1 × p 2
• l and p upto scale factor
• Intersection of two lines p = l 1 × l 2
• When are lines parallel ?
• l1 = a b c
0
• l2 = a b c
• Intersection point p ?
Affine Geometry
Consider v 1 , v 2 ∈ R2
Linear combination: Span {v 1 , v 2 }
Affine combination: Line in R2
Affine Combinations
Linear Combinations
Consider vectors v 1 , · · · , v k ∈ Rn
Consider vectors v 1 , · · · , v k ∈ Rn
Affine Combination: λ1 v 1 + · · · λk v k
Linear Combination:
λ1 , · · · , λk ∈ R
λ1 v 1 + · · · + λk v k ∈ Rn
Restriction: λ1 + · · · + λk = 1
λ1 , · · · , λk ∈ R
Recall further restriction λi ≥ 0
Affine Geometry
Affine Subspace
Vector Subspace • A ⊆ Rn
• A⊆R n
• No origin
• 0∈A • a ∈ A ⇒ λa ∈ A
• a ∈ A ⇒ λa ∈ A • a, b ∈ A ⇒ λa + (1 − λ)b ∈ A
• a, b ∈ A ⇒ a + b ∈ A • A − a is a vector space for any
• Points and vectors coincide a∈A
• Equipped with inner product • Vectors only as differences
• Distances and angles preserved (translations)
• Only parallelism is preserved
Affine Geometry
Affine Subspaces
• Consider the 2D plane, but forget origin
• What can two independent observers agree upon ?
• Second observer assumes that p is the origin
• Adding two vectors a and b results in p + (a − p) + (b − p)
• When linear combination is λa + (1 − λ)b, observers agree
• Observers know the “affine structure” but not the “linear structure”
• Direction is a fundamental property here, not length
wikipedia
Projective Geometry
Basic Definition
• n-dim real affine space is set of all points
(x1 , · · · , xn ) Rn
• Projective space Pn given by
• (x1 , · · · , xn , xn+1 ) Rn+1
• at least one xi is non-zero
• for λ 6= 0, all (λx1 , · · · , λxn , λxn+1 ) are equivalent
• Homogeneous coordinates obtained by (x1 , · · · , xn , 1)
Homogeneous Form
0 0
x x x x
h11 h12 h13 h11 h12 h13
0
h23 y
0
y = h21 h22 y = h21 h22 h23 y
z z
0 0
z h31 h32 h33 z h31 h32 h33
Two interpretations
• Euclidean vs. Projective transformations
• H : R3 → R3 (9 dof)
• H : P2 → P2 (8 dof)
Projective Geometry
We now have
x X
1
y = Y
Z
1 Z
Recall, that scaled points are projectively equivalent, i.e.
x X
y = Y
1 Z
p=P
X
1 0 0 0
x
y = 0 Y
1 0 0
Z
1 0 0 1 0
1
Taking a Picture
• 3D Point in Homogeneous Form
• Rigid 3D Motion
• Ideal Pinhole Camera
• Image Projection
• P3 → P2
Projective Geometry
r11 r12 r13 X
tx
1 0 0 0
x r21
y = 0 1 0 0 r22 r23 ty Y
r31 r32 r33 tz Z
1 0 0 1 0 1
0 0 0 1
Taking a Picture
• 3D Point in Homogeneous Form
• Rigid 3D Motion
• Ideal Pinhole Camera
• Image Projection
• P3 → P2
Projective Geometry
Taking a Picture
• 3D Point in Homogeneous Form
• Rigid 3D Motion
• Ideal Pinhole Camera
• Image Projection
• P3 → P2
Projective Geometry
r r12 r13 tx
X
1 0 0 0 11
x r21
y = 0 1 0 0 r22 r23 ty Y
r31 r32 r33
0 0 1 0 tz Z
1
0 0 0 1 1
Taking a Picture
• 3D Point in Homogeneous Form
• Rigid 3D Motion
• Ideal Pinhole Camera
• Image Projection
• P3 → P2
Projective Geometry
Taking a Picture
• 3D Point in Homogeneous Form
• Rigid 3D Motion
• Ideal Pinhole Camera
• Ideal Projection
• P3 → P2
Projective Geometry
Taking a Picture
• 3D Point in Homogeneous Form
• Rigid 3D Motion
• Ideal Pinhole Camera
• Image Projection
• P3 → P2
Projective Geometry
Taking a Picture
• 3D Point in Homogeneous Form
• Rigid 3D Motion
• Ideal Pinhole Camera
• Image Projection
• P3 → P2