You are on page 1of 57

EECS 442 Computer vision

Cameras
without cameras we wouldnt have C.V. /

Pinhole cameras
Cameras & lenses
The geometry of pinhole cameras
Other camera models
Reading:

[FP] Chapters 1 3
[HZ] Chapter 6
Some slides in this lecture are courtesy to Profs. J. Ponce, S. Seitz, F-F Li

EECS 442 Computer vision


Cameras
without cameras we wouldnt have C.V. /

Pinhole cameras
Cameras & lenses
The geometry of pinhole cameras
Other camera models
Reading:

[FP] Chapters 1 2
[HZ] Chapter 6
Some slides in this lecture are courtesy to Profs. J. Ponce, S. Seitz, F-F Li

How do we see the world?


object

film

Lets design a camera


Idea 1: put a piece of film in front of an object
Do we get a reasonable image?

Pinhole camera
object

barrier

film

Add a barrier to block off most of the rays


This reduces blurring
The opening known as the aperture

Pinholeprojection
camera
Pinhole perspective
f

f = focal length
c = center of the camera

Some history
Milestones:
Leonardo da Vinci (1452-1519):
first record of camera obscura

Some history
Milestones:
Leonardo da Vinci (1452-1519):
first record of camera obscura
Johann Zahn (1685): first
portable camera

Some history
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

Photography (Niepce, La
Table Servie, 1822)

Some history
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
Daguerrotypes (1839)
Photographic Film (Eastman, 1889)
Cinema (Lumire Brothers, 1895)
Color Photography (Lumire Brothers,
1908)

Photography (Niepce, La
Table Servie, 1822)

Lets also not forget

Motzu
(468-376 BC)

Aristotle
(384-322 BC)

Ibn al-Haitham
(965-1040)

Pinhole camera

x
P = y
z

x
P =
y

x ' = f

y' = f

x
z
y
z

Derived using similar triangles

Pinhole camera

f
O

P=[x, f]

P = [x, z]
z

x x
=
f
z

Pinhole camera
f

Common to draw image plane in front of


the focal point. Moving the image plane
merely scales the image.

x ' = f

y' = f

x
z
y
z

Pinhole camera
Is the size of the aperture important?

object

barrier

film

Kate lazuka

Shrinking
aperture
size
- Rays are mixed up

-Why the aperture cannot be too small?


-Less light passes through
-Diffraction effect

Adding lenses!

Cameras & Lenses


object

lens

A lens focuses light onto the film

film

Cameras & Lenses


object

lens

film
focal point

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

Cameras & Lenses


object

lens

film

circle of
confusion

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]

Cameras & Lenses


Snells law

n1 sin 1 = n2 sin 2
1 = incident angle
2 = refraction angle
ni = index of refraction

Thin Lenses
zo

Snells law:
n1 sin 1 = n2 sin 2

Small angles:

n1 1 n2 2
n1 = n (lens)
n1 = 1 (air)

1 1 1
=
z' z f
R
f=
2(n 1)

Thin Lenses
zo

x ' = z' z

y' = z ' y

z' = f + z o
R
f=
2(n 1)

Lenses are combined in various ways


A compound lens

Issues with lenses: Chromatic Aberration


Lens has different refractive indices for different
wavelengths: causes color fringing

Near Lens Center

Near Lens Outer Edge

Issues with lenses: Spherical aberration


Rays farther from the
optical axis focus closer

Issues with lenses: Radial Distortion


Caused by imperfect lenses
Deviations are most noticeable for rays that pass through
the edge of the lens

No distortion

Pin cushion

Barrel

Cameras

Pinhole cameras
Cameras & lenses
The geometry of pinhole cameras
Other camera models

Pinholeprojection
camera
Pinhole perspective
f

f = focal length
c = center of the camera

x y
( x, y, z) (f , f )
z z
E

x x
=
f
z

Is this a linear transformation?

No division by z is nonlinear

How to make it linear?

Homogeneous coordinates

homogeneous image
coordinates

homogeneous scene
coordinates

Converting from homogeneous


coordinates

Perspective Projection
Transformation
x
f x f 0 0 0
y

X = f y = 0 f 0 0
z
z 0 0 1 0
1
M

f
Xi =
f

x
z
y

X = M X
H

Normalized image plane

1. Off set
y

yc
xc
C=[cx, cy]

x
y
( x, y, z) (f + c x , f + c y )
z
z

Normalized image plane

1. Off set
2. From metric to pixels

yc
xc
C=[cx, cy]

x
y
( x, y, z) (f k + c x , f l + c y )
z
z

Units: k,l : pixel/m


f :m

Non-square pixels

: pixel

Normalized image plane

x
y
( x, y, z) ( + c x , + c y )
z
z

yc
xc
C=[cx, cy]

Matrix form?

Camera Matrix

x
y
( x, y, z) ( + c x , + c y )
z
z

yc
xc
C=[cx, cy]

x + c x z
X = y + c y z = 0
0

cx

cy
1

x
0
y

0
z
0
1

Camera Matrix

Camera
matrix K

X = M X
= K[I 0] X

X = 0
0

cx

cy
1

x
0
y

0
z
0
1

Finite projective cameras

Skew parameter

yc
xc

C=[cx, cy]

X = 0
0

cx

cy
1

x
0
y

0
z
0
1

K has 5 degrees of freedom!

World reference system


R,T

jw
kw
Ow
iw

3D Rotation of Points
Rotation around the coordinate axes, counter-clockwise:
0
1
Rx ( ) = 0 cos
0 sin

y
x
z

sin
cos
cos 0 sin
1
0
R y ( ) = 0
sin 0 cos
cos sin 0
Rz ( ) = sin cos 0
0
0
1
0

World reference system


R,T

jw
kw
Ow
iw

In 4D homogeneous coordinates:

X = [R T ] X w

X = M X w= K[R T ] X w
Internal parameters

External parameters

Projective cameras
R,T

jw
kw
Ow
iw

X31 = M X w= K 33 [R T ] 34 X w 41
How many degrees of freedom?
5 + 3 + 3 =11!

K = 0
0

cx
c y
1

Projective cameras
R,T

jw
kw
Ow
iw

X31 = M X w= K 33 [R T ] 34 X w 41
m1X w m 2 X w
( x , y, z) w (
,
)
m 3X w m 3X w

M is defined up to scale!
Multiplying M by a scalar
wont change the image

Theorem (Faugeras, 1993)

K = 0
0

cx

cy
1

0
0
0

= f k;
=f l

Properties of Projection
Points project to points
Lines project to lines

Properties of Projection
Distant objects look smaller
x

x ' = f ' z

y' = f ' y

z
scene

Image plane

Properties of Projection
Angles are not preserved
Parallel lines meet!

Vanishing point

Vanishing points
Each set of parallel lines meets at a different point
[The vanishing point for this direction]

Sets of parallel lines on the same plane lead to collinear


vanishing points [The line is called the horizon for that plane]

One-point perspective
Masaccio, Trinity,
Santa Maria
Novella, Florence,
1425-28

Credit slide S. Lazebnik

Properties of Projection
Objects on the periphery are expanded
The exterior columns appear bigger
The distortion is not due to lens flaws
Problem pointed out by DaVinci

Slide by F. Durand

Credit slide S. Lazebnik

Properties of Projection
Degenerate cases
Line through focal point projects to a point.
Plane through focal point projects to line
Plane perpendicular to image plane projects to
part of the image (with horizon).

Cameras

Pinhole cameras
Cameras & lenses
The geometry of pinhole cameras
Other camera models

Weak perspective projection

x' = mx
f'
where m =

z0
y ' = my

is the magnification.

When the scene depth is small compared its distance from the
Camera, m can be taken constant: weak perspective projection.

Orthographic (affine) projection

x ' = x

y' = y

Distance from center of projection


to image plane is infinite

When the camera is at a


(roughly constant) distance
from the scene, take m=1.

Orthographic (affine) projection


Image

World

K = 0
0

x ' = x

y' = y

1 0 0 0

K = ? = 0 1 0 0
0 0 1 0

cx

cy
1

0
0
0

Weak perspective projection

Qingming Festival by the Riverside

By Zhang Zeduan ~900 AD

Pros and Cons of These Models


Weak perspective much simpler math.
Accurate when object is small and distant.
Most useful for recognition.

Pinhole perspective much more accurate


for scenes.
Used in structure from motion.

Next lecture
How to calibrate a camera?

No conversation hour tomorrow!


Further questions during office hour

You might also like