Point Cloud Library (PCL) 1.15.1-dev
Loading...
Searching...
No Matches
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#include <pcl/point_types.h> // for pcl::Histogram
45
46namespace 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 using Ptr = shared_ptr<CRHEstimation<PointInT, PointNT, PointOutT> >;
65 using ConstPtr = shared_ptr<const CRHEstimation<PointInT, PointNT, PointOutT> >;
66
67 using Feature<PointInT, PointOutT>::feature_name_;
68 using Feature<PointInT, PointOutT>::getClassName;
69 using Feature<PointInT, PointOutT>::indices_;
70 using Feature<PointInT, PointOutT>::k_;
71 using Feature<PointInT, PointOutT>::search_radius_;
72 using Feature<PointInT, PointOutT>::surface_;
73 using FeatureFromNormals<PointInT, PointNT, PointOutT>::normals_;
74
76
77 /** \brief Constructor. */
79 {
80 k_ = 1;
81 feature_name_ = "CRHEstimation";
82 }
83
84 /** \brief Set the viewpoint.
85 * \param[in] vpx the X coordinate of the viewpoint
86 * \param[in] vpy the Y coordinate of the viewpoint
87 * \param[in] vpz the Z coordinate of the viewpoint
88 */
89 inline void
90 setViewPoint (float vpx, float vpy, float vpz)
91 {
92 vpx_ = vpx;
93 vpy_ = vpy;
94 vpz_ = vpz;
95 }
96
97 /** \brief Get the viewpoint.
98 * \param[out] vpx the X coordinate of the viewpoint
99 * \param[out] vpy the Y coordinate of the viewpoint
100 * \param[out] vpz the Z coordinate of the viewpoint
101 */
102 inline void
103 getViewPoint (float &vpx, float &vpy, float &vpz)
104 {
105 vpx = vpx_;
106 vpy = vpy_;
107 vpz = vpz_;
108 }
109
110 inline void
111 setCentroid (Eigen::Vector4f & centroid)
112 {
113 centroid_ = centroid;
114 }
115
116 private:
117 /** \brief Values describing the viewpoint ("pinhole" camera model assumed).
118 * By default, the viewpoint is set to 0,0,0.
119 */
120 float vpx_{0.0f}, vpy_{0.0f}, vpz_{0.0f};
121
122 /** \brief Number of bins, this should match the Output type */
123 int nbins_{90};
124
125 /** \brief Centroid to be used */
126 Eigen::Vector4f centroid_;
127
128 /** \brief Estimate the CRH histogram at
129 * a set of points given by <setInputCloud (), setIndices ()> using the surface in
130 * setSearchSurface ()
131 *
132 * \param[out] output the resultant point cloud with a CRH histogram
133 */
134 void
135 computeFeature (PointCloudOut &output) override;
136 };
137}
138
139#ifdef PCL_NO_PRECOMPILE
140#include <pcl/features/impl/crh.hpp>
141#endif
CRHEstimation estimates the Camera Roll Histogram (CRH) descriptor for a given point cloud dataset co...
Definition crh.h:62
void setCentroid(Eigen::Vector4f &centroid)
Definition crh.h:111
shared_ptr< CRHEstimation< PointInT, PointNT, PointOutT > > Ptr
Definition crh.h:64
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition crh.h:75
shared_ptr< const CRHEstimation< PointInT, PointNT, PointOutT > > ConstPtr
Definition crh.h:65
void getViewPoint(float &vpx, float &vpy, float &vpz)
Get the viewpoint.
Definition crh.h:103
void setViewPoint(float vpx, float vpy, float vpz)
Set the viewpoint.
Definition crh.h:90
CRHEstimation()
Constructor.
Definition crh.h:78
PointCloudNConstPtr normals_
A pointer to the input dataset that contains the point normals of the XYZ dataset.
Definition feature.h:349
Feature represents the base feature class.
Definition feature.h:107
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition feature.h:244
double search_radius_
The nearest neighbors search radius for each point.
Definition feature.h:237
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
PointCloudInConstPtr surface_
An input point cloud describing the surface that is to be used for nearest neighbors estimation.
Definition feature.h:228
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition pcl_base.h:150
Defines all the PCL implemented PointT point type structures.