![](/img/trans.png)
[英]Point Cloud Library - Cannot find pcl_visualizer in Windows 10
[英]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);
}
当我注释掉这一部分并且在主程序中调用此函数时,没有错误。 下面给出了main函数中使用的函数调用。
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));
}
仅供参考, 这里是完整代码的pastebin链接
我发现了问题。 这是OpenCV的版本。 我回到了Opencv 2.4.9,它就像魅力一样。
现在我使用的是Ubuntu 14.04 + OpenCV 2.4.9 +最新版PCL
感谢所有的帮助。 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.