【PCL】KdTree使用报错:Assertion `point_representation_->isValid、Assertion `index > 0 && index < count‘

本文探讨了在使用pcl库进行点云处理时遇到的KdTree相关报错,如无效坐标和索引越界,主要原因是点云中存在异常值。提供了使用removeNaN函数去除这些异常值并解决问题的方法。
摘要由CSDN通过智能技术生成

说明

本文记录几种使用pcl配准库时,该库使用了KdTree方法,运行中的报错如 Assertion point_representation_->isValid (point)、Assertion index > 0 && index < count’ failed.等, 以及解决方法。

报错信息一

normal_distributions_transform: /build/pcl-OilVEB/pcl-1.8.1+dfsg1/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp:172: int pcl::KdTreeFLANN<PointT, Dist>::radiusSearch(const PointT&, double, std::vector&, std::vector&, unsigned int) const [with PointT = pcl::PointXYZ; Dist = flann::L2_Simple]: Assertion `point_representation_->isValid (point) && “Invalid (NaN, Inf) point coordinates given to radiusSearch!”’ failed.

报错信息二

normal_distributions_transform: /usr/include/flann/algorithms/kdtree_single_index.h:492:
eeSingleIndex<flann::L2_Simple >::Interval> >]: Assertion `index > 0 && index < count’ failed.
Aborted (core dumped)

原因和解决办法

一般是点云中存在异常值导致,可以使用pcl库中自带的removeNan函数来解决。

//将自己的cloud在这里设置好

std::vector<int> indices;

pcl::removeNaNFromPointCloud(*cloud, *cloud, indices);
        
std::cout << "After remove nan, left " << cloud->size() << " data points ."<< std::endl;    
  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

steptoward

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值