Point Cloud Library (PCL)  1.3.1
rift.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2010, Willow Garage, Inc.
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: rift.h 1370 2011-06-19 01:06:01Z jspricke $
00035  *
00036  */
00037 
00038 #ifndef PCL_RIFT_H_
00039 #define PCL_RIFT_H_
00040 
00041 #include "pcl/features/feature.h"
00042 
00043 namespace pcl
00044 {
00056   template <typename PointInT, typename GradientT, typename PointOutT>
00057   class RIFTEstimation: public Feature<PointInT, PointOutT>
00058   {
00059     public:
00060       using Feature<PointInT, PointOutT>::feature_name_;
00061       using Feature<PointInT, PointOutT>::getClassName;
00062 
00063       using Feature<PointInT, PointOutT>::surface_;
00064       using Feature<PointInT, PointOutT>::indices_;
00065 
00066       using Feature<PointInT, PointOutT>::tree_;
00067       using Feature<PointInT, PointOutT>::search_radius_;
00068       
00069       typedef typename pcl::PointCloud<PointInT> PointCloudIn;
00070       typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut;
00071 
00072       typedef typename pcl::PointCloud<GradientT> PointCloudGradient;
00073       typedef typename PointCloudGradient::Ptr PointCloudGradientPtr;
00074       typedef typename PointCloudGradient::ConstPtr PointCloudGradientConstPtr;
00075 
00077       RIFTEstimation () : nr_distance_bins_ (4), nr_gradient_bins_ (8)
00078       {
00079         feature_name_ = "RIFTEstimation";
00080       };
00081 
00085       inline void 
00086       setInputGradient (const PointCloudGradientConstPtr &gradient) { gradient_ = gradient; };
00087 
00089       inline PointCloudGradientConstPtr 
00090       getInputGradient () { return (gradient_); };
00091 
00092 
00096       inline void 
00097       setNrDistanceBins (size_t nr_distance_bins) { nr_distance_bins_ = (int) nr_distance_bins; };
00098 
00100       inline int 
00101       getNrDistanceBins () { return (nr_distance_bins_); };
00102 
00103 
00107       inline void 
00108       setNrGradientBins (size_t nr_gradient_bins) { nr_gradient_bins_ = (int) nr_gradient_bins; };
00109 
00111       inline int 
00112       getNrGradientBins () { return (nr_gradient_bins_); };
00113 
00124       void 
00125       computeRIFT (const PointCloudIn &cloud, const PointCloudGradient &gradient, int p_idx, float radius,
00126                    const std::vector<int> &indices, const std::vector<float> &squared_distances, 
00127                         Eigen::MatrixXf &rift_descriptor);
00128 
00129     protected:
00130 
00136       void 
00137       computeFeature (PointCloudOut &output);
00138 
00139     private:
00140 
00142       PointCloudGradientConstPtr gradient_;
00143 
00145       int nr_distance_bins_;
00146 
00148       int nr_gradient_bins_;
00149 
00150   };
00151 }
00152 
00153 #endif // #ifndef PCL_RIFT_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines