| |||||||||
In this project, I implemented several algorithms to construct a depth field from a series of images of a diffuse object under different point light sources. My work is listed as follows (with * to indicate extensions):
| |||||||||
1. Basic AlgorithmThe overall process of constructing photometric stereos basically consists of four steps:1.1 Light Source Direction Estimation: Using a chrome ball under different light source point, to construct the directions of these light sources since the normal at any given point on the ball is known. (Related file: LightDirs.cpp.) Fig. 1 Lighting direction estimation. Second, for each image of the chrome ball, estimate the highlight center by taking the averages of coordinates of all the pixel in the highlight area (intensity > 0.9). Finally, for each image of the chrome ball, compute the light source direction using the formula (illustrated in Fig. 1) (1) where N is the normal vector at the highlight center point and R is the reflection vector. R=(0,0,-1) and N is (xh, yh, xc, yc are the coordinates of the highlight center and ball center, respectively. r is the ball’s radius):1.2 Surface Normal Estimation: After all the light source directions are determined, estimate the surface normal vectors of each point on the object. (Related file: Normals.cpp.) The appearance of the object 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 can be calculated by solving a linear squares problem: (2) where i is the index of images.To avoid the effect of shadows, each pixel is weighted by its intensity, i.e. use a new objective function (3) 1.3 Albedo Estimation: The albedo of the surface can be computed simultaneously with the surface normal or can be computed separately. My implementation calculates them separately for better accuracy. (Related file: Albedos.cpp.) The formula is (4) which is derived from (2).1.4 Depth Estimation: After the surface normals have been calculated, compute the depth of each image pixel. (Related file: Depths.cpp.) As the normal vectors are perpendicular to any vector on the surface, we have (5) in the x and y directions, respectively. | |||||||||
----------------------------------------------------------------------------------------------------- Copyright (c) 2009 Wei Zhang |