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