Main MRPT website > C++ reference for MRPT 1.4.0
ransac.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef mrpt_ransac_H
10 #define mrpt_ransac_H
11 
13 #include <mrpt/math/CMatrixD.h>
14 #include <set>
15 
16 namespace mrpt
17 {
18  namespace math
19  {
20  /** @addtogroup ransac_grp RANSAC and other model fitting algorithms
21  * \ingroup mrpt_base_grp
22  * @{ */
23 
24 
25  /** A generic RANSAC implementation with models as matrices.
26  * See \a RANSAC_Template::execute for more info on usage.
27  * \sa mrpt::math::ModelSearch, a more versatile RANSAC implementation where models can be anything else, not only matrices.
28  */
29  template <typename NUMTYPE = double>
31  {
32  public:
33 
34  /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */
35  typedef void (*TRansacFitFunctor)(
36  const CMatrixTemplateNumeric<NUMTYPE> &allData,
37  const mrpt::vector_size_t &useIndices,
38  std::vector< CMatrixTemplateNumeric<NUMTYPE> > &fitModels );
39 
40  /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */
41  typedef void (*TRansacDistanceFunctor)(
42  const CMatrixTemplateNumeric<NUMTYPE> &allData,
43  const std::vector< CMatrixTemplateNumeric<NUMTYPE> > & testModels,
44  const NUMTYPE distanceThreshold,
45  unsigned int & out_bestModelIndex,
46  mrpt::vector_size_t & out_inlierIndices );
47 
48  /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */
49  typedef bool (*TRansacDegenerateFunctor)(
50  const CMatrixTemplateNumeric<NUMTYPE> &allData,
51  const mrpt::vector_size_t &useIndices );
52 
53  /** An implementation of the RANSAC algorithm for robust fitting of models to data.
54  *
55  * \param data A DxN matrix with all the observed data. D is the dimensionality of data points and N the number of points.
56  * \param
57  *
58  * This implementation is highly inspired on Peter Kovesi's MATLAB scripts (http://www.csse.uwa.edu.au/~pk).
59  * \return false if no good solution can be found, true on success.
60  */
61  static bool execute(
63  TRansacFitFunctor fit_func,
64  TRansacDistanceFunctor dist_func,
65  TRansacDegenerateFunctor degen_func,
66  const double distanceThreshold,
67  const unsigned int minimumSizeSamplesToFit,
68  mrpt::vector_size_t &out_best_inliers,
69  CMatrixTemplateNumeric<NUMTYPE> &out_best_model,
70  bool verbose = false,
71  const double prob_good_sample = 0.999,
72  const size_t maxIter = 2000
73  );
74 
75  }; // end class
76 
77  typedef RANSAC_Template<double> RANSAC; //!< The default instance of RANSAC, for double type
78 
79  /** @} */
80 
81  } // End of namespace
82 } // End of namespace
83 
84 #endif
A generic RANSAC implementation with models as matrices.
Definition: ransac.h:31
static bool execute(const CMatrixTemplateNumeric< NUMTYPE > &data, TRansacFitFunctor fit_func, TRansacDistanceFunctor dist_func, TRansacDegenerateFunctor degen_func, const double distanceThreshold, const unsigned int minimumSizeSamplesToFit, mrpt::vector_size_t &out_best_inliers, CMatrixTemplateNumeric< NUMTYPE > &out_best_model, bool verbose=false, const double prob_good_sample=0.999, const size_t maxIter=2000)
An implementation of the RANSAC algorithm for robust fitting of models to data.
This base class provides a common printf-like method to send debug information to std::cout,...
std::vector< size_t > vector_size_t
Definition: types_simple.h:25
RANSAC_Template< double > RANSAC
The default instance of RANSAC, for double type.
Definition: ransac.h:77
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.1 for MRPT 1.4.0 SVN: at Mon Apr 18 04:08:57 UTC 2022