ConditionalRemoval报错
相信很多人,在刚开始学习PCL的时候,都会先学习PCL官网上放出的tutorials教程。我也一样。
一边运行官网给出的样例程序example,一边阅读样例程序的代码,个人感觉这样学得挺好的(自我感觉良好)。
下面的代码选自《点云库PCL学习编程》里,第6章 点云滤波,6.2.6 移除离群点。
(在12章点云分割里也有,12.2.7基于法线微分的分割)
pcl::ConditionalRemoval<pcl::PointXYZ> condrem (range_cond);
condrem.setInputCloud (cloud);
condrem.setKeepOrganized(true);
报错内容
上述代码编译时候会报错:
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2664 “pcl::ConditionalRemovalpcl::PointXYZ::ConditionalRemoval(pcl::ConditionalRemovalpcl::PointXYZ &&)”: 无法将参数 1 从“boost::shared_ptr<pcl::ConditionAndpcl::PointXYZ>”转换为“int” remove_outliers E:\第六章\6 remove_outliers\source\remove_outliers.cpp 47
或者
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2664 “pcl::ConditionalRemovalpcl::PointNormal::ConditionalRemoval(pcl::ConditionalRemovalpcl::PointNormal &&)”: 无法将参数 1 从“boost::shared_ptr<pcl::ConditionOrpcl::PointNormal>”转换为“int” don_segmentation E:\第十二章\7DoD\source\don_segmentation.cpp 265
解决方法
改成下面这样就可以了:
pcl::ConditionalRemoval<pcl::PointXYZ> condrem; //不要调用构造函数
condrem.setCondition(range_cond); //添加这行代码,设置条件
condrem.setInputCloud (cloud);
condrem.setKeepOrganized(true);
解决了吗?欢迎评论区跟我交流~