Point Cloud Library (PCL)  1.8.0
crh.h
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  * 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: cvfh.h 4936 2012-03-07 11:12:45Z aaldoma $
38  *
39  */
40 
41 #ifndef PCL_FEATURES_CRH_H_
42 #define PCL_FEATURES_CRH_H_
43 
44 #include <pcl/features/feature.h>
45 
46 namespace pcl
47 {
48  /** \brief CRHEstimation estimates the Camera Roll Histogram (CRH) descriptor for a given
49  * point cloud dataset containing XYZ data and normals, as presented in:
50  * - CAD-Model Recognition and 6 DOF Pose Estimation
51  * A. Aldoma, N. Blodow, D. Gossow, S. Gedikli, R.B. Rusu, M. Vincze and G. Bradski
52  * ICCV 2011, 3D Representation and Recognition (3dRR11) workshop
53  * Barcelona, Spain, (2011)
54  *
55  * The suggested PointOutT is pcl::Histogram<90>. //dc (real) + 44 complex numbers (real, imaginary) + nyquist (real)
56  *
57  * \author Aitor Aldoma
58  * \ingroup features
59  */
60  template<typename PointInT, typename PointNT, typename PointOutT = pcl::Histogram<90> >
61  class CRHEstimation : public FeatureFromNormals<PointInT, PointNT, PointOutT>
62  {
63  public:
64  typedef boost::shared_ptr<CRHEstimation<PointInT, PointNT, PointOutT> > Ptr;
65  typedef boost::shared_ptr<const CRHEstimation<PointInT, PointNT, PointOutT> > ConstPtr;
66 
74 
76 
77  /** \brief Constructor. */
79  vpx_ (0), vpy_ (0), vpz_ (0), nbins_ (90)
80  {
81  k_ = 1;
82  feature_name_ = "CRHEstimation";
83  }
84  ;
85 
86  /** \brief Set the viewpoint.
87  * \param[in] vpx the X coordinate of the viewpoint
88  * \param[in] vpy the Y coordinate of the viewpoint
89  * \param[in] vpz the Z coordinate of the viewpoint
90  */
91  inline void
92  setViewPoint (float vpx, float vpy, float vpz)
93  {
94  vpx_ = vpx;
95  vpy_ = vpy;
96  vpz_ = vpz;
97  }
98 
99  /** \brief Get the viewpoint.
100  * \param[out] vpx the X coordinate of the viewpoint
101  * \param[out] vpy the Y coordinate of the viewpoint
102  * \param[out] vpz the Z coordinate of the viewpoint
103  */
104  inline void
105  getViewPoint (float &vpx, float &vpy, float &vpz)
106  {
107  vpx = vpx_;
108  vpy = vpy_;
109  vpz = vpz_;
110  }
111 
112  inline void
113  setCentroid (Eigen::Vector4f & centroid)
114  {
115  centroid_ = centroid;
116  }
117 
118  private:
119  /** \brief Values describing the viewpoint ("pinhole" camera model assumed).
120  * By default, the viewpoint is set to 0,0,0.
121  */
122  float vpx_, vpy_, vpz_;
123 
124  /** \brief Number of bins, this should match the Output type */
125  int nbins_;
126 
127  /** \brief Centroid to be used */
128  Eigen::Vector4f centroid_;
129 
130  /** \brief Estimate the CRH histogram at
131  * a set of points given by <setInputCloud (), setIndices ()> using the surface in
132  * setSearchSurface ()
133  *
134  * \param[out] output the resultant point cloud with a CRH histogram
135  */
136  void
137  computeFeature (PointCloudOut &output);
138  };
139 }
140 
141 #ifdef PCL_NO_PRECOMPILE
142 #include <pcl/features/impl/crh.hpp>
143 #endif
144 
145 #endif //#ifndef PCL_FEATURES_CRH_H_
std::string feature_name_
The feature name.
Definition: feature.h:222
void getViewPoint(float &vpx, float &vpy, float &vpz)
Get the viewpoint.
Definition: crh.h:105
int k_
The number of K nearest neighbors to use for each point.
Definition: feature.h:242
CRHEstimation()
Constructor.
Definition: crh.h:78
void setViewPoint(float vpx, float vpy, float vpz)
Set the viewpoint.
Definition: crh.h:92
PointCloud represents the base class in PCL for storing collections of 3D points. ...
void setCentroid(Eigen::Vector4f &centroid)
Definition: crh.h:113
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: crh.h:75
boost::shared_ptr< CRHEstimation< PointInT, PointNT, PointOutT > > Ptr
Definition: crh.h:64
Feature represents the base feature class.
Definition: feature.h:105
boost::shared_ptr< const CRHEstimation< PointInT, PointNT, PointOutT > > ConstPtr
Definition: crh.h:65
CRHEstimation estimates the Camera Roll Histogram (CRH) descriptor for a given point cloud dataset co...
Definition: crh.h:61