Skip to content

OpenMVG on your image dataset

Pierre Moulon edited this page May 15, 2022 · 3 revisions

This document explain you how to run OpenMVG SfM pipelines on your images.


Note: OpenMVG will try to retrieve your image's pixel focal length. If it can't it will complain No Intrinsic found and you will be able to submit an approximate focal length by using the -f X * 1.2 with X = Max(image <Width, Height>) at the Scene Initialization stage.


Our pipelines consist of Python scripts that chain multiple OpenMVG binaries (i.e. Initialization, Image matching and then SfM).

Sample data

In order to let you play with the pipelines, we recommend you first to try those image datasets : OpenMVG image datasets

  • You will find pinhole[LowRes/HighRes] & 360 images.

Sequential & Incremental SfM pipeline

$ cd openMVG_Build/software/SfM/
$ python SfM_SequentialPipeline.py [full path image directory] [resulting directory]
$ python SfM_SequentialPipeline.py ~/home/user/data/ImageDataset_SceauxCastle/images ~/home/user/data/ImageDataset_SceauxCastle/Castle_Incremental_Reconstruction

Global SfM pipeline

$ cd openMVG_Build/software/SfM/
$ python SfM_GlobalPipeline.py [full path image directory] [resulting directory]
$ python SfM_GlobalPipeline.py ~/home/user/data/ImageDataset_SceauxCastle/images ~/home/user/data/ImageDataset_SceauxCastle/Castle_Global_Reconstruction

How to visualize, reuse OpenMVG SfM pipeline output

Please use Meshlab or CloudCompare and open the file cloud_and_poses.ply.

  • Camera trajectory is displayed with green points
  • The 3D structure is displayed with white or colored points -> see colorized.ply.

The resulting SfM output is stored in the sfm_data.bin file. This file can be converted to JSON/XML for 3rd party usage or PLY for visualization. Those conversions can be done by using openMVG_main_ConvertSfM_DataFormat (note that you can chose which data you want to export, so for example you can keep your JSON output compact if you need only the pose information to display the camera trajectory).


OpenMVG Binaries

Here a description of the main binaries that are used in those Python pipelines:

Image matching/retrieval

Tasks Description
Init the scene
openMVG_main_SfMInit_ImageListing
Initialize a sfm_data scene with Views referencing the input images and reference to camera model(s).
- Each View is referencing an intrinsic Id and a pose Id.
Note that this binary allows choosing with camera model your images are using.
Describe the images
openMVG_main_ComputeFeatures
Compute the requested features (Regions) for all Views of a sfm_data file.
Image Matching
openMVG_main_ComputeMatches
Compute pairwise matches.

Structure-from-Motion specific methods

Tasks Description
openMVG_main_SfM --sfm_engine INCREMENTAL Start the reconstruction from 2-view and sequentially adding the remaining view.
openMVG_main_SfM --sfm_engine INCREMENTALV2 Start the reconstruction from 2 or n-view and sequentially adding the remaining view. This pipeline is faster than openMVG_main_IncrementalSfM but less accurate.
openMVG_main_SfM --sfm_engine GLOBAL Compute relative motion between pairs or images and then use motion averaging to solve all the camera poses at the same time.
openMVG_main_ComputeStructureFromKnownPoses Retrieve the structure of the scene (point cloud) where the camera locations are known by either triangulating the matches or looking for corresponding points along the epipolar lines.

Localization

Tasks Description
openMVG_main_SfM_Localization Retrieve image location on an existing sfm_data scene.