Point Cloud Library (PCL)
1.3.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2011, www.pointclouds.org 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Willow Garage, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 * $Id: usc.h 3275 2011-11-30 16:59:04Z mdixon $ 00035 * 00036 */ 00037 00038 #ifndef PCL_FEATURES_USC_H_ 00039 #define PCL_FEATURES_USC_H_ 00040 00041 #include <pcl/point_types.h> 00042 #include <pcl/features/feature.h> 00043 00044 namespace pcl 00045 { 00046 /* namespace features */ 00047 /* { */ 00068 template <typename PointInT, typename PointOutT> 00069 class UniqueShapeContext : public Feature<PointInT, PointOutT> 00070 { 00071 public: 00072 using Feature<PointInT, PointOutT>::feature_name_; 00073 using Feature<PointInT, PointOutT>::getClassName; 00074 using Feature<PointInT, PointOutT>::indices_; 00075 using Feature<PointInT, PointOutT>::search_parameter_; 00076 using Feature<PointInT, PointOutT>::search_radius_; 00077 using Feature<PointInT, PointOutT>::surface_; 00078 using Feature<PointInT, PointOutT>::input_; 00079 using Feature<PointInT, PointOutT>::searchForNeighbors; 00080 00081 typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut; 00082 typedef typename Feature<PointInT, PointOutT>::PointCloudIn PointCloudIn; 00083 00090 UniqueShapeContext(bool shift = false, bool random = false) : 00091 radii_interval_(0), theta_divisions_(0), phi_divisions_(0), volume_lut_(0), 00092 azimuth_bins_(12), elevation_bins_(11), radius_bins_(15), 00093 min_radius_(0.1), point_density_radius_(0.2) 00094 { 00095 feature_name_ = "UniqueShapeContext"; 00096 search_radius_ = 2.5; 00097 local_radius_ = 2.5; 00098 if(random) 00099 srand(time(NULL)); 00100 else 00101 srand(12345); 00102 } 00103 00104 virtual ~UniqueShapeContext() { } 00105 00107 inline void setAzimuthBins(size_t bins) { azimuth_bins_ = bins; } 00109 inline size_t getAzimuthBins(size_t bins) { return (azimuth_bins_); } 00111 inline void setElevationBins(size_t bins) { elevation_bins_ = bins; } 00113 inline size_t getElevationBins(size_t bins) { return (elevation_bins_); } 00115 inline void setRadiusBins(size_t bins) { radius_bins_ = bins; } 00117 inline size_t getRadiusBins(size_t bins) { return (radius_bins_); } 00121 inline void setMinimalRadius(float radius) { min_radius_ = radius; } 00123 inline float getMinimalRadius() { return (min_radius_); } 00128 inline void setPointDensityRadius(double radius) { point_density_radius_ = radius; } 00130 inline double getPointDensityRadius() { return (point_density_radius_); } 00134 inline void setLocalRadius(float radius) { local_radius_ = radius; } 00136 inline float getLocalRadius() { return (local_radius_); } 00137 00138 protected: 00144 void 00145 computePointDescriptor(size_t index, float rf[9], std::vector<float> &desc); 00146 00150 virtual bool initCompute() ; 00151 00152 virtual void 00153 computeFeature(PointCloudOut &output); 00154 00155 protected: 00157 std::vector<float> radii_interval_; 00159 std::vector<float> theta_divisions_; 00161 std::vector<float> phi_divisions_; 00163 std::vector<float> volume_lut_; 00165 size_t azimuth_bins_; 00167 size_t elevation_bins_; 00169 size_t radius_bins_; 00171 double min_radius_; 00173 double point_density_radius_; 00175 size_t descriptor_length_; 00176 float local_radius_; 00177 00178 private: 00183 void 00184 computePointRF(size_t index, float rf[9]); 00185 }; 00186 /* }; */ 00187 } 00188 00189 #endif //#ifndef PCL_USC_H_