Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
esf.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-2012, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * $Id: pfh.hpp 5027 2012-03-12 03:10:45Z rusu $
38  *
39  */
40 #ifndef PCL_ESF_H_
41 #define PCL_ESF_H_
42 
43 #include <pcl/features/feature.h>
44 #define GRIDSIZE 64
45 #define GRIDSIZE_H GRIDSIZE/2
46 //#include <boost/multi_array.hpp>
47 #include <vector>
48 
49 namespace pcl
50 {
59  template <typename PointInT, typename PointOutT = pcl::ESFSignature640>
60  class ESFEstimation: public Feature<PointInT, PointOutT>
61  {
62  public:
70 
73 
75  ESFEstimation () : lut_ (), local_cloud_ ()
76  {
77  feature_name_ = "ESFEstimation";
78  lut_.resize (GRIDSIZE);
79  for (int i = 0; i < GRIDSIZE; ++i)
80  {
81  lut_[i].resize (GRIDSIZE);
82  for (int j = 0; j < GRIDSIZE; ++j)
83  lut_[i][j].resize (GRIDSIZE);
84  }
85  //lut_.resize (boost::extents[GRIDSIZE][GRIDSIZE][GRIDSIZE]);
86  search_radius_ = 0;
87  k_ = 5;
88  }
89 
93  void
94  compute (PointCloudOut &output);
95 
96  protected:
97 
102  void
103  computeFeature (PointCloudOut &output);
104 
106  int
107  lci (const int x1, const int y1, const int z1,
108  const int x2, const int y2, const int z2,
109  float &ratio, int &incnt, int &pointcount);
110 
112  void
113  computeESF (PointCloudIn &pc, std::vector<float> &hist);
114 
116  void
117  voxelize9 (PointCloudIn &cluster);
118 
120  void
121  cleanup9 (PointCloudIn &cluster);
122 
124  void
125  scale_points_unit_sphere (const pcl::PointCloud<PointInT> &pc, float scalefactor, Eigen::Vector4f& centroid);
126 
127  private:
128 
130  //boost::multi_array<int, 3> lut_;
131  std::vector<std::vector<std::vector<int> > > lut_;
132 
134  PointCloudIn local_cloud_;
135 
139  void
140  computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &) {}
141  };
142 }
143 
144 #endif // #