以下のコードを使用して、パス検索に使用される octree からグラフを作成しています。
私が理解しているように、adj_list.m_verticesには必要な octree セントロイドの 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 ++が初めてなので、明らかな答えであれば申し訳ありません。
前もって感謝します!