see: src/colmap/scene/reconstruction.cc void Reconstruction::ReadPoints3DBinary(const std::string& path) void Reconstruction::WritePoints3DBinary(const std::string& path)
(points3D, path_to_model_file)
| 456 | |
| 457 | |
| 458 | def write_points3D_binary(points3D, path_to_model_file): |
| 459 | """ |
| 460 | see: src/colmap/scene/reconstruction.cc |
| 461 | void Reconstruction::ReadPoints3DBinary(const std::string& path) |
| 462 | void Reconstruction::WritePoints3DBinary(const std::string& path) |
| 463 | """ |
| 464 | with open(path_to_model_file, "wb") as fid: |
| 465 | write_next_bytes(fid, len(points3D), "Q") |
| 466 | for _, pt in points3D.items(): |
| 467 | write_next_bytes(fid, pt.id, "Q") |
| 468 | write_next_bytes(fid, pt.xyz.tolist(), "ddd") |
| 469 | write_next_bytes(fid, pt.rgb.tolist(), "BBB") |
| 470 | write_next_bytes(fid, pt.error, "d") |
| 471 | track_length = pt.image_ids.shape[0] |
| 472 | write_next_bytes(fid, track_length, "Q") |
| 473 | for image_id, point2D_id in zip(pt.image_ids, pt.point2D_idxs): |
| 474 | write_next_bytes(fid, [image_id, point2D_id], "ii") |
| 475 | |
| 476 | |
| 477 | def detect_model_format(path, ext): |
no test coverage detected