gfpfh.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) 2009, Willow Garage, Inc.
00006  *  Copyright (c) 2012-, Open Perception, Inc.
00007  *
00008  *  All rights reserved.
00009  *
00010  *  Redistribution and use in source and binary forms, with or without
00011  *  modification, are permitted provided that the following conditions
00012  *  are met:
00013  *
00014  *   * Redistributions of source code must retain the above copyright
00015  *     notice, this list of conditions and the following disclaimer.
00016  *   * Redistributions in binary form must reproduce the above
00017  *     copyright notice, this list of conditions and the following
00018  *     disclaimer in the documentation and/or other materials provided
00019  *     with the distribution.
00020  *   * Neither the name of the copyright holder(s) nor the names of its
00021  *     contributors may be used to endorse or promote products derived
00022  *     from this software without specific prior written permission.
00023  *
00024  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00026  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00027  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00028  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00029  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00030  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00031  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00033  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00034  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  *  POSSIBILITY OF SUCH DAMAGE.
00036  *
00037  * $Id: gfpfh.h 1423 2011-06-21 09:51:32Z bouffa $
00038  *
00039  */
00040 
00041 #ifndef PCL_GFPFH_H_
00042 #define PCL_GFPFH_H_
00043 
00044 #include <pcl/features/feature.h>
00045 
00046 namespace pcl
00047 {
00064   template <typename PointInT, typename PointLT, typename PointOutT>
00065   class GFPFHEstimation : public FeatureFromLabels<PointInT, PointLT, PointOutT>
00066   {
00067     public:
00068       typedef boost::shared_ptr<GFPFHEstimation<PointInT, PointLT, PointOutT> > Ptr;
00069       typedef boost::shared_ptr<const GFPFHEstimation<PointInT, PointLT, PointOutT> > ConstPtr;
00070       using FeatureFromLabels<PointInT, PointLT, PointOutT>::feature_name_;
00071       using FeatureFromLabels<PointInT, PointLT, PointOutT>::getClassName;
00072       using FeatureFromLabels<PointInT, PointLT, PointOutT>::indices_;
00073       using FeatureFromLabels<PointInT, PointLT, PointOutT>::k_;
00074       using FeatureFromLabels<PointInT, PointLT, PointOutT>::search_parameter_;
00075       using FeatureFromLabels<PointInT, PointLT, PointOutT>::surface_;
00076 
00077       using FeatureFromLabels<PointInT, PointLT, PointOutT>::input_;
00078       using FeatureFromLabels<PointInT, PointLT, PointOutT>::labels_;
00079 
00080       typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut;
00081       typedef typename Feature<PointInT, PointOutT>::PointCloudIn  PointCloudIn;
00082 
00084       GFPFHEstimation () : 
00085         octree_leaf_size_ (0.01),
00086         number_of_classes_ (16),
00087         descriptor_size_ (PointOutT::descriptorSize ())
00088       {
00089         feature_name_ = "GFPFHEstimation";
00090       }
00091 
00094       inline void
00095       setOctreeLeafSize (double size) { octree_leaf_size_ = size; }
00096 
00098       inline double
00099       getOctreeLeafSize () { return (octree_leaf_size_); }
00100 
00102       inline uint32_t
00103       emptyLabel () const { return 0; }
00104 
00106       inline uint32_t
00107       getNumberOfClasses () const { return number_of_classes_; }
00108 
00112       inline void
00113       setNumberOfClasses (uint32_t n) { number_of_classes_ = n; }
00114 
00116       inline int
00117       descriptorSize () const { return descriptor_size_; }
00118 
00122       void
00123       compute (PointCloudOut &output);
00124 
00125     protected:
00126 
00132       void 
00133       computeFeature (PointCloudOut &output);
00134 
00136       uint32_t
00137       getDominantLabel (const std::vector<int>& indices);
00138 
00140       void computeTransitionHistograms (const std::vector< std::vector<int> >& label_histograms,
00141                                         std::vector< std::vector<int> >& transition_histograms);
00142 
00144       void
00145       computeDistancesToMean (const std::vector< std::vector<int> >& transition_histograms,
00146                               std::vector<float>& distances);
00147 
00149       float
00150       computeHIKDistance (const std::vector<int>& histogram,
00151                           const std::vector<float>& mean_histogram);
00152 
00154       void
00155       computeDistanceHistogram (const std::vector<float>& distances,
00156                                 std::vector<float>& histogram);
00157 
00159       void
00160       computeMeanHistogram (const std::vector< std::vector<int> >& histograms,
00161                             std::vector<float>& mean_histogram);
00162 
00163     private:
00165       double octree_leaf_size_;
00166 
00168       uint32_t number_of_classes_;
00169 
00171       int descriptor_size_;
00172    };
00173 }
00174 
00175 #ifdef PCL_NO_PRECOMPILE
00176 #include <pcl/features/impl/gfpfh.hpp>
00177 #endif
00178 
00179 #endif  //#ifndef PCL_GFPFH_H_


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:24:25