Skip to content

Instantly share code, notes, and snippets.

@ducha-aiki
Created January 29, 2019 14:09
Show Gist options
  • Save ducha-aiki/2c29cdfd47fa4fe65f1ca083d8f09ef2 to your computer and use it in GitHub Desktop.
Save ducha-aiki/2c29cdfd47fa4fe65f1ca083d8f09ef2 to your computer and use it in GitHub Desktop.
Install ORBSLAM + python bindings
#!/bin/bash
DIR1=$(pwd)
MAINDIR=$(pwd)/3rdparty
mkdir ${MAINDIR}
cd ${MAINDIR}
conda create -y -n "NavAgents" python=3.6
source activate NavAgents
conda install opencv -y
conda install pytorch torchvision -c pytorch -y
conda install -c conda-forge imageio -y
conda install ffmpeg -c conda-forge -y
cd ${MAINDIR}
mkdir eigen3
cd eigen3
wget http://bitbucket.org/eigen/eigen/get/3.3.5.tar.gz
tar -xzf 3.3.5.tar.gz
cd eigen-eigen-b3f3d4950030
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${MAINDIR}/eigen3_installed/
make install
cd ${MAINDIR}
wget https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.zip
unzip glew-2.1.0.zip
cd glew-2.1.0/
cd build
cmake ./cmake -DCMAKE_INSTALL_PREFIX=${MAINDIR}/glew_installed
make -j4
make install
cd ${MAINDIR}
pip install numpy --upgrade
rm Pangolin -rf
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=${MAINDIR}/glew_installed/ -DCMAKE_LIBRARY_PATH=${MAINDIR}/glew_installed/lib/ -DCMAKE_INSTALL_PREFIX=${MAINDIR}/pangolin_installed
cmake --build .
cd ${MAINDIR}
rm ORB_SLAM2 -rf
rm ORB_SLAM2-PythonBindings -rf
git clone https://github.com/ducha-aiki/ORB_SLAM2
git clone https://github.com/ducha-aiki/ORB_SLAM2-PythonBindings
cd ${MAINDIR}/ORB_SLAM2
sed -i "s,cmake .. -DCMAKE_BUILD_TYPE=Release,cmake .. -DCMAKE_BUILD_TYPE=Release -DEIGEN3_INCLUDE_DIR=${MAINDIR}/eigen3_installed/include/eigen3/ -DCMAKE_INSTALL_PREFIX=${MAINDIR}/ORBSLAM2_installed ,g" build.sh
ln -s ${MAINDIR}/eigen3_installed/include/eigen3/Eigen ${MAINDIR}/ORB_SLAM2/Thirdparty/g2o/g2o/core/Eigen
./build.sh
cd build
make install
cd ${MAINDIR}
cd ORB_SLAM2-PythonBindings/src
ln -s ${MAINDIR}/eigen3_installed/include/eigen3/Eigen Eigen
cd ${MAINDIR}/ORB_SLAM2-PythonBindings
mkdir build
cd build
CONDA_DIR=$(dirname $(dirname $(which conda)))
sed -i "s,lib/python3.5/dist-packages,${CONDA_DIR}/envs/NavAgents/lib/python3.6/site-packages/,g" ../CMakeLists.txt
cmake .. -DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")/libpython3.6m.so -DPYTHON_EXECUTABLE:FILEPATH=`which python` -DCMAKE_LIBRARY_PATH=${MAINDIR}/ORBSLAM2_installed/lib -DCMAKE_INCLUDE_PATH=${MAINDIR}/ORBSLAM2_installed/include;${MAINDIR}/eigen3_installed/include/eigen3 -DCMAKE_INSTALL_PREFIX=${MAINDIR}/pyorbslam2_installed
make
make install
cp ${MAINDIR}/ORB_SLAM2/Vocabulary/ORBvoc.txt ${DIR1}/data/
@ducha-aiki
Copy link
Author

ducha-aiki commented Jul 29, 2019

Hi,
Looks like that you have another OpenCV version installed and it links to one version, but at runtime uses another.

@jxzzhang
Copy link

Hi when I am running the script, I get the following error
''
....
CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1626 (message):
No header defined for python-py35; skipping header check
Call Stack (most recent call first):
CMakeLists.txt:33 (find_package)

CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
Unable to find the requested Boost libraries.

Boost version: 1.65.1

Boost include path: /usr/include

Could not find the following Boost libraries:

      boost_python-py35

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:33 (find_package)

-- Found OpenCV: /home/xxxx/anaconda3/envs/NavAgents (found version "3.4.2")
-- Found ORB_SLAM2: /media/xxxx/xxxx/xxxx/Orb_slam/3rdparty/ORBSLAM2_installed/lib/libORB_SLAM2.so
-- Configuring incomplete, errors occurred!
See also "/media/xxxx/xxxx/xxxx/Orb_slam/3rdparty/ORB_SLAM2-PythonBindings/build/CMakeFiles/CMakeOutput.log".
./install_orbslam_stuff.sh: line 59: /media/xxxx/xxxx/xxxx/Orb_slam/3rdparty/eigen3_installed/include/eigen3: Is a directory
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target 'install'. Stop.
cp: cannot create regular file '/media/xxxx/xxxx/xxxx/Orb_slam/data/': Not a directory
....
''

could you please help me to solve this? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment