Point Cloud Library (PCL) 1.15.1-dev
Loading...
Searching...
No Matches
esf.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2010-2012, 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: pfh.hpp 5027 2012-03-12 03:10:45Z rusu $
38 *
39 */
40
41#pragma once
42
43#include <pcl/features/feature.h>
44#include <pcl/point_types.h> // for pcl::ESFSignature640
45#define GRIDSIZE 64
46#define GRIDSIZE_H (GRIDSIZE/2)
47#include <vector>
48
49namespace pcl
50{
51 /** \brief @b ESFEstimation estimates the ensemble of shape functions descriptors for a given point cloud
52 * dataset containing points. Shape functions are D2, D3, A3. For more information about the ESF descriptor, see:
53 * Walter Wohlkinger and Markus Vincze, "Ensemble of Shape Functions for 3D Object Classification",
54 * IEEE International Conference on Robotics and Biomimetics (IEEE-ROBIO), 2011
55 * \author Walter Wohlkinger
56 * \ingroup features
57 */
58
59 template <typename PointInT, typename PointOutT = pcl::ESFSignature640>
60 class ESFEstimation: public Feature<PointInT, PointOutT>
61 {
62 public:
63 using Ptr = shared_ptr<ESFEstimation<PointInT, PointOutT> >;
64 using ConstPtr = shared_ptr<const ESFEstimation<PointInT, PointOutT> >;
65
66 using Feature<PointInT, PointOutT>::feature_name_;
67 using Feature<PointInT, PointOutT>::getClassName;
68 using Feature<PointInT, PointOutT>::indices_;
69 using Feature<PointInT, PointOutT>::k_;
70 using Feature<PointInT, PointOutT>::search_radius_;
71 using Feature<PointInT, PointOutT>::input_;
72 using Feature<PointInT, PointOutT>::surface_;
73
76
77 /** \brief Empty constructor. */
78 ESFEstimation () : local_cloud_ ()
79 {
80 feature_name_ = "ESFEstimation";
81 lut_.resize (GRIDSIZE);
82 for (int i = 0; i < GRIDSIZE; ++i)
83 {
84 lut_[i].resize (GRIDSIZE);
85 for (int j = 0; j < GRIDSIZE; ++j)
86 lut_[i][j].resize (GRIDSIZE);
87 }
88 //lut_.resize (boost::extents[GRIDSIZE][GRIDSIZE][GRIDSIZE]);
90 k_ = 5;
91 }
92
93 /** \brief Overloaded computed method from pcl::Feature.
94 * \param[out] output the resultant point cloud model dataset containing the estimated features
95 */
96 void
97 compute (PointCloudOut &output);
98
99 protected:
100
101 /** \brief Estimate the Ensebmel of Shape Function (ESF) descriptors at a set of points given by
102 * <setInputCloud (),
103 * \param output the resultant point cloud model histogram that contains the ESF feature estimates
104 */
105 void
106 computeFeature (PointCloudOut &output) override;
107
108 /** \brief ... */
109 int
110 lci (const int x1, const int y1, const int z1,
111 const int x2, const int y2, const int z2,
112 float &ratio, int &incnt, int &pointcount);
113
114 /** \brief ... */
115 void
116 computeESF (PointCloudIn &pc, std::vector<float> &hist);
117
118 /** \brief ... */
119 void
120 voxelize9 (PointCloudIn &cluster);
121
122 /** \brief ... */
123 void
124 cleanup9 (PointCloudIn &cluster);
125
126 /** \brief ... */
127 void
128 scale_points_unit_sphere (const pcl::PointCloud<PointInT> &pc, float scalefactor, Eigen::Vector4f& centroid);
129
130 private:
131
132 /** \brief ... */
133 std::vector<std::vector<std::vector<int> > > lut_;
134
135 /** \brief ... */
136 PointCloudIn local_cloud_;
137 };
138}
139
140#ifdef PCL_NO_PRECOMPILE
141#include <pcl/features/impl/esf.hpp>
142#endif
ESFEstimation estimates the ensemble of shape functions descriptors for a given point cloud dataset c...
Definition esf.h:61
shared_ptr< const ESFEstimation< PointInT, PointOutT > > ConstPtr
Definition esf.h:64
pcl::PointCloud< PointInT > PointCloudIn
Definition esf.h:74
shared_ptr< ESFEstimation< PointInT, PointOutT > > Ptr
Definition esf.h:63
void compute(PointCloudOut &output)
Overloaded computed method from pcl::Feature.
Definition esf.hpp:506
void computeESF(PointCloudIn &pc, std::vector< float > &hist)
...
Definition esf.hpp:52
ESFEstimation()
Empty constructor.
Definition esf.h:78
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition esf.h:75
void voxelize9(PointCloudIn &cluster)
...
Definition esf.hpp:425
void scale_points_unit_sphere(const pcl::PointCloud< PointInT > &pc, float scalefactor, Eigen::Vector4f &centroid)
...
Definition esf.hpp:481
int lci(const int x1, const int y1, const int z1, const int x2, const int y2, const int z2, float &ratio, int &incnt, int &pointcount)
...
Definition esf.hpp:306
void cleanup9(PointCloudIn &cluster)
...
Definition esf.hpp:453
void computeFeature(PointCloudOut &output) override
Estimate the Ensebmel of Shape Function (ESF) descriptors at a set of points given by <setInputCloud ...
Definition esf.hpp:534
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
PointCloudConstPtr input_
The input point cloud dataset.
Definition pcl_base.h:147
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.