Computer Vision

CSE 252A, Winter 2004

David Kriegman

 

Assignment 1

Photometric stereo

(Due date: 2/4/2004)

 

 

The goal of this assignment is to implement an algorithm that reconstructs a surface using the concept of photometric stereo.  You can assume a Lambertian reflectance function, but the albedo is unknown and nonconstant in the images.  Your program will take in multiple images as input along with the light source direction for each image.

 

 

Test case 1: Synthetic data

 

The following four test images will serve as input, and they can be downloaded from http://www.cs.ucsd.edu/classes/wi04/cse291-c/hw1-data.tar . The first row shows the image, the second row is the file name, and the third row is the light source direction used to generate the image.

 

b

im1.png

im2.png

im3.png

im4.png

[0 0 -1]

[0 0.2 -1]

[0 -0.2 -1]

[0.2 0 -1]

 

Your program should have two parts:

  1. Read in the images, and estimate the surface normals and albedo map.
  2. Reconstruct the depth map from the normals.

 

For the second part, try to work out an approach that provides better results than the naive approach outlined in class and in the text.  You might average across multiple integration paths, try out the method by Horn.  For this data set, the naïve approach may work out OK, but for the face data it may be problematic.

 

Try this out with three subsets of images:

  1. im1.png, im2.png, im4.png (Easiest)
  2. im1.png, im2.png, im3.png (problematic)
  3. all four images (most accurate)

 

What to include in your report

You should write up a report that shows:

1.      Estimated albedo map

2.      Estimated surface normals by either showing

a.       A needle map

b.      Three images showing three components of surface normal

3.      A wireframe of a depth map (you can use surf() in matlab).

 

Test Case 2: Face reconstruction

 

For this part  we will use data the Yale Face Database: B ftp://plucky.cs.yale.edu/CVC/pub/images/yalefacesB/ . You should use yaleB01_P00.tar.gz, which is under the TarSets directorty,  but you can also use other datasets in addition. 

 

To read in all the images as well as construct a matrix containing all corresponding lighting directions you can use Paul Schrater’s matlab routine LoadFaceImages.m for this (http://gandalf.psych.umn.edu/~schrater/schrater_lab/courses/CompVis03/HW4/).  This also requires the routine getpgmraw.m which you can find on both websites. 

 

As a preprocessing step you should subtract the ambient image from the other images and make sure no pixel is smaller than zero.  You should also divide the image intensities by 255 to scale them from [0,1].  One possibility to reduce noise consists of convolving the image with a small Gaussian kernel (blurring), but this might not be necessary. 

This should give you input images for your algorithm.

 

This dataset contains 64 images per person, but you’ll only want to use a modest number of images (at least three and perhaps six images).  From the input images, crop out a square region of the face, and just work with that sub-image.

 

What to include in your report.

  1. The cropped input images for your algorithm
  2. The albedo map
  3. Normal field
  4. Wireframe of the depth map
  5. Commentary about any issues that arose, ways to improve your method, etc.

 

What to Hand in

 

You should hand in:

  1. A report with the items described above, any other figures, and comments/issues that you find relevant.
  2. Hardcopy of your code.
  3. Email me a tar or zip file with the code and report.