Point Cloud Library (PCL)  1.7.1
pfhrgb.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2011, Alexandru-Eugen Ichim
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$
38  */
39 
40 #ifndef PCL_PFHRGB_H_
41 #define PCL_PFHRGB_H_
42 
43 #include <pcl/features/feature.h>
44 #include <pcl/features/pfh_tools.h>
45 
46 namespace pcl
47 {
48  template <typename PointInT, typename PointNT, typename PointOutT = pcl::PFHRGBSignature250>
49  class PFHRGBEstimation : public FeatureFromNormals<PointInT, PointNT, PointOutT>
50  {
51  public:
52  typedef boost::shared_ptr<PFHRGBEstimation<PointInT, PointNT, PointOutT> > Ptr;
53  typedef boost::shared_ptr<const PFHRGBEstimation<PointInT, PointNT, PointOutT> > ConstPtr;
61 
62 
64  : nr_subdiv_ (5), pfhrgb_histogram_ (), pfhrgb_tuple_ (), d_pi_ (1.0f / (2.0f * static_cast<float> (M_PI)))
65  {
66  feature_name_ = "PFHRGBEstimation";
67  }
68 
69  bool
71  int p_idx, int q_idx,
72  float &f1, float &f2, float &f3, float &f4, float &f5, float &f6, float &f7);
73 
74  void
76  const std::vector<int> &indices, int nr_split, Eigen::VectorXf &pfhrgb_histogram);
77 
78  protected:
79  void
80  computeFeature (PointCloudOut &output);
81 
82  private:
83  /** \brief The number of subdivisions for each angular feature interval. */
84  int nr_subdiv_;
85 
86  /** \brief Placeholder for a point's PFHRGB signature. */
87  Eigen::VectorXf pfhrgb_histogram_;
88 
89  /** \brief Placeholder for a PFHRGB 7-tuple. */
90  Eigen::VectorXf pfhrgb_tuple_;
91 
92  /** \brief Placeholder for a histogram index. */
93  int f_index_[7];
94 
95  /** \brief Float constant = 1.0 / (2.0 * M_PI) */
96  float d_pi_;
97  };
98 }
99 
100 #ifdef PCL_NO_PRECOMPILE
101 #include <pcl/features/impl/pfhrgb.hpp>
102 #endif
103 
104 #endif /* PCL_PFHRGB_H_ */
boost::shared_ptr< const PFHRGBEstimation< PointInT, PointNT, PointOutT > > ConstPtr
Definition: pfhrgb.h:53
void computeFeature(PointCloudOut &output)
Abstract feature estimation method.
Definition: pfhrgb.hpp:143
std::string feature_name_
The feature name.
Definition: feature.h:222
PCL base class.
Definition: pcl_base.h:68
boost::shared_ptr< PFHRGBEstimation< PointInT, PointNT, PointOutT > > Ptr
Definition: pfhrgb.h:52
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: pfhrgb.h:60
void computePointPFHRGBSignature(const pcl::PointCloud< PointInT > &cloud, const pcl::PointCloud< PointNT > &normals, const std::vector< int > &indices, int nr_split, Eigen::VectorXf &pfhrgb_histogram)
Definition: pfhrgb.hpp:64
Feature represents the base feature class.
Definition: feature.h:105
PointCloud represents the base class in PCL for storing collections of 3D points. ...
bool computeRGBPairFeatures(const pcl::PointCloud< PointInT > &cloud, const pcl::PointCloud< PointNT > &normals, int p_idx, int q_idx, float &f1, float &f2, float &f3, float &f4, float &f5, float &f6, float &f7)
Definition: pfhrgb.hpp:47