安装colmap
依赖项
sudo apt-get install \
git \
cmake \
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 \
针对ubuntu18.04版本,需要安装CGAL Qt5
sudo apt-get install libcgal-qt5-dev
安装ceres-solver
sudo apt-get install libatlas-base-dev libsuitesparse-dev
git clone https://github.com/ceres-solver/ceres-solver # 克隆源码到本地当前目录下,注意自己切换
cd ceres-solver # 进入文件夹
git checkout $(git describe --tags) # Checkout the latest release
mkdir build # 创建build文件夹
cd build # 进入build文件夹
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF # 编译
make
sudo make install # 安装
安装colmap
git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
cmake ..
make
sudo make install
使用colmap进行重建
# The project folder must contain a folder "images" with all the images.
$ DATASET_PATH=/path/to/dataset
$ colmap feature_extractor \ # 特征提取
--database_path $DATASET_PATH/database.db \
--image_path $DATASET_PATH/images \
--SiftExtraction.gpu_index=0 #GPU加速,可选,下同
$ colmap exhaustive_matcher \ # 特征点匹配
--database_path $DATASET_PATH/database.db \
--SiftMatching.gpu_index=0
$ mkdir $DATASET_PATH/sparse # 创建稀疏图文件夹
$ colmap mapper \ # 建稀疏图,不需要GPU加速
--database_path $DATASET_PATH/database.db \
--image_path $DATASET_PATH/images \
--output_path $DATASET_PATH/sparse
$ mkdir $DATASET_PATH/dense # 创建稠密图文件夹
$ colmap image_undistorter \ # 图形去畸变
--image_path $DATASET_PATH/images \
--input_path $DATASET_PATH/sparse/0 \
--output_path $DATASET_PATH/dense \
--output_type COLMAP \
--max_image_size 2000
$ colmap patch_match_stereo \ # 为稠密图再匹配(必需GPU)
--workspace_path $DATASET_PATH/dense \
--workspace_format COLMAP \
--PatchMatchStereo.geom_consistency true \
--PatchMatchStereo.gpu_index=0
$ colmap stereo_fusion \ # 开始建图
--workspace_path $DATASET_PATH/dense \
--workspace_format COLMAP \
--input_type geometric \
--output_path $DATASET_PATH/dense/fused.ply
$ colmap poisson_mesher \ # 使用poisson方法建网格添加纹理
--input_path $DATASET_PATH/dense/fused.ply \
--output_path $DATASET_PATH/dense/meshed-poisson.ply
$ colmap delaunay_mesher \ # 使用delaunay方法建网格添加纹理
--input_path $DATASET_PATH/dense \
--output_path $DATASET_PATH/dense/meshed-delaunay.ply
可使用稀疏图查看点云