Point Cloud Library (PCL)
1.12.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
*/
54
template
<
typename
Po
int
InT,
typename
Po
int
OutT>
55
class
MomentInvariantsEstimation
:
public
Feature
<PointInT, PointOutT>
56
{
57
public
:
58
using
Ptr
= shared_ptr<MomentInvariantsEstimation<PointInT, PointOutT> >;
59
using
ConstPtr
= shared_ptr<const MomentInvariantsEstimation<PointInT, PointOutT> >;
60
using
Feature
<PointInT, PointOutT>
::feature_name_
;
61
using
Feature
<PointInT, PointOutT>
::getClassName
;
62
using
Feature
<PointInT, PointOutT>
::indices_
;
63
using
Feature
<PointInT, PointOutT>
::k_
;
64
using
Feature
<PointInT, PointOutT>
::search_parameter_
;
65
using
Feature
<PointInT, PointOutT>
::surface_
;
66
using
Feature
<PointInT, PointOutT>
::input_
;
67
68
using
PointCloudOut
=
typename
Feature<PointInT, PointOutT>::PointCloudOut
;
69
70
/** \brief Empty constructor. */
71
MomentInvariantsEstimation
()
72
{
73
feature_name_
=
"MomentInvariantsEstimation"
;
74
};
75
76
/** \brief Compute the 3 moment invariants (j1, j2, j3) for a given set of points, using their indices.
77
* \param[in] cloud the input point cloud
78
* \param[in] indices the point cloud indices that need to be used
79
* \param[out] j1 the resultant first moment invariant
80
* \param[out] j2 the resultant second moment invariant
81
* \param[out] j3 the resultant third moment invariant
82
*/
83
void
84
computePointMomentInvariants
(
const
pcl::PointCloud<PointInT>
&cloud,
85
const
pcl::Indices
&indices,
86
float
&j1,
float
&j2,
float
&j3);
87
88
/** \brief Compute the 3 moment invariants (j1, j2, j3) for a given set of points, using their indices.
89
* \param[in] cloud the input point cloud
90
* \param[out] j1 the resultant first moment invariant
91
* \param[out] j2 the resultant second moment invariant
92
* \param[out] j3 the resultant third moment invariant
93
*/
94
void
95
computePointMomentInvariants
(
const
pcl::PointCloud<PointInT>
&cloud,
96
float
&j1,
float
&j2,
float
&j3);
97
98
protected
:
99
100
/** \brief Estimate moment invariants for all points given in <setInputCloud (), setIndices ()> using the surface
101
* in setSearchSurface () and the spatial locator in setSearchMethod ()
102
* \param[out] output the resultant point cloud model dataset that contains the moment invariants
103
*/
104
void
105
computeFeature
(
PointCloudOut
&output)
override
;
106
private
:
107
/** \brief 16-bytes aligned placeholder for the XYZ centroid of a surface patch. */
108
Eigen::Vector4f xyz_centroid_;
109
110
/** \brief Internal data vector. */
111
Eigen::Vector4f temp_pt_;
112
};
113
}
114
115
#ifdef PCL_NO_PRECOMPILE
116
#include <pcl/features/impl/moment_invariants.hpp>
117
#endif
pcl::Feature::search_parameter_
double search_parameter_
The actual search parameter (from either search_radius_ or k_).
Definition
feature.h:237
pcl::Feature::getClassName
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition
feature.h:247
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:243
pcl::Feature::feature_name_
std::string feature_name_
The feature name.
Definition
feature.h:223
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:231
pcl::PointCloudOut
pcl::MomentInvariantsEstimation::MomentInvariantsEstimation
MomentInvariantsEstimation()
Empty constructor.
Definition
moment_invariants.h:71
pcl::MomentInvariantsEstimation::ConstPtr
shared_ptr< const MomentInvariantsEstimation< PointInT, PointOutT > > ConstPtr
Definition
moment_invariants.h:59
pcl::MomentInvariantsEstimation::Ptr
shared_ptr< MomentInvariantsEstimation< PointInT, PointOutT > > Ptr
Definition
moment_invariants.h:58
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:68
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:173
pcl
Definition
convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition
types.h:133