1

我应用了 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)
4

1 回答 1

1

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

if(cloud->size() > 0)

于 2017-07-31T13:40:03.687 回答