Commit 3f7437c1 authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Converting the rational BRDF result to Gold met paint

parent 29871e4a
......@@ -96,5 +96,5 @@ if not env.GetOption('help'):
external = env.SConscript('external/SConscript')
sources = env.SConscript('sources/SConscript')
env.Depends(sources, external)
#env.Depends(sources, external)
#end
......@@ -2,5 +2,5 @@ core = SConscript('core/SConscript')
plugins = SConscript('plugins/SConscript')
softs = SConscript('softs/SConscript')
Requires(plugins, core)
Requires(softs, core)
#Requires(plugins, core)
#Requires(softs, core)
......@@ -35,13 +35,34 @@ rational_fitter_parallel::~rational_fitter_parallel()
bool rational_fitter_parallel::fit_data(const data* dat, function* fit, const arguments &args)
{
rational_function* r = dynamic_cast<rational_function*>(fit) ;
const vertical_segment* d = dynamic_cast<const vertical_segment*>(dat) ;
if(r == NULL || d == NULL)
if(r == NULL)
{
std::cerr << "<<ERROR>> not passing the correct class to the fitter" << std::endl ;
std::cerr << "<<ERROR>> not passing the correct function class to the fitter: must be a rational_function" << std::endl ;
return false ;
}
const vertical_segment* d = dynamic_cast<const vertical_segment*>(dat) ;
if(d == NULL)
{
std::cerr << "<<WARNING>> automatic convertion of the data object to vertical_segment," << std::endl;
std::cerr << "<<WARNING>> we advise you to perform convertion with a separate command." << std::endl;
vertical_segment* vs = new vertical_segment();
for(int i=0; i<dat->size(); ++i)
{
const vec x = dat->get(i);
vec y(dat->dimX() + 3*dat->dimY());
for(int k=0; k<x.size() ; ++k) { y[k] = x[k]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size()] = (1.0 - args.get_float("dt", 0.1)) * x[k + dat->dimX() + dat->dimY()]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size() + dat->dimY()] = (1.0 + args.get_float("dt", 0.1)) * x[k + dat->dimX() + 2*dat->dimY()]; }
vs->set(y);
}
d = vs;
}
// I need to set the dimension of the resulting function to be equal
// to the dimension of my fitting problem
r->setDimX(d->dimX()) ;
......
......@@ -19,5 +19,5 @@ LIBS += -L../../build \
-lcore
#QMAKE_CXXFLAGS += -fPIC
QMAKE_CXXFLAGS += -g
#QMAKE_CXXFLAGS += -g
......@@ -3,10 +3,27 @@
<configuration>
<parameter name="lib-dir" value="./build" />
</configuration>
<!--
<action name="data2data">
<input name="../data/3d/matusik_from_merl/red-metallic.dat" />
<output name="./results/3d/merl/red-metallic.dat" />
<parameter name="in-data" value="./build/libdata_merl.so" />
</action>
-->!
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="./results/3d/merl/red-metallic.dat" />
<!--
<input name="./results/2d/merl/red-metallic.exr" />
<plugin type="data" name="data_brdf_slice" />
-->
<!--
<input name="../data/3d/matusik_from_merl/red-metallic.dat" />
<plugin type="data" name="data_merl" />
-->
<output name="./results/3d/merl/red-metallic.brdf" />
<!-- Define the function to use -->
......@@ -16,15 +33,17 @@
<!-- Define the ftting procedure to use -->
<plugin type="fitter" name="nonlinear_fitter_ceres" />
<!--<plugin type="fitter" name="nonlinear_fitter_nlopt" />-->
<!--<plugin type="fitter" name="nonlinear_fitter_eigen" />-->
<!-- Parameter -->
<parameter name="max" value="[2.0, 0.01, 0.01]" />
<parameter name="ceres-debug" value="true" />
<!--<parameter name="max" value="[2.0, 0.01, 0.01]" />-->
<parameter name="ymin" value="[0.0, 0.0, 0.0]" />
<!--<parameter name="ceres-debug" value="true" />-->
</action>
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../data/3d/matusik_from_merl/red-metallic.dat" />
<input name="./results/3d/merl/red-metallic.dat" />
<output name="./results/3d/merl/red-metallic.brdf" />
<!-- Define the function to use -->
......@@ -38,10 +57,8 @@
<plugin type="fitter" name="nonlinear_fitter_ceres" />
<!-- Parameter -->
<parameter name="min" value="[1.4, 0.0, 0.00]" />
<parameter name="max" value="[2.0, 2.0, 0.01]" />
<parameter name="ceres-debug" value="true" />
<parameter name="cos-fit" value="true" />
<!--<parameter name="ceres-debug" value="true" /> -->
<!--<parameter name="cos-fit" value="true" /> -->
</action>
<action name="brdf2brdf">
......@@ -52,4 +69,32 @@
<!-- Parameter -->
<parameter name="export" value="explorer" />
</action>
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<!--<input name="./results/3d/merl/red-metallic.dat" />-->
<input name="./results/2d/merl/red-metallic.exr" />
<plugin type="data" name="data_brdf_slice" />
<!--
<input name="../data/3d/matusik_from_merl/red-metallic.dat" />
<plugin type="data" name="data_merl" />
-->
<output name="./results/3d/merl/red-metallic-rat.brdf" />
<!-- Define the function to use -->
<function name="rational_function_legendre" />
<!-- Define the ftting procedure to use -->
<plugin type="fitter" name="rational_fitter_parallel" />
<parameter name="min-np" value="10" />
<parameter name="np" value="100" />
<!-- Parameter -->
<!--<parameter name="max" value="[2.0, 0.01, 0.01]" />-->
<parameter name="ymin" value="[0.0, 0.0, 0.0]" />
<!--<parameter name="ceres-debug" value="true" />-->
</action>
</alta>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment