Projective Geometry and Camera
Models
ENEE 731 Image Understanding
Kaushik Mitra
– 3D to 2D mapping
Camera
– 2D to 3D mapping
Preliminaries
• Projective geometry
– Projective spaces (P 2 )
– Homogenous coordinates
– Projective transformations (Homography)
Why Projective Geometry?
• Parallel lines converge to a point
• 2D -2D transformation
– Projective transformation (Homography)
Projective space P 2
• Projective space: set of points
– Each point is a line in R 3 passing through origin
• Motivated from camera geometry
• Alternative way
– P=(x,y,z) and P’=(x’,y’,z’) equivalent if and only if P=λP’
• λ ≠ 0
P 2 =R 2 U P 1
• (x, y, z) ≈ (λx, λy, λz)
• P 2 can be divided into two subsets
– Points with z ≠ 0
– Points with z= 0
• If z ≠ 0, (x, y, z) ≈ (x/z, y/z, 1)
– one-to-one mapping with R2
• If z=0 (x, y, 0)
– points at infinity
– line at infinity
– P 1
• P 2 = R 2 U P 1
• Homogenous coordinates P = (x, y, z) (up to a scale)
Projective Transformation
(Homography)
• Homography
– Invertible mapping h from P2 to P2
– Lines maps to lines
• x1, x2, x3 lie on a line h(x1), h(x2), h(x3) lie on a line
Homography matrix
• Theorem
– h:P2->P2 is homography h(x)=Hx, H nonsingular
• x’=Hx
– H, a homogenous matrix (up to scale)
– 8 dof
Hierarchy of Transformations
• Euclidean < Similarity < Affine < Projective
• Invariants
– Quantities that are preseved
• Euclidean: rotation and translation
– x’ = H
E x = [R t; 0 T 1]
– Invariants: length, angle, area
Hierarchy of Transformations
• Similarity: isotropic scale + (Euclidean)
– x’ = H
S x = [sR t; 0 T 1]
– Invariants: angle, ratios of length and area
• Affine: non-isotropic scales and skew
– x’ = H
A x = [A t; 0 T 1]; A non-singular
– Invariants: Parallel lines, ratio of areas
• Projective:
– x’ = H
P x = [A t; v T u]x
– Note: parallel lines not preserved
– Invariants: Colinearity, cross-ratio
Generalization: P n
• P 3 = R 3 + P 2
– P 2 : plane at infinity
• Homogenous coordinates: X= (X
1
, X
2
, X
3
, X
4
)
• Projective transformation
– X’ = HX
Camera Models
Camera Models
• Mapping 3D to 2D: Camera Matrices
• Central projection
– Pin-hole camera
– Finite projective camera
• Parallel projection
– Orthographic camera
– Affine camera
Pinhole Camera Geometry
• Camera
– Camera center, C
– Image plane
– Principle axis
– Principle point
• Camera coordinate system
– C as origin
– Image plane at Z=f
• (X, Y, Z) T -> (fX/Z, fY/Z) T
Camera Matrix
• (X, Y, Z) T -> (fX/Z, fY/Z) T
• Homogenous coordinates
– (X, Y, Z, 1) T -> (fX, fY, Z) T
• Transformation: diag(f f 1)[I | 0]
• Camera projection matrix: x= PX
– P = diag(f, f, 1)[I | 0 ], a 3×4 matrix
Principle Point Offset
• (px, py): principle point
– (X, Y, Z) -> (fX/Z+p x
, fY/Z+p y
)
• x = K[I | 0]X
• Camera matrix: K[I | 0]
– K: Internal parameter matrix
Camera Rotation and Translation
• World coordinate system
–
X
~ cam
R (
~
X
~
C ) , in inhomogenous coordinates x
K [ R |
R
~
C ] X
• P = K[R | t]
– K: Internal parameters
– R,t: External parameters
Finite Projective Camera
• Finite projective camera
– Generalize K
• α x
, α y
: unequal scale factors
• s: skew parameter
– P = [KR | Kt] = [M | p
4
]
• M = KR non-singular, rank 3
• General projective cameras
– Homogenous 3×4 matrix of rank 3
General Projective Camera
• Given P, what can we say about the camera?
– Camera center?
– P is a 3×4 matrix
• PC=0
– Consider the line joining C and A:
• X(λ) = λA + (1-λ)C
• x = PX(λ) = λPA
– C is the camera center
From 2D to 3D
• Given a point x, find the ray
• Two points on ray
– Camera center
– Another point
• P + x, where P + is the pseudo-inverse
• X(λ) = λP + x + (1-λ)C
Parallel Projection
• Central Projection: P=[I | 0]
• Parallel Projection:
P
1
0
0
0
1
0
0
0
0
0
0
1
– Projection along Z-axis
Hierarchy of Parallel Projection
• Orthographic projection
• Scaled orthographic projection
• Weak perspective projection
• Affine projection
Orthographic Projection
• Projection along Z-axis
• Dof: 5
Generalization of Orthographic
Projection (O.P.)
• Scaled orthographic projection
– O. P. followed by isotropic scaling
– Dof : 6
• Weak perspective projection
– O.P. with non-isotropi c scaling
– Dof: 7
• Affine camera (projection)
– Plus skew
– Dof: 8
Properties of Affine Camera
• Last row is (0 0 0 1)
– Parallel world line maps to parallel image lines
• Camera center at infinity
How to get an Affine Camera?
Computation of Camera Matrix P
Approach for Computing P
• x = PX
• Estimate P from 3D-2D correspondences
– X i
↔ x i
• Compute K, R, t from P
Basic Equations for Computing P
• Each X i
– x i
= PX i
↔ x i satisfy
(upto a scale)
– x i
× PX i
= 0
• Linear in P
– A i p = 0, where p = vec(P)
– 2 linearly independent eqns. per corrs.
• P is a 3×4 homogenous matrix => 11 dofs
• # of correspondences ≥ 6
Computing P
• Want to solve: Ap = 0, with p≠0
• In presence of noise,
– min p
|| Ap || subject to
– Eigen-value solution
||
– Algebraic cost p ||
1
• Geometric cost: min p
– ML estimate of P
i d ( x i
, PX i
)
2
– Non-linear optimization: use Newton’s method
Summary for Computing P
• Form A from 3D-2D correspondences
• Normalization step (see reference 1)
• Solve algebraic cost
• Solve geometric cost starting from algebraic soln.
• Denormalization step (see reference 1)
Computing K from P
• P = [M | p
4
]
• We know P = K[R | t] = [KR | Kt]
• Decompose M using QR decomposition
– Get K and R
– Obtain t as K -1 p
4
Summary
• Projective geometry: P 2 and P 3
• Camera models
– Central projection (Pin hole camera)
– Parallel projection (affine camera)
• Estimation of Camera Model P
– Estimation of internal parameter K
References
• 1) Multi-view Geometry (Ch 2, 6, 7)
– Hartley and Zisserman
• 2) Computer Vision: Algorithms and
Applications
– Richard Szeliski