MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / write_images_binary

Function write_images_binary

scene/colmap_loader.py:393–411  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

391
392
393def 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
414def write_points3D_text(points3D, path):

Callers 1

save_extrinsicFunction · 0.90

Calls 1

write_next_bytesFunction · 0.85

Tested by

no test coverage detected