我尝试用PCL执行ICP,
但 pcl::transformPointCloud不起作用.这是我的代码:
int
main ()
{
pcl::PointCloud<pcl::PointXYZI>::Ptr cloudIn (new pcl::PointCloud<pcl::PointXYZI>);
pcl::PointCloud<pcl::PointXYZI>::Ptr cloudOut (new pcl::PointCloud<pcl::PointXYZI>);
pcl::PointCloud<pcl::PointXYZI> finalCloud ;
pcl::PointCloud<pcl::PointXYZI> finalCloud1 ;
pcl::PointCloud<pcl::PointXYZI>::Ptr cloudOut_new (new pcl::PointCloud<pcl::PointXYZI>) ;
if(pcl::io::loadPCDFile ("/ICP_PCL/000.pcd", *cloudIn)==-1)
{
PCL_ERROR ("Couldn't read first file! \n");
return (-1);
}
if(pcl::io::loadPCDFile ("/ICP_PCL/001.pcd", *cloudOut)==-1)
{
PCL_ERROR ("Couldn't read second input file! \n");
return (-1);
}
pcl::IterativeClosestPoint<pcl::PointXYZI, pcl::PointXYZI> icp;
icp.setInputCloud(cloudOut);
icp.setInputTarget(cloudIn);
icp.setMaximumIterations (500);
icp.setTransformationEpsilon (1e-9);
icp.setMaxCorrespondenceDistance (0.05);
icp.setEuclideanFitnessEpsilon (1);
icp.setRANSACOutlierRejectionThreshold (1.5);
icp.align(finalCloud);
if (icp.hasConverged())
{
std::cout << "ICP converged." << std::endl
<< …Run Code Online (Sandbox Code Playgroud) 我正在用某个对象填充 std::vector。
此向量实例定义在以下行中:
std::vector< std::list< pcl::PointXYZRGB>> tab;
Run Code Online (Sandbox Code Playgroud)
我现在想删除空单元格。我试过如下:
tab.erase(remove_if(tab.begin(), tab.end(), std::is_empty), tab.end());
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
error: missing template arguments before ‘)’ token
voxels.erase(remove_if(voxels.begin(), voxels.end(), is_empty**)**, voxels.end());
Run Code Online (Sandbox Code Playgroud)
我很困惑,有人能告诉我怎么做吗?
我有一个点云。我想得到它的RGB值。我怎样才能做到这一点?
\n 为了让我的问题更清楚,请查看代码。
// Load the first input file into a PointCloud<T> with an appropriate type : \n pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud1 (new pcl::PointCloud<pcl::PointXYZRGB>);\n if (pcl::io::loadPCDFile<pcl::PointXYZRGB> ("../data/station1.pcd", *cloud1) == -1)\n {\n std::cout << "Error reading PCD file !!!" << std::endl;\n exit(-1);\n }\nRun Code Online (Sandbox Code Playgroud)\n\n我想单独获取每个值
\n\nstd::cout << " x = " << cloud1->points[11].x << std::endl;\nstd::cout << " y = " << cloud1->points[11].y << std::endl;\nstd::cout << " z = " << cloud1->points[11].z << std::endl;\nstd::cout << " r = " << cloud1->points[11].r << …Run Code Online (Sandbox Code Playgroud) 我的问题是:我有 3D 点云。我想将每个法线归因于每个点。来自 PCL 教程:
// Create the normal estimation class, and pass the input dataset to it
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
ne.setInputCloud (cloud.makeShared());
// Create an empty kdtree representation, and pass it to the normal estimation object.
// Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
ne.setSearchMethod (tree);
// Output datasets
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);
// Use all neighbors in a sphere …Run Code Online (Sandbox Code Playgroud)