Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
features
moment_invariants.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$
38
*
39
*/
40
41
#pragma once
42
43
#include <pcl/features/feature.h>
44
45
namespace
pcl
46
{
47
/** \brief MomentInvariantsEstimation estimates the 3 moment invariants (j1, j2, j3) at each 3D point.
48
*
49
* \note The code is stateful as we do not expect this class to be multicore parallelized. Please look at
50
* \ref NormalEstimationOMP for an example on how to extend this to parallel implementations.
51
* \author Radu B. Rusu
52
* \ingroup features
53
* \tparam PointOutT Suggested type is `pcl::MomentInvariants`
54
*/
55
template
<
typename
Po
int
InT,
typename
Po
int
OutT>
56
class
MomentInvariantsEstimation
:
public
Feature
<PointInT, PointOutT>
57
{
58
public
:
59
using
Ptr
= shared_ptr<MomentInvariantsEstimation<PointInT, PointOutT> >;
60
using
ConstPtr
= shared_ptr<const MomentInvariantsEstimation<PointInT, PointOutT> >;
61
using
Feature
<PointInT, PointOutT>
::feature_name_
;
62
using
Feature
<PointInT, PointOutT>
::getClassName
;
63
using
Feature
<PointInT, PointOutT>
::indices_
;
64
using
Feature
<PointInT, PointOutT>
::k_
;
65
using
Feature
<PointInT, PointOutT>
::search_parameter_
;
66
using
Feature
<PointInT, PointOutT>
::surface_
;
67
using
Feature
<PointInT, PointOutT>
::input_
;
68
69
using
PointCloudOut
=
typename
Feature<PointInT, PointOutT>::PointCloudOut
;
70
71
/** \brief Empty constructor. */
72
MomentInvariantsEstimation
()
73
{
74
feature_name_
=
"MomentInvariantsEstimation"
;
75
};
76
77
/** \brief Compute the 3 moment invariants (j1, j2, j3) for a given set of points, using their indices.
78
* \param[in] cloud the input point cloud
79
* \param[in] indices the point cloud indices that need to be used
80
* \param[out] j1 the resultant first moment invariant
81
* \param[out] j2 the resultant second moment invariant
82
* \param[out] j3 the resultant third moment invariant
83
*/
84
void
85
computePointMomentInvariants
(
const
pcl::PointCloud<PointInT>
&cloud,
86
const
pcl::Indices
&indices,
87
float
&j1,
float
&j2,
float
&j3);
88
89
/** \brief Compute the 3 moment invariants (j1, j2, j3) for a given set of points, using their indices.
90
* \param[in] cloud the input point cloud
91
* \param[out] j1 the resultant first moment invariant
92
* \param[out] j2 the resultant second moment invariant
93
* \param[out] j3 the resultant third moment invariant
94
*/
95
void
96
computePointMomentInvariants
(
const
pcl::PointCloud<PointInT>
&cloud,
97
float
&j1,
float
&j2,
float
&j3);
98
99
protected
:
100
101
/** \brief Estimate moment invariants for all points given in <setInputCloud (), setIndices ()> using the surface
102
* in setSearchSurface () and the spatial locator in setSearchMethod ()
103
* \param[out] output the resultant point cloud model dataset that contains the moment invariants
104
*/
105
void
106
computeFeature
(
PointCloudOut
&output)
override
;
107
private
:
108
/** \brief 16-bytes aligned placeholder for the XYZ centroid of a surface patch. */
109
Eigen::Vector4f xyz_centroid_;
110
111
/** \brief Internal data vector. */
112
Eigen::Vector4f temp_pt_;
113
};
114
}
115
116
#ifdef PCL_NO_PRECOMPILE
117
#include <pcl/features/impl/moment_invariants.hpp>
118
#endif
pcl::Feature::search_parameter_
double search_parameter_
The actual search parameter (from either search_radius_ or k_).
Definition
feature.h:234
pcl::Feature::getClassName
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition
feature.h:244
pcl::Feature::PointCloudOut
pcl::PointCloud< PointOutT > PointCloudOut
Definition
feature.h:124
pcl::Feature::k_
int k_
The number of K nearest neighbors to use for each point.
Definition
feature.h:240
pcl::Feature::feature_name_
std::string feature_name_
The feature name.
Definition
feature.h:220
pcl::Feature::Feature
Feature()
Empty constructor.
Definition
feature.h:131
pcl::Feature::surface_
PointCloudInConstPtr surface_
An input point cloud describing the surface that is to be used for nearest neighbors estimation.
Definition
feature.h:228
pcl::PointCloudOut
pcl::MomentInvariantsEstimation::MomentInvariantsEstimation
MomentInvariantsEstimation()
Empty constructor.
Definition
moment_invariants.h:72
pcl::MomentInvariantsEstimation::ConstPtr
shared_ptr< const MomentInvariantsEstimation< PointInT, PointOutT > > ConstPtr
Definition
moment_invariants.h:60
pcl::MomentInvariantsEstimation::Ptr
shared_ptr< MomentInvariantsEstimation< PointInT, PointOutT > > Ptr
Definition
moment_invariants.h:59
pcl::MomentInvariantsEstimation::computeFeature
void computeFeature(PointCloudOut &output) override
Estimate moment invariants for all points given in <setInputCloud (), setIndices ()> using the surfac...
Definition
moment_invariants.hpp:116
pcl::MomentInvariantsEstimation::PointCloudOut
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition
moment_invariants.h:69
pcl::MomentInvariantsEstimation::computePointMomentInvariants
void computePointMomentInvariants(const pcl::PointCloud< PointInT > &cloud, const pcl::Indices &indices, float &j1, float &j2, float &j3)
Compute the 3 moment invariants (j1, j2, j3) for a given set of points, using their indices.
Definition
moment_invariants.hpp:49
pcl::PCLBase< PointInT >::input_
PointCloudConstPtr input_
Definition
pcl_base.h:147
pcl::PCLBase< PointInT >::indices_
IndicesPtr indices_
Definition
pcl_base.h:150
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:174
pcl
Definition
convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition
types.h:133