Concepts
Software
MVE
The Good One
Multi-View Reconstruction Environment
-
Simon’s web site with excellent related research papers.
Features Structue-from-Motion (SfM) algorithm, Multi-View Stereo implementation, export tools, surface reconstruction tools. C++ "…suitable for reconstruction amateurs."
Wow! Thank goodness someone knows how to write technical software! This package is excellent. No stupid CMake or dependency dipshittery. This software just does the math like a competent pro. Nice. Doesn’t seem to use the GPU. Good! I’m tired of Nvidia’s nonsense.
The User’s Guide is sensible and complete.
You may need this if you want to run the GUI.
apt install qt5-default
I found the GUI helpful to have a quick look at the results but I think it would be not hard to skip using the GUI at all. This approach is totally scriptable.
Here’s the workflow - seems quite sensible and can be easily wrapped up into a script.
$ S=/tmp/MySceneDirectory
$ makescene/makescene -i <image-dir> $S # Prepare a "scene" from an image set
$ sfmrecon/sfmrecon $S # Structure From Motion Reconstruction
$ dmrecon/dmrecon -s2 $S # Multi-View Stereo computes Depth-Map Reconstruction
$ scene2pset/scene2pset -F2 $S $S/pset-L2.ply # Scene's point cloud union converted to point cloud
$ fssrecon/fssrecon $S/pset-L2.ply $S/surface-L2.ply # Floating Scale Surface Reconstruction
$ meshclean/meshclean -t10 $S/surface-L2.ply $S/surface-L2-clean.ply # Cull doubles, strays, etc.
We are advised to try out other off-piste components like Poisson Surface Mesh Reconstruction, pictures here.
Here’s a full script.
#!/bin/bash # Scene directory. S=/tmp/photo3d/ # Supplied directory where images are. Default could be a symlink. IMGIN=${1:-${S}current} # Timestamp. Because this may take a few attempts. TS=$(date +%Y%m%d-%H%M%S) # Basename to call this scene. NAME=$(basename ${IMGIN})-scene-${TS} S=${S}${NAME} MVEPATH=/home/xed/src/mve/ MVEAP=${MVEPATH}apps # Prepare a "scene" from an image set echo "-----------------------------------" date +%Y%m%d-%H%M%S >> $S/log echo ${MVEAP}/makescene/makescene -i $IMGIN $S >> $S/log ${MVEAP}/makescene/makescene -i $IMGIN $S # Structure From Motion Reconstruction echo "-----------------------------------" date +%Y%m%d-%H%M%S >> $S/log echo ${MVEAP}/sfmrecon/sfmrecon $S >> $S/log ${MVEAP}/sfmrecon/sfmrecon $S # Multi-View Stereo computes Depth-Map Reconstruction echo "-----------------------------------" date +%Y%m%d-%H%M%S >> $S/log echo ${MVEAP}/dmrecon/dmrecon -s2 $S >> $S/log ${MVEAP}/dmrecon/dmrecon -s2 $S # Scene's point cloud union converted to point cloud date +%Y%m%d-%H%M%S >> $S/log echo ${MVEAP}/scene2pset/scene2pset -F2 $S $S/pset-L2.ply >> $S/log ${MVEAP}/scene2pset/scene2pset -F2 $S $S/pset-L2.ply # Floating Scale Surface Reconstruction echo "-----------------------------------" date +%Y%m%d-%H%M%S >> $S/log echo ${MVEAP}/fssrecon/fssrecon $S/pset-L2.ply $S/surface-L2.ply >> $S/log ${MVEAP}/fssrecon/fssrecon $S/pset-L2.ply $S/surface-L2.ply # Cull doubles, strays, etc. echo "-----------------------------------" date +%Y%m%d-%H%M%S >> $S/log echo ${MVEAP}/meshclean/meshclean -t10 $S/surface-L2.ply $S/surface-L2-clean.ply >> $S/log ${MVEAP}/meshclean/meshclean -t10 $S/surface-L2.ply $S/surface-L2-clean.ply echo "Try viewing with:" echo "meshlab $S/surface-L2-clean.ply"
Bundler
This may be useful as an alternate component to replace MVE’s
sfmrecon
if a different approach is needed. Although now that I look
at that source code of mve’s sfmrecon, it uses the name "bundler" a
lot. So maybe this is already being done, or maybe it’s just very
compatible or similar.
Might need some Nearest Neighbor magic.
apt install libann-dev
If you have the Ceres library, go ahead and enable it in
src/Makefile
.
USE_CERES=true
Other than that it is properly organized, with only relevant easy-to-install technical dependencies.
The library it complains about, libann_char
is built and put in it’s
own ./lib
directory. You might need to run with something like this.
LD_LIBRARY_PATH=./lib ./bin/bundler
OpenMVG
openMVG - No installation instructions, but none needed - compiled without drama!
git clone https://github.com/openMVG/openMVG
cd openMVG/src
mkdir build && cd build
git submodule update -i
cmake ..
make
python SfM_SequentialPipeline.py ~/data/photogrammetry/ImageDataset_SceauxCastle/images/ /tmp/mvgresults
apt install meshlab
meshlab /tmp/mvgresults/reconstruction_sequential/cloud_and_poses.ply
Then export to obj and import that cloud file into Blender.
This all worked great but it stops short of trying to put together a
mesh from the vertices. So you’ll have to fill in the edges yourself
or use the data to support some direct geometry creation by hand or
with other software. It turns out that MVE can import data from
OpenMVG using MVE’s makescene
program.
Meshroom
Meshroom - A very slick looking piece of software that has some problems. Like compiling against Nvidia drivers that can’t possibly be present in a normal Debian system. Like not telling you that’s a problem until halfway through. Like telling you your card is not sufficient for the job when your card clearly is. Like telling you this 30min into the job. Like the fact that compiling from source leaves you missing mystery dependencies that the internet has not heard of — WTF is "geogram"? Like everything works great on Windows. Like the Windows version is reported to work on Wine even when the Linux version fails. Like I couldn’t get the Wine version working because I didn’t have an IPv6 route. WTF??
Regard3d
Has an especially cogent description of the concept of photogrammetry and how this software executes that.
Says it requires Windows or Mac, but also elsewhere mentions Linux.
Unpacks the 7z archive into current directory though it’s a small mess — look for src
and
version.txt
if you need to clean it up.
Seems to mention OpenMVG - maybe uses it as an internal component.
Here were dependencies I needed.
apt install libopenscenegraph-3.4-dev libmetis-dev libvlfeat-dev
Ah, it’s a no go for Linux:
I got to the part where it flailed looking for vague OpenMVG headers
that find
could not find in the (working) OpenMVG source.
COLMAP
COLMAP - Prebuilt binaries for Windows and Mac… Ahem. Trying to compile I get the absurd "…gcc versions later than 7 are not supported!"
Blender Addon
Here’s a Blender add-on that nicely imports various photogrammetry files.
While not exactly doing full photogrammetry per se, Blender has some astonishing abilities that are very similar. It seems a lot of this is based on tracking cameras from tracking features in video. This allows Blender to reconstruct a 3d environment where the camera makes sense. This is done by the "camera solver" which should sound familiar to this topic. Check out my Blender notes.
Meshlab
Useful for playing with point clouds and converting them to something Blendable.
apt install meshlab
Data
-
A big list of image sets possibly suitable for photogrammetry.
-
Some photos of a skull can be found here
-
Colmap has some datasets of buildings.
-
OpenMVG has some data too. Buildings.
-
MVE has some data too.