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