- 本文涉及的主要内容
- Pangolin
- Sophus
- OpenCV
- Ceres-Solver
- g2o
- gtsam
- DBow3
- fmt
本文基于《视觉SLAM十四讲》内容,安装一些第三方库,主要有:Pangolin、Sophus、OpenCV、Ceres-Solver、g2o、DBoW3、gtsam、fmt等。
Pangolin# Get Pangolin, use latest stable branch recommended cd ~/your_fav_code_directory git clone --recursive https://github.com/stevenlovegrove/Pangolin.git -b v0.8 cd Pangolin # Dependencies # See what package manager and packages are recommended # ./scripts/install_prerequisites.sh --dry-run recommended # Override the package manager choice and install all packages # ./scripts/install_prerequisites.sh -m brew all # Install dependencies (as described above, or your preferred method) ./scripts/install_prerequisites.sh recommended # Configure and build cmake -B build cmake --build build # with Ninja for faster builds (sudo apt install ninja-build) cmake -B build -GNinja cmake --build build sudo make install # GIVEME THE PYTHON STUFF!!!! (Check the output to verify selected python version) # cmake --build build -t pypangolin_pip_install # Run me some tests! (Requires Catch2 which must be manually installed on Ubuntu.) # ctestSophus
# 获取源码 git clone https://github.com/strasdat/Sophus.git # 编译安装 cd Sophus cmake -B build cmake --build build cd build && sudo make installOpenCV
# get source code git clone https://github.com/opencv/opencv # build && install mkdir build && cd build cmake .. make sudo make install
遇到问题:
modules/python/src2/cv2.cpp:885:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] char* str = PyString_AsString(obj); modules/python3/CMakeFiles/opencv_python3.dir/build.make:62: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o' failed make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1 CMakeFiles/Makefile2:5446: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2 Makefile:162: recipe for target 'all' failed make: *** [all] Error 2
解决办法:
编辑报错文件:/your/path/of/opencv/modules/python/src2/cv2.cpp第885行
// before
bool pyopencv_to(PyObject* obj, String& value, const char* name)
{
(void)name;
if(!obj || obj == Py_None)
return true;
char* str = PyString_AsString(obj); // This is row 885.
if(!str)
return false;
value = String(str);
return true;
}
// after
bool pyopencv_to(PyObject* obj, String& value, const char* name)
{
(void)name;
if(!obj || obj == Py_None)
return true;
const char* str = PyString_AsString(obj);
if(!str)
return false;
value = String(str);
return true;
}
Ceres-Solver
# install dependences sudo apt install libgoogle-glog-dev libatlas-base-dev libeigen3-dev libsuitesparse-dev libsuitesparse-dev liblapack-dev libcxsparse3.1.2 libgflags-dev libgtest-dev # get source code git clone https://github.com/ceres-solver/ceres-solver.git # build && install cd ceres-solver cmake -B build cmake --build build cd build && sudo make installg2o
# install dependences sudo apt install libeigen3-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev # get source code git clone https://github.com/RainerKuemmerle/g2o.git # build & install cd g2o mkdir build cd build cmake .. make sudo make installgtsam
# get source code git clone https://bitbucket.org/gtborg/gtsam.git # install dependences sudo apt-get install libboost-all-dev libtbb-dev # build & install mkdir build cd build cmake .. make check (optional, runs unit tests) sudo make installDBow3
DBow3依赖OpenCV,因此需要注意需要先编译安装OpenCV,再编译DBow3。
# get source code git clone https://github.com/rmsalinas/DBow3 # build & install mkdir build cd build cmake .. make sudo make installfmt
# get source code git clone https://github.com/fmtlib/fmt.git # build & install mkdir build && cd build cmake -DBUILD_SHARED_LIBS=TRUE .. sudo make install



