diff --git a/corelib/src/util3d_filtering.cpp b/corelib/src/util3d_filtering.cpp index 0f373e9c..d19e31fb 100644 --- a/corelib/src/util3d_filtering.cpp +++ b/corelib/src/util3d_filtering.cpp @@ -582,6 +582,10 @@ typename pcl::PointCloud::Ptr voxelizeImpl( pcl::VoxelGrid 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);