Problemadvanced
Shape from shading
Also called photoclinometry.
Recover the shape of a surface from the shading of one image under known light and reflectance. Without boundary data the first-order PDE is ill-posed.
- Time
- Ω(W H) worst
- Where
- H = the image height in pixels; W = the image width in pixels
- Model
- Real RAM
Shape from shading is the problem of finding the 3D shape of a surface from one image, using only how bright each pixel is. A surface patch that faces the light looks bright and a patch that turns away looks dark, so the brightness says something about the direction the surface faces. But one brightness value at a pixel cannot fix the two numbers of a surface direction, so the problem needs more: smoothness, boundary values, or a model that removes the ambiguity. Horn (1970) wrote it as a first-order partial differential equation and solved it along characteristic curves. In astronomy the same task, applied to images of the Moon and planets, is called photoclinometry. With several images under different lights, the problem becomes photometric stereo, which has a unique solution at each pixel. Shape from shading uses only one image, so it is much harder, and in its simplest form it has more than one solution.
In plain words
Look at a photo of a smooth white ball lit from the front. The middle is bright and the edge gets darker. From this alone you can guess that the middle faces you and the edge turns away. You cannot tell which way it turns: a ball that bulges toward you and a bowl that curves away give the same photo. The brightness of one pixel tells only how far the surface turns from the light, not in which direction. Shape from shading puts together the clues from all pixels, assumes the surface is smooth, and uses known points, such as the edge of the object, to choose one shape. The result is often good in its fine detail but can be wrong in its overall shape.
Definition
Frame. As on photometric stereo, this page uses the height-field frame of Horn: and lie in the image plane and points toward the viewer. The surface is with slopes and , and its unit normal is .
Input.
- One gray image of size , with a linear response.
- The reflectance map : the brightness of a surface patch with slopes under the known light. For a Lambertian surface with albedo and a distant light in the unit direction ,
- Often, boundary data: the depth on the border of the image or of a region, or the points where the surface faces the light exactly.
Output. A height map that satisfies the image irradiance equation
at every pixel, together with the boundary data.
The eikonal form. With the light at the viewer, , and , the equation is , which is the eikonal equation
The brightness fixes the steepness of the surface at each point, and nothing else. The points with , where the surface faces the light, are the singular points of the equation: there , and has a local maximum, a local minimum or a saddle.
Ill-posed. In this simple form, the problem does not have a unique solution. If solves it, so do for every constant and , since does not change. At each singular point, the surface can bulge up or down, and away from them, nonsmooth solutions can join pieces. Without boundary data and a rule that picks one solution, the image does not determine the shape.
Variants
- Light at the viewer or oblique. With the light at the viewer, the problem is the eikonal equation. An oblique light gives a more general first-order equation of Hamilton and Jacobi type.
- Orthographic or perspective camera. The classical problem uses an orthographic camera. Prados and Faugeras (2005) use a perspective camera with a point light at the optical center whose light falls with the square of the distance. They show that this model is well-posed: the darkening with distance breaks the convex and concave ambiguity.
- Known or unknown light and albedo. With an unknown light direction or albedo, these must be estimated too, which adds more ambiguity. Natural light from all directions is often modeled with a few low-frequency terms.
- Other reflectance. Specular or rough surfaces need a different reflectance map, for example from a measured BRDF.
- Shading as a refinement. Many systems use a rough depth map from stereo or a depth camera and use shading only to add fine detail. This removes most of the ambiguity.
Examples
One pixel. With the light at the viewer and , a pixel of brightness has : the surface there slopes by degrees, in a direction that the pixel does not tell. All slopes on the circle give the same brightness.
A ball and a bowl. The hemisphere has and , so and, with the light at the viewer, . The image is brightest at the center and goes to 0 at the edge. The bowl has the same and gives exactly the same image. The center is the one singular point, and the choice between a maximum and a minimum there decides between the two shapes.
A crater illusion. A photo of a crater on the Moon, turned upside down, often looks like a hill. When the light direction is not known, a viewer assumes light from above, and turning the image changes the shape that the shading suggests. This is the same ambiguity, made worse by the unknown light.
Known algorithms
Zhang et al. (1999) and Durou et al. (2008) survey the methods. Durou et al. sort them into PDE methods, optimization methods and methods that approximate the equation.
| Class | Method | Idea |
|---|---|---|
| PDE | characteristic strips (Horn 1970) | integrate ordinary differential equations along characteristic curves, by the method of characteristics, from a known start curve or from singular points |
| PDE | viscosity solutions | solve the eikonal or Hamilton-Jacobi form on the grid with an upwind scheme, which picks one solution when the depth on the boundary and at the singular points is given |
| PDE | fast marching | solve the eikonal form in one pass, in order of increasing depth from the start points, in time |
| Optimization | variational methods | minimize the squared brightness error plus a smoothness term, and often an integrability term, by iteration; see the papers collected by Horn and Brooks (1989) |
| Approximation | local linearization | replace the reflectance map by a linear function of or of the depth near the current estimate, and solve the linear problem; repeat |
Optimization methods often estimate the slopes first and then fit a height map. The fit is done by projecting the slopes onto integrable surfaces with the fast Fourier transform (Frankot and Chellappa 1988), or by solving a Poisson equation.
Bounds
- Input size. On the real RAM, a method that gives a height for every pixel must read every pixel in the worst case, since the brightness of a pixel that it does not read can change the slope there. So any method takes time. Fast marching and sweeping methods for the eikonal form come close: and per sweep.
- No unique answer from the image alone. In the classical model, and give the same image, so no method can decide between them without extra data. Under a known light that is not at the viewer, the image still gives only one equation for two unknowns at each pixel.
- Accuracy. The benchmarks of Zhang et al. and Durou et al. show that no method gives good results on all test images. The errors depend on the image, the noise and how well the model fits the real surface.
Reductions
- From photometric stereo. Photometric stereo with images under different lights gives equations at each pixel. Shape from shading is the case , where the linear system has fewer equations than unknowns.
- To the eikonal equation. With the light at the viewer and constant albedo, the problem is the eikonal equation with speed , so methods for shortest paths and wave fronts, such as fast marching, solve it.
- To normal integration. If the slopes are known, finding is a Poisson equation with boundary conditions.
Applications
- Planetary maps. Photoclinometry finds slopes and heights on the Moon and planets from orbital images, where only one image of an area may exist.
- Shape refinement. Fine detail from shading improves depth maps from stereo and from depth cameras, and meshes from multi-view stereo.
- Endoscopy and inspection. A camera with a light next to its lens is close to the model of Prados and Faugeras, for example in medical endoscopes.
- Human vision. The ambiguities explain how people see shape from shading and where they are fooled.
References
- Berthold K. P. Horn, Shape from shading: a method for obtaining the shape of a smooth opaque object from one view, PhD thesis, Massachusetts Institute of Technology, 1970, the image irradiance equation as a first-order partial differential equation and its solution along characteristic strips
- Berthold K. P. Horn and Michael J. Brooks (editors), Shape from Shading, MIT Press, 1989, the collected papers on the reflectance map and on variational and characteristic methods
- Ruo Zhang, Ping-Sing Tsai, James Edwin Cryer and Mubarak Shah, Shape from shading: a survey, IEEE Transactions on Pattern Analysis and Machine Intelligence 21(8), 1999, pages 690 to 706, the classes of methods (minimization, propagation, local and linear) and their comparison on synthetic and real images
- Jean-Denis Durou, Maurizio Falcone and Manuela Sagona, Numerical methods for shape-from-shading: a new survey with benchmarks, Computer Vision and Image Understanding 109(1), 2008, pages 22 to 43, the sorting of methods into PDE methods, optimization methods and methods that approximate the image irradiance equation, and the benchmarks
- Emmanuel Prados and Olivier Faugeras, Shape from shading: a well-posed problem?, IEEE Conference on Computer Vision and Pattern Recognition 2005, the perspective model with a light at the optical center and attenuation with the square of the distance, for which the problem is well-posed
- Robert T. Frankot and Rama Chellappa, A method for enforcing integrability in shape from shading algorithms, IEEE Transactions on Pattern Analysis and Machine Intelligence 10(4), 1988, pages 439 to 451, the projection of a gradient field onto integrable surfaces in the Fourier domain
- Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Section 13.1.1, Shape from shading and photometric stereo
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag BVKC3J Edit this page History Report an error Markdown