| 14 | |
| 15 | |
| 16 | def incremental_mapping_with_pbar( |
| 17 | database_path: Path, image_path: Path, sfm_path: Path |
| 18 | ) -> dict[int, pycolmap.Reconstruction]: |
| 19 | with pycolmap.Database.open(database_path) as database: |
| 20 | num_images = database.num_images() |
| 21 | with enlighten.Manager() as manager: |
| 22 | with manager.counter( |
| 23 | total=num_images, desc="Images registered:" |
| 24 | ) as pbar: |
| 25 | pbar.update(0, force=True) |
| 26 | reconstructions = pycolmap.incremental_mapping( |
| 27 | database_path, |
| 28 | image_path, |
| 29 | sfm_path, |
| 30 | initial_image_pair_callback=lambda: pbar.update(2), |
| 31 | next_image_callback=lambda: pbar.update(1), |
| 32 | ) |
| 33 | return reconstructions |
| 34 | |
| 35 | |
| 36 | def run() -> None: |