Possible problem in new VoxelGrid implementation from PCL 1.5.0

今天在学习PCL的时候,发现了一个问题,上网查找的结果跟大家分享一下,希望对大家以后的学习有所帮助。

在此,感谢发现并提出解决方案的Mike先生。

In the VoxelGrid filter, with the new implementation of VoxelGrid (PCL 1.5.0), if you are using the same variable for input and output as explained in the "Aligning object templates to a point cloud" tutorial, the filtering process will crash (it was working correctly in 1.4.0). It will work correctly if you use "SetInputCloud" from the VoxelGrid class.

In PCL 1.5.0, at line 280 in voxel_grid.hpp (output.points.resize (total);), it will resize the variable "input_" from the base class "pcl::PCLBase" too (because variable "input_" and "output" are the same reference). Because of this, in voxel_grid.hpp lines 327, 328, 329 or 343, it will crash if you are trying to access the vector input_->points[] outside his new size. It can be easily fixed by using a variable called "output_temp" instead of using "output" in the function "pcl::VoxelGrid<PointT>::applyFilter (PointCloud &output)" and, at the last line of the function, resize "output" and copy "output_temp" in "output".

你可能感兴趣的:(cloud,libra,PCLPoint,VoxelGrid)