视觉SLAM十四讲高翔第二版调试记录
前言
在B站搜索slam,看高翔老师的视频
- 安张Ubuntu1804,然后学一下linux操作系统,简单看一下视频。
-
打开终端下载本书的程序
git clone https://github.com/gaoxiang12/slambook2
下载的程序不需要解压(不过有时候会下载不了,是因为github.com打不开),另外看一下终端地址,会下载到对应文件夹。 -
最好先简单看一下书,再对照着视频看。
注意事项:
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 88 个软件包未被升级。
需要下载 17.9 kB 的归档。
解压缩后会消耗 84.0 kB 的额外空间。
您希望继续执行吗? [Y/n] Y
当提示你要卸载软件包的时候,要注意。可以会破坏你的依赖环境。
一、3.7可视化演示程序运行全过程Pangolin plotTrajectory.cpp
参考https://blog.csdn.net/holly_Z_P_F/article/details/116324358
1.
在3rdparty中下载Pangolin
对应地址终端中 git clone https://github.com/stevenlovegrove/Pangolin;(有时候会终端下载不了,在网站上下载是一样的,不过需要解压一下)
2.
安装Pangolin.h
在(Pangolin/include/pangolin)
mkdir build
cd build
cmake ..
make
3. 参考链接
https://blog.csdn.net/holly_Z_P_F/article/details/116324358
4. 打开plotTrajectory.cpp
按照3中修改(Vim,KDevelop, visual studio code都行,不过记得修改之后保存)
5. 然后
mkdir build
cd build
cmake ..
make
./plotTrajectory
最后一步(注意:终端在build地址运行)
参考原文:https://blog.csdn.net/holly_Z_P_F/article/details/116324358
二、4.4.1Sophus的基本使用方法 useSophus.cpp
1.首先,按照书中的Sophus安装包进行安装,可能出现:
编译过程中可能会出现的问题:
/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment
unit_complex_.real() = 1.;
/Sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment
unit_complex_.imag() = 0.;
(原文链接:https://blog.csdn.net/Night___Raid/article/details/105113617)
该错误可以定位到so2.cpp源码文件下
:(更多问题可参考https://blog.csdn.net/haxiongha/article/details/82464148)
将
SO2::SO2()
{
unit_complex_.real() = 1.;
unit_complex_.imag() = 0.;
}
对应位置修改为
SO2::SO2()
{
//unit_complex_.real() = 1.;
//unit_complex_.imag() = 0.;
unit_complex_.real(1.);
unit_complex_.imag(0.);
}
2. 模板类Sophus
但是
,后续在ch4中进行编译可能会出现
fatal error: sophus/se3.hpp: 没有那个文件或目录
,这是由于书中给的Sophus库不是模板库。需要安装其模板库。
slam十四讲(第二版)中安装的为模板类Sophus,该sophus对eigen库的版本有要求,如果你有3.3以下的版本的eigen,那么请先卸载:
sudo rm -rf /usr/include/eigen3 /usr/lib/cmake/eigen3 /usr/share/doc/libeigen3-dev /usr/share/pkgconfig/eigen3.pc /var/lib/dpkg/info/libeigen3-dev.list /var/lib/dpkg/info/libeigen3-dev.md5sums
安装eigen3.3以上版本(这里我选用最新的3.3.6,注意3.2系列的不可以!!!)
注意:千万不要使用 sudo apt-get install libeigen3-dev 因为这个命令下载的是3.2版本的eigen,从而无法与模板类的sophus相匹配
正确方法:
(1)在官网(http://eigen.tuxfamily.org/index.php?title=Main_Page)下载安装包:eigen-3.3.6.tar.bz2 ,然后提取到此处
(2)进入文件夹eigen-3.3.6,右键在终端打开。
(3)进行安装
mkdir build
cd build
cmake ..
sudo make install
Sophus安装
自己建立一个文件夹,在终端打开,然后
git clone https://github.com/strasdat/Sophus.git
cd Sophus/
mkdir build
cd build
cmake ..
make
sudo make install
且强调sudo make install一定要有,注意:sudo make install安装后会到usr/local/include/sophus下,可以打开看看,是不是有se3.hpp.
安装之后
,对useSophus.cpp进行编译运行(mkdir build, cd build, cmake … , make ),make过程中可能会出现
fatal error:Egien/Core 没有那个文件或者目录
这是由于和useSophue.cpp同一文件夹中的CMakeLists.txt,其第8行中的地址错误导致。
cmake_minimum_required(VERSION 3.0)
project(useSophus)
# 为使用 sophus,需要使用find_package命令找到它
find_package(Sophus REQUIRED)
# Eigen
include_directories("/usr/local/include/eigen3/")
add_executable(useSophus useSophus.cpp)
target_link_libraries(useSophus Sophus::Sophus)
add_subdirectory(example)
应将 “/usr/include/eigen3/“修改为“/usr/local/include/eigen3/”
此处错误修改的另一种方法:include
sudo cp -r /usr/local/include/eigen3/ /usr/include/eigen3/
意思是:将/usr/local/include/eigen3/地址下的文件复制到/usr/include/eigen3/
后续还可能出现错误:具体忘了
#include <ftm/>
就是没有ftm库
方法:
git clone https://github.com/fmtlib/fmt
cd fmt/
mkdir build
cd build
cmake ..
make
sudo make install
最后,在对useSophus.cpp进行编译运行(mkdir build, cd build, cmake … , make )
还是在build下
./useSophus.cpp
版权声明:本文为CSDN博主「F.D.I.O.E.H.R」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Night___Raid/article/details/105113617
三、4.4.2 例子:评估轨迹的误差trajectoryError.cpp
问题1:没有链接fmt库
undefined reference to `vtable for fmt::v7::format_error'
undefined reference to `fmt::v7::detail::assert_fail(char const*, int, char const*)'
是没有链接fmt库,链接上fmt 库应该就没问题。
target_link_libraries(trajectoryError ${Pangolin_LIBRARIES})
改为
target_link_libraries(trajectoryError ${Pangolin_LIBRARIES} fmt)
问题2:trajectoryError.cpp中地址的问题
trajectory ./example/groundtruth.txt not found.
trajectory ./example/estimated.txt not found.
trajectoryError: /home/haha/slambook2/ch4/example/trajectoryError.cpp:22: int main(int, char**): Assertion `!groundtruth.empty() && !estimated.empty()' failed.
已放弃 (核心已转储)
还是trajectoryError.cpp中地址的问题。
打开trajectoryError.cpp
解决办法:
我们打开源码
把本来写的是 ./examples/groundtruth.txt 改成 …/…/examples/groundtruth.txt
…/…/examples/groundtruth.txt
因为你观察外边的目录结构,就发现这个txt文件是存在examples下面的,但是呢你使用KDevelop执行的时候,是在examples/build下执行的
所以要先… 退出build 再 … 退出examples 然后 /examples/groundtruth.txt
另一个与之类似
修改之后,重新cmake
————————————————
版权声明:本文为CSDN博主「1900_」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/holly_Z_P_F/article/details/116324358
四、5章 OpenCV安装和imageBasics.cpp调试
1. OpenCV的下载与安装
试了一下高翔老师的方法,好像链接打不开了,找了个其他的。OpenCV下载/OpenCV国内镜像/opencv_contrib下载:
各版本下载链接
安装调试链接:
OpenCV在Linux上的安装与使用
原文写的很详细,其中在安装之后的main.cpp测试环节,遇到的问题如下:
/usr/local/lib$ ./main
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/haha/下载/opencv-3.3.1/modules/highgui/src/window.cpp, line 331
terminate called after throwing an instance of 'cv::Exception'
what(): /home/haha/下载/opencv-3.3.1/modules/highgui/src/window.cpp:331: error: (-215) size.width>0 && size.height>0 in function imshow
问题原因:我把main.cpp建在了和原文中“opencv.conf”同一文件夹下了。
main.cpp应该建立和“lena.jpg”同一文件夹中(该文件在OpenCV文件解压的文件中,可以搜索一下。)
2. imageBasics.cpp调试
遇到的问题1:
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘main’中:
imageBasics.cpp:(.text+0x6e):对‘cv::imread(cv::String const&, int)’未定义的引用
imageBasics.cpp:(.text+0x1d8):对‘cv::imshow(cv::String const&, cv::_InputArray const&)’未定义的引用
imageBasics.cpp:(.text+0x200):对‘cv::waitKey(int)’未定义的引用
imageBasics.cpp:(.text+0x46f):对‘cv::noArray()’未定义的引用
...
解决办法:
CMakeLists.txt中代码错误导致的
将原代码:
project(imageBasics)
add_executable(imageBasics imageBasics.cpp)
# 链接OpenCV库
target_link_libraries(imageBasics ${OpenCV_LIBS})
add_executable(undistortImage undistortImage.cpp)
# 链接OpenCV库
target_link_libraries(undistortImage ${OpenCV_LIBS})
替换为:
cmake_minimum_required( VERSION 2.8 )
project(imageBasics)
set( CMAKE_CXX_FLAGS "-std=c++11 -O3")
find_package(OpenCV)
include_directories(${OpenCV})
add_executable(imageBasics imageBasics.cpp)
# 链接OpenCV库
target_link_libraries(imageBasics ${OpenCV_LIBS})
add_executable(undistortImage undistortImage.cpp)
# 链接OpenCV库
target_link_libraries(undistortImage ${OpenCV_LIBS})
参考原文链接:https://blog.csdn.net/loveSIYU/article/details/113377763
遇到问题2:
~/slambook2/ch5/imageBasics/build$ ./undistortImage
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/haha/下载/opencv-3.3.1/modules/highgui/src/window.cpp, line 331
terminate called after throwing an instance of 'cv::Exception'
what(): /home/haha/下载/opencv-3.3.1/modules/highgui/src/window.cpp:331: error: (-215) size.width>0 && size.height>0 in function imshow
已放弃 (核心已转储)
问题原因:图片和undistortImage 不再同一文件夹。复制到build中即可。
遇到问题3:
Gtk-Message: 17:51:15.897: Failed to load module "canberra-gtk-module"
原因:
这问题怎么来的?这是因为在编译的机器上链接到这个库,而执行的机器上没有这个库。
解决办法:
sudo apt install libcanberra-gtk-module
之后,运行试一下(不用cmake)。实在不行再重新cmake。
3. 其他
undistorImage.cpp调试和steroVision.cpp调试和上述的2类似。
CMakeLists.txt有点区别。
cmake_minimum_required( VERSION 2.8 )
set( CMAKE_CXX_FLAGS "-std=c++11 -O3")
find_package(OpenCV)
include_directories(${OpenCV})
把这一块复制到前面就行。
5.4.2 RGB调试问题jointMap.cpp
问题1:
和上述2和3中CMakeLists.txt中问题一样
CMakeLists.txt中添加保存:
cmake_minimum_required( VERSION 2.8 )
set( CMAKE_CXX_FLAGS "-std=c++11 -O3")
find_package(OpenCV)
include_directories(${OpenCV})
find_package(Sophus REQUIRED)
include_directories(${Sophus_INCLUDE_DIRS})
问题2:
CMakeFiles/joinMap.dir/joinMap.cpp.o:在函数‘fmt::v7::detail::formatbuf<char>::xsputn(char const*, long)’中:
joinMap.cpp:(.text._ZN3fmt2v76detail9formatbufIcE6xsputnEPKcl[_ZN3fmt2v76detail9formatbufIcE6xsputnEPKcl]+0x18e):对‘fmt::v7::detail::assert_fail(char const*, int, char const*)’未定义的引用
修改方法
CMakeLists.txt
中
target_link_libraries(joinMap ${OpenCV_LIBS} ${Pangolin_LIBRARIES})
添加
fmt
CMakeLists.txt最后如下所示:
cmake_minimum_required( VERSION 2.8 )
set( CMAKE_CXX_FLAGS "-std=c++11 -O3")
find_package(OpenCV)
include_directories(${OpenCV})
find_package(Sophus REQUIRED)
include_directories(${Sophus_INCLUDE_DIRS})
find_package(Pangolin REQUIRED)
add_executable(joinMap joinMap.cpp)
target_link_libraries(joinMap ${OpenCV_LIBS} ${Pangolin_LIBRARIES} fmt)
问题3:
~/slambook2/ch5/rgbd/build$ ./joinMap
请在有pose.txt的目录下运行此程序
前文中将“pose.txt”复制到build文件夹中是不行的
会出如下错误:
~/slambook2/ch5/rgbd/build$ ./joinMap
转换图像中: 1
转换图像中: 2
转换图像中: 3
转换图像中: 4
转换图像中: 5
点云共有0个点.
Point cloud is empty!
所以,要解决问题三的问题要采取如下操作:
在joinMap.cpp中
方法1:
将
ifstream fin("./pose.txt");
boost::format fmt( “./%s/%d.%s” );
改为
ifstream fin("/home/用户名/文件所在的位置/pose.txt");
boost::format fmt( "/home/用户名/文件所在的位置/%s/%d.%s" )
方法2:
改为
ifstream fin("../pose.txt");
boost::format fmt( "../%s/%d.%s" )
五、6章
6.1 Ceres安装
6.1.1 问题1:无法定位软件包 libcxsparse3.1.4
解决办法
:libcxsparse3.1.4 更改为libcxsparse3
安装如下:
sudo apt-get install libcxsparse3 libsuitesparse-dev libeigen3-dev libgoogle-glog-dev libgtest-dev
然后正常安装:
git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver
mkdir build
cd build
cmake ..
make -j2
sudo make install
6.2 G2O安装
6.2.1 问题1:无法定位软件包 libcxsparse3.1.4
解决办法
:libcxsparse3.1.4 更改为libcxsparse3
6.2.2 问题2:无法定位软件包 libcholmod3.0.6
解决办法
:
输入
sudo apt-get install libcholmod
然后按Tab键,Tab键就是自动补充命令,当你记不住完整命令的时候,你按下它,他会自动搜索!我在这里出来的是libcholmod1.7.1,然后安装就好!
参考原文:
原文链接
https://blog.csdn.net/WUYIDUER/article/details/79062978
6.2.3 问题3:软件包 libqglviewer-dev 没有可安装候选
解决方法:
apt-cache search libqglviewer-dev
执行命令出现:
libqglviewer-dev-qt4 - OpenGL 3D viewer library based on Qt4 - development files
libqglviewer-dev-qt5 - OpenGL 3D viewer library based on Qt5 - development files
选择下面你要安装的软件包即可,我安装了第二个
sudo apt-get install libqglviewer-dev-qt5
参考原文:
原文链接
https://www.cnblogs.com/darklights/p/10510279.html
原安装:
sudo apt install -y \
qt5-qmake \
qt5-default \
libqglviewer-dev \
libsuitesparse-dev \
libcxsparse3.1.4 \
libcholmod3.0.6
————————————————
版权声明:本文为CSDN博主「雨木冰日」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43863574/article/details/107080443
修改后:
sudo apt install -y qt5-qmake qt5-default libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod1.7.1
安装:
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make install
7 视觉里程计1
7.2.1OpenCV的ORB特征orb_cv.cpp
问题1:
CMakeFiles/pose_estimation_3d2d.dir/pose_estimation_3d2d.cpp.o:在函数‘bundleAdjustmentGaussNewton(std::vector<Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1, 0, 3, 1> > > const&, std::vector<Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 2, 1, 0, 2, 1> > > const&, cv::Mat const&, Sophus::SE3<double, 0>&)’中:
pose_estimation_3d2d.cpp:(.text+0x3803):对‘fmt::v7::vprint(fmt::v7::basic_string_view<char>, fmt::v7::basic_format_args<fmt::v7::basic_format_context<fmt::v7::appender, char> >)’未定义的引用
原因:
没有链接到fmt库
解决方法:
修改CMakeList.txt
如:
target_link_libraries(orb_self ${OpenCV_LIBS})
修改为
target_link_libraries(orb_self ${OpenCV_LIBS} fmt)
所有的都添加target_link_libraries后都添加。
修改完成后:
cmake_minimum_required(VERSION 2.8)
project(vo1)
set(CMAKE_BUILD_TYPE "Release")
add_definitions("-DENABLE_SSE")
set(CMAKE_CXX_FLAGS "-std=c++11 -O2 ${SSE_FLAGS} -msse4")
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(OpenCV 3 REQUIRED)
find_package(G2O REQUIRED)
find_package(Sophus REQUIRED)
include_directories(
${OpenCV_INCLUDE_DIRS}
${G2O_INCLUDE_DIRS}
${Sophus_INCLUDE_DIRS}
"/usr/include/eigen3/"
)
add_executable(orb_cv orb_cv.cpp)
target_link_libraries(orb_cv ${OpenCV_LIBS}
add_executable(orb_self orb_self.cpp)
target_link_libraries(orb_self ${OpenCV_LIBS})
# add_executable( pose_estimation_2d2d pose_estimation_2d2d.cpp extra.cpp ) # use this if in OpenCV2
add_executable(pose_estimation_2d2d pose_estimation_2d2d.cpp)
target_link_libraries(pose_estimation_2d2d ${OpenCV_LIBS})
# # add_executable( triangulation triangulation.cpp extra.cpp) # use this if in opencv2
add_executable(triangulation triangulation.cpp)
target_link_libraries(triangulation ${OpenCV_LIBS})
add_executable(pose_estimation_3d2d pose_estimation_3d2d.cpp)
target_link_libraries(pose_estimation_3d2d
g2o_core g2o_stuff
${OpenCV_LIBS})
add_executable(pose_estimation_3d3d pose_estimation_3d3d.cpp)
target_link_libraries(pose_estimation_3d3d
g2o_core g2o_stuff
${OpenCV_LIBS})
问题2:
make之后,在build下运行(书本视觉SLAM十四讲)
./orb_cv
出现问题(1):
usage: feature_extraction img1 img2
**原因:**由于没有输入两个图像的位置
查看书本输入:
build/orb_cv 1.png 2.png
出现问题(2):
bash: build/orb_cv: 没有那个文件或目录
解决方法1:
运行下列程序:
./orb_cv ../1.png ../2.png
解决方法2:
(1)将图片1.png和2.png复制到build文件夹中
(2)运行下列程序
./orb_cv 1.png 2.png
7.2.2 手写ORB特征orb_self.cpp
问题1:
./orb_self
bad/total: 0/0
bad/total: 0/0
extract ORB cost = 0.000383345 seconds.
match ORB cost = 5.3e-08 seconds.
matches: 0
OpenCV Error: Assertion failed (!outImage.empty()) in drawKeypoints, file /home/haha/下载/opencv-3.3.1/modules/features2d/src/draw.cpp, line 115
terminate called after throwing an instance of 'cv::Exception'
what(): /home/haha/下载/opencv-3.3.1/modules/features2d/src/draw.cpp:115: error: (-215) !outImage.empty() in function drawKeypoints
原因:
未读取图片
解决方法:
修改org_self.cpp中第12行和14行文件
将:
string first_file = "./1.png";
string second_file = "./2.png";
修改为:
string first_file = "../1.png";
string second_file = "../2.png";
最后在build终端下:
运行1:
make clean
运行2:
make
运行3:
./orb_self
7.4实践:对极约束求解相机运动
pose_estimation_2d2d.cpp
问题:
./pose_estimation_2d2d
usage: pose_estimation_2d2d img1 img2
解决办法:
./pose_estimation_2d2d ../1.png ../2.png
triangulation.cpp
问题:
usage: triangulation img1 img2
解决办法:
./triangulation ../1.png ../2.png
pose_estimation_3d2d.cpp
问题:
usage: pose_estimation_3d2d img1 img2 depth1 depth2
解决办法:
./pose_estimation_3d2d ../1.png ../2.png ../1_depth.png ../2_depth.png
pose_estimation_3d3d.cpp
问题:
usage: pose_estimation_3d3d img1 img2 depth1 depth2
解决办法:
./pose_estimation_3d3d ../1.png ../2.png ../1_depth.png ../2_depth.png
8 视觉里程计2
cmake问题
问题1:
CMake Error at CMakeLists.txt:8 (find_package):
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "4".
The following configuration files were considered but not accepted:
/usr/local/share/OpenCV/OpenCVConfig.cmake, version: 3.3.1
-- Configuring incomplete, errors occurred!
See also "/home/haha/slambook2/ch8/build/CMakeFiles/CMakeOutput.log".
virtual-machine:~/slambook2/ch8/build$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
解决办法:
将CMakeList.txt中第8行
find_package(OpenCV 4 REQUIRED)
修改为
find_package(OpenCV 3 REQUIRED)
问题2:
CMakeFiles/direct_method.dir/direct_method.cpp.o:在函数‘DirectPoseEstimationSingleLayer(cv::Mat const&, cv::Mat const&, std::vector<Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 2, 1, 0, 2, 1> > > const&, std::vector<double, std::allocator<double> >, Sophus::SE3<double, 0>&)’中:
/usr/local/include/fmt/core.h:2884:对‘fmt::v7::vprint(fmt::v7::basic_string_view<char>, fmt::v7::basic_format_args<fmt::v7::basic_format_context<fmt::v7::appender, char> >)’未定义的引用
/usr/local/include/fmt/core.h:2884:对‘fmt::v7::vprint(fmt::v7::basic_string_view<char>, fmt::v7::basic_format_args<fmt::v7::basic_format_context<fmt::v7::appender, char> >)’未定义的引用
解决方法:
在CMakeList.txt 中链接fmt库(21行和24行)
cmake_minimum_required(VERSION 2.8)
project(ch8)
set(CMAKE_BUILD_TYPE "Release")
add_definitions("-DENABLE_SSE")
set(CMAKE_CXX_FLAGS "-std=c++11 ${SSE_FLAGS} -g -O3 -march=native")
find_package(OpenCV 3 REQUIRED)
find_package(Sophus REQUIRED)
find_package(Pangolin REQUIRED)
include_directories(
${OpenCV_INCLUDE_DIRS}
${G2O_INCLUDE_DIRS}
${Sophus_INCLUDE_DIRS}
"/usr/include/eigen3/"
${Pangolin_INCLUDE_DIRS}
)
add_executable(optical_flow optical_flow.cpp)
target_link_libraries(optical_flow ${OpenCV_LIBS} fmt)
add_executable(direct_method direct_method.cpp)
target_link_libraries(direct_method ${OpenCV_LIBS} ${Pangolin_LIBRARIES} fmt)
optical_flow.cpp
问题:
OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /home/haha/下载/opencv-3.3.1/modules/imgproc/src/resize.cpp, line 3289
terminate called after throwing an instance of 'cv::Exception'
what(): /home/haha/下载/opencv-3.3.1/modules/imgproc/src/resize.cpp:3289: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize
解决办法:
修改optical_flow.cpp文件(14行和15行)
将
string file_1 = "./LK1.png"; // first image
string file_2 = "./LK2.png"; // second image
修改为
string file_1 = "../LK1.png"; // first image
string file_2 = "../LK2.png"; // second image
direct_method.cpp
问题:
段错误 (核心已转储)
解决办法:
修改direct_method(15行、16行和17行)
将
string left_file = "./left.png";
string disparity_file = "./disparity.png";
boost::format fmt_others("./%06d.png"); // other files
修改为
string left_file = "../left.png";
string disparity_file = "../disparity.png";
boost::format fmt_others("../%06d.png"); // other files