设为首页 加入收藏

TOP

编译安装DSO并在线运行摄像头
2019-03-02 20:08:05 】 浏览:196
Tags:编译 安装 DSO 在线 运行 摄像头

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


摄像头:笔记本摄像头


1. 当然,先下载源码:
$ git clone https://github.com/JakobEngel/dso.git


2. 安装相应的依赖项
$ sudo apt-get install libsuitesparse-dev libeigen3-dev libboost-all-dev


最好将ziplib装上(下载的源码里有安装包),因为在运行数据集的时候,可以直接读取.zip文件。在libzip解压文件下,敲下面几行命令:
$ ./configure
$ make
$ sudo make install
$ sudo cp lib/zipconf.h /usr/local/include/zipconf.h 


3. 安装DSO,在dso文件下输入:
$ mkdir build
$ cd build
$ cmake ..
$ make -j
此时,有可能会报如下的错误
/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:139: 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


解决方案: 修改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 -j


4. 启动数据集,在安装了OpenCV和Pangolin的前提下,在命令行输入:
 $ ~/dso/build/bin/dso_dataset \
files=PATH/sequence_14/images.zip \
calib=PATH/sequence_14/camera.txt \
gamma=PATH/sequence_14/pcalib.txt \
vignette=PATH/sequence_14/vignette.png \
preset=0 \
mode=0


其中,PATH为自己放置sequence_14数据集的路径,运行的结果如下:



5.下面在线跑自己的摄像头,我们需要dso_ros (catkin版本),下载地址:https://github.com/JakobEngel/dso_ros/tree/catkin


将下载的文件放置在catkin_ws/src目录下,执行:
$ cd ~/catkin_ws
$ catkin_make
$ cd ./src/dso_ros
$ export DSO_PATH=PATH/dso
$ rosmake


一样的,PATH为自己安装dso的路径,注意是dso路径,不是dso_ros路径!!!


6. 在第一个终端中执行:
$ roscore


第二个终端,在usb_cam/lauch路径下执行:
roslaunch usb_cam usb_cam-test.launch


第三个终端就要执行runros操作了:
rosrun dso_ros dso_live image:=/usb_cam/image_raw calib=PATH/camera.txt mode=1


其中,PATH为自己的相机标定文件的路径。


不出意外,就能在线运行自己的摄像头了。



参考:https://github.com/JakobEngel/dso


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇ROS Kinetic下编译安装ORB_SLAM2 下一篇编译第一个ROS程序 - Hello ROS

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目