MCPcopy Create free account
hub / github.com/XiaoBaiiiiii/colmap-pcd / write_points3D_binary

Function write_points3D_binary

scripts/python/read_write_model.py:390–406  ·  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

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

Callers 1

write_modelFunction · 0.85

Calls 1

write_next_bytesFunction · 0.85

Tested by

no test coverage detected