ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

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...
}