42#include <pcl/features/shot_omp.h>
44#include <pcl/common/point_tests.h>
46#include <pcl/features/shot_lrf_omp.h>
49template<
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT,
typename Po
intRFT>
bool
54 PCL_ERROR (
"[pcl::%s::initCompute] Init failed.\n",
getClassName ().c_str ());
62 "[pcl::%s::initCompute] Error! Search method set to k-neighborhood. Call setKSearch(0) and setRadiusSearch( radius ) to use this class.\n",
79 PCL_ERROR (
"[pcl::%s::initCompute] Init failed.\n",
getClassName ().c_str ());
87template<
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT,
typename Po
intRFT>
bool
92 PCL_ERROR (
"[pcl::%s::initCompute] Init failed.\n",
getClassName ().c_str ());
100 "[pcl::%s::initCompute] Error! Search method set to k-neighborhood. Call setKSearch(0) and setRadiusSearch( radius ) to use this class.\n",
117 PCL_ERROR (
"[pcl::%s::initCompute] Init failed.\n",
getClassName ().c_str ());
125template<
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT,
typename Po
intRFT>
void
139template<
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT,
typename Po
intRFT>
void
151 output.is_dense =
true;
153#pragma omp parallel for \
156 num_threads(threads_)
157 for (std::ptrdiff_t idx = 0; idx < static_cast<std::ptrdiff_t> (
indices_->size ()); ++idx)
160 Eigen::VectorXf shot;
163 bool lrf_is_nan =
false;
164 const PointRFT& current_frame = (*frames_)[idx];
165 if (!std::isfinite (current_frame.x_axis[0]) ||
166 !std::isfinite (current_frame.y_axis[0]) ||
167 !std::isfinite (current_frame.z_axis[0]))
169 PCL_WARN (
"[pcl::%s::computeFeature] The local reference frame is not valid! Aborting description of point with index %d\n",
177 std::vector<float> nn_dists (
k_);
183 for (Eigen::Index d = 0; d < shot.size (); ++d)
184 output[idx].descriptor[d] = std::numeric_limits<float>::quiet_NaN ();
185 for (
int d = 0; d < 9; ++d)
186 output[idx].rf[d] = std::numeric_limits<float>::quiet_NaN ();
188 output.is_dense =
false;
196 for (Eigen::Index d = 0; d < shot.size (); ++d)
197 output[idx].descriptor[d] = shot[d];
198 for (
int d = 0; d < 3; ++d)
200 output[idx].rf[d + 0] = (*frames_)[idx].x_axis[d];
201 output[idx].rf[d + 3] = (*frames_)[idx].y_axis[d];
202 output[idx].rf[d + 6] = (*frames_)[idx].z_axis[d];
208template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT,
typename Po
intRFT>
void
222template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT,
typename Po
intRFT>
void
238 output.is_dense =
true;
240#pragma omp parallel for \
243 num_threads(threads_)
244 for (std::ptrdiff_t idx = 0; idx < static_cast<std::ptrdiff_t> (
indices_->size ()); ++idx)
246 Eigen::VectorXf shot;
252 std::vector<float> nn_dists (
k_);
254 bool lrf_is_nan =
false;
255 const PointRFT& current_frame = (*frames_)[idx];
256 if (!std::isfinite (current_frame.x_axis[0]) ||
257 !std::isfinite (current_frame.y_axis[0]) ||
258 !std::isfinite (current_frame.z_axis[0]))
260 PCL_WARN (
"[pcl::%s::computeFeature] The local reference frame is not valid! Aborting description of point with index %d\n",
270 for (Eigen::Index d = 0; d < shot.size (); ++d)
271 output[idx].descriptor[d] = std::numeric_limits<float>::quiet_NaN ();
272 for (
int d = 0; d < 9; ++d)
273 output[idx].rf[d] = std::numeric_limits<float>::quiet_NaN ();
275 output.is_dense =
false;
283 for (Eigen::Index d = 0; d < shot.size (); ++d)
284 output[idx].descriptor[d] = shot[d];
285 for (
int d = 0; d < 3; ++d)
287 output[idx].rf[d + 0] = (*frames_)[idx].x_axis[d];
288 output[idx].rf[d + 3] = (*frames_)[idx].y_axis[d];
289 output[idx].rf[d + 6] = (*frames_)[idx].z_axis[d];
294#define PCL_INSTANTIATE_SHOTEstimationOMP(T,NT,OutT,RFT) template class PCL_EXPORTS pcl::SHOTEstimationOMP<T,NT,OutT,RFT>;
295#define PCL_INSTANTIATE_SHOTColorEstimationOMP(T,NT,OutT,RFT) template class PCL_EXPORTS pcl::SHOTColorEstimationOMP<T,NT,OutT,RFT>;
virtual bool initCompute()
This method should get called before starting the actual computation.
const std::string & getClassName() const
int searchForNeighbors(std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const
void setSearchSurface(const PointCloudInConstPtr &cloud)
Provide a pointer to a dataset to add additional information to estimate the features for every point...
void setRadiusSearch(double radius)
Set the sphere radius that is to be used for determining the nearest neighbors used for the feature e...
PointCloudInConstPtr surface_
virtual bool initLocalReferenceFrames(const std::size_t &indices_size, const LRFEstimationPtr &lrf_estimation=LRFEstimationPtr())
PointCloudConstPtr input_
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
virtual void setIndices(const IndicesPtr &indices)
Provide a pointer to the vector of indices that represents the input data.
void computePointSHOT(const int index, const pcl::Indices &indices, const std::vector< float > &sqr_dists, Eigen::VectorXf &shot) override
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
unsigned int threads_
The number of threads the scheduler should use.
void computeFeature(PointCloudOut &output) override
Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by ...
bool initCompute() override
This method should get called before starting the actual computation.
const int nr_grid_sector_
void computePointSHOT(const int index, const pcl::Indices &indices, const std::vector< float > &sqr_dists, Eigen::VectorXf &shot) override
unsigned int threads_
The number of threads the scheduler should use.
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
bool initCompute() override
This method should get called before starting the actual computation.
void computeFeature(PointCloudOut &output) override
Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by ...
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
SHOTLocalReferenceFrameEstimation estimates the Local Reference Frame used in the calculation of the ...
shared_ptr< SHOTLocalReferenceFrameEstimationOMP< PointInT, PointOutT > > Ptr
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Define methods for measuring time spent in code blocks.
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.