In contrast to the techniques in photometric stereo and structure from motion that need to at least capture two images of a scene, the technique of shape from shading can recover the shape information of a 3-D scene from a single image.
When an object is illuminated in a scene, different parts of its surface will appear with different brightness, as they are oriented differently. This spatial variation of brightness is referred to as shading. The shading on an image depends on four factors: The geometry of the visible surface (surface normal), the radiance direction and radiance energy, the relative orientation and distance between an object and an observer, and the reflectance property of the object surface, Zhang (2000b). The meaning of the letters in Figure 3.23 is as follows. The object is represented by the patch Q, and the surface normal N indicates the orientation of the patch. The vector I represents the incidence intensity and the direction of the source. The vector V indicates the relative orientation and distance between the object and the observer. The reflectance property of the object surface p depends on the material of the surface, which is normally a scale, but can be the function of the patch’s spatial position.
According to Figure 3.23, the image’s gray levels depend on the incidence intensity I, the reflectance property of the object surface ρ, and the angle between the viewing direction and the surface normal i, which is given by
Consider the case where the light source is just behind the observer, cos i = cos e. Suppose that the object has a Lambertian surface; that is, the surface reflectance intensities are not changed with the observation locations. The observed light intensities are
Since N = [pq – 1]T and V = [0 0 – 1]T, by overlapping the gradient coordinate system onto the XY coordinate system, as shown in Figure 3.24,
Taking eq. (3.82) into eq. (3.80) yields
Consider now the case where i = e, and suppose that I is perpendicular to the patch Q, which has a normal [pi qi − 1]T. Then it has
Taking eq. (3.84) into eq. (3.80) yields the image’s gray levels with any incident angle by
Equation (3.85) can be written in a more general form as
Equation (3.85) is just the image brightness constraint equation as shown in eq. (3.28).
A 3-D surface can be represented by z = f(x, y). A patch on it can be represented by N = [p q − 1]T. From the orientation point of view, a 3-D surface is a point G(p, q) in a 2-D gradient space, as shown in Figure 3.25. Using the gradient space to study the 3-D surface will reduce the dimensionality, but this representation cannot determine the location of the 3-D surface in the 3-D coordinate system. In other words, a point in a 2-D gradient space can represent all patches having the same orientation, but these patches can have different 3-D space locations.
With the help of the gradient space, the structure formed by cross-planes can be easily understood.
Example 3.9 Judge the structure formed by cross-planes.
Several planes cross to make up a convex or concave structure. Consider two crossed planes S1 and S2 forming a joint line l, as shown in Figure 3.26. In Figure 3.26, G1 and G2 represent the points in the gradient space, corresponding to the normal of the plane. The connecting line between G1 and G2 is perpendicular to the projection line l′ of l.
Overlapping the gradient space to the XY space, and projecting the two planes and the gradient points corresponding to their normal on the overlapped space, the following conclusion can be made. These two planes form a convex structure if S and G have the same sign (located on the same side of l′), as shown in Figure 3.27(a). These two planes form a concave structure if S and G have different signs (located separately on two sides of l′), as shown in Figure 3.27(b).
A further example is shown in Figure 3.28. In Figure 3.28(a), three planes A, B, C are intersected with intersect lines l1, l2, l3, respectively. When the sequence of planes is AABBCC, clockwise, then the three planes form a convex structure, as shown in Figure 3.28(b). When the sequence of planes is CBACBA, clockwise, then the three planes form a concave structure, as shown in Figure 3.28(c).
Referring back, eq. (3.83) can be rewritten as
where K represents the relative reflectance intensity. Equation (3.87) corresponds to a set of nested circles in the PQ plan, in which each circle represents the trace of patches having the same gray level. When i = e, the reflectance map is composed of circles having the same center. While for the case of i ≠ e, the reflectance map is composed of ellipses or hyperbolas.
Example 3.10 Application of the reflectance map.
Suppose that three planes A, B, C are observed, and they form the intersecting angles shown in Figure 3.29(a). The lean angle for each plane is not known, yet, but it can be determined with the help of the reflectance map. Suppose that I and V have the same directions, and KA = 0.707, KB = 0.807, and KC = 0.577. According to the characteristic that the connecting lines between G(p, q) of the two planes are perpendicular to these two planes, the triangle shown in Figure 3.29(b) can be obtained. The problem becomes to find GA, GB and GC on the reflectance map shown in Figure 3.29(c). Taking KA, KB, and KC into eq. (3.87) yields two groups of solutions:
The solution of eq. (3.88) corresponds to the small triangle in Figure 3.29(c), while the solution of eq. (3.89) corresponds to the big triangle in Figure 3.29(c). Both of them are correct.
3.3.3Solving the Brightness Equation with One Image
In Section 3.1, the brightness equation has been solved by using additional images taken under different lighting conditions, which provide additional constraints for the brightness equation. Here, only one image is used, but some smooth constraints could be used to provide additional information.
3.3.3.1Linear Case
As shown in Figure 3.30, suppose that the reflectance map is a function of a linear combination of gradients,
where a and b are constants. In Figure 3.30, the contours of the constant brightness are parallel lines in the gradient space.
In eq. (3.90), f is a strictly monotonic function that has an inverse, f−1. As shown in Figure 3.31
The gradient (p, q) cannot be determined from a measurement of the brightness alone, but one equation that constrains its possible values can be obtained. The slope of the surface, in a direction that makes an angle θ with the x-axis, is
If a particular direction θ0 is chosen, where tan θ0 = b/a,
The slope in this direction is
The slope of the surface in a particular direction is thus obtained. Starting at a particular image point, and taking a small step of a length δs, a change in z of δz = mδs is produced by
Both x and y are linear functions of s, given by
To find the solution at a point (x0, y0, z0) on the surface, integrating the differential equation for z yields
A profile of the surface along a line in the special direction (one of the straight lines in Figure 3.32) is obtained. The profile is called a characteristic curve.
3.3.3.2Rotationally Symmetric Case
When the point source is located at the same place as the viewer, the reflectance map is rotationally symmetric, which is given by
Suppose that the function f is strictly monotonic and differentiable, with the inverse f−1. It has
The direction of the steepest ascent makes an angle θs with the x-axis, where tan θs = p/q, so that
According to eq. (3.92), the slope in the direction of the steepest ascent is
In this case, the slope of the surface can be found, given its brightness, but the direction of the steepest ascent cannot be found. Suppose that the direction of the steepest ascent is given by (p, q). If a small step of a length δs is taken in the direction of the steepest ascent, the changes in x and y would be
The change in z would be
If taking the step length to be the above expressions will be simplified as
A planar surface patch gives rise to a region of a uniform brightness in the image. Only curved surfaces show non-zero brightness gradients. To determine the brightness gradients, equations for the changes of p and q should be developed. Denote u, v, and w as the second partial derivatives of z with respect to x and y
Then,
where f′(r) is the derivative of f(r) with respect to its single argument r.
The changes δp and δq caused by taking the step (δx, δy) in the image plane can be determined by differentiation,
Following eq. (3.104),
Following eq. (3.106),
Therefore, in the limit as δs → 0, the following five differential equations are obtained (the dots denote differentiations with respect to s)
Given starting values, this set of five ordinary differential equations can be solved numerically to produce a curve on the surface of the object.
By differentiating one more time with respect to s, the alternate formulation can be obtained as
Since both Ex and Ey are image brightness measurements, these equations must be solved numerically.
3.3.3.3General Smooth Case
In general, the object surface is quite smooth. This induces the following two equations
Combining them with the image brightness constraint equation, the problem of solving the surface orientation becomes the problem of minimizing the following total error
Denote the average values of p and q neighborhoods, respectively. Taking the derivatives of ε to p and q, setting the results to zero, and taking and into eq. (3.114) yields
3.144.30.236