MCPcopy Create free account
hub / github.com/CUT3R/CUT3R / write_points3D_binary

Function write_points3D_binary

datasets_preprocess/read_write_model.py:457–473  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

write_modelFunction · 0.85

Calls 1

write_next_bytesFunction · 0.85

Tested by

no test coverage detected