COLMAP3.8在Ubuntu18.04 下的配置
因想在Ubuntu下配置COLMAP并使用CUDA编译踩坑了一天,遂记录下正确方式。
主要参考官网指引:https://colmap.github.io/install.html#linux
- 安装依赖库
这里安装可能不成功,需要逐个满足依赖。
sudo apt-get install \
git \
cmake \
ninja-build \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgflags-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libceres-dev
- 安装glags库
- 拉取源码:
git clone https://github.com/gflags/gflags
- 编译安装:
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DINSTALL_HEADERS=ON -DINSTALL_SHARED_LIBS=ON -DINSTALL_STATIC_LIBS=ON ..
make -j24 // 我是12核的cpu,加速编译
make install
- 安装Ceres Solver
git clone https://github.com/ceres-solver/ceres-solver
mkdir build
cd build
cmake ..
make -j24 //可用nproc这个命令查看cpu核心数,我的cpu核心数是8
sudo make install
- 更改anaconda3名字,安装完COLMAP后改回来
mv anaconda3 axx
- 编译COLMAP
我的错误出现在cmake那步,因为官网编译方式不同,我本地定位不到cuda,同时注意到官网写了Or, manually install latest CUDA from NVIDIA’s homepage. During CMake configuration specify CMAKE_CUDA_ARCHITECTURES as “native”, if you want to run COLMAP on your current machine only, “all”/”all-major” to be able to distribute to other machines, or a specific CUDA architecture like “75”, etc.
所以在Ubuntu 18.04下编译需要加参数
git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
sudo cmake .. -D CMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" ../CMakeLists.txt -D CMAKE_CUDA_ARCHITECTURES='native'
cd ../
make
sudo make install
- 启动COLMAP
至此安装完了,测试一下:
colmap -h
colmap gui