Transcript

5C-L1 Shape from shading

CS4495/6495 Introduction to Computer Vision

Thanks to Srinivasa Narasimhan, Shree Nayar, David Kreigman, Marc Pollefeys

Shape from shading

Shading as a cue for shape reconstruction

Shape from shading/lighting

What is the relation between intensity and shape?

โ€ข Need to look at the reflectance function

โ€ข Reflectance Map

Surface normals: A bit of math

โ€ข Letโ€™s assume we have a surface ๐‘ง(๐‘ฅ, ๐‘ฆ)

โ€ขWe can define the following:

โˆ’๐œ•๐‘ง

๐œ•๐‘ฅ= ๐‘ โˆ’

๐œ•๐‘ง

๐œ•๐‘ฆ= ๐‘ž

Surface Normal: A bit more math surface normal

๐‘ฅ ๐‘ฆ

z

๐ Suppose we have a point on the surface. We can define two tangents: ๐‘ก๐‘ฅ = 1,0,โˆ’๐‘ ๐‘‡and ๐‘ก๐‘ฆ = 0,1,โˆ’๐‘ž ๐‘‡

2 2

| | |

1, ,1

| 1

x y

x y

Tt tN

Np q

p qt t

n

Surface Normal: Gaussian sphere surface normal

๐‘ฅ ๐‘ฆ

z

๐

Surface Normal: Gradient space projection surface normal

๐‘ฅ ๐‘ฆ

z

๐

Surface Normal: Gradient space projection surface normal

๐‘ฅ ๐‘ฆ

z

๐

p

q (๐’‘๐ŸŽ, ๐’’๐ŸŽ)

๐‘ง = 1 plane is called Gradient Space (๐‘๐‘ž plane)

Gradient Space of Source and Normal z

๐‘ฅ ๐‘ฆ

๐‘

๐‘ž

1

๐‘ง = 1

๐’ ๐

๐ง ๐ฌ

Unit normal vector:

๐ง =๐

|๐|=

๐‘, ๐‘ž, 1

๐‘2 + ๐‘ž2 + 1

Unit source vector:

๐ฌ =๐’

|๐’|=

๐‘๐‘†, ๐‘ž๐‘†, 1

๐‘๐‘†2 + ๐‘ž๐‘†

2 + 1

Normal vector

Unit normal vector

Source vector

Unit source vector

Gradient Space of Source and Normal z

๐‘ฅ ๐‘ฆ

๐œƒ๐‘– ๐‘

๐‘ž

1

๐‘ง = 1

๐’ ๐

๐ง ๐ฌ

Unit normal vector:

๐ง =๐

|๐|=

๐‘, ๐‘ž, 1

๐‘2 + ๐‘ž2 + 1

Unit source vector:

๐ฌ =๐’

|๐’|=

๐‘๐‘†, ๐‘ž๐‘†, 1

๐‘๐‘†2 + ๐‘ž๐‘†

2 + 1

cos๐œƒ๐‘– = ๐ง โ‹… ๐ฌ =๐‘๐‘๐‘† + ๐‘ž๐‘ž๐‘† + 1

๐‘2 + ๐‘ž2 + 1 ๐‘๐‘†2 + ๐‘ž๐‘†

2 + 1

Shape from shading: Problem definition

๐ผ(๐‘ฅ, ๐‘ฆ) ๐‘(๐‘ฅ, ๐‘ฆ)

Output: 3D shape of object Input: 1 or more images

Reflectance Map

Relates image brightness ๐ผ(๐‘ฅ, ๐‘ฆ) to surface orientation (๐‘, ๐‘ž) for given source direction and surface reflectance

Reflectance Map: Lambertian case

Terms: ๐‘˜: source brightness ๐œŒ: surface albedo (reflectance)

Image brightness:

๐ผ = ๐œŒ โ‹… ๐‘˜ โ‹… cos๐œƒ๐‘– = ๐œŒ โ‹… ๐‘˜ (๐ง โ‹… ๐ฌ)

Let ๐œŒ โ‹… ๐‘˜ = 1 then ๐ผ = cos๐œƒ๐‘– = ๐ง โ‹… ๐ฌ

๐ผ(๐‘ฅ, ๐‘ฆ)

๐œƒ๐‘– ๐ฌ

๐ง

๐ฏ

Reflectance Map: Lambertian case

cone of constant ๐œƒ๐‘–

Iso-brightness contour in pq space

๐ผ = cos๐œƒ๐‘– = ๐ง โ‹… ๐ฌ =๐‘๐‘๐‘  + ๐‘ž๐‘ž๐‘  + 1

๐‘2 + ๐‘ž2 + 1 ๐‘๐‘†2 + ๐‘ž๐‘†

2 + 1

= ๐‘… ๐‘, ๐‘ž

Reflectance Map (Lambertian)

Note: ๐‘… ๐‘, ๐‘ž is maximum when ๐‘, ๐‘ž = ๐‘๐‘†, ๐‘ž๐‘†

๐œƒ๐‘– = 90โˆ˜ ๐‘๐‘๐‘† + ๐‘ž๐‘ž๐‘† + 1 = 0

0.0

0.3

๐‘

๐‘… ๐‘, ๐‘ž = 0.7

0.8

0.9

1.0

๐‘๐‘ , ๐‘ž๐‘ 

๐‘ž

Iso-brightness contours

Shape from a single image?

Given ๐‘…(๐‘, ๐‘ž) ((๐‘๐‘†, ๐‘ž๐‘†) and surface reflectance) can we determine (๐‘, ๐‘ž) uniquely for each image point?

NO ๐‘

๐‘ž

Shape from Shading

Need more information:

โ€ขAdd more constraints: Shape-from-shading

โ€ข Take more images: Photometric stereo

Given a single image of an object with known surface reflectance taken under a known light source, can we recover its shape?

Shape from shading

Given ๐‘…(๐‘, ๐‘ž) ((๐‘๐‘†, ๐‘ž๐‘†) and surface reflectance) can we determine (๐‘, ๐‘ž) uniquely for each image point?

โ€ข Assume shape along the occluding boundary is known

โ€ข Constraints on neighboring normals โ€” integrability

โ€ข Smoothness

Shape from shading

Yes, a slightly ugly optimization

Synthetic results

Shape from Shading: โ€œRealโ€ Results

โ€ข These single image methods work poorly in practice

โ€ข Why? The assumptions are quite restrictive

Shape from Shading

Need more information:

โ€ขAdd more constraints: Shape-from-shading

โ€ข Take more images: Photometric stereo

Photometric stereo Output:

โ€ข 3D shape of object

โ€ข Albedo at (๐‘ฅ, ๐‘ฆ)

Input: Several images

โ€ข Same object

โ€ข Different lightings

โ€ข Same pose

Photometric stereo Image brightness:

๐ง

๐ฌ๐Ÿ

๐ฌ๐Ÿ‘

๐ฏ

๐ฌ๐Ÿ

๐ผ1 = ๐œŒ๐ง โˆ™ ๐ฌ๐Ÿ

๐ผ2 = ๐œŒ๐ง โˆ™ ๐ฌ๐Ÿ

๐ผ3 = ๐œŒ๐ง โˆ™ ๐ฌ๐Ÿ‘

๐ผ = ๐œŒ โ‹… ๐‘˜ โ‹… cos๐œƒ๐‘– = ๐œŒ๐ง โ‹… ๐ฌ where k = 1

Write this as a matrix equation:

๐ผ1๐ผ2๐ผ3

= ๐œŒ๐ฌ๐Ÿ

๐‘‡

๐ฌ๐Ÿ ๐‘‡

๐ฌ๐Ÿ‘ ๐‘‡

๐ง

Solving the equations: Linear

๐ผ1๐ผ2๐ผ3

=๐ฌ๐Ÿ

๐‘‡

๐ฌ๐Ÿ ๐‘‡

๐ฌ๐Ÿ‘ ๐‘‡

๐œŒ๐ง

๐ˆ ๐’ ๐ง 3 ร— 1 3 ร— 3 3 ร— 1

๐ง = ๐’โˆ’1๐ˆ

๐œŒ = ๐ง

๐ง =๐ง

๐ง =๐ง

๐œŒ

๐ˆ and ๐’ are known

inverse

Adding more light sources

Get better results by using more (๐‘€) lights:

๐ผ1โ‹ฎ๐ผ๐‘€

=๐ฌ๐Ÿ

๐‘‡

โ‹ฎ๐ฌ๐‘€

๐‘‡

๐œŒ๐ง

Least squares solution:

๐ˆ = ๐’๐ง ๐’๐‘‡๐ˆ = ๐’๐‘‡๐’๐ง ๐ง = ๐’๐‘‡๐’ โˆ’๐Ÿ๐’๐‘‡๐ˆ

Solve for๐œŒ, ๐ง as before

๐‘€ ร— 1 = ๐‘€ ร— 3 3 ร— 1

Moore-Penrose pseudo inverse min ๐ˆ โˆ’ ๐’๐ง 2

2

Photometric stereo: pq space

๐‘

๐‘ž

๐‘๐‘ 1, ๐‘ž๐‘ 

1

๐‘๐‘ 2, ๐‘ž๐‘ 

2

๐‘๐‘ 3, ๐‘ž๐‘ 

3

Results: Lambertian sphere

Input Images

Estimated Albedo Estimated Surface Normals

Needles are projections of surface normal on image plane

Photometric stereo: Lambertian toy

Input Images

Estimated Surface Normals Estimated Albedo

Surface Normals

Albedo

And from GT: www.trimensional.com

Photometric stereo: Limitations

Big problems โ€ข Doesnโ€™t work for shiny things, semi-translucent things โ€ข Shadows, inter-reflections Smaller problems โ€ข Camera and lights have to be distant โ€ข Calibration requirements

โ€“ Measure light source directions, intensities โ€“ Camera response function

A real application that works

A real application that works

Human shape from shading

Thomas R et al. J Vis 2010; 10:6

Also check Ramachandranโ€™s work on Shape from Shading by Humans http://psy.ucsd.edu/chip/ramabio.html


Top Related