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)
| 335 | |
| 336 | |
| 337 | def write_images_binary(images, path_to_model_file): |
| 338 | """ |
| 339 | see: src/colmap/scene/reconstruction.cc |
| 340 | void Reconstruction::ReadImagesBinary(const std::string& path) |
| 341 | void Reconstruction::WriteImagesBinary(const std::string& path) |
| 342 | """ |
| 343 | with open(path_to_model_file, "wb") as fid: |
| 344 | write_next_bytes(fid, len(images), "Q") |
| 345 | for _, img in images.items(): |
| 346 | write_next_bytes(fid, img.id, "i") |
| 347 | write_next_bytes(fid, img.qvec.tolist(), "dddd") |
| 348 | write_next_bytes(fid, img.tvec.tolist(), "ddd") |
| 349 | write_next_bytes(fid, img.camera_id, "i") |
| 350 | for char in img.name: |
| 351 | write_next_bytes(fid, char.encode("utf-8"), "c") |
| 352 | write_next_bytes(fid, b"\x00", "c") |
| 353 | write_next_bytes(fid, len(img.point3D_ids), "Q") |
| 354 | for xy, p3d_id in zip(img.xys, img.point3D_ids): |
| 355 | write_next_bytes(fid, [*xy, p3d_id], "ddq") |
| 356 | |
| 357 | |
| 358 | def read_points3D_text(path): |
no test coverage detected