Skip to content

Foundation of Computer Vision: Photometric Stereo

Photometric Stereo

Photometric stereo is a technique in computer vision for estimating the surface normals of objects by observing that object under different lighting conditions. Having this surface normals, we can recreate the shape of the object in 3D. Theoretically, a minimum of three light directions are required to fully recover the 3D shape surface normal, but because there are noises, more than 3 light sources will improve the accuracy of the recovery. There are some limitations to this method: 1. the light source needs to be far away so that it can be approximated as a point light source. 2. Specular (bright reflective spot) or dark spots don't give accuracy results because the camera sensor clip the signal. 3. This model do not take into account for shadow.

Image brightness received by the camera at each pixel in each colour channels v = R, G, B, is given by

(1)      I_v(\vec{x}) = a_v(\vec{x})[\vec{n}(\vec{x}) \cdot \vec{L}]

where a is the albedo of the surface at pixel  \vec{x}, \vec{n} is the surface normal and \vec{L} is the direction of the light source.


The first step before doing any 3D surface recovering is calibration. To do this, we used a chrome sphere, a camera with fixed position and several light sources with fixed position as well. We then use the images taken with one light source turn on a time.


Screen Shot 2015-10-05 at 2.10.21 PM

We can turn the light on and capture the chrome sphere shape and produce a mask image.

Screen Shot 2015-10-05 at 2.10.30 PM

Using equation (1) and the two images, we can figure out this one light source's direction. This is because we know the surface normal of the chrome sphere at any one pixel of the image, the surface albedo of the chrome sphere (~1 in grayscale) and the light intensity (given by the pixel brightness).

After figuring out several light source direction, we can now apply the light to different objects. We first need to find out the surface normal using a grayscale image first because we can simplify the albedo to only 1 unknown.

We use the minimize square error method,

(2)      min \sum^k_{j=1} (I_v(\vec{x})- a_v(\vec{x}) \vec{n} (\vec{x}) \cdot \vec{L}_j)^2

Where k is the number of light sources. We take the derivative of the square error with respect to the surface normal and set the derivative equal to 0 (to find the minimum). We then end up with the following equation:

(3)     \sum^k_{j=1}I_j(\vec{x}) =\sum^k_{j=1} a \vec{n}(\vec{x}) \cdot \vec{L}_j

a now is just a scale factor for the surface normal (because it is in grayscale), so we can simply just ignore it because we are only interested in the unit vector of the surface normal. Equation (3) is essentially in matrix form, we can use the least square method to solve for the surface normal. Similarly,  we can solve for the RGB albedo after the light source directions have been calculated.


Sample input images (I only show 1 input image per object here, but I actually have 11 different images per object. All have light source in different direction):

Screen Shot 2015-10-05 at 2.40.05 PM Screen Shot 2015-10-05 at 2.43.42 PMScreen Shot 2015-10-05 at 2.43.31 PM

Sample output:

Screen Shot 2015-10-05 at 2.41.51 PM

Screen Shot 2015-10-05 at 2.42.07 PM

Screen Shot 2015-10-05 at 2.43.08 PM

Screen Shot 2015-10-05 at 2.42.55 PM

Screen Shot 2015-10-05 at 2.47.22 PM

Screen Shot 2015-10-05 at 2.47.17 PM

This is written in Matlab.

Published inAcademicProgramming

Be First to Comment

Leave a Reply

Facebook IconYouTube IconTwitter IconVisit My LinkedinVisit My Linkedin