Lecture 7 -Fei-Fei Li
Lecture 7: Camera Models
Professor Fei‐Fei LiStanford Vision Lab
15‐Oct‐111
Lecture 7 -Fei-Fei Li
What we will learn today?
• Pinhole cameras• Cameras & lenses• The geometry of pinhole cameras
15‐Oct‐112
Reading: [FP] Chapters 1 – 3[HZ] Chapter 6
Lecture 7 -Fei-Fei Li
What we will learn today?
• Pinhole cameras• Cameras & lenses• The geometry of pinhole cameras
15‐Oct‐113
Reading: [FP] Chapters 1 – 3[HZ] Chapter 6
Lecture 7 -Fei-Fei Li 15‐Oct‐114
How do we see the world?
• Let’s design a camera– Idea 1: put a piece of film in front of an object– Do we get a reasonable image?
Lecture 7 -Fei-Fei Li 15‐Oct‐115
Pinhole camera
• Add a barrier to block off most of the rays– This reduces blurring– The opening known as the aperture
Lecture 7 -Fei-Fei Li 15‐Oct‐116
Some history…
Milestones: • Leonardo da Vinci (1452‐1519): first record of camera obscura• Johann Zahn (1685): first portable camera
Lecture 7 -Fei-Fei Li 15‐Oct‐117
Some history…
Photography (Niepce, “La Table Servie,” 1822)
Milestones: • Leonardo da Vinci (1452‐1519): first record of camera obscura• Johann Zahn (1685): first portable camera• Joseph Nicephore Niepce (1822): first photo ‐ birth of photography
• Daguerréotypes (1839)• Photographic Film (Eastman, 1889)• Cinema (Lumière Brothers, 1895)• Color Photography (Lumière Brothers, 1908)
Lecture 7 -Fei-Fei Li 15‐Oct‐118
Some history…
Motzu(468‐376 BC)
Aristotle(384‐322 BC)
Also: Plato, Euclid
Al‐Kindi (c. 801–873) Ibn al‐Haitham (965‐1040)Oldest existent book
on geometry in China
Lecture 7 -Fei-Fei Li 15‐Oct‐119
Pinhole camera
zyfy
zxfx
''
''
yx
P
zyx
P
Derived using similar triangles
Note: z is always negative.
Lecture 7 -Fei-Fei Li 15‐Oct‐1110
Pinhole camera
O
P = [x, z]
P’=[x’, f’]
f’
zx
fx
'
x
z
Lecture 7 -Fei-Fei Li 15‐Oct‐1111
Pinhole camera
• Common to draw image plane in front of the focal point • Moving the image plane merely scales the image.
f f
zyf'y
zxf'x
Lecture 7 -Fei-Fei Li 15‐Oct‐1112
Pinhole camera
Kate lazuka ©
Is the size of the aperture important?
Lecture 7 -Fei-Fei Li 15‐Oct‐1113
Cameras & Lenses
Shrinkingaperturesize
‐ Rays are mixed up
Adding lenses!‐Why the aperture cannot be too small?
‐Less light passes through‐Diffraction effect
Lecture 7 -Fei-Fei Li 15‐Oct‐1114
Cameras & Lenses
• A lens focuses light onto the film
Lecture 7 -Fei-Fei Li 15‐Oct‐1115
Cameras & Lenses
• A lens focuses light onto the film– Rays passing through the center are not deviated– All parallel rays converge to one point on a plane located at the focal
length f
focal point
f
Lecture 7 -Fei-Fei Li 15‐Oct‐1116
Cameras & Lenses
• A lens focuses light onto the film– There is a specific distance at which objects are “in focus”
[other points project to a “circle of confusion” in the image]
“circle of confusion”
Lecture 7 -Fei-Fei Li
Cameras & Lenses• Laws of geometric optics
– Light travels in straight lines in homogeneous medium– Reflection upon a surface: incoming ray, surface normal,
and reflection are co‐planar– Refraction: when a ray passes from one medium to
another
15‐Oct‐1117
Snell’s law
n1 sin1 = n2 sin 2
1 = incident angle2 = refraction angleni = index of refraction
Lecture 7 -Fei-Fei Li 15‐Oct‐1118
Thin Lenses
Snell’s law:
n1 sin1 = n2 sin 2
Small angles:n1 1 n2 2
n1 = n (lens)n1 = 1 (air)
zo
zy'z'y
zx'z'x
ozf'z
)1n(2Rf
Lecture 7 -Fei-Fei Li 15‐Oct‐1119
Cameras & Lenses
Source wikipedia
Lecture 7 -Fei-Fei Li 15‐Oct‐1120
Issues with lenses: Chromatic Aberration
• Lens has different refractive indices for different wavelengths: causes color fringing
)1n(2Rf
Lecture 7 -Fei-Fei Li 15‐Oct‐1121
Issues with lenses: Chromatic Aberration
• Rays farther from the optical axis focus closer
Lecture 7 -Fei-Fei Li 15‐Oct‐1122
Issues with lenses: Chromatic Aberration
No distortion
Pin cushion
Barrel (fisheye lens)
– Deviations are most noticeable for rays that pass through the edge of the lens
Image magnification decreases with distance from the optical axis
Lecture 7 -Fei-Fei Li
What we will learn today?
• Pinhole cameras• Cameras & lenses• The geometry of pinhole cameras
15‐Oct‐1123
Lecture 7 -Fei-Fei Li 15‐Oct‐1124
Pinhole cameraf
f = focal lengthc = center of the camera
c
)zyf,
zxf()z,y,x(
2E
3
Lecture 7 -Fei-Fei Li 15‐Oct‐1125
Pinhole camera
No — division by z is nonlinear!
)zyf,
zxf()z,y,x(
Is this a linear transformation?
How to make it linear?
Lecture 7 -Fei-Fei Li 15‐Oct‐1126
Homogeneous coordinates
homogeneous image coordinates
homogeneous scene coordinates
• Converting from homogeneous coordinates
Lecture 7 -Fei-Fei Li 15‐Oct‐1127
Homogeneous coordinates
10100000000
'zyx
ff
zyfxf
P
zyfzxf
'iP
PMP '
M3
H4
Perspective Projection Transformation:“Projection matrix”
Lecture 7 -Fei-Fei Li 15‐Oct‐1128
From retina plane to images
Pixels, bottom‐left coordinate systems
Lecture 7 -Fei-Fei Li 15‐Oct‐1129
From retina plane to images
)czyf,c
zxf()z,y,x( yx
1. Off set
x
y
xc
yc
C=[cx, cy]
Lecture 7 -Fei-Fei Li 15‐Oct‐1130
From retina plane to images
),(),,( yx czylfc
zxkfzyx
1. Off set2. From metric to pixels
x
y
xc
yc
C=[cx, cy] Units: k,l : pixel/m
f : m : pixel, Non‐square pixels
Lecture 7 -Fei-Fei Li 15‐Oct‐1131
From retina plane to images
Matrix form?x
y
xc
yc
C=[cx, cy]
)czy,c
zx()z,y,x( yx
Lecture 7 -Fei-Fei Li 15‐Oct‐1132
Camera matrix
x
y
xc
yc
C=[cx, cy]
)czy,c
zx()z,y,x( yx
101000000
'zyx
cc
zzcyzcx
P y
x
y
x
Lecture 7 -Fei-Fei Li 15‐Oct‐1133
Camera matrix
x
y
xc
yc
C=[cx, cy]
)czy,c
zx()z,y,x( yx
101000000
'zyx
cc
P y
x
Lecture 7 -Fei-Fei Li 15‐Oct‐1134
Camera matrix
)czy,c
zx()z,y,x( yx
x
y
xc
yc
C=[cx, cy]
Skew parameter
10100000
'zyx
ccs
P y
x
Lecture 7 -Fei-Fei Li 15‐Oct‐1135
Camera matrix
PMP '
PIK 0
10100000
'zyx
ccs
P y
x
Camera matrix K
K has 5 degrees of freedom!
Lecture 7 -Fei-Fei Li 15‐Oct‐1136
Camera & world reference system
Ow
iw
kw
jwR,T
•The mapping is defined within the camera reference system
• What if an object is represented in the world reference system?
Lecture 7 -Fei-Fei Li 15‐Oct‐1137
Camera & world reference system
Ow
iw
kw
jwR,T
wPMP ' wPTRK
wPTRP In 4D homogeneous coordinates:
Internal parameters External parameters
Lecture 7 -Fei-Fei Li 15‐Oct‐1138
Projective cameras
How many degrees of freedom?5 + 3 + 3 =11!
100c0cs
K y
x
Ow
iw
kw
jwR,T
wPMP 13' 144333 wPTRK
Lecture 7 -Fei-Fei Li 15‐Oct‐1139
Projective cameras
Ow
iw
kw
jwR,T
),(),,(3
2
3
1
w
w
w
ww P
PPPzyx
mm
mm
M is defined up to scale!Multiplying M by a scalarwon’t change the image
wPMP 13' 144333 wPTRK
3
2
1
mmm
M
Lecture 7 -Fei-Fei Li 15‐Oct‐1140
Theorem (Faugeras, 1993) ][ bATKRKTRKM
3
2
1
aaa
A
1000 y
x
ccs
K
lf;kf
Lecture 7 -Fei-Fei Li 15‐Oct‐1141
Properties of Projection•Points project to points•Lines project to lines
Lecture 7 -Fei-Fei Li 15‐Oct‐1142
Properties of ProjectionVanishing point•Angles are not preserved
•Parallel lines meet
Lecture 7 -Fei-Fei Li
What we have learned today?
• Pinhole cameras• Cameras & lenses• The geometry of pinhole cameras
15‐Oct‐1143
Reading: [FP] Chapters 1 – 3[HZ] Chapter 6