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

Point Feature Histograms Calculation.

asked 2013-04-02 14:15:40 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-04-03 02:57:18 -0500

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...
}
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-02 14:15:40 -0500

Seen: 338 times

Last updated: Apr 03 '13