3.3Shape from Shading

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.

3.3.1Shading and Shape

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

Figure 3.23: Four factors influencing gray-level variation.

E(x,y)=I(x,y)ρcosi(3.80)

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

E(x,y)=I(x,y)ρcose(3.81)

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,

cose=cosi=[pq1]T[001]T[pq1]T||[001]T|=1(p2+q2+1)(3.82)

Taking eq. (3.82) into eq. (3.80) yields

E(x,y)=I(x,y)ρ1p2+q2+1(3.83)

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

cosi=[pq1]T[plqql1]T[pq1]T|[plqql1]T|=(ppl+qql+1)p2+q2+1pl2+ql2+1(3.84)

Taking eq. (3.84) into eq. (3.80) yields the image’s gray levels with any incident angle by

Figure 3.24: Overlap of gradient coordinate system and XY coordinate system.

E(x,y)=I(x,y)ρ(ppl+qql+1)p2+q2+1pl2+ql2+1(3.85)

Equation (3.85) can be written in a more general form as

E(x,y)=R(p,q)(3.86)

Equation (3.85) is just the image brightness constraint equation as shown in eq. (3.28).

3.3.2Gradient Space

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).

Figure 3.25: Gradient space.

Figure 3.26: Cross of two planes in 3-D space.

Figure 3.27: Convex or concave structures made by two planes in a 3-D space.

Figure 3.28: Two cases of intersected three planes.

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

p2+q2=(I(x,y)ρE(x,y))21=1K21(3.87)

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 ie, the reflectance map is composed of ellipses or hyperbolas.

Figure 3.29: Illustration of the application of the reflectance map.

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:

(pA,qA)=(0.707,0.707),(pB,qB)=(0.189,0.707),(pc,qc)=(0.707,1.225)(3.88)

(pA',qA')=(1,0),(pB',qB')=(0.732,0),(pc',qc')=(1,1)(3.89)

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.

Figure 3.30: The reflectance map of a linear case.

Figure 3.31: A strictly monotonic function that has an inverse.

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,

R(p,q)=f(ap+bq)(3.90)

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

aq+bq=f1[E(x,y)](3.91)

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

m(θ)=pcosθ+qsinθ(3.92)

If a particular direction θ0 is chosen, where tan θ0 = b/a,

cosθ0=a/a2+b2sinθ0=b/a2+b2(3.93)

The slope in this direction is

m(θ0)=ap+bqa2+b2=1a2+b2f1[E(x,y)](3.94)

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

dzds=1a2+b2f1[E(x,y)](3.95)

Both x and y are linear functions of s, given by

x(s)=x0+scosθy(s)=y0+ssinθ(3.96)

To find the solution at a point (x0, y0, z0) on the surface, integrating the differential equation for z yields

z(s)=Z0+1a2+b20sf1[E(x,y)]ds(3.97)

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

R(p,q)=f(p2+q2)(3.98)

Suppose that the function f is strictly monotonic and differentiable, with the inverse f−1. It has

p2+q2=f1[E(x,y)](3.99)

The direction of the steepest ascent makes an angle θs with the x-axis, where tan θs = p/q, so that

cosθs=p/p2+q2andsinθs=q/p2+q2(3.100)

Figure 3.32: The surface can be recovered by integration along the lines.

According to eq. (3.92), the slope in the direction of the steepest ascent is

m(θs)=p2+q2=f1[E(x,y)](3.101)

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

δx=pp2+q2δsδy=qp2+q2δs(3.102)

The change in z would be

δz=mδs=p2+q2δs=f1[E(x,y)]δs(3.103)

If taking the step length to be p2+q2δs, the above expressions will be simplified as

δx=pδsδy=qδsδz=(p2+q2)δs=f1[E(x,y)]δs(3.104)

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

u=2zx22zxy=v=2zyxw=2zy2(3.105)

Then,

Ex=2(pu+qv)f'andEy=2(pv+qw)f'(3.106)

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,

δp=uδx+vδyδq=vδx+wδy(3.107)

Following eq. (3.104),

δp=(pu+qv)δsδq=(pv+qw)δs(3.108)

Following eq. (3.106),

δp=Ex2f'δsδq=Ey2f'δs(3.109)

Therefore, in the limit as δs → 0, the following five differential equations are obtained (the dots denote differentiations with respect to s)

x˙=py˙=qz˙=p2+q2p˙=Ex2f'q˙=Ey2f'(3.110)

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 x˙=pandy˙=q one more time with respect to s, the alternate formulation can be obtained as

x¨=Ex2f'y¨=Ey2f'z˙=f1[E(x,y)](3.111)

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

(p)2=(px+py)2=0(3.112)

(q)2=(qx+qy)2=0(3.113)

Combining them with the image brightness constraint equation, the problem of solving the surface orientation becomes the problem of minimizing the following total error

ε(x,y)=xy{[E(x,y)R(p,q)]2+λ[(p)2+(q)2]}(3.114)

Denote p¯andq¯, the average values of p and q neighborhoods, respectively. Taking the derivatives of ε to p and q, setting the results to zero, and taking p=pp¯ and q=qq¯ into eq. (3.114) yields

p(x,y)=p¯(x,y)+1λ[E(x,y)R(p,q)]Rp(3.115)

q(x,y)=q¯(x,y)+1λ[E(x,y)R(p,q)]Rq(3.116)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.30.236