本文整理汇总了C++中pointcloudt::Ptr::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::begin方法的具体用法?C++ Ptr::begin怎么用?C++ Ptr::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pointcloudt::Ptr
的用法示例。
在下文中一共展示了Ptr::begin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
}
}
else
{
/// check if the provided pcd file contains normals
pcl::PCLPointCloud2 input_pointcloud2;
if (pcl::io::loadPCDFile (pcd_path, input_pointcloud2))
{
PCL_ERROR ("ERROR: Could not read input point cloud %s.\n", pcd_path.c_str ());
return (3);
}
pcl::fromPCLPointCloud2 (input_pointcloud2, *cloud);
if (!ignore_provided_normals)
{
if (hasField (input_pointcloud2,"normal_x"))
{
std::cout << "Using normals contained in file. Set --nonormals option to disable this.\n";
pcl::fromPCLPointCloud2 (input_pointcloud2, *input_normals);
has_normals = true;
}
}
}
std::cout << "Done making cloud!\n";
/////////////////////////////// //////////////////////////////
////////////////////////////// //////////////////////////////
////// This is how to use supervoxels
////////////////////////////// //////////////////////////////
////////////////////////////// //////////////////////////////
// If we're using the single camera transform no negative z allowed since we use log(z)
if (!disable_transform)
{
for (PointCloudT::iterator cloud_itr = cloud->begin (); cloud_itr != cloud->end (); ++cloud_itr)
if (cloud_itr->z < 0)
{
PCL_ERROR ("Points found with negative Z values, this is not compatible with the single camera transform!\n");
PCL_ERROR ("Set the --NT option to disable the single camera transform!\n");
return 1;
}
std::cout <<"You have the single camera transform enabled - this should be used with point clouds captured from a single camera.\n";
std::cout <<"You can disable the transform with the --NT flag\n";
}
pcl::SupervoxelClustering<PointT> super (voxel_resolution, seed_resolution,!disable_transform);
super.setInputCloud (cloud);
if (has_normals)
super.setNormalCloud (input_normals);
super.setColorImportance (color_importance);
super.setSpatialImportance (spatial_importance);
super.setNormalImportance (normal_importance);
std::map <uint32_t, pcl::Supervoxel<PointT>::Ptr > supervoxel_clusters;
std::cout << "Extracting supervoxels!\n";
super.extract (supervoxel_clusters);
std::cout << "Found " << supervoxel_clusters.size () << " Supervoxels!\n";
PointLCloudT::Ptr labeled_voxel_cloud = super.getLabeledVoxelCloud ();
PointCloudT::Ptr voxel_centroid_cloud = super.getVoxelCentroidCloud ();
PointNCloudT::Ptr sv_normal_cloud = super.makeSupervoxelNormalCloud (supervoxel_clusters);
PointLCloudT::Ptr full_labeled_cloud = super.getLabeledCloud ();
std::cout << "Getting supervoxel adjacency\n";
std::multimap<uint32_t, uint32_t> label_adjacency;
super.getSupervoxelAdjacency (label_adjacency);
std::map <uint32_t, pcl::Supervoxel<PointT>::Ptr > refined_supervoxel_clusters;