0

我正在使用下面的代码从八叉树制作图表,用于路径查找。

据我了解,adj_list.m_vertices包含指向我将需要的八叉树质心的 xyz 数据的指针,但我不知道如何获取 xyz 数据。

编码:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/octree/octree_pointcloud_adjacency.h>
#include <pcl/point_cloud.h>
#include <pcl/octree/octree_search.h>
#include <boost/graph/adjacency_matrix.hpp>
#include <vector>       
#include <set>
#include<iterator>

int
main ()
{

  srand ((unsigned int) time (NULL));

  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file pcd.pcd \n");
    return (-1);
  }
  
  

  float resolution = 0.0005f;

  pcl::octree::OctreePointCloudAdjacency<pcl::PointXYZ> octree (resolution);

  boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, pcl::PointXYZ, float> adj_list;


  octree.setInputCloud(cloud);
  octree.addPointsFromInputCloud();

  octree.computeVoxelAdjacencyGraph(adj_list);

  return (0);
}

我是 C++ 新手,如果这是一个明显的答案,我很抱歉。

先感谢您!

4

0 回答 0