【三维重建】Ubuntu16.04安装Colmap+OpenMVS注意事项(踩坑记录)
作者:互联网
最近实验室在搞三维重建的项目,要在服务器上安装Colmap+OpenMVS环境,参考github、博客、官网给出较为完整的安装流程。
注意安装之前确保服务器上没有安装anaconda,否则在编译时会找anaconda的路径而报错。
先说一下各项依赖的版本:
1.colmap-3.5
2.ceres-slover 1.4.1
3.eigen3.3.7
4.cmake3.13
5.opencv-4.5.2
6.vcglib
7.openMVS
1.安装Colmap
按照官网安装http://colmap.github.io/install.html
1)相关依赖
#git 和 cmake单独安装,这里安装的cmake版本为3.5.1,版本较低会编译报错
sudo apt-get install \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libsuitesparse-dev \
libfreeimage-dev \
libgoogle-glog-dev \
libgflags-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev
2)qt5
sudo apt-get install libcgal-qt5-dev
3)Install Ceres Solver:
https://ceres-solver.googlesource.com/ceres-solver
sudo apt-get install libatlas-base-dev libsuitesparse-dev
# git clone https://ceres-solver.googlesource.com/ceres-solver
# 手动下载1.14版本,解压
cd ceres-solver
# git checkout $(git describe --tags) # Checkout the latest release
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make -j
sudo make install
4)编译Colmap
git clone https://github.com/colmap/colmap.git
cd colmap
# git checkout dev
mkdir build
cd build
cmake ..
make -j
sudo make install
2.安装OpenMVS
按照github教程安装
https://github.com/cdcseacave/openMVS/blob/master/BUILD.md
1)安装依赖
sudo apt-get update -qq && sudo apt-get install -qq
# 手动安装更高版本的cmake
sudo apt-get -y install libpng-dev libjpeg-dev libtiff-dev libglu1-mesa-dev
main_path=`pwd` # 具体路径
2)Eigen(Required)
git clone https://gitlab.com/libeigen/eigen.git --branch 3.3.7
mkdir eigen_build && cd eigen_build
cmake . ../eigen
make && sudo make install
cd ..
3)Boost (Required)
sudo apt-get -y install libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-serialization-dev
4)OpenCV(Required),注意使用高版本
# sudo apt-get -y install libopencv-dev
# 这里安装的opencv版本较低,为2.4.9,在编译OpenMVS时会报opencv相关的错误
# 可以查看issue:https://github.com/cdcseacave/openMVS/issues/614
报错信息cv::Matx_DivOp’ has not been declared
[ 3%] Building CXX object libs/Common/CMakeFiles/Common.dir/CUDA.cpp.o
In file included from /home/bjfu/software/openMVS/libs/Common/Common.h:176:0,
from /home/bjfu/software/openMVS/libs/Common/CUDA.cpp:8:
/home/bjfu/software/openMVS/libs/Common/Types.h:1488:70: error: ‘cv::Matx_DivOp’ has not been declared
TMatrix(const TMatrix<TYPE,m,n>& a, const TMatrix<TYPE,m,n>& b, cv::Matx_DivOp) : Base(a, b, cv::Matx_DivOp()) {}
^
/home/bjfu/software/openMVS/libs/Common/Types.h: In constructor ‘SEACAVE::TMatrix<TYPE, m, n>::TMatrix(const SEACAVE::TMatrix<TYPE, m, n>&, const SEACAVE::TMatrix<TYPE, m, n>&, int)’:
/home/bjfu/software/openMVS/libs/Common/Types.h:1488:95: error: ‘Matx_DivOp’ is not a member of ‘cv’
TMatrix(const TMatrix<TYPE,m,n>& a, const TMatrix<TYPE,m,n>& b, cv::Matx_DivOp) : Base(a, b, cv::Matx_DivOp()) {}
^
5)CGAL (Required)
# 这两个依赖前面已经加过了
sudo apt-get -y install libcgal-dev libcgal-qt5-dev
6)VCGLib (Required)
git clone https://github.com/cdcseacave/VCG.git vcglib
7)#Ceres (optional)
# 前面已经安装好了
8)GLFW3 (Optional)
sudo apt-get -y install freeglut3-dev libglew-dev libglfw3-dev
9)OpenMVS
git clone https://github.com/cdcseacave/openMVS.git openMVS
mkdir openMVS_build && cd openMVS_build
cmake . ../openMVS -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT="$main_path/vcglib"
#If you want to use OpenMVS as shared library, add to the CMake command:
-DBUILD_SHARED_LIBS=ON
#Install OpenMVS library (optional):
make -j2 && sudo make install
参考博客:
https://blog.csdn.net/X_kh_2001/article/details/83690094
https://segmentfault.com/a/1190000022276314
https://www.cnblogs.com/gtx159/p/10825877.html
标签:Ubuntu16.04,git,https,sudo,dev,install,Colmap,三维重建,openMVS 来源: https://blog.csdn.net/DJames23/article/details/117478361