Home

Awesome

Codes_NonConvex_PS

Flexible Matlba codes for robust nonconvex photometric stereo, with various options including:

Introduction

These Matlab codes implement the method for robust nonconvex photometric stereo described in [1]. Given a set of photometric stereo images of a still scene acquired from a fixed (pinhole or orthographic camera) camera, and (possibly inaccurate) lighting parameters, this algorithm estimates depth, normals, albedo and, optionally, refined lighting intensities and directions.

[1] "A Non-Convex Variational Approach to Photometric Stereo under Inaccurate Lighting", Yvain Quéau et al., Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2017).

Please cite the above work if using the provided codes for your own research.

Author: Yvain Quéau, Technical University Munich, yvain.queau@tum.de

Datasets and demo

A demo file on a synthetic dataset is provided

Usage

The main fuction is Toolbox/robust_ps_V2.m (see header for details).

Outputs:

Inputs:

Refining an inaccurate lighting calibration

If the calibration of lighting directions and intensities is not perfect, it is possible to automatically refine them by turning on the following options:

Enforcing robustness to shadows, highlights, etc.

Robustness can be improved by playing with the following parameters:

Providing a rough shape estimate

If you have a good initial estimate of the shape (e.g., a Kinect prior), then you can provide it to the algorithm by using:

Controlling the non-convex descent

Various options can be set in order to control the behavior of the ARLS algorithm we put forward. Useful parameters are:

Fast debugging

For fast debugging or proof of concept, it may be useful to disable one or the other estimate, to reduce the size of the data or to display live surface, albedo, normals and energy:

Ambient light estimation

In real-world scenarios, calibrating the ambient light is easy: just capture a series of images without any of the controlled lights on, average them and provide the result to data.ambient. If for some awkward reason you can't or don't want to do that, then ambient light can be estimated by setting the following option (WARNING: can be pretty unstable)

Dependencies

We strongly recommend to use the CMG preconditioner from Koutis et al., which can be downloaded here: http://www.cs.cmu.edu/~jkoutis/cmg.html

If CMG it is not installed, set the "precond" parameter to "ichol". Standard incomplete Cholesky will be used, which should prevent any error message in Matlab, but may also be super slow or even non-convergent. Jacobi or Gauss-Seidel can also be quite efficient if the multi-scale strategy is used. They can be selected through jacobi or gs, respectively.

For the multi-scale approach, resizing the outputs at each scale is required. We achieve this with Matlab built-in functions, except for the depth extrapolation part which uses the inpaint_nans function from https://de.mathworks.com/matlabcentral/fileexchange/4551-inpaint-nans