手机版
你好,游客 登录 注册
背景:
阅读新闻

编译安装DSO并在线运行摄像头

[日期:2019-03-02] 来源:Linux社区  作者:TangCode [字体: ]

操作系统:Ubuntu 16.04

数据集: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

此时需要电脑中安装了ROS,安装步骤可以参考:https://www.linuxidc.com/Linux/2019-03/157199.htm 

将下载的文件放置在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

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2019-03/157204.htm

linux
相关资讯       编译安装DSO 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款