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