Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rift.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id: rift.h 6144 2012-07-04 22:06:28Z rusu $
37  *
38  */
39 
40 #ifndef PCL_RIFT_H_
41 #define PCL_RIFT_H_
42 
43 #include <pcl/features/feature.h>
44 
45 namespace pcl
46 {
58  template <typename PointInT, typename GradientT, typename PointOutT>
59  class RIFTEstimation: public Feature<PointInT, PointOutT>
60  {
61  public:
64 
67 
70 
73 
77 
78  typedef typename boost::shared_ptr<RIFTEstimation<PointInT, GradientT, PointOutT> > Ptr;
79  typedef typename boost::shared_ptr<const RIFTEstimation<PointInT, GradientT, PointOutT> > ConstPtr;
80 
81 
83  RIFTEstimation () : gradient_ (), nr_distance_bins_ (4), nr_gradient_bins_ (8)
84  {
85  feature_name_ = "RIFTEstimation";
86  };
87 
91  inline void
92  setInputGradient (const PointCloudGradientConstPtr &gradient) { gradient_ = gradient; };
93 
96  getInputGradient () const { return (gradient_); };
97 
101  inline void
102  setNrDistanceBins (int nr_distance_bins) { nr_distance_bins_ = nr_distance_bins; };
103 
105  inline int
106  getNrDistanceBins () const { return (nr_distance_bins_); };
107 
111  inline void
112  setNrGradientBins (int nr_gradient_bins) { nr_gradient_bins_ = nr_gradient_bins; };
113 
115  inline int
116  getNrGradientBins () const { return (nr_gradient_bins_); };
117 
128  void
129  computeRIFT (const PointCloudIn &cloud, const PointCloudGradient &gradient, int p_idx, float radius,
130  const std::vector<int> &indices, const std::vector<float> &squared_distances,
131  Eigen::MatrixXf &rift_descriptor);
132 
133  protected:
134 
140  void
141  computeFeature (PointCloudOut &output);
142 
144  PointCloudGradientConstPtr gradient_;
145 
147  int nr_distance_bins_;
148 
150  int nr_gradient_bins_;
151 
152  private:
156  void
157  computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf>&) {}
158  };
159 
171  template <typename PointInT, typename GradientT>
172  class RIFTEstimation<PointInT, GradientT, Eigen::MatrixXf>: public RIFTEstimation<PointInT, GradientT, pcl::Histogram<32> >
173  {
174  public:
184 
185  private:
191  void
192  computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output);
193 
197  void
199  };
200 }
201 
202 #endif // #ifndef PCL_RIFT_H_