see: src/colmap/scene/reconstruction.cc void Reconstruction::ReadImagesBinary(const std::string& path) void Reconstruction::WriteImagesBinary(const std::string& path)
(images, path_to_model_file)
| 391 | |
| 392 | |
| 393 | def write_images_binary(images, path_to_model_file): |
| 394 | """ |
| 395 | see: src/colmap/scene/reconstruction.cc |
| 396 | void Reconstruction::ReadImagesBinary(const std::string& path) |
| 397 | void Reconstruction::WriteImagesBinary(const std::string& path) |
| 398 | """ |
| 399 | with open(path_to_model_file, "wb") as fid: |
| 400 | write_next_bytes(fid, len(images), "Q") |
| 401 | for _, img in images.items(): |
| 402 | write_next_bytes(fid, img.id, "i") |
| 403 | write_next_bytes(fid, img.qvec.tolist(), "dddd") |
| 404 | write_next_bytes(fid, img.tvec.tolist(), "ddd") |
| 405 | write_next_bytes(fid, img.camera_id, "i") |
| 406 | for char in img.name: |
| 407 | write_next_bytes(fid, char.encode("utf-8"), "c") |
| 408 | write_next_bytes(fid, b"\x00", "c") |
| 409 | write_next_bytes(fid, len(img.point3D_ids), "Q") |
| 410 | for xy, p3d_id in zip(img.xys, img.point3D_ids): |
| 411 | write_next_bytes(fid, [*xy, p3d_id], "ddq") |
| 412 | |
| 413 | |
| 414 | def write_points3D_text(points3D, path): |
no test coverage detected