41#include <pcl/features/pfh.h>
42#include <pcl/features/pfh_tools.h>
44#include <pcl/common/point_tests.h>
48template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool
51 int p_idx,
int q_idx,
float &f1,
float &f2,
float &f3,
float &f4)
54 cloud[q_idx].getVector4fMap (), normals[q_idx].getNormalVector4fMap (),
60template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void
63 const pcl::Indices &indices,
int nr_split, Eigen::VectorXf &pfh_histogram)
68 pfh_histogram.setZero ();
71 float hist_incr = 100.0f /
static_cast<float> (indices.size () * (indices.size () - 1) / 2);
73 std::pair<int, int> key;
74 bool key_found =
false;
77 for (std::size_t i_idx = 0; i_idx < indices.size (); ++i_idx)
79 for (std::size_t j_idx = 0; j_idx < i_idx; ++j_idx)
99 key = std::pair<int, int> (p1, p2);
128 f_index_[1] =
static_cast<int> (std::floor (nr_split * ((
pfh_tuple_[1] + 1.0) * 0.5)));
132 f_index_[2] =
static_cast<int> (std::floor (nr_split * ((
pfh_tuple_[2] + 1.0) * 0.5)));
144 pfh_histogram[h_index] += hist_incr;
166template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void
171 std::queue<std::pair<int, int> > empty;
179 std::vector<float> nn_dists (
k_);
181 output.is_dense =
true;
186 for (std::size_t idx = 0; idx <
indices_->size (); ++idx)
191 output[idx].histogram[d] = std::numeric_limits<float>::quiet_NaN ();
193 output.is_dense =
false;
208 for (std::size_t idx = 0; idx <
indices_->size (); ++idx)
214 output[idx].histogram[d] = std::numeric_limits<float>::quiet_NaN ();
216 output.is_dense =
false;
230#define PCL_INSTANTIATE_PFHEstimation(T,NT,OutT) template class PCL_EXPORTS pcl::PFHEstimation<T,NT,OutT>;
PointCloudNConstPtr normals_
int searchForNeighbors(std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const
PointCloudInConstPtr surface_
PointCloudConstPtr input_
void computePointPFHSignature(const pcl::PointCloud< PointInT > &cloud, const pcl::PointCloud< PointNT > &normals, const pcl::Indices &indices, int nr_split, Eigen::VectorXf &pfh_histogram)
Estimate the PFH (Point Feature Histograms) individual signatures of the three angular (f1,...
bool computePairFeatures(const pcl::PointCloud< PointInT > &cloud, const pcl::PointCloud< PointNT > &normals, int p_idx, int q_idx, float &f1, float &f2, float &f3, float &f4)
Compute the 4-tuple representation containing the three angles and one distance between two points re...
float d_pi_
Float constant = 1.0 / (2.0 * M_PI)
int f_index_[3]
Placeholder for a histogram index.
void computeFeature(PointCloudOut &output) override
Estimate the Point Feature Histograms (PFH) descriptors at a set of points given by <setInputCloud ()...
Eigen::VectorXf pfh_histogram_
Placeholder for a point's PFH signature.
Eigen::Vector4f pfh_tuple_
Placeholder for a PFH 4-tuple.
int nr_subdiv_
The number of subdivisions for each angular feature interval.
bool use_cache_
Set to true to use the internal cache for removing redundant computations.
unsigned int max_cache_size_
Maximum size of internal cache memory.
std::queue< std::pair< int, int > > key_list_
Queue of pairs saved, used to constrain memory usage.
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
std::map< std::pair< int, int >, Eigen::Vector4f, std::less<>, Eigen::aligned_allocator< std::pair< const std::pair< int, int >, Eigen::Vector4f > > > feature_map_
Internal hashmap, used to optimize efficiency of redundant computations.
PointCloud represents the base class in PCL for storing collections of 3D points.
PCL_EXPORTS bool computePairFeatures(const Eigen::Vector4f &p1, const Eigen::Vector4f &n1, const Eigen::Vector4f &p2, const Eigen::Vector4f &n2, float &f1, float &f2, float &f3, float &f4)
Compute the 4-tuple representation containing the three angles and one distance between two points re...
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.