前言:
安装openMVS和colmap顺序不一样,会导致出现各种问题。这里建议先安装openMVS,再安装colmap,最后安装openMVG。
安装步骤参考了官网的dockerfile文件,需要自己预先安装cuda,可以度娘cuda的安装步骤。
一、openMVS安装过程
sudo apt-get -y install git mercurial cmake libpng-dev libjpeg-dev libtiff-dev libglu1-mesa-dev
git clone https://gitlab.com/libeigen/eigen --branch 3.4
安装eigen(一定要手动安装,自动安装的版本会低于3.4)
mkdir eigen_build
cd eigen_build &&\
cmake . ../eigen -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ &&\
make && sudo make install &&\
cd ..
安装Boost
sudo apt-get -y install libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-serialization-dev
安装OpenCV
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq libopencv-dev
安装CGAL
sudo apt-get -y install libcgal-dev libcgal-qt5-dev
安装VCGLib
git clone -b v1.0.1 https://github.com/cdcseacave/VCG.git vcglib
下载openMVS
git clone -b v1.1.1 https://github.com/cdcseacave/openMVS.git
编译
mkdir openMVS_build
注意了这里的cuda版本,需要改成自己的
cd openMVS_build &&\
cmake . ../openMVS -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT=../vcglib -DOpenMVS_USE_CUDA=ON -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs/ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.6.0/ -DCUDA_INCLUDE_DIRS=/usr/local/cuda-11.6.0/include/ -DCUDA_CUDART_LIBRARY=/usr/local/cuda-11.6.0lib64 -DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-11.6.0/bin/
安装
make -j4 &&\
sudo make install
二、colmap安装过程
sudo apt-get install -y \
git \
cmake \
vim \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-regex-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 \
libcgal-qt5-dev
Build and install ceres solver
sudo apt-get -y install \
libatlas-base-dev \
libsuitesparse-dev
git clone https://ghproxy.com/https://github.com/ceres-solver/ceres-solver.git --branch 1.14.0
cd ceres-solver && \
mkdir build && \
cd build && \
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF && \
make -j4 && \
sudo make install
下载colmap
git clone -b 3.6 https://ghproxy.com/https://github.com/colmap/colmap.git #--branch 3.6-dev.3
如果编译出现代码报错,可以更换其colmap的其它版本
cd colmap && \
#git checkout dev && \
mkdir build && \
cd build && \
cmake .. && \
make -j4 && \
sudo make install
三、安装openMVG
安装依赖
由于ubuntu20的资源库缺少python-minimal和liblemon-dev,我将python-minimal换成python2-minimal,而liblemon-dev采用手动安装。
apt-get install -y \
cmake \
build-essential \
graphviz \
git \
coinor-libclp-dev \
libceres-dev \
libflann-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
python2-minimal; \
apt-get autoclean && apt-get clean
安装liblemon-dev
打开lemon库网站,将lemon下载下来,我这里直接给出下载地址:http://security.ubuntu.com/ubuntu/pool/universe/s/sqlite3/lemon_3.31.1-4ubuntu0.5_amd64.deb
然后使用下面命令进行安装:
sudo dpkg -i lemon_3.31.1-4ubuntu0.5_amd64.deb
下载openMVG
git clone --recursive https://github.com/openMVG/openMVG.git
编译
mkdir openMVG_Build; \
cd openMVG_Build;
cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DOpenMVG_BUILD_TESTS=ON \
-DOpenMVG_BUILD_EXAMPLES=OFF \
../openMVG/src; \
make -j 4;
安装
make test && sudo make install;
ps:如果安装过程中出现各种乱七八糟的问题,可以使用docker进行安装,确认好安装步骤后再迁移本地。