Regularized Least-Squares Surface Reconstruction from Gradient Fields: grad2Surf Version 1.0
This toolbox is for the reconstruction of a surface from its measured gradient field. It is assumed that the gradient field is corrupted by noise, and thereby the package provides algorithms which compute the least-squares solution to the problem, along with various forms of regularization, including:
1) Spectral Regularization
2) Tikhonov Regularization
3) Constrained Regularization (Dirichlet Boundary Values)
4) Weighted Least-Squares
Examples of these types of regularization and how to use the toolbox are given in the accompanying documentation file: g2sIntro.pdf
This toolbox requires the Discrete Orthogonal Polynomial Toolbox (DOPbox):
The theory behind this toolbox is described in the papers:
 Harker, M., O’Leary, P., Regularized Reconstruction of a Surface from its Measured Gradient Field, (preprint available at arxiv.org)
 Harker, M., O’Leary, P., Direct regularized surface reconstruction from gradients for Industrial Photometric Stereo, Computers in Industry, In Press, 2013.
 Harker, M., O’Leary, P., Least squares surface reconstruction from measured gradient fields, IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2008, pp. 1-7.
 Harker, M., O’Leary, P., Least squares surface reconstruction from gradients: Direct algebraic methods with spectral, Tikhonov, and constrained regularization, IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2011, pp. 2529-2536.
Hello ! Great work, the results are awesome.
May I ask a question ? Maybe it's stupid, I don't understand everything, but would it be possible to use Dirichlet Boundaries with the Tikhonov regularization ?
Indeed there was an error in dopDiffLocal which was a result of a change made in Version 1.6. We have deposited a corrected version of the library (Version 1.7).
I just got the code working by replacing line 157 in the m-file "dopDiffLocal.m" from
rS = rank( S );
rS = sprank( S );
since the error I was getting before seemed to have been generated by the fact that the matrix S is sparse, and the function rank does not work with sparse matrices.
Please let me know your take on this modification (i.e., if this was your intended meaning in the context).
I have downloaded your code for surface reconstruction from gradient for comparison purposes. I am in the early testing stages, and I tried generating a test surface using the function provided "g2sTestSurf.m". Specifically, I tried:
[Z,Zx,Zy,x,y] = g2sTestSurf(121,121,'even',1);
This works, and I can see the test surface as well as its gradient components, but when I try to reconstruct the surface from the gradient, by typing in the command:
Zr = g2s( Zx, Zy, x, y );
I get the following error message:
Error using svd
Use svds for sparse singular values and vectors.
Error in rank (line 15)
s = svd(A);
Error in dopDiffLocal (line 157)
rS = rank( S );
Error in g2s (line 82)
Dx = dopDiffLocal( x, N, N, 'sparse' ) ;
Could you please let me know what it is that I am doing wrong?
Thank you in advance,
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.