MegBA: A High-Performance and Distributed Library for Large-Scale Bundle Adjustment