(id, camera : Camera)
| 283 | return camera_list |
| 284 | |
| 285 | def camera_to_JSON(id, camera : Camera): |
| 286 | Rt = np.zeros((4, 4)) |
| 287 | Rt[:3, :3] = camera.R.transpose() |
| 288 | Rt[:3, 3] = camera.T |
| 289 | Rt[3, 3] = 1.0 |
| 290 | |
| 291 | W2C = np.linalg.inv(Rt) |
| 292 | pos = W2C[:3, 3] |
| 293 | rot = W2C[:3, :3] |
| 294 | serializable_array_2d = [x.tolist() for x in rot] |
| 295 | camera_entry = { |
| 296 | 'id' : id, |
| 297 | 'img_name' : camera.image_name, |
| 298 | 'width' : camera.width, |
| 299 | 'height' : camera.height, |
| 300 | 'position': pos.tolist(), |
| 301 | 'rotation': serializable_array_2d, |
| 302 | 'fy' : fov2focal(camera.FovY, camera.height), |
| 303 | 'fx' : fov2focal(camera.FovX, camera.width) |
| 304 | } |
| 305 | return camera_entry |
| 306 | |
| 307 | |
| 308 |
nothing calls this directly
no test coverage detected