簡體   English   中英

Point-cloud-library 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);
}

當我注釋掉這一部分並且在主程序中調用此函數時,沒有錯誤。 下面給出了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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM