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) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef ransac_optimizers_H
29 #define ransac_optimizers_H
30 
31 #include <mrpt/math/ransac.h>
32 #include <mrpt/math/geometry.h>
33 
34 namespace mrpt
35 {
36  namespace math
37  {
38  using std::vector;
39 
40  /** @addtogroup ransac_grp
41  * @{ */
42 
43  /** @name RANSAC detectors
44  @{
45  */
46 
47  /** 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.
48  * \param out_detected_planes The output list of pairs: number of supporting inliers, detected plane.
49  * \param threshold The maximum distance between a point and a temptative plane such as the point is considered an inlier.
50  * \param min_inliers_for_valid_plane The minimum number of supporting inliers to consider a plane as valid.
51  */
52  template <typename NUMTYPE>
54  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &x,
55  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &y,
56  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &z,
57  std::vector<std::pair<size_t,TPlane> > &out_detected_planes,
58  const double threshold,
59  const size_t min_inliers_for_valid_plane = 10
60  );
61 
62  /** 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.
63  * \param out_detected_lines The output list of pairs: number of supporting inliers, detected line.
64  * \param threshold The maximum distance between a point and a temptative line such as the point is considered an inlier.
65  * \param min_inliers_for_valid_line The minimum number of supporting inliers to consider a line as valid.
66  */
67  template <typename NUMTYPE>
69  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &x,
70  const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &y,
71  std::vector<std::pair<size_t,TLine2D> > &out_detected_lines,
72  const double threshold,
73  const size_t min_inliers_for_valid_line = 5
74  );
75 
76 
77  /** A stub for ransac_detect_3D_planes() with the points given as a mrpt::slam::CPointsMap
78  */
79  template <class POINTSMAP>
81  const POINTSMAP * points_map,
82  std::vector<std::pair<size_t,TPlane> > &out_detected_planes,
83  const double threshold,
84  const size_t min_inliers_for_valid_plane
85  )
86  {
87  vector_float xs,ys,zs;
88  points_map->getAllPoints(xs,ys,zs);
89  ransac_detect_3D_planes(xs,ys,zs,out_detected_planes,threshold,min_inliers_for_valid_plane);
90  }
91 
92  /** @} */
93  /** @} */ // end of grouping
94 
95  } // End of namespace
96 } // End of namespace
97 
98 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013