Ubuntu16.04搭建和运行DSO

本文档详细介绍了如何在Ubuntu 16.04上搭建DSO(Direct Sparse Odometry)环境,包括安装依赖库如Eigen、SuiteSparse、OpenCV和Pangolin,解决编译过程中遇到的内存不足和链接问题,以及运行数据集时的错误处理。通过本教程,读者可以学习到DSO的配置和调试技巧。
摘要由CSDN通过智能技术生成

DSO的GitHub链接:https://github.com/JakobEngel/dso

本博客基于VMware搭建的Ubuntu16.04实现DSO


1. 克隆DSO

sudo apt install git
git clone https://github.com/JakobEngel/dso.git



2. 搭配环境

eigen3

sudo apt install libsuitesparse-dev libeigen3-dev libboost-all-dev

opencv

sudo apt install libopencv-dev

Pangolin

github:https://github.com/stevenlovegrove/Pangolin

  1. 克隆
git clone https://github.com/stevenlovegrove/Pangolin.git
  1. 安装Pangolin需要的依赖项:
tar -zxvf Pangolin.tar.gz
  1. 编译和安装Pangolin
cd [path-to-pangolin]
mkdir build
cd build
cmake ..
make
sudo make install

ziplib

sudo apt-get install zlib1g-dev
cd dso/thirdparty
tar -zxvf libzip-1.1.1.tar.gz
cd libzip-1.1.1/
./configure
make
sudo make install
sudo cp lib/zipconf.h /usr/local/include/zipconf.h   # (no idea why that is needed).



3. 编译DSO

	cd dso
	mkdir build
	cd build
	cmake ..
	make -j4



4. make可能出现的错误

错误一

virtual memory exhausted: 无法分配内存
CMakeFiles/dso.dir/build.make:62: recipe for target 'CMakeFiles/dso.dir/src/FullSystem/FullSystem.cpp.o' failed
make[2]: *** [CMakeFiles/dso.dir/src/FullSystem/FullSystem.cpp.o] Error 1
make[2]: *** 正在等待未完成的任务....
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/dso.dir/all' failed
make[1]: *** [CMakeFiles/dso.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

解决方法:
make -j4该低点 ,改成make -j2

错误二

[ 96%] Linking CXX executable bin/dso_dataset
/usr/bin/ld: CMakeFiles/dso_dataset.dir/src/main_dso_pangolin.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/dso_dataset.dir/build.make:129: recipe for target 'bin/dso_dataset' failed
make[2]: *** [bin/dso_dataset] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dso_dataset.dir/all' failed
make[1]: *** [CMakeFiles/dso_dataset.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

解决方法:
参考博客:https://blog.csdn.net/qq_17232031/article/details/79540286
修改CMakeLists.txt有关于Thread,首先在CMakeLists.txt中添加一条:

FIND_PACKAGE(Threads QUIET)

然后将:

if (OpenCV_FOUND AND Pangolin_FOUND)
  	message("--- compiling dso_dataset.")
  	add_executable(dso_dataset ${PROJECT_SOURCE_DIR}/src/main_dso_pangolin.cpp )
   target_link_libraries(dso_dataset dso boost_system boost_thread cxsparse ${LIBZIP_LIBRARY} ${Pangolin_LIBRARIES} ${OpenCV_LIBS} )
else()
  	message("--- not building dso_dataset, since either don't have openCV or Pangolin.")
endif()

改为:

if (OpenCV_FOUND AND Pangolin_FOUND)
  	message("--- compiling dso_dataset.")
  	add_executable(dso_dataset ${PROJECT_SOURCE_DIR}/src/main_dso_pangolin.cpp )
    target_link_libraries(dso_dataset dso boost_system boost_thread cxsparse ${LIBZIP_LIBRARY} ${Pangolin_LIBRARIES} ${OpenCV_LIBS} ${CMAKE_THREAD_LIBS_INIT})
else()
  	message("--- not building dso_dataset, since either don't have openCV or Pangolin.")
endif()

然后重新编译:

cmake ..
make -j2



5. 运行数据集

数据来源:https://vision.in.tum.de/data/datasets/mono-dataset?redirect=1

输入以下内容;但是导致了报错
在这里插入图片描述
原因:没有解压


所以我们先加压一下;解压suquence_14和里面的images,并删除压缩文件
输入:

./dso_dataset files=./sequence_14/images calib=./sequence_14/camera.txt gamma=./sequence_14/pcalib.txt vignette=./sequence_14/vignette.png preset=0 mode=0

又报了以下错误:
在这里插入图片描述
原因:Pangolin没有装好;重新安装Pangolin;参考https://blog.csdn.net/qq_39236499/article/details/122722038里面的Pangolin报错解决方法,两个是一模一样的错误

再次输入上面指令!成功!!!
在这里插入图片描述

参考博客

https://blog.csdn.net/qq_17232031/article/details/79540286
https://blog.csdn.net/qq_37568167/article/details/106384458
https://blog.csdn.net/qq_39236499/article/details/109010081
https://blog.csdn.net/weixin_40941966/article/details/107408299

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zdb呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值