mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.37k stars 856 forks source link

Possible optimization - use only `two_view_reconstruction_plane_based` #771

Open mattip opened 3 years ago

mattip commented 3 years ago

In two_view_reconstruction_general, first OpenSfM tries the general two_view_reconstruction and after that two_view_reconstruction_plane_based. Would it significantly speed up processing if there were a flag to only use two_view_reconstruction_plane_based when the user knows the input is from something like a drone flyover of an agricultural field?

https://github.com/mapillary/OpenSfM/blob/97f29b0a6f894bffae088ca9cb54305ec110b654/opensfm/reconstruction.py#L467-L508
YanNoun commented 3 years ago

Hi @mattip,

The reconstruction_general will make sure that plane-based estimation is used if it is "more relevant" than the general 5-point method.

For agricultural fields, OpenSfM's bad result are observed in case of dataset with flat surface only (such as a field with no trees or building surrounding) + nadir capture (i.e. camera almost perfectly parallel to the field), which arise more than often. Such cases are critical configurations for SfM and are highly ambiguous : several combinations of focal/disto/position leads to perfect reprojection errors, leading to bad reconstructions.

For such cases, OpenSfM would need either to know (or could be automatically detected) that such configuration is observed (planar surface + fronto parallel), and then the following solution could be used :

Yann

mattip commented 3 years ago

For agricultural fields ...

This is exactly my use case. I am using OpenDroneMap to wrap OpenSFM, so the best for me (and maybe others) would be to have a configuration parameter for OpenSFM --open-fields or so to cause OpenSFM to use planarity constraints.