Skip to content

General-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline using COLMAP

Notifications You must be signed in to change notification settings

Computational-Plant-Science/3D_colmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3D modeing pipeline using Colmap

Pipeline: Build 3D root models from images captured by 3D root scanner.

This repo was to reconstruct a 3D point cloud root model from images captured by our 3D root scanner or portable scanner in the field.

For example, images are captured by our 3D root scanner with 10 cameras mouting on a rotating arm.

3D root scanner prototype

Our upgraded portable scanner can capture around 240 images in 7 mins:

portable scanner

and build 3D point cloud models based on only these 240 images.

3D point cloud models

Installation

The easiest way to use this software is with Docker or Singularity. A public Docker image definition is available: computationalplantscience/3d_colmap

Docker

Pull an image or a repository from a registry

docker pull computationalplantscience/3d_colmap

Mount the current working directory "/opt/dev" and open an interactive shell:

docker run -it -v $(pwd):/opt/dev -w /opt/dev computationalplantscience/3d_colmap bash

This docker container was compiled based on nvidia/cuda:12.2.2-devel-ubuntu22.04, and supports GPU running under HPC Singularity environment.

This docker was tested on GPU node in Puma HPC. It will automatically detect the CPU and GPU nodes, if GPU was detected, it will use CUDA to speed up.

We needs a CUDA_ARCH_BIN flag to be set in order to compile the binaries with the correct CUDA architecture.

If this flag is not set correctly, the final use of the binaries would fail.

For example, Volta GPU (v100), NVIDIA V100 has Compute Capability as 7.0

or one A100 MIG slice, NVIDIA A100 has Compute Capability as 8.0

The Docker recipe file was created as "Dockerfile", and DockerHub (computationalplantscience/3d_colmap) was setup linked to this repo directly and in automatic trigger compile mode.

The Colmap pipeline was in bash file "colmap_pipeline.sh"

Singularity

Open a shell in your current working directory:

singularity shell docker://computationalplantscience/3d_colmap

Usage

Reconstructing a 3D point cloud

To reconstruct a point cloud from an image set, use colmap_pipeline.sh as such:

    ./colmap_pipeline.sh

A successful reconstruction will produce several files in the output directory:

  • sparse.ply: sparse point cloud model
  • dense.ply: dense point cloud model

Colmap configuration

There are several configurable values for colmap's patch matching step during dense reconstruction. Optimal values will vary by host machine.

  • --cache_size: cache size (in GB) to use during patch matching, defaults to 32
  • --window_step: patch window step size, defaults to 1
  • --window_radius: patch window radius, defaults to 5
  • --num_iterations: number of patch match iterations, defaults to 5
  • --num_samples: number of sampled views, defaults to 15
  • --geom_consistency: whether to perform geometric dense reconstruction, defaults to True

Visualizing a 3D point cloud

Currently this software does not support model visualization. PLY files can be visualized with e.g. Meshlab or cloudcompare.

Dependencies

This software is built on top of COLMAP, Recommended dependencies: CUDA (at least version 7.X).

COLMAP

https://colmap.github.io Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de) @inproceedings{schoenberger2016sfm, author={Sch"{o}nberger, Johannes Lutz and Frahm, Jan-Michael}, title={Structure-from-Motion Revisited}, booktitle={Conference on Computer Vision and Pattern Recognition (CVPR)}, year={2016}, }

@inproceedings{schoenberger2016mvs, author={Sch"{o}nberger, Johannes Lutz and Zheng, Enliang and Pollefeys, Marc and Frahm, Jan-Michael}, title={Pixelwise View Selection for Unstructured Multi-View Stereo}, booktitle={European Conference on Computer Vision (ECCV)}, year={2016}, }

OUR COLMAP ROOT PHENOTYPING PAPER

@article{Liu2023, author = {Liu, Suxing and Bonelli, Wesley Paul and Pietrzyk, Peter and Bucksch, Alexander}, title = {Comparison of open-source three-dimensional reconstruction pipelines for maize-root phenotyping}, journal = {The Plant Phenome Journal}, volume = {6}, number = {1}, pages = {e20068}, doi = {https://doi.org/10.1002/ppj2.20068}, year = {2023}, }

Author

Suxing Liu (suxingliu@gmail.com)

License

GNU Public License

Docker recipe

This docker recipe was developed based on COLMAP official documents

and COLMAP setup

and UA HPC GPUs

and NVIDIA Developer Program, GPU Compute Capability

Note:

This repo was to replace the old one "Computational-Plant-Science/3D_model_reconstruction_demo" which has compatible issue after HPC Puma upgraded to new OS sysytem.

About

General-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline using COLMAP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published