a. 问题描述:编译成功,但执行报以下错误。
point cloud size = 0 terminate called after throwing an instance of 'pcl::IOException' what(): : [pcl::PCDWriter::writeASCII] Input point cloud has no data! 已放弃 (核心已转储)b.解决方案:文件路径的问题,看代码可知rgb = cv::imread( "./data/rgb.png" );图像是在可执行文件同目录data下,将data文件夹移动到bin目录下,和执行文件generatepointcloud一起。如下pcd文件生成成功。
a. 使用到的rgb图像和深度图像没有的问题。解决方式:这个是高翔博士的github链接https://github.com/gaoxiang12,可自己下载。我把4张图上传 b.编译错误:slam/src/detectFeatures.cpp:8:39: fatal error: opencv2/nonfree/nonfree.hpp: 没有那个文件或目录 解决方法:
sudo add-apt-repository --yes ppa:xqms/opencv-nonfree sudo apt-get update sudo apt-get install libopencv-nonfree-dev参考:https://blog.csdn.net/zyh821351004/article/details/47322823 c. src文件夹下CMakeList.txt文件没有生成detectFeatures执行文件的make命令。 在其中最底下添加如下:
#生成detectFeatures执行文件 ADD_EXECUTABLE( detectFeatures detectFeatures.cpp ) TARGET_LINK_LIBRARIES( detectFeatures slambase ${OpenCV_LIBS} ${PCL_LIBRARIES})d. make 报错:
error: ‘AlgorithmInfo’ does not name a type AlgorithmInfo* info() const;官方库报的错。 解决方法:https://bbs.csdn.net/topics/392271034
d. 报错
‘create’ is not a member of ‘cv::DescriptorExtractor {aka cv::Feature2D}’ descriptor = cv::DescriptorExtractor::create("ORB");解决方案:使用 pkg-config –modversion opencv 查看自己的opencv版本,结果是3.4.2。而代码使用的是2.4版本的方式。因为高博士使用的是2.4版本,所以我将CMakeList指定为低版本的编译方式。FIND_PACKAGE( OpenCV 2.4 REQUIRED )
