#!/bin/sh
# openmvs_pipeline.sh
# 2025-10-27
# by Gernot Walzl
# This script runs the OpenMVS pipeline with a spares point cloud
# generated by COLMAP. The output is a textured mesh.
# Based on: https://github.com/cdcseacave/openMVS/wiki/Usage
export PATH="/usr/bin/OpenMVS:$PATH"
PROJECT=$1
cd "$PROJECT" || exit 1
# https://colmap.github.io/cli.html#example
colmap image_undistorter \
--image_path images \
--input_path sparse/0 \
--output_path dense \
--output_type COLMAP
InterfaceCOLMAP -i dense -o scene.mvs --image-folder dense/images
DensifyPointCloud scene.mvs
ReconstructMesh scene_dense.mvs -p scene_dense.ply
RefineMesh scene_dense.mvs -m scene_dense_mesh.ply
TextureMesh scene_dense.mvs -m scene_dense_refine.ply --empty-color 16777215 # = 0xFFFFFF