欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

《视觉SLAM 十四讲》第五讲 实践:拼接点云-编译遇到的terminate called after throwing an instance of 'pcl::IOException问题及解决方法

程序员文章站 2022-05-28 16:11:59
...

《视觉SLAM 十四讲》第五讲 实践:拼接点云-编译遇到的terminate called after throwing an instance of 'pcl::IOException问题及解决方法

错误1:

启动:/home/xxx/资料/slambook-master/ch5/joinMap/build/joinMap
请在有pose.txt的目录下运行此程序
*** 退出,返回值:1 ***
解决方法:

   vector<cv::Mat> colorImgs, depthImgs;    // 彩色图和深度图
    vector<Eigen::Isometry3d, Eigen::aligned_allocator<Eigen::Isometry3d>> poses;         // 相机位姿
    
    ifstream fin("../pose.txt");
    if (!fin)
    {
        cerr<<"请在有pose.txt的目录下运行此程序"<<endl;
        return 1;
    }

第一种:即将ifstream fin("./pose.txt");改为ifstream fin("…/pose.txt");或者改成绝对路径
第二种:将pose.txt复制到build目录下

错误2:

启动:/home/xxx/资料/slambook-master/ch5/joinMap/build/joinMap
正在将图像转换为点云…
转换图像中: 1
转换图像中: 2
转换图像中: 3
转换图像中: 4
转换图像中: 5
点云共有0个点.
terminate called after throwing an instance of ‘pcl::IOException’
what(): : [pcl::PCDWriter::writeBinary] Input point cloud has no data!
*** 崩溃,返回值:0 ***
解决方法:

boost::format fmt( "../%s/%d.%s" ); //图像文件格式
        colorImgs.push_back( cv::imread( (fmt%"color"%(i+1)%"png").str() ));
        depthImgs.push_back( cv::imread( (fmt%"depth"%(i+1)%"pgm").str(), -1 )); // 使用-1读取原始图像

第一种:即将boost::format fmt( “./%s/%d.%s” ); 改为boost::format fmt( “…/%s/%d.%s” );
第二种:boost::format fmt( "/home/sunshine/slambook/ch5/joinMap/%s/%d.%s" ); //图像文件格式 colorImgs.push_back( cv::imread( (fmt%"color"%(i+1)%"png").str() )); depthImgs.push_back( cv::imread( (fmt%"depth"%(i+1)%"pgm").str(), -1 )); // 使用-1读取原始图像
按照这种格式把你的路径修改。

感谢原作者的回复!还有就是遇到问题是上github.com上那里面有前人遇到的问题https://github.com/gaoxiang12/slambook/issues/35
作者:RichardHansir
来源:CSDN
原文:https://blog.csdn.net/hxy130611/article/details/81170376
版权声明:本文为博主原创文章,转载请附上博文链接!