Cameras
Source: S. Lazebnik
Reading
• Szeliski 2.1.3-2.1.6
Image formation
• Let’s design a camera
– Idea 1: put a piece of film in front of an object
– Do we get a reasonable image?
Pinhole camera
• Add a barrier to block off most of the rays
– This reduces blurring
– The opening known as the aperture
– How does this transform the image?
– The image is upside-down
!"#$"%&%'()"*)+)!"#$,'&-)./(/"%)01('&#
Camera
Lighting
Computer
Scene
Scene Interpretation
Pinhole and the Perspective Projection
(x,y)
screen
scene
image plane
r = ( x, y, z )
y
optical effective focal length, f’ z
axis
pinhole
x
r ' = ( x' , y ' , f ' )
r' r x' x y' y
= = =
f' z f' z f' z
Pinhole camera model
f
Real
object
f = Focal length
c = Optical center of the camera
Figure from Forsyth
Pinhole camera model
• 3D point 𝑃 = (𝑥, 𝑦, 𝑧) projects to 2D image
point 𝑃! = (𝑥′, 𝑦′)
• By symmetric
! !! $ $!
"
= #
and "
= #
i.e.,
% %
𝑥 𝑦
%
𝑃 = (𝑥 , 𝑦 ) = (𝑓 , 𝑓 )
𝑧 𝑧
• Simplest form of perspective projection
Camera parameters
• How can we model the geometry of a camera?
v
y
COP
u
Camera
o x
Two important coordinate systems:
1. World coordinate system z “The World”
2. Camera coordinate system
Camera parameters
• To project a point (x,y,z) in world coordinates
into a camera
• First transform (x,y,z) into camera coordinates
• Need to know
– Camera position (in world coordinates)
– Camera orientation (in world coordinates)
• The formation of image frame
– Need to know camera intrinsics
Intrinsic Parameters
• In the image frame, denote location of
𝑐 (𝑝𝑟𝑖𝑛𝑐𝑖𝑝𝑙𝑒 𝑝𝑜𝑖𝑛𝑡) image plane as 𝑐" and 𝑐#
• Image principle point:
Intersection between the camera optical axis
and image plane
• Then
% % %
𝑥 𝑦
𝑃 = (𝑥 , 𝑦 ) = (𝑓 + 𝑐! , 𝑓 + 𝑐$ )
𝑧 𝑧
Intrinsic Parameters
• Points in digital image are expressed as in pixels
• Points in image plane are represented in physical
measurement (e.g., centimeter)
• The mapping between digital image and image plan can be
!"#$%&
something like '(
• We can use two parameters, k and l, to describe the mapping.
If 𝑘 = 𝑙, then the camera has “square pixels”.
• The equation now becomes:
% % % ! $
𝑃 = (𝑥 , 𝑦 ) = (𝑓𝑘 + 𝑐! , 𝑓𝑙 + 𝑐$ )
" "
! $
= (α + 𝑐! , 𝛽 +𝑐$ )
" "
Modeling projection
Homogeneous coordinates to the rescue!
homogeneous image homogeneous scene
coordinates coordinates
Converting from homogeneous coordinates
Intrinsic Parameters
% % % ! $
𝑃 = (𝑥 , 𝑦 ) = (α " + 𝑐! , 𝛽 " +𝑐$ )
In matrix form:
𝛼 0 𝑐# 0 𝑥
𝑃) = 0 𝛽 𝑐* 0 𝑦
𝑧 = 𝑀𝑃
0 0 1 0 1
𝛼 0 𝑐#
𝑃) = 𝑀𝑃 = 0 𝛽 𝑐* 𝐼 0𝑃=𝐾 𝐼 0𝑃
0 0 1
K: Camera matrix (or calibration matrix)
Extrinsic Parameters
• What if the information about the 3D world is available in a
different coordinate system?
• We need to relate the points from world reference system to
the camera reference system
• Given a point in world reference system 𝑃+ , the camera
coordinate is computed as
𝑅 𝑇
𝑃= 𝑃+
0 1
World Camera Pixel
coordinate 3D->3D coordinate 3D->2D coordinate
Extrinsic Parameters Intrinsic Parameters
Projection Matrix
• Combining intrinsic and extrinsic parameters, we have
extrinsic parameters
𝑃) = 𝐾 𝑅 𝑇 𝑃+ = 𝑀𝑃+
intrinsic parameters
• K changes as the type of camera changes
• Extrinsic parameters are independent of camera
Where does all this lead?
• Given an arbitrary camera, we may not have
access to intrinsic parameters
• The problem of estimating intrinsic and
extrinsic parameters is known as camera
calibration
18
A pinhole camera has focal length 5mm. Each pixel is 0.02mm×0.02mm
and the image principle point is at pixel (500,500). Pixel coordinate start at
(0,0) in the upper-left corner of the image.
(a) Show the 3×3 camera matrix for this camera.
(b) Assume the world coordinate system is aligned with camera coordinate
system (i.e., their origins are the same and their axes are aligned), and
the origins are at the camera’s pinhole, show the 3×4 projection
matrix.
(c) What is the projection of a 3D scene point (100, 150, 800) into image
coordinates?
19