|
Point Cloud Library (PCL)
1.5.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010-2011, Willow Garage, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of Willow Garage, Inc. nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * $Id: usc.h 4702 2012-02-23 09:39:33Z gedikli $ 00037 * 00038 */ 00039 00040 #ifndef PCL_FEATURES_USC_H_ 00041 #define PCL_FEATURES_USC_H_ 00042 00043 #include <pcl/point_types.h> 00044 #include <pcl/features/feature.h> 00045 00046 namespace pcl 00047 { 00065 template <typename PointInT, typename PointOutT> 00066 class UniqueShapeContext : public Feature<PointInT, PointOutT> 00067 { 00068 public: 00069 using Feature<PointInT, PointOutT>::feature_name_; 00070 using Feature<PointInT, PointOutT>::getClassName; 00071 using Feature<PointInT, PointOutT>::indices_; 00072 using Feature<PointInT, PointOutT>::search_parameter_; 00073 using Feature<PointInT, PointOutT>::search_radius_; 00074 using Feature<PointInT, PointOutT>::surface_; 00075 using Feature<PointInT, PointOutT>::input_; 00076 using Feature<PointInT, PointOutT>::searchForNeighbors; 00077 00078 typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut; 00079 typedef typename Feature<PointInT, PointOutT>::PointCloudIn PointCloudIn; 00080 00082 UniqueShapeContext () : 00083 radii_interval_(0), theta_divisions_(0), phi_divisions_(0), volume_lut_(0), 00084 azimuth_bins_(12), elevation_bins_(11), radius_bins_(15), 00085 min_radius_(0.1), point_density_radius_(0.2) 00086 { 00087 feature_name_ = "UniqueShapeContext"; 00088 search_radius_ = 2.5; 00089 local_radius_ = 2.5; 00090 } 00091 00092 virtual ~UniqueShapeContext() { } 00093 00097 inline void 00098 setAzimuthBins (size_t bins) { azimuth_bins_ = bins; } 00099 00101 inline size_t 00102 getAzimuthBins (size_t bins) { return (azimuth_bins_); } 00103 00107 inline void 00108 setElevationBins (size_t bins) { elevation_bins_ = bins; } 00109 00111 inline size_t 00112 getElevationBins (size_t bins) { return (elevation_bins_); } 00113 00117 inline void 00118 setRadiusBins (size_t bins) { radius_bins_ = bins; } 00119 00121 inline size_t 00122 getRadiusBins (size_t bins) { return (radius_bins_); } 00123 00127 inline void 00128 setMinimalRadius (float radius) { min_radius_ = radius; } 00129 00131 inline float 00132 getMinimalRadius () { return (min_radius_); } 00133 00138 inline void 00139 setPointDensityRadius (double radius) { point_density_radius_ = radius; } 00140 00142 inline double 00143 getPointDensityRadius () { return (point_density_radius_); } 00144 00148 inline void 00149 setLocalRadius (float radius) { local_radius_ = radius; } 00150 00152 inline float 00153 getLocalRadius () { return (local_radius_); } 00154 00155 protected: 00161 void 00162 computePointDescriptor (size_t index, float rf[9], std::vector<float> &desc); 00163 00165 virtual bool 00166 initCompute (); 00167 00171 virtual void 00172 computeFeature (PointCloudOut &output); 00173 00179 bool 00180 computePointRF (size_t index, float rf[9]); 00181 00183 std::vector<float> radii_interval_; 00184 00186 std::vector<float> theta_divisions_; 00187 00189 std::vector<float> phi_divisions_; 00190 00192 std::vector<float> volume_lut_; 00193 00195 size_t azimuth_bins_; 00196 00198 size_t elevation_bins_; 00199 00201 size_t radius_bins_; 00202 00204 double min_radius_; 00205 00207 double point_density_radius_; 00208 00210 size_t descriptor_length_; 00211 00213 float local_radius_; 00214 private: 00218 void 00219 computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output) {} 00220 }; 00221 00239 template <typename PointInT> 00240 class UniqueShapeContext<PointInT, Eigen::MatrixXf> : public UniqueShapeContext<PointInT, pcl::SHOT> 00241 { 00242 public: 00243 using UniqueShapeContext<PointInT, pcl::SHOT>::indices_; 00244 using UniqueShapeContext<PointInT, pcl::SHOT>::descriptor_length_; 00245 using UniqueShapeContext<PointInT, pcl::SHOT>::compute; 00246 using UniqueShapeContext<PointInT, pcl::SHOT>::computePointRF; 00247 using UniqueShapeContext<PointInT, pcl::SHOT>::computePointDescriptor; 00248 00249 private: 00253 virtual void 00254 computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output); 00255 00259 void 00260 compute (pcl::PointCloud<pcl::SHOT> &output) {} 00261 }; 00262 } 00263 00264 #endif //#ifndef PCL_USC_H_
1.8.0