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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019