点云库PCL可视化工具中的分段故障
Segmentation fault in Point-cloud-library PCL visualizer
我正试图从SGBM方法获得的视差图生成一个点云。我有RGB图像,视差图像,Q矩阵存储在一个XML文件中。我正在使用这个博客中给出的代码。当我用提供的图像和Q矩阵执行从博客中获得的代码时,我会出现分割错误。我正在包括我认为导致分段错误的代码段。
//This function creates a PCL visualizer, sets the point cloud to view and returns a pointer
boost::shared_ptr<pcl::visualization::PCLVisualizer> createVisualizer (pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr cloud)
{
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
viewer->setBackgroundColor (0, 0, 0);
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);
viewer->addPointCloud<pcl::PointXYZRGB> (cloud, rgb, "reconstruction");
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "reconstruction");
viewer->addCoordinateSystem ( 1.0 );
viewer->initCameraParameters ();
return (viewer);
}
当我注释掉这个部分并且在主程序中调用这个函数时,没有错误。下面给出了主函数中使用的函数调用。
point_cloud_ptr->width = (int) point_cloud_ptr->points.size();
point_cloud_ptr->height = 1;
//Create visualizer // Two lines below is the function call
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;
viewer = createVisualizer( point_cloud_ptr );
//Main loop
while ( !viewer->wasStopped())
{
viewer->spinOnce(100);
boost::this_thread::sleep (boost::posix_time::microseconds (100000));
}
只是为了参考,粘贴到完整代码的链接在这里
我发现了这个问题。这是与OpenCV版本有关的。我回到Opencv2.4.9,它就像魅力一样发挥作用。
现在我使用的是Ubuntu 14.04+OpenCV 2.4.9+PCL 的最新版本
感谢所有的帮助。非常感谢。
相关文章:
- 分段故障(堆芯转储)矢量
- 数组的指针从不分段故障
- Windows 10-使用gtkmm-3.0库和g++[包括再现]的分段故障
- 分段故障 运行C++代码时出现 SIGSEGV
- 分段故障背包问题
- 分段故障 11,从类函数显示动态 C 字符串
- 面临分段故障 使用 ffmpeg 读取视频时,因为"pFormatCtx-> streams [i]-> codecpar"的地址0x00
- 在C++中,当指向删除和指向不同对象时,分段故障指针
- 分段故障说明
- 分段故障(核心转储)-不知道为什么
- 分段故障线程
- hiredis SET遇到分段故障
- 分段故障,合并排序算法
- 多线程程序中的分段故障和gdb回溯上的不完整信息
- 到达主C++之前分段故障
- 分段故障核心使用 IF流转储
- 使用向量的移动键盘排列(分段故障)
- 在二进制树插入和遍历期间,我得到了分段故障
- 分段故障在类之间返回整数
- C++分段故障BST