Main MRPT website > C++ reference
MRPT logo
ransac_applications.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (c) 2005-2013, Individual contributors, see AUTHORS file |
7  | Copyright (c) 2005-2013, MAPIR group, University of Malaga |
8  | Copyright (c) 2012-2013, University of Almeria |
9  | All rights reserved. |
10  | |
11  | Redistribution and use in source and binary forms, with or without |
12  | modification, are permitted provided that the following conditions are |
13  | met: |
14  | * Redistributions of source code must retain the above copyright |
15  | notice, this list of conditions and the following disclaimer. |
16  | * Redistributions in binary form must reproduce the above copyright |
17  | notice, this list of conditions and the following disclaimer in the |
18  | documentation and/or other materials provided with the distribution. |
19  | * Neither the name of the copyright holders nor the |
20  | names of its contributors may be used to endorse or promote products |
21  | derived from this software without specific prior written permission.|
22  | |
23  | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
24  | 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
25  | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR|
26  | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE |
27  | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL|
28  | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR|
29  | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30  | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
31  | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
32  | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
33  | POSSIBILITY OF SUCH DAMAGE. |
34  +---------------------------------------------------------------------------+ */
35 #ifndef ransac_optimizers_H
36 #define ransac_optimizers_H
37 
38 #include <mrpt/math/ransac.h>
39 #include <mrpt/math/geometry.h>
40 
41 namespace mrpt
42 {
43  namespace math
44  {
45  using std::vector;
46 
47  /** @addtogroup ransac_grp
48  * @{ */
49 
50  /** @name RANSAC detectors
51  @{
52  */
53 
54  /** Fit a number of 3-D planes to a given point cloud, automatically determining the number of existing planes by means of the provided threshold and minimum number of supporting inliers.
55  * \param out_detected_planes The output list of pairs: number of supporting inliers, detected plane.
56  * \param threshold The maximum distance between a point and a temptative plane such as the point is considered an inlier.
57  * \param min_inliers_for_valid_plane The minimum number of supporting inliers to consider a plane as valid.
58  */
59  template <typename NUMTYPE>
61  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &x,
62  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &y,
63  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &z,
64  std::vector<std::pair<size_t,TPlane> > &out_detected_planes,
65  const double threshold,
66  const size_t min_inliers_for_valid_plane = 10
67  );
68 
69  /** Fit a number of 2-D lines to a given point cloud, automatically determining the number of existing lines by means of the provided threshold and minimum number of supporting inliers.
70  * \param out_detected_lines The output list of pairs: number of supporting inliers, detected line.
71  * \param threshold The maximum distance between a point and a temptative line such as the point is considered an inlier.
72  * \param min_inliers_for_valid_line The minimum number of supporting inliers to consider a line as valid.
73  */
74  template <typename NUMTYPE>
76  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &x,
77  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &y,
78  std::vector<std::pair<size_t,TLine2D> > &out_detected_lines,
79  const double threshold,
80  const size_t min_inliers_for_valid_line = 5
81  );
82 
83 
84  /** A stub for ransac_detect_3D_planes() with the points given as a mrpt::slam::CPointsMap
85  */
86  template <class POINTSMAP>
88  const POINTSMAP * points_map,
89  std::vector<std::pair<size_t,TPlane> > &out_detected_planes,
90  const double threshold,
91  const size_t min_inliers_for_valid_plane
92  )
93  {
94  vector_float xs,ys,zs;
95  points_map->getAllPoints(xs,ys,zs);
96  ransac_detect_3D_planes(xs,ys,zs,out_detected_planes,threshold,min_inliers_for_valid_plane);
97  }
98 
99  /** @} */
100  /** @} */ // end of grouping
101 
102  } // End of namespace
103 } // End of namespace
104 
105 #endif
void BASE_IMPEXP ransac_detect_3D_planes(const Eigen::Matrix< NUMTYPE, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< NUMTYPE, Eigen::Dynamic, 1 > &y, const Eigen::Matrix< NUMTYPE, Eigen::Dynamic, 1 > &z, std::vector< std::pair< size_t, TPlane > > &out_detected_planes, const double threshold, const size_t min_inliers_for_valid_plane=10)
Fit a number of 3-D planes to a given point cloud, automatically determining the number of existing p...
The base class of MRPT vectors, actually, Eigen column matrices of dynamic size with specialized cons...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void BASE_IMPEXP ransac_detect_2D_lines(const Eigen::Matrix< NUMTYPE, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< NUMTYPE, Eigen::Dynamic, 1 > &y, std::vector< std::pair< size_t, TLine2D > > &out_detected_lines, const double threshold, const size_t min_inliers_for_valid_line=5)
Fit a number of 2-D lines to a given point cloud, automatically determining the number of existing li...



Page generated by Doxygen 1.8.14 for MRPT 1.0.2 SVN: at lun oct 28 00:52:41 CET 2019 Hosted on:
SourceForge.net Logo