Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2...

50
Camera calibration & radiometry • Reading: – Chapter 2, and section 5.4, Forsyth & Ponce – Chapter 10, Horn Optional reading: – Chapter 4, Forsyth & Ponce Sept. 17, 2002 MIT 6.801/6.866 Profs. Freeman and Darrell

Transcript of Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2...

Page 1: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Camera calibration & radiometry

• Reading: – Chapter 2, and section 5.4, Forsyth & Ponce– Chapter 10, Horn

• Optional reading:– Chapter 4, Forsyth & Ponce

Sept. 17, 2002MIT 6.801/6.866Profs. Freeman and Darrell

Page 2: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates
Page 3: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates
Page 4: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Camera calibration

• Geometric: how positions in the image relate to 3-d positions in the world.

• Photometric: how the intensities in the image relate surface and lighting properties in the world.

Page 5: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Calibration target

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

Page 6: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

From last lecture: camera calibration

=

1.........

1

1 3

2

1

z

y

x

T

T

T

WWW

mmm

zvu

PMz

prr 1

=

pixel coordinatesworld coordinates

z is in the camera coordinate system, but we can solve for that, since , leading to:

zPmr

⋅= 31

PmPmv

PmPmu

r

r

r

r

⋅⋅

=

⋅⋅

=

3

2

3

1

Page 7: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Camera calibration

PmPmv

PmPmu

r

r

r

r

⋅⋅

=

⋅⋅

=

3

2

3

1

Because of these relations,

0)(0)(

32

31

=⋅−=⋅−

ii

ii

PmvmPmumr

rFor each feature point, i, we have:

Page 8: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

=

−−−−−−−−

−−−−−−−−

00

00

1000000001

1000000001

34

33

32

31

24

23

22

21

14

13

12

11

1111111111

1111111111

MLLL

mmmmmmmmmmmm

vPvPvPvPPPuPuPuPuPPP

vPvPvPvPPPuPuPuPuPPP

nnznnynnxnnznynx

nnznnynnxnnznynx

zyxzyx

zyxzyx

P m = 0

Camera calibration

We want to solve for the unit vector m (the stacked one)that minimizes 2Pm

The eigenvector corresponding to the minimum eigenvalue of the matrix PTP gives us that (see Forsyth&Ponce, 3.1).

Page 9: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

What makes a valid M matrix?

defined only up to a scale;

normalize M so that .133 == TT ra rr

( )

== baaa

MT

T

T

r

r

r

rr

3

2

1

bA.

M is a perspective projection matrix iff 0)( ≠ADet.

Page 10: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Camera calibration

• Geometric: how positions in the image relate to 3-d positions in the world.

• Photometric: how the intensities in the image relate surface and lighting properties in the world.

Page 11: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

surface

light

Irradiance, E

• Light power per unit area (watts per square meter) incident on a surface.

Page 12: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

surface

light

Radiance, L

• Amount of light radiated from a surface into a given solid angle per unit area (watts per square meter per steradian).

• Note: the area is the foreshortened area, as seen from the direction that the light is being emitted.

Page 13: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Horn, 1986

),(),(),,,(

ii

eeeeii E

LfBRDFφθφθφθφθ ==

Page 14: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

How does the world give us the brightness we observe at a point?

Accounting for the foreshortened area of center patch relative to illuminant.

The total irradiance of the surface is:

iiiii ddEE φθθθφθπ

π

π

)cos( )sin(),( i

2/

00 ∫ ∫

=

radiance per solid angle

The total radiance reflected from the surface patch is:

iiiiieeiiee ddEfL φθθθφθφθφθφθπ

π

π

)cos( )sin( ),( ),,,(),( i

2/

0∫ ∫−

=

Page 15: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

What you’d like to pull out from L

Pixel intensities may be proportional to radiance reflected from the surface patch:

iiiiieeiiee ddEfL φθθθφθφθφθφθπ

π

π

)cos( )sin( ),( ),,,(),( i

2/

0∫ ∫−

=

ee φθ , surface orientation relative to camera

),,,( eeiif φθφθ surface BRDF

),( iiE φθ illumination conditions

ii φθ , surface orientation relative to illumination

That’s hard, so let’s focus on special cases for the rest of this lecture.

Page 16: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Special case BRDF: Lambertianreflectance

πφθφθ 1),,,( =eeiif

iiiiiee ddL φθθθφφδθθδπ

φθπ

π

π

)cos( )sin( )()( 1),( i00

2/

0

−−= ∫ ∫−

Radiance reflected from Lambertian surface illuminated by point source:

BRDF is a constant. These surfaces look equally bright from all viewing directions.

)cos( 0θ∝

Page 17: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Reflectance map

• For orthographic projection, and light sources at infinity, the reflectance map is a useful tool for describing the relationship of surface orientation to image intensity.

• Describes the image intensity for a given surface orientation.

• Parameterize surface orientation by the partial derivatives p and q of surface height z.

Page 18: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Relate surface normal to p & q

1

1

pxz=

∂∂

qyz=

∂∂

x

y

kzqypx =−+Local tangent plane:

n

Unit normal to surface:

( )2211ˆ

qpqp

nnn

T

++

−−== r

r

Page 19: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Refl map for point source (in direction ) Lambertian surfaces

For a Lambertian surface,

)cos(ˆˆ),( isnqpR θ=⋅∝

2222 111

ss

ss

qpqpqqppk

++++

++=

Unit vector to source:( )

221

1ˆss

Tss

qp

qps++

−−=

Page 20: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Picture of Lambertian refl map

Horn, 1986

Page 21: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

W. T. Freeman, Exploiting the generic viewpoint assumption, International Journal Computer Vision, 20 (3), 243-261, 1996

Page 22: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

What constraints are there for form of reflectance map?

Page 23: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Freeman, 1994

Page 24: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Freeman, 1994

Page 25: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Freeman, 1994

Page 26: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Shape 1

Freeman, 1994

Page 27: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Shape 2

Freeman, 1994

Page 28: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

shape 1 shape 2

Freeman, 1994

Page 29: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Freeman, 1994

Page 30: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Freeman, 1994

Page 31: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Freeman, 1994

Page 32: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Freeman, 1994

Page 33: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Let’s list the things this model doesn’t handle properly

• Occluding edges• Albedo changes• Perspective effects (small)• Interreflections• Material changes across surfaces in the

image

Page 34: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Linear shading map

Horn, 1986

Page 35: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Linear shading: 1st order terms of Lambertian shading

2222 111),(

ss

ss

qpqpqqppkqpR

++++

++=

Lambertian point source

qq

qpRpp

qpRkqpqp 0,00,0

2),(),(

==== ∂∂

+∂

∂+≈

1st order Taylor series about p=q=0

)1( 2 qqppk ss ++=

See Pentland, IJCV vol. 1 no. 4, 1990.

Page 36: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Linear shading

range image Lambertian shading

quadratic terms higher-order termslinear shading

Pentland 1990, Adelson&Freeman, 1991

Page 37: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Advantages of linear shading• Linear relationship between surface range map

and rendered image.• Rendering is easy: differentiate with respect to

azimuthal light source direction.• Applies: linear sources, or shallow illumination

angles and Lambertian surface.• Allows for very simple inverse transformation

from rendered image to surface range map, which we’ll discuss later with shape-from-shading material.

Page 38: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Knowing the reflectance map, can we infer the gradient at any point?

Page 39: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Generic reflectance map

Horn, 1986

Page 40: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Photometric stereo

Horn, 1986

Fixed camera and object positions. Take two or more images under different lighting conditions.

Page 41: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Page 42: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Approach 1

• Photograph the object with a calibration object in the picture, or available in another photograph.

• Use the multiple responses of the calibration object to the different light sources to form a look-up table.

• Index into that table using the multiple responses of the unknown object.

• Handles arbitrary BRDF.

Page 43: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Approach 2

• Assume a particular functional form for the BRDF (Lambertian). Assume known light source positions (point sources at infinity as specified locations).

• Analytically determine the surface slope for each location’s collection of image intensities.

Page 44: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Photometric stereo

See Forsyth&Ponce sect. 5.4 for procedure. In HW: don’t need to integrate the surface normals to get the shape.

Page 45: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

From the image under the ith lighting condition (Lambertian)

i

ii

SyxNyxk

yxkLyxIˆ),(ˆ),(

),( ),(

⋅=

=

ρ

Pixel intensity at position x,yin ith image.

surface radiance

surface albedosurface normal

ith light source direction

Page 46: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Combining all the measurements

),(ˆ),(

ˆ

ˆˆ

),(

),(),(

2

1

2

1

yxNyx

S

SS

yxI

yxIyxI

Tn

T

T

n

ρ

=

MM

Page 47: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Solve for g(x,y). May be ill-conditioned

),(

ˆ

ˆˆ

),(

),(),(

2

1

2

1

yxg

S

SS

yxI

yxIyxI

Tn

T

T

n

r

MM

=

Page 48: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

A fix to avoid problems in dark areas: pre-multiply both sides by the image intensities

),(

ˆ

ˆˆ

),(00000),(000),(

),(

),(),(

),(00000),(000),(

2

1

2

1

2

1

2

1

yxg

S

SS

yxI

yxIyxI

yxI

yxIyxI

yxI

yxIyxI

Tn

T

T

n

nn

r

MMMM

L

L

MMMM

L

L

=

Page 49: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Recovering albedo and surface normal

),(),( yxgyx r=ρ

),(),(),(ˆ

yxgyxgyxN r

r

=

Page 50: Camera calibration & radiometry · From last lecture: camera calibration = 1. . .. . .. . . 1 1 3 2 1 z y x T T T W W W m m m z v u MP z p r 1 r = pixel coordinates world coordinates

Surface shape from surface gradients

• Can you do it?• What are the ambiguities?• What are the constraints?• Method of Weiss, to be discussed in linear

filtering section. • So for your homework, we’ll leave the

computation at the gradients.