如何正确使用 PCL 的阴影点类
how to properly use PCL's ShadowPoints class
我正在使用点云库(PCL),并试图从点云中删除阴影点。
为了做到这一点,我使用ShadowPoints过滤器类。出于某种原因,它从我的点云中过滤掉了所有点,无论我使用的阈值如何(在附加的代码中,我使用的是默认阈值,但我尝试使用各种阈值运行此代码)。
我在网上搜索了相关数据,但找不到问题的答案。 我在这里错过了什么?
//input point cloud.
pcl::PointCloud<pcl::PointXYZRGB>::Ptr sourceCloud(new pcl::PointCloud<pcl::PointXYZRGB>);
pcl::PointCloud<pcl::PointXYZ>::Ptr sourceCloudBasic(new pcl::PointCloud<pcl::PointXYZ>);
/* code for filling sourceCloud and sourceCloudBasic*/
...
//output point cloud
pcl::PointCloud<pcl::PointXYZRGB>::Ptr outCloud(new pcl::PointCloud<pcl::PointXYZRGB>());
//filter object
pcl::ShadowPoints<pcl::PointXYZRGB, pcl::Normal> shadowfilters(true);
//sets the source point cloud
shadowfilters.setInputCloud(sourceCloud);
//calculates normals
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
ne.setInputCloud(sourceCloudBasic);
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>());
ne.setSearchMethod(tree);
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals(new pcl::PointCloud<pcl::Normal>);
double normalsThreshold = 0.3;
ne.setRadiusSearch(normalsThreshold);
ne.compute(*cloud_normals);
//sets normals into shadowfilters
shadowfilters.setNormals(cloud_normals);
//sets threshold
double shadowThreshold = 0.1;
shadowfilters.setThreshold(shadowThreshold);
//filters
shadowfilters.filter(*outCloud);
非常感谢!
问题解决了。网格是从嘈杂的深度图像创建的 - 因此法线也不准确。它使阴影过滤器将所有内容标记为阴影。扩大法线计算的半径搜索可改进法线贴图,从而使阴影过滤器正常工作。
相关文章:
- 如何获取pcl迭代最近点(ICP)的迭代点数?
- 将 PCL 链接到 Cython C++ 模块
- PCL:当我在setConditionFunction中使用std::bind 时,没有合适的转换函数
- PCL octree std::bad_alloc c++
- C++声明模板参数阴影模板参数错误
- 在点云库 (PCL) 中使用自定义点类型的问题
- PCL 出错:体系结构x86_64 @pcl的未定义符号
- DirectX 11 - 点光源阴影
- PCL:将两个点云缩放到相同的大小
- 在同一项目中使用 CGAL 和 PCL
- 深度缓冲区未填充阴影贴图渲染通道中的数据
- PCL 中的 GICP 用法
- 退出 PCL 查看器:即使窗口已关闭,wasStop() 也不会更改值
- 使用pcl transformcloud将三维点平移并旋转到原点
- 模板中的Typedef导致阴影模板parm错误
- 使用pcl库设置错误
- 如何在ROS中使用PCL可视化动力学数据的表面法线
- C++具有内置缓存 - 阴影模板参数的对象工厂
- 增加 PCL 中点云的点大小以实现可视化
- 如何正确使用 PCL 的阴影点类