Reputation: 99
I applied RANSAC and successfully segment out the required part from the scene. The problem is when for a long time the required part is not present infront of the camera it crashes out after throwing an exception. How I could possibly deals with this exception in the best way as even the object is not found in the scene it keeps looking for it ?
[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)
Upvotes: 1
Views: 7986
Reputation: 954
Check the size of the cloud before calling the write function.
if(cloud->size() > 0)
Upvotes: 1