(reconstruction: pycolmap.Reconstruction,
database_path: Path)
| 33 | |
| 34 | |
| 35 | def create_db_from_model(reconstruction: pycolmap.Reconstruction, |
| 36 | database_path: Path) -> Dict[str, int]: |
| 37 | if database_path.exists(): |
| 38 | logger.warning('The database already exists, deleting it.') |
| 39 | database_path.unlink() |
| 40 | |
| 41 | db = COLMAPDatabase.connect(database_path) |
| 42 | db.create_tables() |
| 43 | |
| 44 | for i, camera in reconstruction.cameras.items(): |
| 45 | db.add_camera( |
| 46 | camera.model_id, camera.width, camera.height, camera.params, |
| 47 | camera_id=i, prior_focal_length=True) |
| 48 | |
| 49 | for i, image in reconstruction.images.items(): |
| 50 | db.add_image(image.name, image.camera_id, image_id=i) |
| 51 | |
| 52 | db.commit() |
| 53 | db.close() |
| 54 | return {image.name: i for i, image in reconstruction.images.items()} |
| 55 | |
| 56 | |
| 57 | def import_features(image_ids: Dict[str, int], |
no test coverage detected