Contents
はじめに
皆様、ご無沙汰しています。いかがお過ごしでしょうか?今日は完全なcomputer visionネタです。velomobileと無関係で失礼します。
computer visionの究極の目的のうちの一つに時空の再現があります。どういうことかというと、写真をとる、ビデオをとる、のさらに先に、各時刻での3次元世界の復元である4d reconstruction(時間と3次元空間の4次元の再構成)です。今日はその為のパーツとして考えられる静的な3次元空間の復元の1手法のやり方についてメモしておきます。
できること
点群表現で3次元環境を作成できます。結果のビデオが上記です。
環境
OS: Ubuntu 18.04
Python: version 2.7 (anaconda environment)
ROS: melodic
インストールと実行
github page: https://github.com/raulmur/ORB_SLAM2
しかし、このページ通りにやってもうまく行かないので、その場合の対処方法を下記にまとめておきます。 えーっと、ここから英語で行きます。えー!!
- Install prerequisites : follow the project page
- Build orb_slam2: follow the project page
- * If you encounter the error “error: ‘usleep’ was not declared in this scope”,
#include <unistd.h>
to include/System.h.
- * If you encounter the error “error: ‘usleep’ was not declared in this scope”,
- Run example: follow the project page
- run mono example
e.g.$ ./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/masahiro/data/tum/rgbd_dataset_freiburg1_desk
- run rgbd example
e.g.$ ./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/masahiro/data/tum/rgbd_dataset_freiburg1_desk Examples/RGB-D/associations/fr1_desk.txt
- run mono example
- Build ROS node
$ source /opt/ros/melodic/setup.bash
- e.g.
$ export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/masahiro/proj/study/computervision/slam/ORB_SLAM2/Examples/ROS
$ ./build_ros.sh
- * If you encounter the below error,
“/usr/bin/ld: CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: undefined reference to symbol ‘_ZN5boost6system15system_categoryEv'”
add these into ORB_SLAM2/Examples/ROS/ORB_SLAM2/CMakeLists.txt (l.43,87,96)
find_package(Boost COMPONENTS system filesystem REQUIRED)
target_link_libraries(Stereo
${LIBS} ${Boost_SYSTEM_LIBRARY}
)
target_link_libraries(RGBD
${LIBS} ${Boost_SYSTEM_LIBRARY}
) - *If you encounter “ImportError: No module named rosdep”, create conda environment for python 2.7, and install rosdep.
$ conda create -n py27 python=2.7
$ conda activate py27
$ conda install -c conda-forge rosdep - * if you encounter the error; “ImportError: No module named roslib.manifest”, run below command.
$ export PYTHONPATH=${PYTHONPATH}:/usr/lib/python2.7/dist-packages
- *If you encounter “[rospack] Error: the rosdep view is empty: call ‘sudo rosdep init’ and ‘rosdep update'”, run
$ sudo rosdep init
$ rosdep update
- * If you encounter the below error,
- Running ROS Monocular Node
$ roscore
$ rosrun uvc_camera uvc_camera_node
- * If you encounter problem, $sudo apt install ros-melodic-uvc-camera
$ rosrun image_transport republish raw in:=/image_raw raw out:=/camera/image_raw
$ rosrun ORB_SLAM2 Mono Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml
- If you encounter realsense old version issue, rebuild pangolin.
- Congratulations! Now you must be able to see the “Map Viewer” and “Current Frame” window. Move your usb camera and create map. Enjoy!
Please follow and like us: