MCPcopy Create free account
hub / github.com/TheMariday/marimapper / write_images_binary

Function write_images_binary

marimapper/pycolmap_tools/read_write_model.py:337–355  ·  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

335
336
337def 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
358def read_points3D_text(path):

Callers 1

write_modelFunction · 0.85

Calls 1

write_next_bytesFunction · 0.85

Tested by

no test coverage detected