84
C280 Computer Vision C280, Computer Vision Prof. Trevor Darrell [email protected] [email protected] L t 2I F ti Lecture 2: Image Formation

C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell [email protected] LtLecture 2: Image FtiFormation

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

C280 Computer VisionC280, Computer Vision

Prof. Trevor Darrell

[email protected]@eecs.berkeley.edu

L t 2 I F tiLecture 2: Image Formation

Page 2: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

AdministriviaAdministrivia

• We’re now in 405 SodaWe re now in 405 Soda…

• New office hours: Thurs. 5‐6pm, 413 Soda.

’ll d id i li d i i• I’ll decide on waitlist decisions tomorrow.

• Any Matlab issues yet?

• Roster…

Page 3: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Physical parameters of image formation

• Geometric• Geometric– Type of projection– Camera posep

• Optical– Sensor’s lens type– focal length, field of view, aperture

• PhotometricT di ti i t it f li ht hi– Type, direction, intensity of light reaching sensor

– Surfaces’ reflectance properties

• SensorSensor– sampling, etc.

Page 4: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Physical parameters of image formation

• Geometric• Geometric– Type of projection– Camera posep

• Optical– Sensor’s lens type– focal length, field of view, aperture

• PhotometricT di ti i t it f li ht hi– Type, direction, intensity of light reaching sensor

– Surfaces’ reflectance properties

• SensorSensor– sampling, etc.

Page 5: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective and art• Use of correct perspective projection indicated in 1st

century B C frescoescentury B.C. frescoes

• Skill resurfaces in Renaissance: artists develop systematic methods to determine perspectivesystematic methods to determine perspective projection (around 1480‐1515)

Durer, 1525RaphaelK. Grauman

Page 6: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective projection equations

• 3d world mapped to 2d projection in image plane

Image plane

Focal l thlength

Camera frame

Optical axis

Scene / world points‘’

‘’

Forsyth and Ponce

Scene point Image coordinates

Page 7: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Homogeneous coordinatesIs this a linear transformation?

• no—division by z is nonlinear

Trick:  add one more coordinate:

homogeneous image  homogeneous scene coordinates coordinates

Converting from homogeneous coordinatesg f g

Slide by Steve Seitz

Page 8: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective Projection Matrix

• Projection is a matrix multiplication using homogeneous coordinates:coordinates:

⎤⎡⎥⎤

⎢⎡

⎤⎡ 0001 xx

⎥⎥⎥⎤

⎢⎢⎢⎡

=⎥⎥⎥

⎢⎢⎢

⎥⎥⎥⎤

⎢⎢⎢⎡

00100001

yx

zy

)','(zyf

zxf⇒

divide by the third coordinate to convert back to non‐h di t

⎥⎦⎢⎣⎥⎥

⎦⎢⎢

⎣⎥⎦⎢⎣ '/

10'/100 fz

zf

zz

homogeneous coordinates

Complete mapping from world points to image pixel

Slide by Steve Seitz

Complete mapping from world points to image pixel positions?

Page 9: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective projection & calibration

• Perspective equations so far in terms of camera’sreference frame….

• Camera’s intrinsic and extrinsic parameters needed to calibrate geometry.

Camera frame

K. Grauman

Page 10: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective projection & calibration

Extrinsic:Camera frame World frame

World frame

Intrinsic:Image coordinates relative to camera

Camera frame  World frame

Camera frame

Image coordinates relative to camera Pixel coordinates

World to camera coord. trans. matrix

Perspectiveprojection matrix

(3x4)

Camera to pixel coord. trans. matrix =

2Dpoint(3x1)

3Dpoint(4x1)

(4x4)(3x4)

(3x3)(3x1) ( )

K. Grauman

Page 11: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Intrinsic parameters:  from idealized world coordinates to pixel valuesp

Forsyth&Ponce

xfu =Perspective projection

yfvz

f

=z

f

W. Freeman

Page 12: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Intrinsic parameters

xu α=But “pixels” are in some bi i l i

yvz

α=

arbitrary spatial units

zW. Freeman

Page 13: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Intrinsic parameters

xu α=Maybe pixels are not square

yvz

β=z

β

W. Freeman

Page 14: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Intrinsic parameters

0uxu += αWe don’t know the origin of i l di

0

0

vyvz

+= β

our camera pixel coordinates

0zβ

W. Freeman

Page 15: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Intrinsic parameters

v v′ ′

θu u ′

vv)()(

)sin(θθ

θ′′

=′

)( yx θ

May be skew between camera pixel axes

vuvuu )cot()cos( θθ −=′−=′

0)cot(

y

uzy

zxu +−=

β

θαα

0)sin(v

zyv +=

θβ

W. Freeman

Page 16: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Intrinsic parameters, homogeneous coordinates

0)cot(

y

uzy

zxu +−=

β

θαα

0 )sin(

vzyv +=

θβ

⎛ ⎞ t(θ)⎛ ⎞ x⎛ ⎞ Using homogenous coordinates,we can write this as:

uv

⎛ ⎜ ⎜ ⎜

⎞ ⎟ ⎟ ⎟

=

α −α cot(θ) u0

0 βi (θ)

v0

00

⎛ ⎜ ⎜ ⎜

⎞ ⎟ ⎟ ⎟

xy

⎛ ⎜ ⎜ ⎜

⎞ ⎟ ⎟ ⎟

we can write this as:

1⎝ ⎜ ⎜

⎠ ⎟ ⎟ sin(θ)

0 0 1 0⎝ ⎜

⎠ ⎟ z

1⎝

⎜ ⎜

⎟ ⎟ or:

pp Crr K =In camera‐based coords

In pixels

W. Freeman

Page 17: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Extrinsic parameters:  translation d t ti f fand rotation of camera frame

tpRp CW

WCW

C rrr+= Non‐homogeneous 

coordinates

Homogeneous ⎟⎞

⎜⎛

⎟⎞

⎜⎛ −−−⎟

⎞⎜⎛ |

coordinates

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

⎟⎟⎟⎟

⎜⎜⎜⎜

−−−−−=

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

ptRp WCW

CW

C rrr

|⎟⎟⎠

⎜⎜⎝

⎟⎠

⎜⎝⎟⎟

⎠⎜⎜⎝ 1000

W. Freeman

Page 18: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Combining extrinsic and intrinsic calibration parameters in homogeneous coordinatesparameters, in homogeneous coordinates

CIntrinsicpixels

pp Crr K =

⎟⎞

⎜⎛

⎟⎞

⎜⎛ −−−⎟

⎞⎜⎛ |

World coordinatesCamera coordinates

p

Extrinsic

⎟⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎜⎛

⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎛

−−−−−=

⎟⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎜⎛

ptRp WCW

CW

C rrr

|

|

⎟⎟⎠

⎜⎜⎝

⎟⎠

⎜⎝⎟⎟

⎠⎜⎜⎝ 1000

|

( ) ptRKp WCW

CW

rrr =0 0 0 1

Forsyth&PoncepMp W rr =

W. Freeman

Page 19: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Other ways to write the same equationpixel coordinates

world coordinates

pMp W rr =

⎟⎞

⎜⎛

⎞⎛⎞⎛ xW

T pmu

Pmu r

r⋅

= 1

⎟⎟⎟⎟

⎜⎜⎜⎜

⎟⎟⎟⎞

⎜⎜⎜⎛

=⎟⎟⎟⎞

⎜⎜⎜⎛

...

...

2

1

Wy

Wx

T

T

pp

mm

vu

PmPm

ur

r

⋅⋅

2

3

⎟⎟⎠

⎜⎜⎝

⎟⎠

⎜⎝

⎟⎠

⎜⎝ 1

...1 3zT p

mPm

mv r⋅

=3

2

Conversion back from homogeneous coordinatesConversion back from homogeneous coordinates leads to:

W. Freeman

Page 20: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Calibration target

Find the position, ui and vi, in pixels, of each

http://www.kinetic.bc.ca/CompVision/opti‐CAL.html

Find the position, ui and vi, in pixels, of each calibration object feature point.

Page 21: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Camera calibration

PmPmu r

r

⋅⋅

=3

1From before, we had these equations relating image positions,u,v, to points at 3‐d positions P (in homogeneous 

PmPmv r

r

⋅⋅

=3

2coordinates):

0)( Pr

So for each feature point, i, we have:

0)(0)(

32

31

=⋅−=⋅−

ii

ii

PmvmPmumr

W. Freeman

Page 22: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Camera calibration

0)( 31 =⋅− ii Pmumr

rStack all these measurements of  i=1…n points 

0)( 32 =⋅− ii Pmvmr

into a big matrix:

⎞⎛⎟⎞

⎜⎛ − 00 PuP TTT

⎟⎟⎟⎞

⎜⎜⎜⎛

⎟⎟⎞

⎜⎜⎛

⎟⎟⎟⎞

⎜⎜⎜⎛

−−

00

00

1111

111

M

mPvPPuP

TTT

⎟⎟⎟⎟

⎜⎜⎜⎜=

⎟⎟

⎠⎜⎜

⎝⎟⎟⎟⎟

⎜⎜⎜⎜

−000

3

2 MLLL

mm

PuP Tnn

TTn

⎟⎟⎠

⎜⎜⎝⎟

⎠⎜⎝ − 00 PvP T

nnT

nT

W. Freeman

Page 23: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

⎟⎟⎟⎞

⎜⎜⎜⎛

=⎟⎟⎞

⎜⎜⎛

⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎛

−−

00

00

2

1111

111

MLLL mmPvP

PuPTTT

TTTIn vector form:

Camera calibration

⎟⎟⎟⎟

⎠⎜⎜⎜⎜

⎟⎟

⎠⎜⎜

⎝⎟⎟⎟

⎠⎜⎜⎜

⎝ −−

00

00

3

2 M

mm

PvPPuP

Tnn

Tn

T

Tnn

TTn

⎞⎛

⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎛

13

12

11

mmm

Showing all the elements:

⎟⎟⎞

⎜⎜⎛

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

⎟⎟⎞

⎜⎜⎛

−−−−−−−−

00

1000000001

21

14

13

1111111111

1111111111 mm

vPvPvPvPPPuPuPuPuPPP zyxzyx

⎟⎟⎟⎟⎟

⎠⎜⎜⎜⎜⎜

=

⎟⎟⎟⎟

⎜⎜⎜⎜

⎟⎟⎟⎟⎟

⎠⎜⎜⎜⎜⎜

−−−−00

0

1000000001

10000

24

23

221111111111

MLLL

mmm

PPPPPPuPuPuPuPPP

vPvPvPvPPP

nnznnynnxnnznynx

zyxzyx

⎟⎠

⎜⎝

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜⎟

⎠⎜⎝ −−−− 010000

32

31

24

mmmvPvPvPvPPP nnznnynnxnnznynx

⎟⎟⎟

⎠⎜⎜⎜

⎝ 34

33

mm

W. Freeman

Page 24: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎛

13

12

11

mmm

Camera calibration

⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎛

=⎟⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜⎜

⎟⎟⎟⎟⎞

⎜⎜⎜⎜⎛

−−−−−−−−

0

00

1000000001

22

21

14

13

1111111111

1111111111

MLLLmmmm

vPvPvPvPPPuPuPuPuPPP

zyxzyx

zyxzyx

⎟⎟⎟

⎠⎜⎜⎜

⎟⎟⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜⎜⎜

⎟⎟⎟

⎠⎜⎜⎜

⎝ −−−−−−−−

00

1000000001

32

31

24

23

mmmm

vPvPvPvPPPuPuPuPuPPP

nnznnynnxnnznynx

nnznnynnxnnznynx

⎟⎟⎟

⎠⎜⎜⎜

⎝ 34

33

mm

Q m = 0

We want to solve for the unit vector m (the stacked one)

Q                                  m = 0

that minimizes 2QmThe minimum eigenvector of the matrix QTQ gives us that(see Forsyth&Ponce, 3.1), because it is the unit vector x that minimizes xT QTQ  x.

W. Freeman

Page 25: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Camera calibration

Once you have the M matrix, can recover the intrinsic and extrinsic parameters as in Forsyth&Ponce, sect. 3.2.2.

W. Freeman

Page 26: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Recall, perspective effects…

• Far away objects appear smaller

Forsyth and Ponce

Page 27: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective effects

Page 28: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective effects

Page 29: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Perspective effects• Parallel lines in the scene intersect in the image

• Converge in image on horizon line• Converge in image on horizon line

Image plane(virtual)(virtual)

pinhole

SceneScene

Page 30: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Projection properties

• Many‐to‐one: any points along same ray map to same point in imagesame point in image

• Points  ? – pointsp

• Lines  ?– lines (collinearity preserved)

• Distances and angles are / are not ? preserved– are not

• Degenerate cases:– Line through focal point projects to a point.

Pl h h f l i j li– Plane through focal point projects to line

– Plane perpendicular to image plane projects to part of the image.

Page 31: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Weak perspective

• Approximation: treat magnification as constant

A d th di t t• Assumes scene depth << average distance to camera

World points:    

Image plane

Page 32: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Orthographic projection• Given camera at constant distance from scene

• World points projected along rays parallel to optical• World points projected along rays parallel to optical access

Page 33: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation
Page 34: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation
Page 35: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

2D2D

Page 36: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

3D3D

Page 37: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Other types of projectionOther types of projection

• Lots of intriguing variantsLots of intriguing variants…

• (I’ll just mention a few fun ones)

S. Seitz

Page 38: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

360 degree field of view…360 degree field of view…

• Basic approachBasic approach– Take a photo of a parabolic mirror with an orthographic lens (Nayar)– Or buy one a lens from a variety of omnicam manufacturers…

S http://www cis upenn edu/~kostas/omni html• See http://www.cis.upenn.edu/ kostas/omni.html

S. Seitz

Page 39: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Tilt‐shift

http://www.northlight-images.co.uk/article_pages/tilt_and_shift_ts-e.html

Titlt-shift images from Olivo Barbieriand Photoshop imitations S. Seitz

Page 40: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

tilt, shifttilt, shift

http://en.wikipedia.org/wiki/Tilt‐shift_photography

Page 41: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Tilt‐shift perspective correctionTilt shift perspective correction

http://en.wikipedia.org/wiki/Tilt‐shift_photography

Page 42: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

normal lens tilt‐shift lens

http://www.northlight‐images.co.uk/article_pages/tilt_and_shift_ts‐e.html

Page 43: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Rotating sensor (or object)Rotating sensor (or object)

Rollout Photographs © Justin Kerr http://research.famsi.org/kerrmaya.html

Also known as “cyclographs”, “peripheral images”

S. Seitz

Page 44: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

PhotofinishPhotofinish

S. Seitz

Page 45: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Physical parameters of image formation

• Geometric• Geometric– Type of projection– Camera posep

• Optical– Sensor’s lens type– focal length, field of view, aperture

• PhotometricT di ti i t it f li ht hi– Type, direction, intensity of light reaching sensor

– Surfaces’ reflectance properties

• SensorSensor– sampling, etc.

Page 46: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Pinhole size / apertureHow does the size of the aperture affect the image we’d get?

Larger

Smaller

K. Grauman

Page 47: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Adding a lens

focal point

f

• A lens focuses light onto the film

f

• 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 p y g p plocated at the focal length f

Slide by Steve Seitz

Page 48: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Pinhole vs. lens

K. Grauman

Page 49: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Cameras with lenses

F

focal pointoptical center

(Center Of Projection)(Center Of Projection)

• A lens focuses parallel rays onto a single focal point• A lens focuses parallel rays onto a single focal point

• Gather more light, while keeping focus; make pinhole perspective projection practicalpinhole perspective projection practical

K. Grauman

Page 50: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Human eye

Rough analogy with human visual system:

Pupil/Iris – control amount of light passing through lens

Retina ‐ contains sensor cells where image iscells, where image is formed

Fovea – highest concentration of cones

Fig from Shapiro and Stockman

Page 51: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Thin lens

Thin lensRays entering parallel on one side go through f h d iLeft focus Ri ht f focus on other, and vice versa. 

In ideal case – all rays

Left focus Right focus

In ideal case  all rays from P imaged at P’.

Focal length fLens diameter d

K. Grauman

Page 52: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Thin lens equation

111vuf

+=

u v

• Any object point satisfying this equation is in focusin focus

K. Grauman

Page 53: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Focus and depth of field

Image credit: cambridgeincolour.com

Page 54: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Focus and depth of field

• Depth of field: distance between image planes where blur is tolerableblur is tolerable

Thin lens: scene points atThin lens: scene points at distinct depths come in focus at different image planesplanes.

(Real camera lens systems have greater depth of field.)

“circles of confusion”

Shapiro and Stockman

Page 55: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Focus and depth of field• How does the aperture affect the depth of field?

• A smaller aperture increases the range in which the object i i t l i fis approximately in focus

Flower images from Wikipedia   http://en.wikipedia.org/wiki/Depth_of_field Slide from S. Seitz

Page 56: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Depth from focus

Images from sameImages from same point of view, different camera parameters

3d shape / depth3d shape / depth estimates

[figs from H. Jin and P. Favaro, 2002]

Page 57: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Field of view

• AngularAngular measure of portion of 3d space seen by the camera

Images from http://en.wikipedia.org/wiki/Angle_of_view K. Grauman

Page 58: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Field of view depends on focal length

• As f gets smaller, image becomes more wide anglebecomes more wide angle 

– more world points project onto the finite image plane

• As f gets larger, image becomes more telescopic 

– smaller part of the world– smaller part of the world projects onto the finite image plane

from R. Duraiswami 

Page 59: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Field of view depends on focal length

Smaller FOV = larger Focal LengthSlide by A. Efros

Page 60: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

VignettingVignetting

http://www.ptgui.com/examples/vigntutorial.htmlhttp://www.tlucretius.net/Photo/eHolga.html

Page 61: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

VignettingVignetting

• “natural”:natural :

“ h i l” i i i l h• “mechanical”: intrusion on optical path

Page 62: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Chromatic aberrationChromatic aberration

Page 63: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Chromatic aberrationChromatic aberration

Page 64: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Physical parameters of image formation

• Geometric• Geometric– Type of projection– Camera posep

• Optical– Sensor’s lens type– focal length, field of view, aperture

• PhotometricT di ti i t it f li ht hi– Type, direction, intensity of light reaching sensor

– Surfaces’ reflectance properties

• SensorSensor– sampling, etc.

Page 65: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Environment mapEnvironment map

http://www.sparse.org/3d.html

Page 66: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

BDRFBDRF

Page 67: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Diffuse / LambertianDiffuse / Lambertian

Page 68: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

ForeshorteningForeshortening

Page 69: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Specular reflectionSpecular reflection

Page 70: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

PhongPhong

• Diffuse+specular+ambient:Diffuse+specular+ambient:

Page 71: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Physical parameters of image formation

• Geometric• Geometric– Type of projection– Camera posep

• Optical– Sensor’s lens type– focal length, field of view, aperture

• PhotometricT di ti i t it f li ht hi– Type, direction, intensity of light reaching sensor

– Surfaces’ reflectance properties

• SensorSensor– sampling, etc.

Page 72: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Digital cameras

• Film  sensor array

• Often an array of charge coupled devices

• Each CCD is light sensitive diode that converts photons (l h ) l(light energy) to electrons

cameraCCD array

optics frame grabber

computer

K. Grauman

Page 73: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Historical contextHistorical context• Pinhole model:Mozi (470‐390 BCE), 

Aristotle (384‐322 BCE)

• Principles of optics (including lenses):Principles of optics (including lenses):Alhacen (965‐1039 CE)  

• Camera obscura: Leonardo da Vinci (1452‐1519) Johann Zahn (1631‐1707)

Alhacen’s notes

(1452‐1519), Johann Zahn (1631‐1707)

• First photo: Joseph Nicephore Niepce (1822)

• Daguerréotypes (1839)

• Photographic film (Eastman, 1889)

• Cinema (Lumière Brothers, 1895)

• Color Photography (Lumière Brothers, 1908)

Niepce, “La Table Servie,” 1822

Color Photography (Lumière Brothers, 1908)

• Television (Baird, Farnsworth, Zworykin, 1920s)

• First consumer camera with CCD: Sony Mavica (1981)Sony Mavica (1981)

• First fully digital camera: Kodak DCS100 (1990)

CCD chipSlide credit: L. Lazebnik K. Grauman

Page 74: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation
Page 75: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Digital SensorsDigital Sensors

Page 76: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Resolution

• sensor: size of real world scene element a that images to a single pixelimages to a single pixel

• image: number of pixels

• Influences what analysis is feasible affects best• Influences what analysis is feasible, affects best representation choice.

[fig from Mori et al][fig from Mori et al]

Page 77: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Digital images

Think of images as matrices taken from CCDmatrices taken from CCD array.

K. Grauman

Page 78: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

widthDigital images

width 520j=1i=1Intensity : [0,255]

500 height

im[176][201] has value 164  im[194][203] has value 37

K. Grauman

Page 79: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Color sensing in digital cameras

Estimate missing

Bayer grid

Estimate missing components from neighboring values(demosaicing)(demosaicing)

Source: Steve Seitz

Page 80: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Color images, RGBColor images, RGB color space

R G BR G B

K. GraumanMuch more on color in next lecture…

Page 81: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Physical parameters of image formation

• Geometric• Geometric– Type of projection– Camera posep

• Optical– Sensor’s lens type– focal length, field of view, aperture

• PhotometricT di ti i t it f li ht hi– Type, direction, intensity of light reaching sensor

– Surfaces’ reflectance properties

• SensorSensor– sampling, etc.

Page 82: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Summary• Image formation affected by geometry, photometry, and optics.

• Projection equations express how world points mapped to 2d image.

• Homogenous coordinates allow linear system for projection equations.

• Lenses make pinhole model practical

• Photometry models: Lambertian, BRDFy ,

• Digital imagers, Bayer demosaicing

Parameters (focal length aperture lens diameterParameters (focal length, aperture, lens diameter, sensor sampling…) strongly affect image obtained.

K. Grauman

Page 83: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Slide CreditsSlide Credits

• Bill FreemanBill Freeman

• Steve Seitz

i G• Kristen Grauman

• Forsyth and Ponce

• Rick Szeliski

• and others as markedand others, as marked…

Page 84: C280, Computer Vision - People › ~trevor › CS280Notes... · 2009-09-05 · C280, Computer Vision Prof. Trevor Darrell trevor@eecs.berkeley.edu LtLecture 2: Image FtiFormation

Next timeNext time

`ColorColorReadings:

F h d P Ch 6– Forsyth and Ponce, Chapter 6

– Szeliski, 2.3.2