Я могу успешно создать структуру данных octree.Затем я должен получить список смежных вокселей для каждого вокселя в октрее.Я пытался использовать OctreePointCloudAdjacency, но возвращаемый indexVector имеет размер 0. Не могли бы вы помочь мне получить список соседних вокселей?Я с нетерпением жду вашего ответа! Заранее спасибо
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
//read pcd file
pcl::io::loadPCDFile<pcl::PointXYZ>("FARO_SCAN010203_SEMI_DIAGONAL - Cloud.pcd", *cloud);
//voxel dimension
float resolution;
std::cout << "Voxel buyuklugu m cinsinden girin." << std::endl;
std::cin >> resolution;
pcl::octree::OctreePointCloudSearch<pcl::PointXYZ> octree(resolution);
octree.setInputCloud(cloud);
octree.setInputCloud(cloud);
octree.addPointsFromInputCloud();
std::cout << "Number of voxels: " << octree.getLeafCount() << std::endl;
std::vector<pcl::PointXYZ, Eigen::aligned_allocator<pcl::PointXYZ>> pointGrid;
octree.getOccupiedVoxelCenters(pointGrid);
//get adjacent voxels of a voxel
pcl::octree::OctreePointCloudAdjacency<pcl::PointXYZ > deneme(resolution);
deneme.setInputCloud(cloud);
deneme.addPointsFromInputCloud();
pcl::octree::OctreePointCloudAdjacencyContainer<pcl::PointXYZ> *leaf_container;
leaf_container = deneme.getLeafContainerAtPoint(cloud->points[1000]);
std::cout << "leaf container size =" << leaf_container->size() << std::endl;
std::cout << "leaf_container number of meighbors =" << leaf_container->getNumNeighbors() << std::endl;
std::cout << "leaf container point counter =" << leaf_container->getPointCounter() << std::endl;
std::cout << "leaf container size2 =" << leaf_container->getSize() << std::endl;
pcl::IndicesPtr indexVectorXX(new std::vector <int>);
leaf_container->getPointIndices(*indexVectorXX);
std::cout << "index vector size =" << indexVectorXX->size() << std::endl;