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-2018, 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 #pragma once
10 
13 #include <set>
14 #include <functional>
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 CMatrixTemplateNumeric<NUMTYPE>& allData,
36  const std::vector<size_t>& useIndices,
37  std::vector<CMatrixTemplateNumeric<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 CMatrixTemplateNumeric<NUMTYPE>& allData,
43  const std::vector<CMatrixTemplateNumeric<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 CMatrixTemplateNumeric<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(
68  const TRansacFitFunctor& fit_func,
69  const TRansacDistanceFunctor& dist_func,
70  const TRansacDegenerateFunctor& degen_func,
71  const double distanceThreshold,
72  const unsigned int minimumSizeSamplesToFit,
73  std::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) const;
77 
78 }; // end class
79 
80 /** The default instance of RANSAC, for double type */
82 
83 /** @} */
84 
85 }
86 
std::function< bool(const CMatrixTemplateNumeric< 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
std::function< void(const CMatrixTemplateNumeric< NUMTYPE > &allData, const std::vector< CMatrixTemplateNumeric< 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
This base provides a set of functions for maths stuff.
Versatile class for consistent logging and management of output messages.
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, std::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:24
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
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3546
std::function< void(const CMatrixTemplateNumeric< NUMTYPE > &allData, const std::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:37



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020