Point Cloud Library (PCL)
1.7.0
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010-2012, Willow Garage, Inc. 00006 * Copyright (c) 2012-, Open Perception, Inc. 00007 * 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * * Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * * Redistributions in binary form must reproduce the above 00017 * copyright notice, this list of conditions and the following 00018 * disclaimer in the documentation and/or other materials provided 00019 * with the distribution. 00020 * * Neither the name of the copyright holder(s) nor the names of its 00021 * contributors may be used to endorse or promote products derived 00022 * from this software without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00025 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00026 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00027 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00028 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00029 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00030 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00034 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00035 * POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 * $Id: pfh.hpp 5027 2012-03-12 03:10:45Z rusu $ 00038 * 00039 */ 00040 #ifndef PCL_ESF_H_ 00041 #define PCL_ESF_H_ 00042 00043 #include <pcl/features/feature.h> 00044 #define GRIDSIZE 64 00045 #define GRIDSIZE_H GRIDSIZE/2 00046 #include <vector> 00047 00048 namespace pcl 00049 { 00050 /** \brief @b ESFEstimation estimates the ensemble of shape functions descriptors for a given point cloud 00051 * dataset containing points. Shape functions are D2, D3, A3. For more information about the ESF descriptor, see: 00052 * Walter Wohlkinger and Markus Vincze, "Ensemble of Shape Functions for 3D Object Classification", 00053 * IEEE International Conference on Robotics and Biomimetics (IEEE-ROBIO), 2011 00054 * \author Walter Wohlkinger 00055 * \ingroup features 00056 */ 00057 00058 template <typename PointInT, typename PointOutT = pcl::ESFSignature640> 00059 class ESFEstimation: public Feature<PointInT, PointOutT> 00060 { 00061 public: 00062 typedef boost::shared_ptr<ESFEstimation<PointInT, PointOutT> > Ptr; 00063 typedef boost::shared_ptr<const ESFEstimation<PointInT, PointOutT> > ConstPtr; 00064 00065 using Feature<PointInT, PointOutT>::feature_name_; 00066 using Feature<PointInT, PointOutT>::getClassName; 00067 using Feature<PointInT, PointOutT>::indices_; 00068 using Feature<PointInT, PointOutT>::k_; 00069 using Feature<PointInT, PointOutT>::search_radius_; 00070 using Feature<PointInT, PointOutT>::input_; 00071 using Feature<PointInT, PointOutT>::surface_; 00072 00073 typedef typename pcl::PointCloud<PointInT> PointCloudIn; 00074 typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut; 00075 00076 /** \brief Empty constructor. */ 00077 ESFEstimation () : lut_ (), local_cloud_ () 00078 { 00079 feature_name_ = "ESFEstimation"; 00080 lut_.resize (GRIDSIZE); 00081 for (int i = 0; i < GRIDSIZE; ++i) 00082 { 00083 lut_[i].resize (GRIDSIZE); 00084 for (int j = 0; j < GRIDSIZE; ++j) 00085 lut_[i][j].resize (GRIDSIZE); 00086 } 00087 //lut_.resize (boost::extents[GRIDSIZE][GRIDSIZE][GRIDSIZE]); 00088 search_radius_ = 0; 00089 k_ = 5; 00090 } 00091 00092 /** \brief Overloaded computed method from pcl::Feature. 00093 * \param[out] output the resultant point cloud model dataset containing the estimated features 00094 */ 00095 void 00096 compute (PointCloudOut &output); 00097 00098 protected: 00099 00100 /** \brief Estimate the Ensebmel of Shape Function (ESF) descriptors at a set of points given by 00101 * <setInputCloud (), 00102 * \param output the resultant point cloud model histogram that contains the ESF feature estimates 00103 */ 00104 void 00105 computeFeature (PointCloudOut &output); 00106 00107 /** \brief ... */ 00108 int 00109 lci (const int x1, const int y1, const int z1, 00110 const int x2, const int y2, const int z2, 00111 float &ratio, int &incnt, int &pointcount); 00112 00113 /** \brief ... */ 00114 void 00115 computeESF (PointCloudIn &pc, std::vector<float> &hist); 00116 00117 /** \brief ... */ 00118 void 00119 voxelize9 (PointCloudIn &cluster); 00120 00121 /** \brief ... */ 00122 void 00123 cleanup9 (PointCloudIn &cluster); 00124 00125 /** \brief ... */ 00126 void 00127 scale_points_unit_sphere (const pcl::PointCloud<PointInT> &pc, float scalefactor, Eigen::Vector4f& centroid); 00128 00129 private: 00130 00131 /** \brief ... */ 00132 std::vector<std::vector<std::vector<int> > > lut_; 00133 00134 /** \brief ... */ 00135 PointCloudIn local_cloud_; 00136 }; 00137 } 00138 00139 #ifdef PCL_NO_PRECOMPILE 00140 #include <pcl/features/impl/esf.hpp> 00141 #endif 00142 00143 #endif // #