c++ - 使用 PCL 进行点云下采样和正态估计
问题描述
我正在研究下采样点云和正常估计。正常的估计对我来说很好,也可以进行下采样;但是,当它们结合在一起时,它们不起作用,我收到了这个:(核心转储)。下面是我的代码。任何帮助表示赞赏?
pcl::PCLPointCloud2 pcl_pc2;
pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud2(new pcl::PointCloud<pcl::PointXYZ>);
pcl_conversions::toPCL(*input,pcl_pc2);
pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::fromPCLPointCloud2(pcl_pc2,*temp_cloud);
// Perform the actual filtering
pcl::VoxelGrid<pcl::PointXYZ> sor;
sor.setInputCloud (temp_cloud);
sor.setLeafSize (0.1f, 0.1f, 0.1f);
sor.filter (*temp_cloud2);
//do stuff with temp_cloud here
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
ne.setInputCloud (temp_cloud2);
// 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 of radius 3cm
ne.setRadiusSearch (0.03);
// Compute the features
ne.compute (*cloud_normals);
解决方案
它为我解决了;我已将搜索半径从 更改为0.03
,0.3
因为0.03
由于下采样,没有点云数据。
推荐阅读
- linux - 如何验证给定的参数格式,根据参数格式将执行不同的脚本
- python - 使用交叉验证时如何使用测试数据集进行预测?
- javascript - puppeteer page.evaluate 页面未定义
- c# - Blazor WebAssembly;.net core SignalR Client;调用 HubConnectionBuilder.Builder() 时抛出 InvalidOperationException
- r - 使用集成卡尔曼滤波器计算具有新初始值的新预测值
- excel - 比较两个表之间的数据并更新另一行中的值
- c# - 您能否建议从 NetworkStream 频繁使用异步与同步读取/写入小数据包?
- xml - XSLT如何删除不匹配节点的值
- javascript - 有没有办法修复 window.open 中的嵌套 document.write?
- ajax - 带有 HTTP/2 和 ajax 调用的 WCF 请求-响应对