Main MRPT website > C++ reference for MRPT 1.5.7
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-2017, 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>
30  class BASE_IMPEXP RANSAC_Template : public mrpt::utils::COutputLogger
31  {
32  public:
34  mrpt::utils::COutputLogger("RANSAC_Template")
35  {
36  }
37 
38  /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */
39  typedef void (*TRansacFitFunctor)(
40  const CMatrixTemplateNumeric<NUMTYPE> &allData,
41  const mrpt::vector_size_t &useIndices,
42  std::vector< CMatrixTemplateNumeric<NUMTYPE> > &fitModels );
43 
44  /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */
45  typedef void (*TRansacDistanceFunctor)(
46  const CMatrixTemplateNumeric<NUMTYPE> &allData,
47  const std::vector< CMatrixTemplateNumeric<NUMTYPE> > & testModels,
48  const NUMTYPE distanceThreshold,
49  unsigned int & out_bestModelIndex,
50  mrpt::vector_size_t & out_inlierIndices );
51 
52  /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */
53  typedef bool (*TRansacDegenerateFunctor)(
54  const CMatrixTemplateNumeric<NUMTYPE> &allData,
55  const mrpt::vector_size_t &useIndices );
56 
57  /** An implementation of the RANSAC algorithm for robust fitting of models to data.
58  *
59  * \param data A DxN matrix with all the observed data. D is the dimensionality of data points and N the number of points.
60  * \param
61  *
62  * This implementation is highly inspired on Peter Kovesi's MATLAB scripts (http://www.csse.uwa.edu.au/~pk).
63  * \return false if no good solution can be found, true on success.
64  * \note [MRPT 1.5.0] `verbose` parameter has been removed, supersedded by COutputLogger settings.
65  */
66  bool execute(
68  TRansacFitFunctor fit_func,
69  TRansacDistanceFunctor dist_func,
70  TRansacDegenerateFunctor degen_func,
71  const double distanceThreshold,
72  const unsigned int minimumSizeSamplesToFit,
73  mrpt::vector_size_t &out_best_inliers,
74  CMatrixTemplateNumeric<NUMTYPE> &out_best_model,
75  const double prob_good_sample = 0.999,
76  const size_t maxIter = 2000
77  ) const;
78 
79  }; // end class
80 
81  typedef RANSAC_Template<double> RANSAC; //!< The default instance of RANSAC, for double type
82 
83  /** @} */
84 
85  } // End of namespace
86 } // End of namespace
87 
88 #endif
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
RANSAC_Template< double > RANSAC
The default instance of RANSAC, for double type.
Definition: ransac.h:81
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
A generic RANSAC implementation with models as matrices.
Definition: ransac.h:30
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3520
std::vector< size_t > vector_size_t



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019