@@ -51,7 +51,7 @@ def _get_camera_from_bundle(
5151
5252def log_bundle_stats (bundle_type : str , bundle_report : Dict [str , Any ]) -> None :
5353 times = bundle_report ["wall_times" ]
54- time_secs = times ["run" ] + times ["setup" ] + times ["teardown" ]
54+ time_secs = times ["run" ] + times ["setup" ] + times ["teardown" ] + times [ "triangulate" ]
5555 num_images , num_points , num_reprojections = (
5656 bundle_report ["num_images" ],
5757 bundle_report ["num_points" ],
@@ -71,6 +71,7 @@ def bundle(
7171 camera_priors : Dict [str , pygeometry .Camera ],
7272 rig_camera_priors : Dict [str , pymap .RigCamera ],
7373 gcp : Optional [List [pymap .GroundControlPoint ]],
74+ grid_size : int ,
7475 config : Dict [str , Any ],
7576) -> Dict [str , Any ]:
7677 """Bundle adjust a reconstruction."""
@@ -79,6 +80,7 @@ def bundle(
7980 dict (camera_priors ),
8081 dict (rig_camera_priors ),
8182 gcp if gcp is not None else [],
83+ grid_size ,
8284 config ,
8385 )
8486 log_bundle_stats ("GLOBAL" , report )
@@ -109,6 +111,7 @@ def bundle_local(
109111 camera_priors : Dict [str , pygeometry .Camera ],
110112 rig_camera_priors : Dict [str , pymap .RigCamera ],
111113 gcp : Optional [List [pymap .GroundControlPoint ]],
114+ grid_size : int ,
112115 central_shot_id : str ,
113116 config : Dict [str , Any ],
114117) -> Tuple [Dict [str , Any ], List [int ]]:
@@ -119,6 +122,7 @@ def bundle_local(
119122 dict (rig_camera_priors ),
120123 gcp if gcp is not None else [],
121124 central_shot_id ,
125+ grid_size ,
122126 config ,
123127 )
124128 log_bundle_stats ("LOCAL" , report )
@@ -1509,7 +1513,7 @@ def grow_reconstruction(
15091513 paint_reconstruction (data , tracks_manager , reconstruction )
15101514 align_reconstruction (reconstruction , gcp , config )
15111515
1512- bundle (reconstruction , camera_priors , rig_camera_priors , None , config )
1516+ bundle (reconstruction , camera_priors , rig_camera_priors , None , - 1 , config )
15131517 remove_outliers (reconstruction , config )
15141518 paint_reconstruction (data , tracks_manager , reconstruction )
15151519
@@ -1522,6 +1526,10 @@ def grow_reconstruction(
15221526 list (reconstruction .points .keys ()),
15231527 )
15241528
1529+ local_ba_radius = config ["local_bundle_radius" ]
1530+ local_ba_grid = config ["local_bundle_grid" ]
1531+ final_bundle_grid = config ["final_bundle_grid" ]
1532+
15251533 while True :
15261534 if config ["save_partial_reconstructions" ]:
15271535 paint_reconstruction (data , tracks_manager , reconstruction )
@@ -1579,12 +1587,12 @@ def grow_reconstruction(
15791587 logger .info ("Re-triangulating" )
15801588 align_reconstruction (reconstruction , gcp , config )
15811589 b1rep = bundle (
1582- reconstruction , camera_priors , rig_camera_priors , None , config
1590+ reconstruction , camera_priors , rig_camera_priors , None , local_ba_grid , config
15831591 )
15841592 rrep = retriangulate (tracks_manager , reconstruction , config )
15851593 resection_candidates .update (reconstruction )
15861594 b2rep = bundle (
1587- reconstruction , camera_priors , rig_camera_priors , None , config
1595+ reconstruction , camera_priors , rig_camera_priors , None , local_ba_grid , config
15881596 )
15891597 resection_candidates .remove (* remove_outliers (reconstruction , config ))
15901598 step ["bundle" ] = b1rep
@@ -1595,17 +1603,18 @@ def grow_reconstruction(
15951603 elif should_bundle .should ():
15961604 align_reconstruction (reconstruction , gcp , config )
15971605 brep = bundle (
1598- reconstruction , camera_priors , rig_camera_priors , None , config
1606+ reconstruction , camera_priors , rig_camera_priors , None , local_ba_grid , config
15991607 )
16001608 resection_candidates .remove (* remove_outliers (reconstruction , config ))
16011609 step ["bundle" ] = brep
16021610 should_bundle .done ()
1603- elif config [ "local_bundle_radius" ] > 0 :
1611+ elif local_ba_radius > 0 :
16041612 bundled_points , brep = bundle_local (
16051613 reconstruction ,
16061614 camera_priors ,
16071615 rig_camera_priors ,
16081616 None ,
1617+ local_ba_grid ,
16091618 image ,
16101619 config ,
16111620 )
@@ -1627,7 +1636,7 @@ def grow_reconstruction(
16271636 overidden_config ["bundle_compensate_gps_bias" ] = False
16281637 config = overidden_config
16291638
1630- bundle (reconstruction , camera_priors , rig_camera_priors , gcp , config )
1639+ bundle (reconstruction , camera_priors , rig_camera_priors , gcp , final_bundle_grid , config )
16311640 resection_candidates .remove (* remove_outliers (reconstruction , config ))
16321641 paint_reconstruction (data , tracks_manager , reconstruction )
16331642 return reconstruction , report
0 commit comments