C++ pcl::体素网格<>;::筛选器崩溃:未分配要释放的指针
我试图通过在macOS Sierra上使用酿制pcl-1.8(最新酿制版本)的pcl::VoxelGrid::filter来减少点云的采样 我在这里学习了教程,效果很好。然后我将点类型修改为pcl::PointXYZRGB。修改后,我的程序崩溃,出现以下错误: 过滤前的点云:460400个数据点(x y z)。点云 过滤后:41049个数据点(x y z) .test_体素(22372,0x7fff9663e3c0)malloc: *对象0x10d4bc020出错:未分配要释放的指针*在malloc\u error\u break中设置断点以进行调试 源代码:C++ pcl::体素网格<>;::筛选器崩溃:未分配要释放的指针,c++,point-cloud-library,C++,Point Cloud Library,我试图通过在macOS Sierra上使用酿制pcl-1.8(最新酿制版本)的pcl::VoxelGrid::filter来减少点云的采样 我在这里学习了教程,效果很好。然后我将点类型修改为pcl::PointXYZRGB。修改后,我的程序崩溃,出现以下错误: 过滤前的点云:460400个数据点(x y z)。点云 过滤后:41049个数据点(x y z) .test_体素(22372,0x7fff9663e3c0)malloc: *对象0x10d4bc020出错:未分配要释放的指针*在mall
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/voxel_grid.h>
typedef pcl::PointXYZRGB PointT;
typedef pcl::PointCloud<pcl::PointXYZRGB> CloudT;
int
main (int argc, char** argv)
{
CloudT::Ptr cloud (new CloudT());
CloudT::Ptr cloud_filtered (new CloudT());
// Fill in the cloud data
pcl::PCDReader reader;
// Replace the path below with the path where you saved your file
reader.read ("table_scene_lms400.pcd", *cloud); // Remember to download the file first!
std::cerr << "PointCloud before filtering: " << cloud->width * cloud->height
<< " data points (" << pcl::getFieldsList (*cloud) << ").";
// Create the filtering object
pcl::VoxelGrid<PointT> sor;
sor.setInputCloud (cloud);
const float grid_size = 0.01f;
sor.setLeafSize (grid_size, grid_size, grid_size);
sor.filter (*cloud_filtered); // <==== culprit
std::cerr << "PointCloud after filtering: " << cloud_filtered->width * cloud_filtered->height
<< " data points (" << pcl::getFieldsList (*cloud_filtered) << ").";
return (0);
}
#包括
#包括
#包括
#包括
typedef pcl::PointXYZRGB PointT;
类型定义pcl::点云云云;
int
主(内部argc,字符**argv)
{
CloudT::ptrcloud(newcloudt());
CloudT::Ptr cloud_过滤(新CloudT());
//填写云数据
pcl::pcr读卡器;
//将下面的路径替换为保存文件的路径
reader.read(“table_scene_lms400.pcd”,*cloud);//记得先下载文件!
标准:cerr高度
这似乎是macOS特有的问题。同样的程序在Ubuntu 16.04和PCL-1.7上运行良好。我想这是我最近重新安装的操作系统的问题。通过重新安装PCL和清除cmake缓存(删除CMakeFiles/
和CMakeCache.txt
)解决了。