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

Function write_cameras_text

hloc/utils/read_write_model.py:159–173  ·  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

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

Callers 1

write_modelFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected