Fixed pcl::voxelGrid filtering crash on Windows (latest PCL, eigen allocation issue)

This commit is contained in:
matlabbe
2021-06-18 16:02:17 -04:00
parent d75cc04ad2
commit b8c22e1c99

View File

@@ -582,6 +582,10 @@ typename pcl::PointCloud<PointT>::Ptr voxelizeImpl(
pcl::VoxelGrid<PointT> filter;
filter.setLeafSize(voxelSize, voxelSize, voxelSize);
filter.setInputCloud(cloud);
#ifdef WIN32
// Pre-allocating the cloud helps to avoid crash when freeing memory allocated inside pcl library
output->resize(cloud->size());
#endif
if(!indices->empty())
{
filter.setIndices(indices);