MCPcopy Create free account
hub / github.com/ai4ce/RAP / write_cameras_binary

Function write_cameras_binary

utils/read_write_model.py:190–204  ·  view source on GitHub ↗

see: src/colmap/scene/reconstruction.cc void Reconstruction::WriteCamerasBinary(const std::string& path) void Reconstruction::ReadCamerasBinary(const std::string& path)

(cameras, path_to_model_file)

Source from the content-addressed store, hash-verified

188
189
190def write_cameras_binary(cameras, path_to_model_file):
191 """
192 see: src/colmap/scene/reconstruction.cc
193 void Reconstruction::WriteCamerasBinary(const std::string& path)
194 void Reconstruction::ReadCamerasBinary(const std::string& path)
195 """
196 with open(path_to_model_file, "wb") as fid:
197 write_next_bytes(fid, len(cameras), "Q")
198 for _, cam in cameras.items():
199 model_id = CAMERA_MODEL_NAMES[cam.model].model_id
200 camera_properties = [cam.id, model_id, cam.width, cam.height]
201 write_next_bytes(fid, camera_properties, "iiQQ")
202 for p in cam.params:
203 write_next_bytes(fid, float(p), "d")
204 return cameras
205
206
207def read_images_text(path):

Callers 1

write_modelFunction · 0.85

Calls 1

write_next_bytesFunction · 0.85

Tested by

no test coverage detected