Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usc.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: usc.h 6144 2012-07-04 22:06:28Z rusu $
37  *
38  */
39 
40 #ifndef PCL_FEATURES_USC_H_
41 #define PCL_FEATURES_USC_H_
42 
43 #include <pcl/point_types.h>
44 #include <pcl/features/feature.h>
45 
46 namespace pcl
47 {
65  template <typename PointInT, typename PointOutT, typename PointRFT = pcl::ReferenceFrame>
66  class UniqueShapeContext : public Feature<PointInT, PointOutT>,
67  public FeatureWithLocalReferenceFrames<PointInT, PointRFT>
68  {
69  public:
80 
83  typedef typename boost::shared_ptr<UniqueShapeContext<PointInT, PointOutT, PointRFT> > Ptr;
84  typedef typename boost::shared_ptr<const UniqueShapeContext<PointInT, PointOutT, PointRFT> > ConstPtr;
85 
86 
89  radii_interval_(0), theta_divisions_(0), phi_divisions_(0), volume_lut_(0),
90  azimuth_bins_(12), elevation_bins_(11), radius_bins_(15),
91  min_radius_(0.1), point_density_radius_(0.2), descriptor_length_ (), local_radius_ (2.5)
92  {
93  feature_name_ = "UniqueShapeContext";
94  search_radius_ = 2.5;
95  }
96 
97  virtual ~UniqueShapeContext() { }
98 
102  inline void
103  setAzimuthBins (size_t bins) { azimuth_bins_ = bins; }
104 
106  inline size_t
107  getAzimuthBins () const { return (azimuth_bins_); }
108 
112  inline void
113  setElevationBins (size_t bins) { elevation_bins_ = bins; }
114 
116  inline size_t
117  getElevationBins () const { return (elevation_bins_); }
118 
122  inline void
123  setRadiusBins (size_t bins) { radius_bins_ = bins; }
124 
126  inline size_t
127  getRadiusBins () const { return (radius_bins_); }
128 
132  inline void
133  setMinimalRadius (double radius) { min_radius_ = radius; }
134 
136  inline double
137  getMinimalRadius () const { return (min_radius_); }
138 
143  inline void
144  setPointDensityRadius (double radius) { point_density_radius_ = radius; }
145 
147  inline double
148  getPointDensityRadius () const { return (point_density_radius_); }
149 
153  inline void
154  setLocalRadius (double radius) { local_radius_ = radius; }
155 
157  inline double
158  getLocalRadius () const { return (local_radius_); }
159 
160  protected:
165  void
166  computePointDescriptor (size_t index, std::vector<float> &desc);
167 
169  virtual bool
170  initCompute ();
171 
175  virtual void
176  computeFeature (PointCloudOut &output);
177 
179  std::vector<float> radii_interval_;
180 
182  std::vector<float> theta_divisions_;
183 
185  std::vector<float> phi_divisions_;
186 
188  std::vector<float> volume_lut_;
189 
191  size_t azimuth_bins_;
192 
194  size_t elevation_bins_;
195 
197  size_t radius_bins_;
198 
200  double min_radius_;
201 
203  double point_density_radius_;
204 
206  size_t descriptor_length_;
207 
209  double local_radius_;
210  private:
214  void
215  computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &) {}
216  };
217 
235  template <typename PointInT, typename PointRFT>
236  class UniqueShapeContext<PointInT, Eigen::MatrixXf, PointRFT> : public UniqueShapeContext<PointInT, pcl::SHOT, PointRFT>
237  {
238  public:
244 
245  private:
249  virtual void
250  computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output);
251 
255  void
257  };
258 }
259 
260 #endif //#ifndef PCL_USC_H_