()
| 34 | |
| 35 | |
| 36 | def run() -> None: |
| 37 | output_path = Path("example/") |
| 38 | image_path = output_path / "Fountain/images" |
| 39 | database_path = output_path / "database.db" |
| 40 | sfm_path = output_path / "sfm" |
| 41 | |
| 42 | output_path.mkdir(exist_ok=True) |
| 43 | # The log filename is postfixed with the execution timestamp. |
| 44 | logging.set_log_destination(logging.INFO, output_path / "INFO.log.") |
| 45 | |
| 46 | data_url = "https://cvg-data.inf.ethz.ch/local-feature-evaluation-schoenberger2017/Strecha-Fountain.zip" |
| 47 | if not image_path.exists(): |
| 48 | logging.info("Downloading the data.") |
| 49 | zip_path = output_path / "data.zip" |
| 50 | urllib.request.urlretrieve(data_url, zip_path) |
| 51 | with zipfile.ZipFile(zip_path, "r") as fid: |
| 52 | fid.extractall(output_path) |
| 53 | logging.info(f"Data extracted to {output_path}.") |
| 54 | |
| 55 | if database_path.exists(): |
| 56 | database_path.unlink() |
| 57 | pycolmap.set_random_seed(0) |
| 58 | pycolmap.extract_features(database_path, image_path) |
| 59 | pycolmap.match_exhaustive(database_path) |
| 60 | |
| 61 | if sfm_path.exists(): |
| 62 | shutil.rmtree(sfm_path) |
| 63 | sfm_path.mkdir(exist_ok=True) |
| 64 | |
| 65 | recs = incremental_mapping_with_pbar(database_path, image_path, sfm_path) |
| 66 | # alternatively, use: |
| 67 | # import custom_incremental_pipeline |
| 68 | # recs = custom_incremental_pipeline.main( |
| 69 | # database_path, image_path, sfm_path |
| 70 | # ) |
| 71 | for idx, rec in recs.items(): |
| 72 | logging.info(f"#{idx} {rec.summary()}") |
| 73 | |
| 74 | |
| 75 | if __name__ == "__main__": |
no test coverage detected