| 49 | |
| 50 | |
| 51 | class QueryLocalizer: |
| 52 | def __init__(self, reconstruction, config=None): |
| 53 | self.reconstruction = reconstruction |
| 54 | self.config = config or {} |
| 55 | |
| 56 | def localize(self, points2D_all, points2D_idxs, points3D_id, query_camera): |
| 57 | points2D = points2D_all[points2D_idxs] |
| 58 | points3D = [self.reconstruction.points3D[j].xyz for j in points3D_id] |
| 59 | ret = pycolmap.absolute_pose_estimation( |
| 60 | points2D, points3D, query_camera, |
| 61 | estimation_options=self.config.get('estimation', {}), |
| 62 | refinement_options=self.config.get('refinement', {}), |
| 63 | ) |
| 64 | return ret |
| 65 | |
| 66 | |
| 67 | def pose_from_cluster( |