photometric stereo · 2018. 4. 7. · photometric stereo -the math •how do we recover g if the...

55
Photometric stereo

Upload: others

Post on 01-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo

Page 2: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Radiance

• Pixels measure radiance

This pixelMeasures radiance

along this ray

Page 3: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Where do the rays come from?

• Rays from the light source “reflect” off a surface and reach camera• Reflection:

Surface absorbs light energy and radiates it back

Page 4: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Light rays interacting with a surface• Light of radiance !" comes from light source at an

incoming direction #"• It sends out a ray of radiance !$ in the outgoing

direction #$• How does !$ relate to !" ?

#" #$

• N is surface normal• L is direction of light, making #"

with normal• V is viewing direction, making #$

with normal

Page 5: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Light rays interacting with a surface

!" !#

• N is surface normal• L is direction of light, making !"

with normal• V is viewing direction, making !#

with normal

$# = & !", !# $" cos !"Output radiance along V

Bi-directional reflectance function (BRDF)

Incoming irradiance along L

Page 6: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Light rays interacting with a surface

• Special case 1: Perfect mirror• ! "#, "% = 0 unless "# = "%

• Special case 2: Matte surface• ! "#, "% = !' (constant)

"# "%(% = ! "#, "% (# cos "#

Page 7: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Special case 1: Perfect mirror

• ! "#, "% = 0 unless "# = "%• Also called “Specular surfaces”• Reflects light in a single, particular direction

Page 8: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Special case 2: Matte surface

• ! "#, "% = !&• Also called “Lambertian surfaces”• Reflected light is independent of viewing direction

Page 9: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Lambertian surfaces

• For a lambertian surface:

• ! is called albedo• Think of this as paint• High albedo: white colored surface• Low albedo: black surface• Varies from point to point

Lr = ⇢Li cos ✓i

) Lr = ⇢LiL ·N"# "$

Page 10: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Lambertian surfaces

• Assume the light is directional: all rays from light source are parallel• Equivalent to a light source

infinitely far away

• All pixels get light from the same direction L and of the same intensity Li

!" !#

Page 11: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Lambertian surfaces

I(x, y) = ⇢(x, y)LiL ·N(x, y)

Reflectance image

Shading image

Intrinsic Image Decomposition

Page 12: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Reconstructing Lambertiansurfaces

• Equation is a constraint on albedo and normals• Can we solve for albedo and normals?

I(x, y) = ⇢(x, y)LiL ·N(x, y)

Page 13: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Solution 1: Recovery from a single image• Step 1: Intrinsic image

decomposition• Reflectance image ! ", $• Shading image• Decomposition relies on priors on

reflectance image• What kind of priors?• Reflectance image captures the

“paint” on an object surface• Surfaces tend to be of uniform color

with sharp edges when color changes

LiL ·N(x, y)

Images from Barron et al, TPAMI 13

Page 14: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Solution 1: Recovery from a single image

• Step 2: Decompose shading image into illumination and normals

• Called Shape-From-Shading• Relies on priors on shape: shapes are smooth

LiL ·N(x, y)

Far

Near

Page 15: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Solution 2: Recovery from multiple images

• Represents an equation in the albedo and normals• Multiple images give constraints on albedo and normals• Called Photometric Stereo

I(x, y) = ⇢(x, y)LiL ·N(x, y)

Image credit: Wikipedia

Page 16: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Multiple Images: Photometric Stereo

N

L1L2

V

L3

Page 17: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo - the math

• Consider single pixel• Assume !" = 1

• Write• Gis a 3-vector• Norm of G = '• Direction of G = N

I(x, y) = ⇢(x, y)LiL ·N(x, y)

I = ⇢L ·N

I = ⇢NTL

G = ⇢N

Page 18: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo - the math

• Consider single pixel• Assume !" = 1

• Write• Gis a 3-vector• Norm of G = '• Direction of G = N

I = ⇢NTLG = ⇢N

I = GTL = LTG

Page 19: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo - the math

• Multiple images with different light sources but same viewing direction?

I = LTG

I1 = LT1 G

I2 = LT2 G

...

Ik = LTkG

Page 20: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo - the math

• Assume lighting directions are known• Each is a linear equation in G• Stack everything up into a massive linear system of

equations!

I1 = LT1 G

I2 = LT2 G

...

Ik = LTkG

Page 21: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo - the math

I1 = LT1 G

I2 = LT2 G

...

Ik = LTkG

I = LTG

k x 1 vector of intensities

k x 3 matrix of lighting directions

3x1 vector of unknowns

Page 22: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo - the math

• What is the minimum value of k to allow recovery of G?• How do we recover G if the problem is

overconstrained?

I = LTGk x 1 k x 3 3 x 1

G = L�T I

Page 23: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric stereo - the math

• How do we recover G if the problem is overconstrained? • More than 3 lights: more than 3 images

• Least squares

• Solved using normal equations

minG

kI� LTGk2

G = (LLT )�1LI

Page 24: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Normal equations

• Take derivative with respect to G and set to 0

kI� LTGk2 = IT I+GTLLTG� 2GTLI

2LLTG� 2LI = 0

) G = (LLT )�1LI

Page 25: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Estimating normals and albedo from G• Recall that G = ⇢N

kGk = ⇢

G

kGk = N

Page 26: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Multiple pixels

• We’ve looked at a single pixel till now• How do we handle multiple pixels?• Essentially independent equations!

Page 27: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Multiple pixels: matrix form

• Note that all pixels share the same set of lights

I(1) = LTG(1)

I(2) = LTG(2)

...

I(n) = LTG(n)

Page 28: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Multiple pixels: matrix form

• Can stack these into columns of a matrix

⇥I(1) I(2) · · · I(n)

⇤= LT

⇥G(1) G(2) · · · G(n)

I(1) = LTG(1)

I(2) = LTG(2)

...

I(n) = LTG(n)

I = LTG

Page 29: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Multiple pixels: matrix form

I = LTG

I LTG

=#lights

#pixels #pixels

#lights

3

3

Page 30: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Estimating depth from normals

• So we got surface normals, can we get depth?• Yes, given boundary conditions• Normals provide information about the derivative

Page 31: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Brief detour: Orthographic projection• Perspective projection• ! = #

$ , & ='$

• If all points have similar depth• ( ≈ (*• ! ≈ #

$+, & ≈ '

$+• ! ≈ ,-, & ≈ ,.

• A scaled version of orthographic projection• ! = -, & = .

Perspective

Scaled orthographic

Page 32: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Depth Map from Normal Map

• We now have a surface normal, but how do we get depth?

32

V1V2

N

Assume a smooth surface

Get a similar equation for V2• Each normal gives us two linear constraints on z• compute z values by solving a matrix equation

(cx, cy, Zx,y)

(c(x+ 1), cy, Zx+1,y)

(cx, c(y + 1), Zx,y+1)

V1 = (c(x+ 1), cy, Zx+1,y)� (cx, cy, Zx,y)

= (c, 0, Zx+1,y � Zx,y)

0 = N · V1

= (nx, ny, nz) · (c, 0, Zx+1,y � Zx,y)

= cnx + nz(Zx+1,y � Zx,y)

Page 33: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Determining Light Directions

33

• Trick: Place a mirror ball in the scene.

• The location of the highlight is determined by the light source direction.

Page 34: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

• For a perfect mirror, the light is reflected across N:Determining Light Directions

34

Page 35: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

= - 2

So the light source directionis given by:

Determining Light Directions

35

L

N

R||||= " ⋅ $ "= $ − " ⋅ $ "= $ − " ⋅ $ "

= $ − 2 $ − " ⋅ $ "= 2 " ⋅ $ " − $

Page 36: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Determining Light Directions• Assume orthographic projection• Viewing direction R = [0,0,-1]• Normal?

Z=1

("#, %#)

("', %')

("#, %#, (#)

("', %', (')

(# and (' are unknown, but:

"# − "' * + %# − %' *+ (# − (' * = -*

(# − (' can be computed

"# − "', %# − %', (# − (' is the normal

Page 37: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Photometric Stereo

Input(1 of 12)

Normals (RGB colormap)

Normals (vectors) Shaded 3Drendering

Textured 3Drendering

What results can you get?

Page 38: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Results

38

from Athos Georghiades

Page 39: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Results

Input(1 of 12)

Normals (RGB colormap)

Normals (vectors) Shaded 3Drendering

Textured 3Drendering

Page 40: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares

Questions?

Page 41: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 42: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 43: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 44: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 45: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 46: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 47: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 48: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 49: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 50: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 51: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 52: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 53: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 54: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares
Page 55: Photometric stereo · 2018. 4. 7. · Photometric stereo -the math •How do we recover G if the problem is overconstrained? •More than 3 lights: more than 3 images •Least squares