This commit is contained in:
matlabbe
2020-07-07 13:55:42 -04:00
parent 9ef1c1a609
commit c3c76a8bd3
3 changed files with 20 additions and 5 deletions
+3 -2
View File
@@ -470,10 +470,11 @@ private:
if(indices->size() && voxelSize_ > 0.0)
{
pclCloud = rtabmap::util3d::voxelize(pclCloud, indices, voxelSize_);
pclCloud->is_dense = true;
}
// Do radius filtering after voxel filtering ( a lot faster)
if(pclCloud->size() && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
if(!pclCloud->empty() && (pclCloud->is_dense || !indices->empty()) && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
{
if(pclCloud->is_dense)
{
@@ -489,7 +490,7 @@ private:
}
sensor_msgs::PointCloud2 rosCloud;
if(pclCloud->size() && (normalK_ > 0 || normalRadius_ > 0.0f))
if(!pclCloud->empty() && (pclCloud->is_dense || !indices->empty()) && (normalK_ > 0 || normalRadius_ > 0.0f))
{
//compute normals
pcl::PointCloud<pcl::Normal>::Ptr normals = rtabmap::util3d::computeNormals(pclCloud, normalK_, normalRadius_);