MCPcopy
hub / github.com/cvg/Hierarchical-Localization / write_points3D_binary

Function write_points3D_binary

hloc/utils/read_write_model.py:393–409  ·  view source on GitHub ↗

see: src/base/reconstruction.cc void Reconstruction::ReadPoints3DBinary(const std::string& path) void Reconstruction::WritePoints3DBinary(const std::string& path)

(points3D, path_to_model_file)

Source from the content-addressed store, hash-verified

391
392
393def write_points3D_binary(points3D, path_to_model_file):
394 """
395 see: src/base/reconstruction.cc
396 void Reconstruction::ReadPoints3DBinary(const std::string& path)
397 void Reconstruction::WritePoints3DBinary(const std::string& path)
398 """
399 with open(path_to_model_file, "wb") as fid:
400 write_next_bytes(fid, len(points3D), "Q")
401 for _, pt in points3D.items():
402 write_next_bytes(fid, pt.id, "Q")
403 write_next_bytes(fid, pt.xyz.tolist(), "ddd")
404 write_next_bytes(fid, pt.rgb.tolist(), "BBB")
405 write_next_bytes(fid, pt.error, "d")
406 track_length = pt.image_ids.shape[0]
407 write_next_bytes(fid, track_length, "Q")
408 for image_id, point2D_id in zip(pt.image_ids, pt.point2D_idxs):
409 write_next_bytes(fid, [image_id, point2D_id], "ii")
410
411
412def detect_model_format(path, ext):

Callers 1

write_modelFunction · 0.85

Calls 1

write_next_bytesFunction · 0.85

Tested by

no test coverage detected