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

Function write_cameras_text

scripts/python/read_write_model.py:156–170  ·  view source on GitHub ↗

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

(cameras, path)

Source from the content-addressed store, hash-verified

154
155
156def write_cameras_text(cameras, path):
157 """
158 see: src/base/reconstruction.cc
159 void Reconstruction::WriteCamerasText(const std::string& path)
160 void Reconstruction::ReadCamerasText(const std::string& path)
161 """
162 HEADER = "# Camera list with one line of data per camera:\n" + \
163 "# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]\n" + \
164 "# Number of cameras: {}\n".format(len(cameras))
165 with open(path, "w") as fid:
166 fid.write(HEADER)
167 for _, cam in cameras.items():
168 to_write = [cam.id, cam.model, cam.width, cam.height, *cam.params]
169 line = " ".join([str(elem) for elem in to_write])
170 fid.write(line + "\n")
171
172
173def write_cameras_binary(cameras, path_to_model_file):

Callers 1

write_modelFunction · 0.85

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected