Main MRPT website > C++ reference
MRPT logo
ransac_applications.h
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                       http://www.mrpt.org/                                |
00005    |                                                                           |
00006    |   Copyright (C) 2005-2011  University of Malaga                           |
00007    |                                                                           |
00008    |    This software was written by the Machine Perception and Intelligent    |
00009    |      Robotics Lab, University of Malaga (Spain).                          |
00010    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00011    |                                                                           |
00012    |  This file is part of the MRPT project.                                   |
00013    |                                                                           |
00014    |     MRPT is free software: you can redistribute it and/or modify          |
00015    |     it under the terms of the GNU General Public License as published by  |
00016    |     the Free Software Foundation, either version 3 of the License, or     |
00017    |     (at your option) any later version.                                   |
00018    |                                                                           |
00019    |   MRPT is distributed in the hope that it will be useful,                 |
00020    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00021    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00022    |     GNU General Public License for more details.                          |
00023    |                                                                           |
00024    |     You should have received a copy of the GNU General Public License     |
00025    |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
00026    |                                                                           |
00027    +---------------------------------------------------------------------------+ */
00028 #ifndef  ransac_optimizers_H
00029 #define  ransac_optimizers_H
00030 
00031 #include <mrpt/math/ransac.h>
00032 #include <mrpt/math/geometry.h>
00033 
00034 namespace mrpt
00035 {
00036         namespace math
00037         {
00038                 using std::vector;
00039 
00040                 /** @addtogroup ransac_grp
00041                   * @{ */
00042 
00043                 /** @name RANSAC detectors
00044                         @{
00045                   */
00046 
00047                 /** 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.
00048                   * \param out_detected_planes The output list of pairs: number of supporting inliers, detected plane.
00049                   * \param threshold The maximum distance between a point and a temptative plane such as the point is considered an inlier.
00050                   * \param min_inliers_for_valid_plane  The minimum number of supporting inliers to consider a plane as valid.
00051                   */
00052                 template <typename NUMTYPE>
00053                 void BASE_IMPEXP ransac_detect_3D_planes(
00054                         const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1>  &x,
00055                         const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1>  &y,
00056                         const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1>  &z,
00057                         std::vector<std::pair<size_t,TPlane> >   &out_detected_planes,
00058                         const double           threshold,
00059                         const size_t           min_inliers_for_valid_plane = 10
00060                         );
00061 
00062                 /** 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.
00063                   * \param out_detected_lines The output list of pairs: number of supporting inliers, detected line.
00064                   * \param threshold The maximum distance between a point and a temptative line such as the point is considered an inlier.
00065                   * \param min_inliers_for_valid_line  The minimum number of supporting inliers to consider a line as valid.
00066                   */
00067                 template <typename NUMTYPE>
00068                 void BASE_IMPEXP ransac_detect_2D_lines(
00069                         const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1>  &x,
00070                         const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1>  &y,
00071                         std::vector<std::pair<size_t,TLine2D> >   &out_detected_lines,
00072                         const double           threshold,
00073                         const size_t           min_inliers_for_valid_line = 5
00074                         );
00075 
00076 
00077                 /** A stub for ransac_detect_3D_planes() with the points given as a mrpt::slam::CPointsMap
00078                   */
00079                 template <class POINTSMAP>
00080                 inline void ransac_detect_3D_planes(
00081                         const POINTSMAP * points_map,
00082                         std::vector<std::pair<size_t,TPlane> >   &out_detected_planes,
00083                         const double           threshold,
00084                         const size_t           min_inliers_for_valid_plane
00085                         )
00086                 {
00087                         vector_float xs,ys,zs;
00088                         points_map->getAllPoints(xs,ys,zs);
00089                         ransac_detect_3D_planes(xs,ys,zs,out_detected_planes,threshold,min_inliers_for_valid_plane);
00090                 }
00091 
00092                 /** @} */
00093                 /** @} */  // end of grouping
00094 
00095         } // End of namespace
00096 } // End of namespace
00097 
00098 #endif



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011