MRPT  1.9.9
ransac.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
13 #include <functional>
14 #include <set>
15 
16 namespace mrpt::math
17 {
18 /** @addtogroup ransac_grp RANSAC and other model fitting algorithms
19  * \ingroup mrpt_math_grp
20  * @{ */
21 
22 /** A generic RANSAC implementation with models as matrices.
23  * See \a RANSAC_Template::execute for more info on usage.
24  * \sa mrpt::math::ModelSearch, a more versatile RANSAC implementation where
25  * models can be anything else, not only matrices.
26  */
27 template <typename NUMTYPE = double>
29 {
30  public:
31  RANSAC_Template() : mrpt::system::COutputLogger("RANSAC_Template") {}
32  /** The type of the function passed to mrpt::math::ransac - See the
33  * documentation for that method for more info. */
34  using TRansacFitFunctor = std::function<void(
35  const CMatrixDynamic<NUMTYPE>& allData,
36  const std::vector<size_t>& useIndices,
37  std::vector<CMatrixDynamic<NUMTYPE>>& fitModels)>;
38 
39  /** The type of the function passed to mrpt::math::ransac - See the
40  * documentation for that method for more info. */
41  using TRansacDistanceFunctor = std::function<void(
42  const CMatrixDynamic<NUMTYPE>& allData,
43  const std::vector<CMatrixDynamic<NUMTYPE>>& testModels,
44  const NUMTYPE distanceThreshold, unsigned int& out_bestModelIndex,
45  std::vector<size_t>& out_inlierIndices)>;
46 
47  /** The type of the function passed to mrpt::math::ransac - See the
48  * documentation for that method for more info. */
49  using TRansacDegenerateFunctor = std::function<bool(
50  const CMatrixDynamic<NUMTYPE>& allData,
51  const std::vector<size_t>& useIndices)>;
52 
53  /** An implementation of the RANSAC algorithm for robust fitting of models
54  * to data.
55  *
56  * \param data A DxN matrix with all the observed data. D is the
57  * dimensionality of data points and N the number of points.
58  * \param
59  *
60  * This implementation is highly inspired on Peter Kovesi's MATLAB scripts
61  * (http://www.csse.uwa.edu.au/~pk).
62  * \return false if no good solution can be found, true on success.
63  * \note [MRPT 1.5.0] `verbose` parameter has been removed, supersedded by
64  * COutputLogger settings.
65  */
66  bool execute(
67  const CMatrixDynamic<NUMTYPE>& data, const TRansacFitFunctor& fit_func,
68  const TRansacDistanceFunctor& dist_func,
69  const TRansacDegenerateFunctor& degen_func,
70  const double distanceThreshold,
71  const unsigned int minimumSizeSamplesToFit,
72  std::vector<size_t>& out_best_inliers,
73  CMatrixDynamic<NUMTYPE>& out_best_model,
74  const double prob_good_sample = 0.999,
75  const size_t maxIter = 2000) const;
76 
77 }; // end class
78 
79 /** The default instance of RANSAC, for double type */
81 
82 /** @} */
83 
84 } // namespace mrpt::math
std::function< bool(const CMatrixDynamic< NUMTYPE > &allData, const std::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:51
This base provides a set of functions for maths stuff.
Versatile class for consistent logging and management of output messages.
std::function< void(const CMatrixDynamic< NUMTYPE > &allData, const std::vector< size_t > &useIndices, std::vector< CMatrixDynamic< NUMTYPE > > &fitModels)> TRansacFitFunctor
The type of the function passed to mrpt::math::ransac - See the documentation for that method for mor...
Definition: ransac.h:37
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
COutputLogger()
Default class constructor.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
A generic RANSAC implementation with models as matrices.
Definition: ransac.h:28
bool execute(const CMatrixDynamic< NUMTYPE > &data, const TRansacFitFunctor &fit_func, const TRansacDistanceFunctor &dist_func, const TRansacDegenerateFunctor &degen_func, const double distanceThreshold, const unsigned int minimumSizeSamplesToFit, std::vector< size_t > &out_best_inliers, CMatrixDynamic< 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:24
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3550
std::function< void(const CMatrixDynamic< NUMTYPE > &allData, const std::vector< CMatrixDynamic< NUMTYPE > > &testModels, const NUMTYPE distanceThreshold, unsigned int &out_bestModelIndex, std::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:45



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: cb8dd5fc8 Sat Dec 7 21:55:39 2019 +0100 at sáb dic 7 22:00:13 CET 2019