see: src/base/reconstruction.cc void Reconstruction::ReadImagesBinary(const std::string& path) void Reconstruction::WriteImagesBinary(const std::string& path)
(images, path_to_model_file)
| 288 | |
| 289 | |
| 290 | def write_images_binary(images, path_to_model_file): |
| 291 | """ |
| 292 | see: src/base/reconstruction.cc |
| 293 | void Reconstruction::ReadImagesBinary(const std::string& path) |
| 294 | void Reconstruction::WriteImagesBinary(const std::string& path) |
| 295 | """ |
| 296 | with open(path_to_model_file, "wb") as fid: |
| 297 | write_next_bytes(fid, len(images), "Q") |
| 298 | for _, img in images.items(): |
| 299 | write_next_bytes(fid, img.id, "i") |
| 300 | write_next_bytes(fid, img.qvec.tolist(), "dddd") |
| 301 | write_next_bytes(fid, img.tvec.tolist(), "ddd") |
| 302 | write_next_bytes(fid, img.camera_id, "i") |
| 303 | for char in img.name: |
| 304 | write_next_bytes(fid, char.encode("utf-8"), "c") |
| 305 | write_next_bytes(fid, b"\x00", "c") |
| 306 | write_next_bytes(fid, len(img.point3D_ids), "Q") |
| 307 | for xy, p3d_id in zip(img.xys, img.point3D_ids): |
| 308 | write_next_bytes(fid, [*xy, p3d_id], "ddq") |
| 309 | |
| 310 | |
| 311 | def read_points3D_text(path): |
no test coverage detected