We aim at recovering specular albedo and shininess in a photometric stereo procedure.
The adopted camera model is pinhole.
The image model for
We run an alternating optimization procedure, aiming at solving:
Applying the logarithm on both sides, this is equivalent to solving:
where
To the
Moreover, calling the residual
where abstractly,
The corresponding weight for reweighted optimization is:
so that for a fixed
The best performing robust estimator is the Cauchy one.
- wherever a part of the image is free from observations of specularities, there the optimization is ill posed, so that the specular albedo explodes
- connect this purely specular optimization in an alternating fashion to a full photometric stereo pipeline
- the algorithm performance can vary substantially according to the choice of the initial specular albedo, and the variance parameter in the Cauchy estimator
It is in Matlab, and mainly contained in launch.m
, which the user can run (just by pressing the "Run" button in Matlab) to perform the optimization. The various options for the optimization are described at the beginning of the script.
Two ready datasets are provided in the folder Datasets
. Best parameters configurations for both of them are also indicated in launch.m
.
These are generated using OpenGL and the script Datasets\opengl2matlab.m
. To generate additional data, see the next sections.
The user should generate his/her data with the script opengl2matlab.m
, that can be just run using the "Run" button of Matlab.
In turn, this file also needs some input before being run: we now explain how to generate such input.
Beforehands, we explain how to setup the OpenGL data generation, with Microsoft Visual Studio 2022. The instructions work on Windows 10. We are all the time working in the folder OpenGL
.
- set up glad, khr, glfw, assimp, glm as in https://learnopengl.com/Getting-started/Creating-a-window, https://learnopengl.com/Model-Loading/Assimp, https://learnopengl.com/Getting-started/Transformations. Populate
lib
with the files indicated inlib\list of libs that should be here.txt
, andinclude
with the necessary header files. - create a new project in the folder
OpenGL
, call it e.g.data_generation
- add
src\glad.c
,src\rgbd_generator.cpp
as source files for thedata_generation
solution - add the
lib
andinclude
directories in thesolution properties > configuration properties > VC++ directories > general > library directory
andinclusion directories
. The two folders must be in front of the other - prepend
assimp-vc143-mtd.lib;opengl32.lib;glfw3.lib;
tosolution properties > configuration properties > linker > additional dependencies
- add the
lib
folder tosolution properties > configuration properties > linker > general > additional library directories
- add the
bin
path tosolution properties > configuration properties > debug > environment
: use the syntaxPATH=C:\path\to\bin;%PATH%
- add
mesh.h, conf.h, model.h
in the header files of the solution
- the user has to provide a textured geometric model. For the two aforementioned examples, we provide all the needed files. For other models apart from the provided ones, it is important to set up the
.mtl
file correctly, a guide on how to do this is avaiable here: https://www.youtube.com/watch?v=4DQquG_o-Ac&ab_channel=Code%2CTech%2CandTutorials. The model folder has to be specified inOpenGL\conf.h
through the stringmodel
- with reference to
OpenGL\conf.h
, manually the user has specify anout_folder
, which must exist in the system. Everything will be saved there - then, run the main file
OpenGL\depth_map.cpp
. A window will pop up. The navigation is locked, pressu
orl
to unlock or lock the navigation. With the keysa,w,s,d
the user can translate the camera, with the mouse position the orientation can be changed, a zoom effect is available with the mouse wheel. With the keys, the light can be modified, just for visualization purposes. Onceenter
is pressed, a series of pictures of the object are rendered, seeOpenGL\conf.h
for more details. Pressesc
to exit - the shaders can be changed in
OpenGL\conf.h
. There the user can implement any BRDF function. Phong is the default one
What is happening down the line: the object is illuminated at different angles with directional lighting, and HDR RGBD images (with normals etc) are saved. HDR is crucial in specular optimization, because specular observation sometimes ecceed the usual range 0-255.