41#ifndef PCL_FEATURES_IMPL_MOMENT_INVARIANTS_H_
42#define PCL_FEATURES_IMPL_MOMENT_INVARIANTS_H_
44#include <pcl/features/moment_invariants.h>
48template <
typename Po
intInT,
typename Po
intOutT>
void
51 float &j1,
float &j2,
float &j3)
60 for (
const auto &index : indices)
63 temp_pt_[0] = cloud[index].x - xyz_centroid_[0];
64 temp_pt_[1] = cloud[index].y - xyz_centroid_[1];
65 temp_pt_[2] = cloud[index].z - xyz_centroid_[2];
67 mu200 += temp_pt_[0] * temp_pt_[0];
68 mu020 += temp_pt_[1] * temp_pt_[1];
69 mu002 += temp_pt_[2] * temp_pt_[2];
70 mu110 += temp_pt_[0] * temp_pt_[1];
71 mu101 += temp_pt_[0] * temp_pt_[2];
72 mu011 += temp_pt_[1] * temp_pt_[2];
82template <
typename Po
intInT,
typename Po
intOutT>
void
93 for (
const auto& point: cloud.points)
96 temp_pt_[0] = point.x - xyz_centroid_[0];
97 temp_pt_[1] = point.y - xyz_centroid_[1];
98 temp_pt_[2] = point.z - xyz_centroid_[2];
100 mu200 += temp_pt_[0] * temp_pt_[0];
101 mu020 += temp_pt_[1] * temp_pt_[1];
102 mu002 += temp_pt_[2] * temp_pt_[2];
103 mu110 += temp_pt_[0] * temp_pt_[1];
104 mu101 += temp_pt_[0] * temp_pt_[2];
105 mu011 += temp_pt_[1] * temp_pt_[2];
115template <
typename Po
intInT,
typename Po
intOutT>
void
125 if (input_->is_dense)
128 for (std::size_t idx = 0; idx < indices_->size (); ++idx)
130 if (this->searchForNeighbors ((*indices_)[idx], search_parameter_,
nn_indices,
nn_dists) == 0)
132 output[idx].j1 =
output[idx].j2 =
output[idx].j3 = std::numeric_limits<float>::quiet_NaN ();
137 computePointMomentInvariants (*surface_,
nn_indices,
144 for (std::size_t idx = 0; idx < indices_->size (); ++idx)
146 if (!
isFinite ((*input_)[(*indices_)[idx]]) ||
147 this->searchForNeighbors ((*indices_)[idx], search_parameter_,
nn_indices,
nn_dists) == 0)
149 output[idx].j1 =
output[idx].j2 =
output[idx].j3 = std::numeric_limits<float>::quiet_NaN ();
154 computePointMomentInvariants (*surface_,
nn_indices,
160#define PCL_INSTANTIATE_MomentInvariantsEstimation(T,NT) template class PCL_EXPORTS pcl::MomentInvariantsEstimation<T,NT>;
Define methods for centroid estimation and covariance matrix calculus.
Iterator class for point clouds with or without given indices.
ConstCloudIterator(const PointCloud< PointT > &cloud)
void computeFeature(PointCloudOut &output) override
Estimate moment invariants for all points given in <setInputCloud (), setIndices ()> using the surfac...
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
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.
unsigned int compute3DCentroid(ConstCloudIterator< PointT > &cloud_iterator, Eigen::Matrix< Scalar, 4, 1 > ¢roid)
Compute the 3D (X-Y-Z) centroid of a set of points and return it as a 3D vector.
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
IndicesAllocator<> Indices
Type used for indices in PCL.