(gt_path)
| 113 | |
| 114 | |
| 115 | def load_colmap_gt(gt_path): |
| 116 | camera_path = gt_path + "/sparse/cameras.txt" |
| 117 | camera_df = load_camera_data(camera_path) |
| 118 | |
| 119 | image_path = gt_path + "/sparse/images.txt" |
| 120 | image_df = load_image_data(image_path) |
| 121 | |
| 122 | results = {} |
| 123 | for name, row in image_df.iterrows(): |
| 124 | pose = row['POSE'] |
| 125 | camera_id = row['CAMERA_ID'] |
| 126 | |
| 127 | R = quat2rot(pose['qw'], pose['qx'], pose['qy'], pose['qz']) |
| 128 | t = np.array([pose['tx'], pose['ty'], pose['tz']]) |
| 129 | |
| 130 | if camera_id in camera_df.index: |
| 131 | K = camera_df.loc[camera_id, 'K'] |
| 132 | else: |
| 133 | K = None |
| 134 | |
| 135 | results[name] = { |
| 136 | "id": camera_id, |
| 137 | "K": K, |
| 138 | "R": R, |
| 139 | "t": t, |
| 140 | "camera_id": camera_id |
| 141 | } |
| 142 | |
| 143 | return results |
no test coverage detected