Shape from Shading Source Code


The Package

This program is packaged in shading.tar.Z

Abstract

In this paper, we present an extremely simple algorithm for shape from shading, which can be implemented in 25 lines of C code (code included), and which converges in one to two iterations. The algorithm is very fast, taking .2 seconds on a Sun SparcStation-1 for a 128 x 128 image, and is purely local and highly parallelizable (parallel implementation included). The algorithm gives a solution which is proveably convergent and unique, and is general in that it works for both the Lambertian and Specular reflectance functions. In our approach, we employ a linear approximation of the reflectance function, as used by others. However, the major difference is that we first use the discrete approximations f or surface normal, p and q, using finite differences, and then linearize the reflectance function in depth, Z(x,y), instead of p and q. The algorithm has been tested on several synthetic and real images of both Lambertian and specular surfaces, and good results have been obtained. It gives good results even for the spherical surfaces, in contrast to other linear methods.

What's In It

  Program Name: shading
  Output: The output data file (the estimated depth map) can
          be display using xprism3, part of Khoros, or any
          other 3-D plotting program.

The Technical Report

The algorithm is described in Technical Report fSFS.ps.gz