rift.h
Go to the documentation of this file.
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 6144 2012-07-04 22:06:28Z rusu $
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 
00078       typedef typename boost::shared_ptr<RIFTEstimation<PointInT, GradientT, PointOutT> > Ptr;
00079       typedef typename boost::shared_ptr<const RIFTEstimation<PointInT, GradientT, PointOutT> > ConstPtr;
00080 
00081 
00083       RIFTEstimation () : gradient_ (), nr_distance_bins_ (4), nr_gradient_bins_ (8)
00084       {
00085         feature_name_ = "RIFTEstimation";
00086       };
00087 
00091       inline void 
00092       setInputGradient (const PointCloudGradientConstPtr &gradient) { gradient_ = gradient; };
00093 
00095       inline PointCloudGradientConstPtr 
00096       getInputGradient () const { return (gradient_); };
00097 
00101       inline void 
00102       setNrDistanceBins (int nr_distance_bins) { nr_distance_bins_ = nr_distance_bins; };
00103 
00105       inline int 
00106       getNrDistanceBins () const { return (nr_distance_bins_); };
00107 
00111       inline void 
00112       setNrGradientBins (int nr_gradient_bins) { nr_gradient_bins_ = nr_gradient_bins; };
00113 
00115       inline int 
00116       getNrGradientBins () const { return (nr_gradient_bins_); };
00117 
00128       void 
00129       computeRIFT (const PointCloudIn &cloud, const PointCloudGradient &gradient, int p_idx, float radius,
00130                    const std::vector<int> &indices, const std::vector<float> &squared_distances, 
00131                    Eigen::MatrixXf &rift_descriptor);
00132 
00133     protected:
00134 
00140       void 
00141       computeFeature (PointCloudOut &output);
00142 
00144       PointCloudGradientConstPtr gradient_;
00145 
00147       int nr_distance_bins_;
00148 
00150       int nr_gradient_bins_;
00151 
00152     private:
00156       void 
00157       computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf>&) {}
00158   };
00159 
00171   template <typename PointInT, typename GradientT>
00172   class RIFTEstimation<PointInT, GradientT, Eigen::MatrixXf>: public RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >
00173   {
00174     public:
00175       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::getClassName;
00176       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::surface_;
00177       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::indices_;
00178       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::tree_;
00179       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::search_radius_;
00180       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::gradient_;
00181       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::nr_gradient_bins_;
00182       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::nr_distance_bins_;
00183       using RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >::compute;
00184       
00185     private:
00191       void 
00192       computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output);
00193 
00197       void 
00198       compute (pcl::PointCloud<pcl::Normal>&) {}
00199   };
00200 }
00201 
00202 #endif // #ifndef PCL_RIFT_H_


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:17:41