photometric stereo, shape from shading sfs chapter 2 new...

80
Photometric Stereo, Shape from Shading SfS Chapter 2 new F&P Guido Gerig CS 6320, Spring 2013 Credits: M. Pollefey UNC CS256, Ohad Ben-Shahar CS BGU, Wolff JUN (http://www.cs.jhu.edu/~wolff/course600.461/week9.3/index.htm)

Upload: others

Post on 28-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Photometric Stereo, Shape from Shading SfS

Chapter 2 new F&P

Guido Gerig

CS 6320, Spring 2013

Credits: M. Pollefey UNC CS256, Ohad Ben-Shahar CS BGU, Wolff JUN

(http://www.cs.jhu.edu/~wolff/course600.461/week9.3/index.htm)

Page 2: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Photometric Stereo

Depth from Shading?

First step: Surface

Normals from Shading

Second step:

Re-integration of

surface from Normals

Page 4: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Credit: Ohad Ben-Shahar CS BGU

Page 5: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shape from Shading

Page 6: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Photometric Stereo

• Assume:

– a local shading model

– a set of point sources that are infinitely

distant

– a set of pictures of an object, obtained in exactly the same camera/object configuration but using different sources

– A Lambertian object (or the specular

component has been identified and removed)

Page 7: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Setting for Photometric Stereo

Multiple images with different lighting (vs binocular/geometric stereo)

Page 8: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Goal: 3D from One View and multiple Source positions

Input images Usable Data

Mask

Page 9: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Scene Results

Needle Diagram:

Surface Normals

Albedo

Re-lit:

Page 10: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Projection model for surface recovery - usually called a Monge patch

Page 11: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Lambertian Reflectance Map

LAMBERTIAN MODEL

E = r <n,ns> =r COS q

Y

X Z

q (ps,qs,-1)

(p,q,-1)

2222 11

1

LL

LL

qpqp

qqppCOS

q

Page 12: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Wolff, November 4, 1998 12

REFLECTANCE MAP IS A VIEWER-CENTERED

REPRESENTATION OF REFLECTANCE

Depth

Surface

Orientation

Y

X

Z

IMAGE PLANE

z=f(x,y)

x y

dx dy

y (-f , -f , 1)

(f , f , -1)

(0,1,f ) x

(0,1,f ) x

(1,0,f )

(1,0,f ) y

= x y

Page 13: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

13

REFLECTANCE MAP IS A VIEWER-CENTERED

REPRESENTATION OF REFLECTANCE

(-f x , -f y , 1) = (-p, -q, 1)

p, q comprise a gradient or gradient space representation for

local surface orientation.

Reflectance map expresses the reflectance of a material directly

in terms of viewer-centered representation of local surface

orientation.

Wolff, November 4, 1998

Page 14: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Reflectance Map (ps=0, qs=0)

Page 15: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Reflectance Map

Credit: Ohad Ben-Shahar CS BGU

Page 16: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Reflectance Map

Credit: Ohad Ben-Shahar CS BGU

Page 17: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Reflectance Map

Page 18: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Reflectance Map (General)

y

zq

x

zp

isophote

ss qp ,

Page 19: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Reflectance Map

Given Intensity I in image,

there are multiple (p,q) combinations (= surface

orientations).

Use multiple images with

different light source

directions.

y

zq

x

zp

Isophote I

ss qp ,

Page 20: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Multiple Images = Multiple Maps

Can isolate p, q as contour intersection

(p,q) I1

I2

I2 I1

Page 21: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Example: Two Views

Still not unique for certain intensity pairs.

Page 22: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Constant Albedo

Solve linear equation system

to calculate 𝑁 .

Page 23: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Varying Albedo

Solution Forsyth & Ponce:

For each point source, we know the source vector (by assumption). We assume we know the scaling constant of the linear camera (k). Fold the normal (N) and the reflectance (𝝆(x,y)) into one

vector g, and the scaling constant and source vector into another Vj.

• Out of shadow:

• In shadow: 𝐼 𝑥, 𝑦 = 0

Page 24: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Multiple Images: Linear Least Squares Approach

• Combine albedo and normal

• Separate lighting parameters

• More than 3 images => overdetermined system

• How to calculate albedo 𝜌 and 𝑁 ?

𝑔 𝑥, 𝑦 = 𝜌 𝑥, 𝑦 𝑁 (x,y)

→ 𝑁 =𝑔

𝑔 , 𝜌 𝑥, 𝑦 = 𝑔

: 𝑔 (x,y)=𝑉−1i(x,y)

Page 25: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Example LLS Input

Problem: Some regions in some images are in

the shadow (no image intensity).

Page 26: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Dealing with Shadows (Missing Info)

For each point source,

we know the source

vector (by assumption).

We assume we know the

scaling constant of the

linear camera. Fold the

normal and the

reflectance into one

vector g, and the scaling

constant and source

vector into another Vj

Out of shadow:

In shadow:

I j(x,y) 0

I j (x, y) kB(x, y)

kr(x, y) N(x, y)S j g(x,y)Vj

No partial shadow

Page 27: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Matrix Trick for Complete Shadows

• Matrix from Image Vector:

• Multiply LHS and RHS with diag matrix

I12(x,y)

I22(x,y)

..

In2(x,y)

I1(x,y) 0 .. 0

0 I2(x,y) .. ..

.. .. .. 0

0 .. 0 In(x,y)

V1T

V2T

..

VnT

g(x,y)

Known Known Known

Unknown

Relevant elements of the left vector and the matrix

are zero at points that are in shadow.

Page 28: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Obtaining Normal and Albedo

• Given sufficient sources, we can solve the previous equation (most likely need a least squares solution) for g(x, y).

• Recall that N(x, y) is the unit normal.

• This means that rx,y) is the magnitude of g(x, y).

• This yields a check

– If the magnitude of g(x, y) is greater than 1, there’s a problem.

• And N(x, y) = g(x, y) / rx,y).

Page 29: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Example LLS Input

Page 30: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Example LLS Result

• Reflectance / albedo:

Page 31: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Recap

• Obtain normal / orientation, no depth

IMAGE PLANE

Depth?

Surface

Orientation

Page 32: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Goal

Shape as surface with depth and normal

Page 33: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Recovering a surface from normals - 1

Recall the surface is

written as

This means the normal

has the form:

If we write the known

vector g as

Then we obtain values

for the partial derivatives

of the surface:

(x,y, f (x, y))

g(x,y)

g1(x, y)

g2 (x, y)

g3(x, y)

fx (x,y) g1(x, y) g3(x, y)

fy(x, y) g2(x,y) g3(x,y)

N(x,y)1

fx2

fy2

1

fx

fy

1

Page 34: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Recovering a surface from normals - 2

Recall that mixed second partials are equal --- this gives us an integrability check. We must have:

We can now recover the

surface height at any

point by integration

along some path, e.g.

g1(x, y) g3(x, y) y

g2(x, y) g3(x, y) x

f (x, y) fx (s, y)ds0

x

fy (x,t)dt0

y

c

Page 35: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Height Map from Integration

How to integrate?

Page 36: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Possible Solutions

• Engineering approach: Path integration

(Forsyth & Ponce)

• In general: Calculus of Variation

Approaches

• Horn: Characteristic Strip Method

• Kimmel, Siddiqi, Kimia, Bruckstein: Level

set method

• Many others ….

Page 37: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shape by Integation (Forsyth&Ponce)

• The partial derivative gives the change in surface height

with a small step in either the x or the y direction

• We can get the surface by summing these changes in

height along some path.

Page 38: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Simple Algorithm

Forsyth & Ponce

Problem: Noise and

numerical (in)accuracy are

added up and result in

distorted surface.

Solution: Choose several

different integration paths,

and build average height

map.

Page 39: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Mathematical Property: Integrability

• Smooth, C2 continuous surface:

𝑍(𝑥, 𝑦)𝑥𝑦=𝑍(𝑥, 𝑦)𝑦𝑥

𝜕𝑝

𝜕𝑦=𝜕𝑞

𝜕𝑥

check if (𝜕𝑝

𝜕𝑦−

𝜕𝑞

𝜕𝑥)2 is small

Page 40: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Enforcing Integrability

• The solution for surface gradients might not be inconsistent.

• Hence there is no Z such that Zx = p and Zy

= q.

• To overcome this inconvenience, a good idea is to insert a step enforcing

integrability to guarantee that when we integrate p and q we will obtain the surface Z.

Page 41: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Enforcing Integrability

• The discrete Fourier transform can be used to find the depth Z and enforce the integrability constraint from the estimated p and q as follows;

• We compute the Fast Fourier Transform (FFT) of p and q.

• Let cp and cq are the Fourier transform of p and q respectively, then

Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape from

shading algorithms." Pattern Analysis and Machine Intelligence, IEEE Transactions on 10, no. 4

(1988): 439-451.

)(),(

yxj

yxpyxecp

)(),(

yxj

yxqyxecq

Page 42: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Enforcing Integrability

• Then Z can be computed as the inverse Fourier transform of c(x, y) where:

• Such that,

Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape from

shading algorithms." Pattern Analysis and Machine Intelligence, IEEE Transactions on 10, no. 4

(1988): 439-451.

)(),(

yxj

yxpyxecp

)(),(

yxj

yxqyxecq

)(),(

yxj

yxyxecZ

22

)),(),((),(

yx

yxqyyxpx

yx

ccjc

yxZx FjyxZ

xp ,),(

yxZy FjyxZy

q ,),(

Where Fz is the Fourier transform of Z(x,y),

Page 43: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Enforcing Integrability

• The function Z has three important properties;

– It provides a solution to the problem of reconstructing a surface from a set of non-integrable p and q.

Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape from

shading algorithms." Pattern Analysis and Machine Intelligence, IEEE Transactions on 10, no. 4

(1988): 439-451.

)(),(

yxj

yxyxecZ

22

)),(),((),(

yx

yxqyyxpx

yx

ccjc

where

Page 44: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Enforcing Integrability

• The function Z has three important properties;

– Since the coefficients c(x, y) do not depend on x and y, Z can be easily differentiated with respect to x and y to give a new set of integrable p and q, say p' and q', such that:

Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape from

shading algorithms." Pattern Analysis and Machine Intelligence, IEEE Transactions on 10, no. 4

(1988): 439-451.

)(),(

yxj

yxyxecZ

22

)),(),((),(

yx

yxqyyxpx

yx

ccjc

where

)()(),('),(

yxj

yxp

yxj

yxxyxyx ececj

x

Zp

)()(),('),(

yxj

yxq

yxj

yxyyxyx ececj

y

Zq

Page 45: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Enforcing Integrability

• The function Z has three important properties;

– Most importantly, p' and q' are the integrable pair closest to the old pair of p and q.

• This can be viewed as if we have projected the old p and q onto a set which contains only integrable pairs.

Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape from

shading algorithms." Pattern Analysis and Machine Intelligence, IEEE Transactions on 10, no. 4

(1988): 439-451.

)(),(

yxj

yxyxecZ

22

)),(),((),(

yx

yxqyyxpx

yx

ccjc

where

Page 46: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Wolff, November 4, 1998

SHAPE FROM SHADING

(Calculus of Variations Approach)

• First Attempt: Minimize error in agreement

with Image Irradiance Equation over the

region of interest:

( ( , ) ( , ))I x y R p q dxdyobject

2

Page 47: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

SHAPE FROM SHADING

(Calculus of Variations Approach)

• Better Attempt: Regularize the Minimization of

error in agreement with Image Irradiance Equation

over the region of interest:

p p q q I x y R p q dxdyx y x y

object

2 2 2 2 2 ( ( , ) ( , ))

Wolff, November 4, 1998

Page 48: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Horn,

Chapter11,

pp. 250-255 Small step in x,y → change in depth:

New values of p,q at this new point (x,y):

(r, s, t: second partial derivatives of z(x,y) w.r.t. x and y)

Hessian: curv. of surface

x

pr

x

q

y

ps

y

qt

Page 49: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Horn,

Chapter11,

pp. 250-255 Irradiance Equation, Reflectance Map:

Derivatives (chain rule):

Relationship between gradient

in the image and gradient in the

reflectance map

Page 50: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Horn,

Chapter11,

pp. 250-255 2 Equations for 3 unknowns (r,s,t): We

can’t continue in artibrary direction.

→ Trick: Specially chosen direction

Step in image E(x,y) parallel

to gradient in R

Page 51: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Horn,

Chapter11,

pp. 250-255 2 Equations for 3 unknowns (r,s,t): We

can’t continue in artibrary direction.

→ Trick: Specially chosen direction

Step in image E(x,y) parallel

to gradient in R

Solving for new values for p,q:

Change in (p,q) can

be computed via

gradient of image

Page 52: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Page 53: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Solution of differential equations: Curve on surface

Page 54: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Page 55: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Horn: Characteristic Strip Method

Horn,

Chapter11,

pp. 250-255

Page 56: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Linear Approaches for SFS

• Linear approaches reduce the non-linear problem into a linear through the linearization of the image irradiance equation .

• The idea is based on the assumption that the lower order components in the reflectance map dominate. Therefore, these algorithms only work well under this assumption.

Page 57: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Simple Scenario

• We will be concerned with the simplest scenario, where the following assumptions hold;

– Camera; orthographic projection.

– Surface reflectivity; Lambertian surface

– Known/estimated illumination direction.

– Known/estimated surface albedo/

– The optical axis is the Z axis of the camera and the surface can be parameterized as Z = Z(x,y).

• The image irradiance (amount of light received by the camera to which the gray-scale produced is directly proportional) can be defined as follows;

• Eq(A) is the typical starting point of many shape from shading techniques, yet it is of a great mathematical complexity, it is a non-linear partial differential equation in p = p(x,y) and q = q(x,y), which are the gradients of the unknown surface Z = Z(x,y)

TTT

I qpqp

qpRyxE ]1,,[1

),(),(22

,

InIr

rr (A)

Page 58: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Simple Scenario

• Eq(A) can be rewritten as follows:

Where 𝐈 = 𝑖𝑥, 𝑖𝑦, 𝑖𝑧𝑇

TTT

I qpqp

qpRyxE ]1,,[1

),(),(22

,

InIr

rr (A)

2222 1

]1,,][,,[1

),(qp

iqipiqpiii

qpyxE

zyxT

zyx

rr (A’)

Page 59: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

• Under the assumptions of :

– Lambertian surface,

– orthographic projections,

– the surface being illuminated by distant light sources, and

– the surface is not self-shadowing,

• Pentland defined the image irradiance equation as follows;

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

2222 1

cossinsincossin

1),(),(

qp

qp

qp

iqipiqpRyxE

zyx

r

TI ]cos,sinsin,cos[sin

Where light source direction is defined as:

Page 60: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

• It is assumed that the surface has constant albedo, hence it can be ignored as it is not a function of surface points anymore.

• In (A’) the surface normal is obtained from the cross product (1,0,p)x(0,1,q), yet in (B) the cross product is applied in the inverse way, i.e. (0,1,q)x(1,0,p), hence the normal vector becomes (p,q,-1) instead of (-p,-q,1).

• Moreover when using the representation of the illumination direction in terms of its slant and tilt, the negative sign in (p,q,-1) is ignored since .

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

2222 1

cossinsincossin

1),(),(

qp

qp

qp

iqipiqpRyxE

zyx

rversus

(B)

)cos(cos

2222 1

]1,,][,,[1

),(qp

iqipiqpiii

qpyxE

zyxT

zyx

rr (A’)

Page 61: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

• By taking the Taylor series expansion of (B) about p = po and q = qo, and ignoring the higher order terms, the image irradiance equation will be reduced to;

• For Lambertian surface, the above equation at p0 = q0 = 0 reduces to;

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

2222 1

cossinsincossin

1),(),(

qp

qp

qp

iqipiqpRyxE

zyx

r

(B)

),()(),()(),(),(),( 00000000 qpq

Rqqqp

p

RppqpRqpRyxE

sinsinsincoscos),( qpyxE

Page 62: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

• Next, Pentland takes the Fourier transform of both sides of (C).

• Since the first term on the right is a DC term, i.e. constant with respect to the variables we are looking for (surface normals), it can be dropped. Using Fourier transform identities, we have the following;

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

2222 1

cossinsincossin

1),(),(

qp

qp

qp

iqipiqpRyxE

zyx

r

(B)

sinsinsincoscos),( qpyxE (C)

yxZx FjyxZ

xp ,),(

yxZy FjyxZy

q ,),(

Where Fz is the Fourier

transform of Z(x,y),

Page 63: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

• Taking the Fourier transform of (C), we will get the following;

Where FE is the Fourier transform of the given image E(x,y).

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

2222 1

cossinsincossin

1),(),(

qp

qp

qp

iqipiqpRyxE

zyx

r

(B)

sinsinsincoscos),( qpyxE (C)

sinsin,sincos, yxZyyxZxE FjFjF

(D)

Page 64: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

• The depth map (our sought surface) Z(x,y) can be computed by rearranging the terms in (D), and then taking the inverse Fourier transform as follows;

• Hence,

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

2222 1

cossinsincossin

1),(),(

qp

qp

qp

iqipiqpRyxE

zyx

r

(B)

sinsinsincoscos),( qpyxE (C)

sinsin,sincos, yxZyyxZxE FjFjF

(D)

sinsinsincos,

sinsinsincos,

yx

EyxZ

yxyxZE

jj

FF

jjFF

yxZFyxZ ,),( 1

(E)

(F)

Page 65: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

• This algorithm gives a non-iterative, closed-form solution using

Fourier transform.

• The problem lies in the linear approximation of the reflectance

map, which causes trouble when the non-linear terms are dominant.

• As pointed out by Pentland, when the quadratic terms in the reflectance map dominate, the frequency doubling occurs, in this

case, the recovered surface will not be consistent with the

illumination conditions.

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

sinsinsincos

,yx

EyxZ

jj

FF

yxZFyxZ ,),( 1

(E)

(F)

Page 66: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Pentland’s Approach

Pentland, A., "Shape Information From Shading: A Theory About Human Perception," Computer

Vision., Second International Conference on , vol., no., pp.404-413, 5-8 Dec 1988.

Page 67: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shah’s Approach

• Shah employed the discrete approximations of p and q using finite

differences in order to linearize the reflectance map in terms of Z. The reflectance function for Lambertian surfaces is defined as

follows;

P. Tsai and M. Shah. Shape from shading using linear approximation. Image and Vision Computing,

12(8):487--498, 1994.

2222 1

]1,,][,,[1

),(qp

iqipiqpiii

qpyxE

zyxT

zyx

rr (A’)

2222 1

sinsinsincoscos

1),(

qp

qp

qp

iqipiqpR

zyx

tancos

cos

sincos

)3(

)1(

I

Iix

tansin

cos

sinsin

)3(

)2(

I

Iiy

TI ]cos,sinsin,cos[sin

(B)

Page 68: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shah’s Approach

• Comparing (B) with (A’),

– surface albedo is ignored (assumed to be constant over the whole surface).

• Using the following discrete approximations for p and q;

P. Tsai and M. Shah. Shape from shading using linear approximation. Image and Vision Computing,

12(8):487--498, 1994.

2222 1

]1,,][,,[1

),(qp

iqipiqpiii

qpyxE

zyxT

zyx

rr (A’)

2222 1

sinsinsincoscos

1),(

qp

qp

qp

iqipiqpR

zyx

(B)

),1(),( yxZyxZp

)1,(),( yxZyxZq

Page 69: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shah’s Approach

• Shah linearized the function f = E – R = 0 in terms of Z in the

vicinity of Zk-1 which is the surface recovered in iteration k-1.

• For a fixed point (x,y) and a given image E, a linear approximation

of the function f about a given depth map is obtained using Taylor series expansion up through the first order terms.

P. Tsai and M. Shah. Shape from shading using linear approximation. Image and Vision Computing,

12(8):487--498, 1994.

2222 1

]1,,][,,[1

),(qp

iqipiqpiii

qpyxE

zyxT

zyx

rr (A’)

2222 1

sinsinsincoscos

1),(

qp

qp

qp

iqipiqpR

zyx

(B)

),1(),( yxZyxZp

)1,(),( yxZyxZq

Page 70: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shah’s Approach

• For an N by N image, there are N2 such equations, which will form

a linear system.

• This system can be solved easily using the Jacobi iterative scheme, which simplifies the Taylor series expansion up to the first order of

f into the following equation (f = E – R);

P. Tsai and M. Shah. Shape from shading using linear approximation. Image and Vision Computing,

12(8):487--498, 1994.

2222 1

]1,,][,,[1

),(qp

iqipiqpiii

qpyxE

zyxT

zyx

rr (A’)

2222 1

sinsinsincoscos

1),(

qp

qp

qp

iqipiqpR

zyx

(B)

),1(),( yxZyxZp

)1,(),( yxZyxZq

),(

)),(()),(),(()),((0)),((

111

yxdZ

yxZdfyxZyxZyxZfyxZf

nnn

(C)

Page 71: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shah’s Approach

P. Tsai and M. Shah. Shape from shading using linear approximation. Image and Vision Computing,

12(8):487--498, 1994.

),(

)),(()),(),(()),((0)),((

111

yxdZ

yxZdfyxZyxZyxZfyxZf

nnn

(C)

• Let Zn(x,y)= Z (x,y) then

• Where

• Assuming Z0(x,y) = 0, then Z(x,y) can be extracted iteratively from (D).

),(

)),((

)),((),(),(

1

11

yxdZ

yxZdf

yxZfyxZyxZ

n

nnn

222222322

1

1)1(

)(

1)1(

)1)((

),(

)),((

yx

yx

yx

yxn

iiqp

ii

iiqp

qipiqp

yxdZ

yxZdf

(D)

Page 72: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Shah’s Approach

Page 73: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Another Solution to SFS: Kimmel, Siddiqi, Kimia, Bruckstein

x

pdf document

Page 74: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Kimmel, Siddiqi, Kimia, Bruckstein

Page 75: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Kimmel, Siddiqi, Kimia, Bruckstein

Page 76: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Kimmel, Siddiqi, Kimia, Bruckstein

Page 77: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Application Area: Geography

Page 78: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Application: Braille Code

pdf document

Page 79: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Mars Rover Heads to a New Crater NYT Sept 22, 2008

Page 80: Photometric Stereo, Shape from Shading SfS Chapter 2 new F&Pgerig/CS6320-S2013/Materials/CS...Frankot, Robert T., and Rama Chellappa. "A method for enforcing integrability in shape

Limitations

• Controlled lighting environment – Specular highlights?

– Partial shadows?

– Complex interrreflections?

• Fixed camera – Moving camera?

– Multiple cameras?

=> Another approach: binocular / geometric stereo