|
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: rift.h 4702 2012-02-23 09:39:33Z gedikli $ 00037 * 00038 */ 00039 00040 #ifndef PCL_RIFT_H_ 00041 #define PCL_RIFT_H_ 00042 00043 #include "pcl/features/feature.h" 00044 00045 namespace pcl 00046 { 00058 template <typename PointInT, typename GradientT, typename PointOutT> 00059 class RIFTEstimation: public Feature<PointInT, PointOutT> 00060 { 00061 public: 00062 using Feature<PointInT, PointOutT>::feature_name_; 00063 using Feature<PointInT, PointOutT>::getClassName; 00064 00065 using Feature<PointInT, PointOutT>::surface_; 00066 using Feature<PointInT, PointOutT>::indices_; 00067 00068 using Feature<PointInT, PointOutT>::tree_; 00069 using Feature<PointInT, PointOutT>::search_radius_; 00070 00071 typedef typename pcl::PointCloud<PointInT> PointCloudIn; 00072 typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut; 00073 00074 typedef typename pcl::PointCloud<GradientT> PointCloudGradient; 00075 typedef typename PointCloudGradient::Ptr PointCloudGradientPtr; 00076 typedef typename PointCloudGradient::ConstPtr PointCloudGradientConstPtr; 00077 00079 RIFTEstimation () : nr_distance_bins_ (4), nr_gradient_bins_ (8) 00080 { 00081 feature_name_ = "RIFTEstimation"; 00082 }; 00083 00087 inline void 00088 setInputGradient (const PointCloudGradientConstPtr &gradient) { gradient_ = gradient; }; 00089 00091 inline PointCloudGradientConstPtr 00092 getInputGradient () { return (gradient_); }; 00093 00094 00098 inline void 00099 setNrDistanceBins (size_t nr_distance_bins) { nr_distance_bins_ = (int) nr_distance_bins; }; 00100 00102 inline int 00103 getNrDistanceBins () { return (nr_distance_bins_); }; 00104 00105 00109 inline void 00110 setNrGradientBins (size_t nr_gradient_bins) { nr_gradient_bins_ = (int) nr_gradient_bins; }; 00111 00113 inline int 00114 getNrGradientBins () { return (nr_gradient_bins_); }; 00115 00126 void 00127 computeRIFT (const PointCloudIn &cloud, const PointCloudGradient &gradient, int p_idx, float radius, 00128 const std::vector<int> &indices, const std::vector<float> &squared_distances, 00129 Eigen::MatrixXf &rift_descriptor); 00130 00131 protected: 00132 00138 void 00139 computeFeature (PointCloudOut &output); 00140 00142 PointCloudGradientConstPtr gradient_; 00143 00145 int nr_distance_bins_; 00146 00148 int nr_gradient_bins_; 00149 00150 private: 00154 void 00155 computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output) {} 00156 }; 00157 00169 template <typename PointInT, typename GradientT> 00170 class RIFTEstimation<PointInT, GradientT, Eigen::MatrixXf>: public RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> > 00171 { 00172 public: 00173 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::getClassName; 00174 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::surface_; 00175 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::indices_; 00176 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::tree_; 00177 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::search_radius_; 00178 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::gradient_; 00179 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::nr_gradient_bins_; 00180 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::nr_distance_bins_; 00181 using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::compute; 00182 00183 private: 00189 void 00190 computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output); 00191 00195 void 00196 compute (pcl::PointCloud<pcl::Normal> &output) {} 00197 }; 00198 } 00199 00200 #endif // #ifndef PCL_RIFT_H_
1.8.0