输入点云没有数据

时间:2017-07-30 15:32:58

标签: c++ computer-vision point-cloud-library robotics ransac

我应用了RANSAC并成功地从场景中分割出所需的部分。 问题是,在很长一段时间内,相机前面不存在所需的部件,它会在抛出异常后崩溃。  我怎么可能以最好的方式处理这个异常,因为即使在它一直寻找的场景中找不到对象呢?

[pcl::SampleConsensusModel::getSamples] Can not select 0 unique points out of 0! 
[pcl::RandomSampleConsensus::computeModel] No samples could be selected! 
[pcl::SACSegmentation::segment] Error segmenting the model! No solution found. 
Could not find any points that fitted the model. 
[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud! 
terminate called after throwing an instance of 'pcl::IOException' 
  what():  : [pcl::PCDWriter::writeASCII] Input point cloud has no data! 
Aborted (core dumped)

1 个答案:

答案 0 :(得分:1)

在调用write函数之前检查云的大小。

if(cloud->size() > 0)