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