00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 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 mrpt_ransac_H 00029 #define mrpt_ransac_H 00030 00031 #include <mrpt/utils/CDebugOutputCapable.h> 00032 #include <mrpt/math/CMatrixD.h> 00033 #include <set> 00034 00035 /*--------------------------------------------------------------- 00036 Class 00037 ---------------------------------------------------------------*/ 00038 namespace mrpt 00039 { 00040 namespace math 00041 { 00042 template <typename NUMTYPE = double> 00043 class MRPTDLLIMPEXP RANSAC_Template 00044 { 00045 public: 00046 00047 /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */ 00048 typedef void (*TRansacFitFunctor)( 00049 const CMatrixTemplateNumeric<NUMTYPE> &allData, 00050 const mrpt::vector_size_t &useIndices, 00051 std::vector< CMatrixTemplateNumeric<NUMTYPE> > &fitModels ); 00052 00053 /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */ 00054 typedef void (*TRansacDistanceFunctor)( 00055 const CMatrixTemplateNumeric<NUMTYPE> &allData, 00056 const std::vector< CMatrixTemplateNumeric<NUMTYPE> > & testModels, 00057 const NUMTYPE distanceThreshold, 00058 unsigned int & out_bestModelIndex, 00059 mrpt::vector_size_t & out_inlierIndices ); 00060 00061 /** The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. */ 00062 typedef bool (*TRansacDegenerateFunctor)( 00063 const CMatrixTemplateNumeric<NUMTYPE> &allData, 00064 const mrpt::vector_size_t &useIndices ); 00065 00066 /** An implementation of the RANSAC algorithm for robust fitting of models to data. 00067 * 00068 * \param data A DxN matrix with all the observed data. D is the dimensionality of data points and N the number of points. 00069 * \param 00070 * 00071 * This implementation is highly inspired on Peter Kovesi's MATLAB scripts (http://www.csse.uwa.edu.au/~pk). 00072 * \return false if no good solution can be found, true on success. 00073 */ 00074 static bool execute( 00075 const CMatrixTemplateNumeric<NUMTYPE> &data, 00076 TRansacFitFunctor fit_func, 00077 TRansacDistanceFunctor dist_func, 00078 TRansacDegenerateFunctor degen_func, 00079 const double distanceThreshold, 00080 const unsigned int minimumSizeSamplesToFit, 00081 mrpt::vector_size_t &out_best_inliers, 00082 CMatrixTemplateNumeric<NUMTYPE> &out_best_model, 00083 bool verbose = false, 00084 const double prob_good_sample = 0.999, 00085 const size_t maxIter = 2000 00086 ); 00087 00088 }; // end class 00089 00090 typedef RANSAC_Template<double> RANSAC; //!< The default instance of RANSAC, for double type 00091 00092 } // End of namespace 00093 } // End of namespace 00094 00095 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |