orb_slam_2_ros
orb_slam_2_ros copied to clipboard
how to build from source on aarch64, opencv 4.* - FAQ
i do not pretend to full wiki but i built it successfully after several attempts. here what i fixed.
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2 && cd ORB_SLAM2
- changes
sed -i 's/++11/++14/g' CMakeLists.txt
nano CMakeLists.txt
find_package(OpenCV 4.0 QUIET)
...
find_package(Eigen3 NO_MODULE)
find_package(Pangolin REQUIRED)
1.1.DBow nano Thirdparty/DBoW2/CMakeLists.txt find_package(OpenCV 4.0 QUIET)
2.Pangolin
cd ~
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
git checkout eab3d3449a33a042b1ee7225e1b8b593b1b21e3e
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_EXAMPLES=OFF -DBUILD_PANGOLIN_DEPTHSENSE=OFF -DBUILD_PANGOLIN_FFMPEG=OFF -DBUILD_PANGOLIN_LIBDC1394=OFF -DBUILD_PANGOLIN_LIBJPEG=OFF -DBUILD_PANGOLIN_LIBOPENEXR=OFF -DBUILD_PANGOLIN_LIBPNG=OFF -DBUILD_PANGOLIN_LIBTIFF=OFF -DBUILD_PANGOLIN_LIBUVC=OFF -DBUILD_PANGOLIN_LZ4=OFF -DBUILD_PANGOLIN_OPENNI=OFF -DBUILD_PANGOLIN_OPENNI2=OFF -DBUILD_PANGOLIN_PLEORA=OFF -DBUILD_PANGOLIN_PYTHON=OFF -DBUILD_PANGOLIN_TELICAM=OFF -DBUILD_PANGOLIN_UVC_MEDIAFOUNDATION=OFF -DBUILD_PANGOLIN_V4L=OFF -DBUILD_PANGOLIN_ZSTD=OFF ..
make -j4 && sudo make install
3.changes
nano /home/rock/ORB_SLAM2/include/ORBextractor.h
//#include <opencv/cv.h>
#include <opencv2/opencv.hpp>
-
add
#include <unistd.h>
to files: /ORB_SLAM2/src/LoopClosing.cc /ORB_SLAM2/src/System.cc /ORB_SLAM2/src/Tracking.cc /ORB_SLAM2/src/LocalMapping.cc /ORB_SLAM2/src/Viewer.cc -
add
#include <opencv2/opencv.hpp>
to /ORB_SLAM2/src/FrameDrawer.cc -
add
#include <opencv2/imgproc/types_c.h>
#include <opencv2/opencv.hpp>
using namespace cv;
to: /ORB_SLAM2/include/System.h /ORB_SLAM2/include/PnPsolver.h
-
fix ORB_SLAM2/include/LoopClosing.h : before:
Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
after:Eigen::aligned_allocator<std::pair<KeyFrame* const, g2o::Sim3> > > KeyFrameAndPose;
-
add
#include <unistd.h>
#include <opencv2/imgproc/types_c.h>
#include <opencv2/opencv.hpp>
using namespace cv;
and change CV_LOAD_IMAGE_UNCHANGED
to IMREAD_UNCHANGED
(should looks like - imRGB = cv::imread(string(argv[3])+"/"+vstrImageFilenamesRGB[ni],IMREAD_UNCHANGED);
in files: nano /home/rock/ORB_SLAM2/Examples/RGB-D/rgbd_tum.cc /ORB_SLAM2/Examples/Stereo/stereo_kitti.cc /ORB_SLAM2/Examples/Stereo/stereo_kitti.cc /ORB_SLAM2/Examples/Stereo/stereo_euroc.cc /ORB_SLAM2/Examples/Monocular/mono_tum.cc /ORB_SLAM2/Examples/Monocular/mono_kitti.cc /ORB_SLAM2/Examples/Monocular/mono_euroc.cc