see: src/base/reconstruction.cc void Reconstruction::WriteCamerasText(const std::string& path) void Reconstruction::ReadCamerasText(const std::string& path)
(cameras, path)
| 157 | |
| 158 | |
| 159 | def 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 | |
| 176 | def write_cameras_binary(cameras, path_to_model_file): |