0
$\begingroup$

Rosanswers logo

To compute a single PFH representation from a k-neighborhood, we use:

computePointPFHSignature (const pcl::PointCloud<PointInT> &cloud,
                          const pcl::PointCloud<PointNT> &normals,
                          const std::vector<int> &indices,
                          int nr_split,
                          Eigen::VectorXf &pfh_histogram);

How can I calculate vector indices which represents the set of k-nearest neighbors from cloud?


Originally posted by Nihad on ROS Answers with karma: 22 on 2013-04-02

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You might consider using the PFHEstimation class, as it already handles this for you. See the PCL tutorial here for more details.

If you want to do the search manually, you'll want to use the kdtree class for that, as shown in this tutorial:

int K = 10;
std::vector<int> KNNidx(K);
std::vector<float> KNNdist(K);
pcl::KdTreeFLANN<pcl::PointXYZ> kdtree;
for (int idx=0; idx<cloud.size(); ++idx) {
  kdtree.nearestKSearch(cloud, idx, K, KNNidx, KNNdist);
  computePointPFHSignature(cloud, normals, KNNidx, nr_split, pfh_hist);
  ...do something with pfh_hist...
}

Originally posted by Jeremy Zoss with karma: 4976 on 2013-04-03

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.