fitter.h 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#pragma once

// Include STL
#include <vector>
#include <string>

// Interface
#include <core/function.h>
#include <core/data.h>
#include <core/fitter.h>
#include <core/args.h>
#include <core/vertical_segment.h>

14 15 16
// CERES include
#include <ceres/ceres.h>

17
/*! \brief A non-linear fitter using the CERES solver
18
 *  \ingroup plugins
19 20 21
 *
 *  \details
 *  <h3>Third party requirements</h3>
22
 *
23 24
 *  You will need three external libraries to compile this plugin:
 *  <ul>
25
 *		<li><a href="https://ceres-solver.googlesource.com/ceres-solver">CERES</a>
26
 *		library, version 1.5.0</li>
27
 *		<li><a href="http://code.google.com/p/google-glog">Google glog</a> library
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
 *		version 0.3.1</li>
 *		<li><a href="http://eigen.tuxfamily.org/">Eigen library</a> version 3</li>
 *  </ul>
 *
 *  The last two dependencies are required to compile CERES and this plugin
 *  must be linked against Google glog to run.
 *
 *  You need to provide your own ceres.prf file for qmake to generate the correct
 *  Makefile or Visual Studio solution. In particular this configuration file
 *  should provide:
 *
 *  <pre>
 *  INCLUDEPATH += [path-to-ceres-include]
 *  LIBS += -L[path-to-ceres-lib] -lceres -L[path-to-glog-lib] -lglog -lgomp
 *  </pre>
 *
 *
 *  <h3>Plugin parameters</h3>
 *
 *  We provide the following command line arguments to manipulate this plugin:
 *  <ul>
 *		<li><b>--ceres-max-num-iterations</b> <em>[int]</em> to control the number
 *		of iterations the non linear solver will take before returning a solution</li>
51 52
 *		<li><b>--ceres-factorizer</b> <em>[string]</em> to control the type of dense
 *		factorization method used to solve the <a href="http://homes.cs.washington.edu/~sagarwal/ceres-solver/stable/solving.html?highlight=dense_qr#equation-normal">normal equations</a></li>
53
 *  </ul>
54 55 56 57 58 59 60 61 62 63
 */
class nonlinear_fitter_ceres: public fitter
{
	public: // methods

		nonlinear_fitter_ceres() ;
		virtual ~nonlinear_fitter_ceres() ;

		// Fitting a data object
		//
64
		virtual bool fit_data(const ptr<data>& d, const ptr<function>& fit, const arguments& args) ;
65 66 67 68 69 70

		// Provide user parameters to the fitter
		//
		virtual void set_parameters(const arguments& args) ;

	protected: // data
71 72 73

        // Fitter options
        ceres::Solver::Options options;
74
} ;