(sfm_dir: Path,
image_dir: Path,
pairs: Path,
features: Path,
matches: Path,
camera_mode: pycolmap.CameraMode = pycolmap.CameraMode.AUTO,
verbose: bool = False,
skip_geometric_verification: bool = False,
min_match_score: Optional[float] = None,
image_list: Optional[List[str]] = None,
image_options: Optional[Dict[str, Any]] = None,
mapper_options: Optional[Dict[str, Any]] = None,
)
| 91 | |
| 92 | |
| 93 | def main(sfm_dir: Path, |
| 94 | image_dir: Path, |
| 95 | pairs: Path, |
| 96 | features: Path, |
| 97 | matches: Path, |
| 98 | camera_mode: pycolmap.CameraMode = pycolmap.CameraMode.AUTO, |
| 99 | verbose: bool = False, |
| 100 | skip_geometric_verification: bool = False, |
| 101 | min_match_score: Optional[float] = None, |
| 102 | image_list: Optional[List[str]] = None, |
| 103 | image_options: Optional[Dict[str, Any]] = None, |
| 104 | mapper_options: Optional[Dict[str, Any]] = None, |
| 105 | ) -> pycolmap.Reconstruction: |
| 106 | |
| 107 | assert features.exists(), features |
| 108 | assert pairs.exists(), pairs |
| 109 | assert matches.exists(), matches |
| 110 | |
| 111 | sfm_dir.mkdir(parents=True, exist_ok=True) |
| 112 | database = sfm_dir / 'database.db' |
| 113 | |
| 114 | create_empty_db(database) |
| 115 | import_images(image_dir, database, camera_mode, image_list, image_options) |
| 116 | image_ids = get_image_ids(database) |
| 117 | import_features(image_ids, database, features) |
| 118 | import_matches(image_ids, database, pairs, matches, |
| 119 | min_match_score, skip_geometric_verification) |
| 120 | if not skip_geometric_verification: |
| 121 | estimation_and_geometric_verification(database, pairs, verbose) |
| 122 | reconstruction = run_reconstruction( |
| 123 | sfm_dir, database, image_dir, verbose, mapper_options) |
| 124 | if reconstruction is not None: |
| 125 | logger.info(f'Reconstruction statistics:\n{reconstruction.summary()}' |
| 126 | + f'\n\tnum_input_images = {len(image_ids)}') |
| 127 | return reconstruction |
| 128 | |
| 129 | |
| 130 | if __name__ == '__main__': |
no test coverage detected