Project 3: Photometric Stereo

Ba-Quy Vuong and Nan Chen

1. Introduction

In this project, we implemented a system to construct a height field from a series of images of a diffuse object under different point light sources. In addition to creating photometric stereos, we also implemented the following extensions:

2. The overall process

The process of constructing photometric stereos basically consists of four steps:

3. Implementation Details

Light Source Direction Estimation:


where N is the normal vector at the highlight center point and R is the reflection vector. R=(0,0,-1) and N is the normalized vector of (hx,hy,cx,cy are the coordinates of the highlight center and ball center respectively. r is the ball’s radius):

Normal Calculation:

The appearance of diffuse objects is modeled as where I is the pixel intensity, kd is the albedo, and L is the lighting direction (a unit vector), and n is the unit surface normal. Let g=kdn, g can be calculated by solving a linear squares problem. The objective function is:

Once we have the vector g=kdn, n can be computed by normalizing g.

Abedo Calculation:

To make the estimates more accurate, we use another least square estimation after normal estimates. Basically, we find the albedo for each channel by minimizing

for the set of all images. The albedo can be solved analytically in the situation by

After we solve the albedo for each channel respectively, we can combine them into a RGB channel image, and display it accordingly. The results listed following indicates that albedo for different channel have close relationship with the color channel of the original images.

Height Estimation:

After normal vectors for each point are estimated, we can also estimate the height for different point by solving the equation array

and

using least square methods. Because of the sparse character of coefficient matrix, we use the sparse matrix in Matlab to save memory in computation. After we estimate the height in the mask area, we can use surfl to plot the 3D shape and can view it from different angle. Detailed results are shown in the next section.





4. Results

Figure 1: RGB-encoded normals

Figure 2: Abedo map


Figure 3: Reconstructed surface 1

Figure 4: Reconstructed surface 2


Figure 5: RGB-encoded normals

Figure 6: Abedo map


Figure 7: Reconstructed surface 1

Figure 8: Reconstructed surface 2


Figure 9: RGB-encoded normal

Figure 10: Abedo map


Figure 11: Reconstructed surface 1

Figure 12: Reconstructed surface 2



Figure 13: RGB-encoded normals

Figure 14: Abedo map


Figure 15: Reconstructed surface 1

Figure 16: Reconstructed surface 2


Figure 17: RGB-encoded normals

Figure 18: Abedo map


Figure 19: Reconstructed surface 1

Figure 20: Reconstructed surface 2


Figure 21: RGB-encoded normals

Figure 22: Abedo map


Figure 23: Reconstructed surface 1

Figure 24: Reconstructed surface 2



5. Extensions

5.1. Estimating light source directions and surface normals simultaneously

This algorithm estimates the light source directions and surface normals simultaneously. Thus, a separate step of estimating light source direction is not needed. The algorithm works as follows.

where iij is pixel intensity.

When implementing this algorithm, we realized that it is crucial to do coordinate transformation as the coordinates used by the algorithm are different from what we are using. After doing coordinate transformation, the result is very optimistic.

Figure 25: RGB-encoded normals using the simultaneous algorithm

Figure 26: Abedo map using the simultaneous algorithm


Figure 27: Reconstructed surface 1 using the simultaneous algorithm

Figure 28: Reconstructed surface 2 using the simultaneous algorithm



5.2. Improving height field estimates with smooth constraints and intensity weighting

In previous sections, we estimate the height field by solving the following least square optimization problem

However, the solution to this function has some issues need to be resolved. First, the results may not be smooth enough for a surface. Second, the noise introduced in extreme dark or bright area may make the estimate of normal vectors inaccurate, and therefore make the estimate of height field unreliable.

Considering these two issues, we change the objective function to improve the estimate of the height field. Our first method adds a constraint term in the objective function to control the second order derivative not to be large. Specifically, we want to find

In the above equations, we use

and

to approximate the second order derivative along x and y directions respectively. λ is the factor controlling the weight of the smooth constraints. The recovered height field with smooth constraints is shown in the following figure:

Figure 29: Reconstructed surface 1 using smooth constraint recovery

Figure 30: Reconstructed surface 2 using smooth constraint recovery

On the other hand, the pixel value close to 0 or 255 could not represent the real intensity well. Therefore, a intensity weighting method is necessary to effectively eliminates the noise. Therefore, we use the similar weighting as

And the corresponding objective function can be expressed as

where the intensity weighting comes into play to determine which constraint is more important for height recovery. The results is shown in the following figures:

Figure 31: Reconstructed surface 1 using intensity weighting

Figure 32: Reconstructed surface 2 using intensity weighting


6. Discussions

From the results we listed above, we can find that our algorithm does not work for all the image set. One common observation among those failed images is that at some point, the normal vector estimation is not stable. In another world, we may get a matrix with rank less than 3, therefore, the obtained normal vector is misleading. We can find from the failed image that when there is some dark area, such as eye ball, or hair, the normal estimation would be inaccurate.

A possible solution to this is set a threshold of the image pixel value. When the pixel value is smaller than that, we can just ignore this pixel, and do not use its normal vector in estimation. However, if we just ignore these normal vectors, the corresponding height will have defects, and more sophisticated method should be used to get satisfactory results.

7. Contributions

Our group has two members and the work was distributed as follows:

  1. Ba-Quy Vuong

  1. Nan Chen

8. References

[1] Woodham, Optical Engineering, 1980, Photometric Stereo

[2] Hayakawa, Journal of the Optical Society of America, 1994, Photometric stereo under a light source with arbitrary motion

[3] Example-Based Photometric Stereo: Shape Reconstruction with General, Varying BRDFs A. Hertzmann, S. M. Seitz. IEEE Trans. PAMI. August 2005. Vol. 27, No. 8, pages 1254-1264.