У меня есть функция, которая успешно читает в pointcloud и сохраняет ее в pcl::PointCloud<pcl::PointXYZ>::Ptr pcd
Затем я запускаю
//filter the pointcloud to remove some noise while still keeping the cloud dense
pcl::PointCloud<pcl::PointXYZ>::Ptr tmp = filter_obj.filterVoxelGrid(pcd, 0.01, 0.01, 0.01);
, где filter_obj
является объектом stereo_pointcloud_filter
pcl::PointCloud<pcl::PointXYZ>::Ptr stereo_pointcloud_filter::filterVoxelGrid(
pcl::PointCloud<pcl::PointXYZ>::Ptr inputcloud,
float voxelX, float voxelY, float voxelZ)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr outputcloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::VoxelGrid<pcl::PointXYZ> sor;
sor.setInputCloud(inputcloud);
sor.setLeafSize(voxelX, voxelY, voxelZ);
sor.filter(*outputcloud);
pcl::PointCloud<pcl::PointXYZ>::Ptr result(outputcloud);
return result;
}
Я получаю ошибку сегментации при отмене выделения tmp
. Я почти уверен, что ошибка связана с некоторыми плохими указателями в filterVoxelGrid()
, но я не уверен, как ее решить.
Вот стек вызовов
lib c .so.6! __ GI ___ libc_free (void * mem) (/usr/src/glibc/glibc-2.23/malloc/malloc.c:2951) Eigen :: internal :: handmade_aligned_free ( void * ptr) (/home/shawn/Documents/Projects/catkin_ws/devel/include/Eigen/src/Core/util/Memory.h:98) Eigen :: internal :: align_free (void * ptr) (/ home / shawn / Documents / Projects / catkin_ws / devel / include / Eigen / src / Core / util / Memory.h: 179) Eigen :: align_allocator :: deallocate (Eigen :: align_allocator * const this, Eigen :: align_allocator :: pointer p ) (/home/shawn/Documents/Projects/catkin_ws/devel/include/Eigen/src/Core/util/Memory.h:755) std :: allocator_traits> :: deallocate (Eigen :: align_allocator & __a, std :: allocator_traits> :: pointer __p, std :: allocator_traits> :: size_type __n) (/usr/include/c++/5/bits/alloc_traits.h:386) std :: _ Vector_base> :: _ M_deallocate (std :: _ Vector_base> * с этим , std :: _ Vector_base> :: указатель __p, std :: size_t __n) (/usr/include/c++/5/bits/stl_vector.h:178) std :: _ Vector_base> :: ~ _Vector_base (std :: _ Vector_base> * const this) (/usr/include/c++/5/bits/stl_vector.h:160) std :: vector> :: ~ vector (std :: vector> * const this) (/ usr / include / c ++ / 5 /bits/stl_vector.h:425) pcl :: PointCloud :: ~ PointCloud (pcl :: PointCloud * const this) (/usr/local/include/pcl-1.8/pcl/point_cloud.h:240) pcl :: PointCloud :: ~ PointCloud (pcl :: PointCloud * const this) (/usr/local/include/pcl-1.8/pcl/point_cloud.h:240) boost :: checked_delete> (pcl :: PointCloud * x) (/ usr / include / boost / core / checked_delete.hpp: 34) boost :: detail :: sp_counting_impl_p> :: dispose (boost :: detail :: sp_counting_impl_p> * const this) (/ usr / include / boost / smart_ptr / detail / sp_counting_impl. hpp: 78) boost :: detail :: sp_counting_base :: release (boost :: detail :: sp_counting_base * const this) (/usr/include/boost/smart_ptr/detail/sp_counting_base_gcc_x86.hpp:146) boost :: detail :: shared_count :: ~ shared_count (boost :: detail :: shared_count * con это) (/usr/include/boost/smart_ptr/detail/shared_count.hpp:443) boost :: shared_ptr> :: ~ shared_ptr (boost :: shared_ptr> * const this) (/ usr / include / boost / smart_ptr / shared_ptr.hpp: 323) read_PCD_file (std :: __ cxx11 :: string pcdFilePath) (/home/shawn/Documents/Projects/catkin_ws/src/file.cpp:402) основной (int arg c, символ ** argv) (/home/shawn/Documents/Projects/catkin_ws/src/file.cpp:567)