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

  • Post author:
  • Post category:其他


错误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”);

错误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” );

编译成功结果:

启动:/home/xxx/资料/slambook-master/ch5/joinMap/build/joinMap

正在将图像转换为点云…

转换图像中: 1

转换图像中: 2

转换图像中: 3

转换图像中: 4

转换图像中: 5

点云共有1081843个点.

*** 正常退出 ***



版权声明:本文为hxy130611原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。