Point Cloud Library (PCL)  1.11.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  vpx_ (0), vpy_ (0), vpz_ (0), nbins_ (90)
79  {
80  k_ = 1;
81  feature_name_ = "CRHEstimation";
82  }
83  ;
84 
85  /** \brief Set the viewpoint.
86  * \param[in] vpx the X coordinate of the viewpoint
87  * \param[in] vpy the Y coordinate of the viewpoint
88  * \param[in] vpz the Z coordinate of the viewpoint
89  */
90  inline void
91  setViewPoint (float vpx, float vpy, float vpz)
92  {
93  vpx_ = vpx;
94  vpy_ = vpy;
95  vpz_ = vpz;
96  }
97 
98  /** \brief Get the viewpoint.
99  * \param[out] vpx the X coordinate of the viewpoint
100  * \param[out] vpy the Y coordinate of the viewpoint
101  * \param[out] vpz the Z coordinate of the viewpoint
102  */
103  inline void
104  getViewPoint (float &vpx, float &vpy, float &vpz)
105  {
106  vpx = vpx_;
107  vpy = vpy_;
108  vpz = vpz_;
109  }
110 
111  inline void
112  setCentroid (Eigen::Vector4f & centroid)
113  {
114  centroid_ = centroid;
115  }
116 
117  private:
118  /** \brief Values describing the viewpoint ("pinhole" camera model assumed).
119  * By default, the viewpoint is set to 0,0,0.
120  */
121  float vpx_, vpy_, vpz_;
122 
123  /** \brief Number of bins, this should match the Output type */
124  int nbins_;
125 
126  /** \brief Centroid to be used */
127  Eigen::Vector4f centroid_;
128 
129  /** \brief Estimate the CRH histogram at
130  * a set of points given by <setInputCloud (), setIndices ()> using the surface in
131  * setSearchSurface ()
132  *
133  * \param[out] output the resultant point cloud with a CRH histogram
134  */
135  void
136  computeFeature (PointCloudOut &output) override;
137  };
138 }
139 
140 #ifdef PCL_NO_PRECOMPILE
141 #include <pcl/features/impl/crh.hpp>
142 #endif
pcl
Definition: convolution.h:46
pcl::CRHEstimation::ConstPtr
shared_ptr< const CRHEstimation< PointInT, PointNT, PointOutT > > ConstPtr
Definition: crh.h:64
pcl::PointCloud< PointOutT >
pcl::CRHEstimation::setCentroid
void setCentroid(Eigen::Vector4f &centroid)
Definition: crh.h:112
pcl::CRHEstimation::PointCloudOut
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: crh.h:74
pcl::CRHEstimation
CRHEstimation estimates the Camera Roll Histogram (CRH) descriptor for a given point cloud dataset co...
Definition: crh.h:60
pcl::Feature< PointInT, pcl::Histogram< 90 > >::k_
int k_
The number of K nearest neighbors to use for each point.
Definition: feature.h:243
pcl::FeatureFromNormals
Definition: feature.h:311
pcl::CRHEstimation::getViewPoint
void getViewPoint(float &vpx, float &vpy, float &vpz)
Get the viewpoint.
Definition: crh.h:104
pcl::CRHEstimation::setViewPoint
void setViewPoint(float vpx, float vpy, float vpz)
Set the viewpoint.
Definition: crh.h:91
pcl::Feature< PointInT, pcl::Histogram< 90 > >::feature_name_
std::string feature_name_
The feature name.
Definition: feature.h:223
pcl::CRHEstimation::Ptr
shared_ptr< CRHEstimation< PointInT, PointNT, PointOutT > > Ptr
Definition: crh.h:63
pcl::CRHEstimation::CRHEstimation
CRHEstimation()
Constructor.
Definition: crh.h:77
pcl::Feature
Feature represents the base feature class.
Definition: feature.h:106