00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 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 /** @name RANSAC detectors 00041 @{ 00042 */ 00043 00044 /** 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. 00045 * \param out_detected_planes The output list of pairs: number of supporting inliers, detected plane. 00046 * \param threshold The maximum distance between a point and a temptative plane such as the point is considered an inlier. 00047 * \param min_inliers_for_valid_plane The minimum number of supporting inliers to consider a plane as valid. 00048 */ 00049 template <typename NUMTYPE> 00050 void BASE_IMPEXP ransac_detect_3D_planes( 00051 const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &x, 00052 const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &y, 00053 const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &z, 00054 std::vector<std::pair<size_t,TPlane> > &out_detected_planes, 00055 const double threshold, 00056 const size_t min_inliers_for_valid_plane = 10 00057 ); 00058 00059 /** 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. 00060 * \param out_detected_lines The output list of pairs: number of supporting inliers, detected line. 00061 * \param threshold The maximum distance between a point and a temptative line such as the point is considered an inlier. 00062 * \param min_inliers_for_valid_line The minimum number of supporting inliers to consider a line as valid. 00063 */ 00064 template <typename NUMTYPE> 00065 void BASE_IMPEXP ransac_detect_2D_lines( 00066 const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &x, 00067 const Eigen::Matrix<NUMTYPE,Eigen::Dynamic,1> &y, 00068 std::vector<std::pair<size_t,TLine2D> > &out_detected_lines, 00069 const double threshold, 00070 const size_t min_inliers_for_valid_line = 5 00071 ); 00072 00073 00074 /** A stub for ransac_detect_3D_planes() with the points given as a mrpt::slam::CPointsMap 00075 */ 00076 template <class POINTSMAP> 00077 inline void ransac_detect_3D_planes( 00078 const POINTSMAP * points_map, 00079 std::vector<std::pair<size_t,TPlane> > &out_detected_planes, 00080 const double threshold, 00081 const size_t min_inliers_for_valid_plane 00082 ) 00083 { 00084 vector_float xs,ys,zs; 00085 points_map->getAllPoints(xs,ys,zs); 00086 ransac_detect_3D_planes(xs,ys,zs,out_detected_planes,threshold,min_inliers_for_valid_plane); 00087 } 00088 00089 /** @} */ 00090 00091 00092 } // End of namespace 00093 } // End of namespace 00094 00095 #endif
Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:30:30 UTC 2011 |