mapillary / OpenSfM

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

Why don't use ba to optimize the shot pose in the resect function? #789

Closed lmz-whu closed 1 year ago

lmz-whu commented 3 years ago

If using pnp to recover shot pose, in fact, only tracks, which tracks length are more than 3, are used. And it ignores the relation between match pairs not reconstructed.

YanNoun commented 2 years ago

Hi @lmz-whu,

Indeed, the process of adding a new camera is the following https://github.com/mapillary/OpenSfM/blob/main/opensfm/reconstruction.py#L1239-L1268 : 1 - Resect a new shot with PnP 2 - Bundle adjust new added shot with tracks of length >= 3 3 - Triangulate new points (i.e. length == 2) (4 - optionaly, bundle locally or the entire scene)

You're right that newly triangulated points aren't optimal reprojection-wise. We expect this to be fixed in further local/global bundles.

Let me know if that answer your question.

Yann