Several recently developed techniques for reconstructing surface shape from shading information estimate surface slopes without ensuring that they are integrable. This paper presents a n approach for enforcing integrability, a particular implementation of the approach, a n example of its application to extending a n existing shapefrom-shading algorithm, and experimental results showing the improvement that results from enforcing integrability. A possibly nonintegrable estimate of surface slopes is represented by a finite set of basis functions, and integrability is enforced by calculating the orthogonal projection onto a vector subspace spanning the set of integrable slopes. This projection maps closed convex sets into closed convex sets and, hence, is attractive as a constraint in iterative algorithms. The same technique is also useful for noniterative algorithms since it provides a least-squares fit of integrable slopes to nonintegrable slopes in one pass of the algorithm. The special case of Fourier basis functions is also formulated. This provides an intuitive frequency domain interpretation of shape from shading, a computationally efficient implementation using fast Fourier transforms, and a convenient method for introducing low-resolution information into the shape-from-shading solution. Reconstruction of surface height by integrating surface slope estimates is obtained as a byproduct of the integrability constraint. The integrability projection constraint was applied to extending a n iterative shape-from-shading algorithm of Brooks and Horn. Experimental results show that the extended algorithm converges faster and with less error than the original version. Good surface reconstructions were obtained with and without known boundary conditions and for fairly complicated surfaces. Simulation examples show that the algorithm is robust with respect to large (but known) changes in illumination geometry, obtaining high-quality reconstructions even in the presence of significant shadowing. Other possible applications of this method to computer vision problems such as shape from texture and surface reconstruction from synthetic aperture radar imagery are discussed.