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 COccupancyGridMapFeatureExtractor_H 00029 #define COccupancyGridMapFeatureExtractor_H 00030 00031 #include <mrpt/slam/COccupancyGridMap2D.h> 00032 #include <mrpt/slam/CLandmarksMap.h> 00033 #include <mrpt/vision/CFeatureExtraction.h> 00034 00035 #include <mrpt/utils/CObserver.h> 00036 00037 #include <mrpt/slam/link_pragmas.h> 00038 00039 namespace mrpt 00040 { 00041 namespace slam 00042 { 00043 using namespace mrpt::math; 00044 00045 /** A class for detecting features from occupancy grid maps. 00046 * The main method is "COccupancyGridMapFeatureExtractor::extractFeatures()", which makes use 00047 * of an advanced cache mechanism to avoid redoing work when applied several times on the same 00048 * occupancy grid maps (unless they changed in the meanwhile). 00049 * 00050 * For an uncached version (which is a static method that can be called without instantiating COccupancyGridMapFeatureExtractor) 00051 * see COccupancyGridMapFeatureExtractor::uncached_extractFeatures() 00052 * 00053 * \ingroup mrpt_slam_grp 00054 */ 00055 class SLAM_IMPEXP COccupancyGridMapFeatureExtractor : public mrpt::utils::CObserver 00056 { 00057 public: 00058 COccupancyGridMapFeatureExtractor(); //!< Default ctor 00059 ~COccupancyGridMapFeatureExtractor(); //!< Destructor 00060 00061 /** Computes a set of distinctive landmarks from an occupancy grid, and store them (previous content is not erased!) into the given landmarks map. 00062 * Landmarks type can be any declared in mrpt::vision::CFeatureExtraction::TOptions 00063 * 00064 * \note See the paper "..." 00065 * \sa uncached_extractFeatures 00066 */ 00067 void extractFeatures( 00068 const mrpt::slam::COccupancyGridMap2D &grid, 00069 mrpt::slam::CLandmarksMap &outMap, 00070 const size_t number_of_features, 00071 const mrpt::vision::TDescriptorType descriptors, 00072 const mrpt::vision::CFeatureExtraction::TOptions &feat_options 00073 ); 00074 00075 /** Computes a set of distinctive landmarks from an occupancy grid, and store them (previous content is not erased!) into the given landmarks map. 00076 * Landmarks type can be any declared in mrpt::vision::CFeatureExtraction::TOptions 00077 * 00078 * \note See the paper "..." 00079 * \sa uncached_extractFeatures 00080 */ 00081 static void uncached_extractFeatures( 00082 const mrpt::slam::COccupancyGridMap2D &grid, 00083 mrpt::slam::CLandmarksMap &outMap, 00084 const size_t number_of_features, 00085 const mrpt::vision::TDescriptorType descriptors, 00086 const mrpt::vision::CFeatureExtraction::TOptions &feat_options 00087 ); 00088 00089 protected: 00090 void OnEvent(const mrptEvent &e); //!< This will receive the events from maps in order to purge the cache. 00091 typedef std::map<const mrpt::slam::COccupancyGridMap2D*,mrpt::slam::CLandmarksMapPtr> TCache; 00092 TCache m_cache; //!< A cache of already computed maps. 00093 00094 00095 }; // End of class def. 00096 00097 } // End of namespace 00098 } // End of namespace 00099 00100 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |