[3D Reconstruction] Installing COLMAP on Ubuntu 18.04

Ubuntu18.04 install COLMAP


Preface

COLMAP is a general-purpose structure from motion (SfM) and multi-view stereo (MVS) pipeline with graphical and command line interfaces. It provides a wide range of functions for the reconstruction of ordered and unordered image collections. Common nerf-based algorithms require colmap to calculate pose. Source code is available on GitHub .


Install COLMAP:

Bloggers refer to the official tutorial for configuration.

There is a very annoying bug here, because there may be a path conflict, so you need to temporarily change the file name of anaconda3/anaconda3 to something else, such as anaconda31, etc., so that the system cannot find the path and prevent path conflicts during the compilation process! ! ! ! ! ! ! ! ! ! ! !

Complete the COLMAP installation and restore the file name.

Install CUDA, cuDNN

You can refer to the blogger's blog post [ detailed tutorial on ubuntu18.04 deep learning environment configuration ]
CUDA installation is completed

nvcc -V


cuDNN installation completed

cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

Install dependencies

sudo apt-get install \
    git \
    cmake \
    ninja-build \
    build-essential \
    libboost-program-options-dev \
    libboost-filesystem-dev \
    libboost-graph-dev \
    libboost-system-dev \
    libeigen3-dev \
    libflann-dev \
    libfreeimage-dev \
    libmetis-dev \
    libgoogle-glog-dev \
    libgtest-dev \
    libsqlite3-dev \
    libglew-dev \
    qtbase5-dev \
    libqt5opengl5-dev \
    libcgal-dev \
    libceres-dev


Under Ubuntu18.04, CGAL's CMake configuration script is damaged, and the CGAL Qt5 package must also be installed:

sudo apt-get install libcgal-qt5-dev

Install Ceres optimization library

可能需要安装的依赖
sudo apt-get install libatlas-base-dev libsuitesparse-dev

It is recommended to create a colmap directory and put the Ceres library location and the subsequent COLMAP library location together.

git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make -j24
sudo make install


Problems that may arise:

/usr/include/glog/logging.h:638:9: error: ambiguous overload for ?operator<<? (operand types are ?std::ostream {
    
    aka std::basic_ostream<char>}? and ?std::nullptr_t?)


Liberation method: Because the downloaded glog version is too old and ceres-solver cannot be installed normally, you can try to use a newer glog version.

Install glog (optional)

# 首先先卸载原始的glog
sudo apt-get remove libgoogle-glog-dev

Download glog-0.6.0 version from the official website

# 解压
tar -zxvf glog-0.6.0.tar.gz
cd glog-0.6.0
mkdir build
cd build
cmake ..
make -j 24
sudo make install

Configure and compile COLMAP

# 与Ceres库在同一目录
git clone https://github.com/colmap/colmap.git
cd colmap
mkdir build
cd build
cmake ..
make -j24
sudo make install


Possible problems during the cmake process:

Modify the contents of CMakeLists.txt in the colmap/ file:

set(CMAKE_CUDA_ARCHITECTURES "70")

Run COLMAP

colmap -h
colmap gui


Summarize

This is a detailed tutorial on Ubuntu 18.04 environment configuration COLMAP as simple and detailed as possible.

Guess you like

Origin blog.csdn.net/yangyu0515/article/details/132803408