see: src/base/reconstruction.cc void Reconstruction::WriteCamerasText(const std::string& path) void Reconstruction::ReadCamerasText(const std::string& path)
(path)
| 99 | |
| 100 | |
| 101 | def read_cameras_text(path): |
| 102 | """ |
| 103 | see: src/base/reconstruction.cc |
| 104 | void Reconstruction::WriteCamerasText(const std::string& path) |
| 105 | void Reconstruction::ReadCamerasText(const std::string& path) |
| 106 | """ |
| 107 | cameras = {} |
| 108 | with open(path, "r") as fid: |
| 109 | while True: |
| 110 | line = fid.readline() |
| 111 | if not line: |
| 112 | break |
| 113 | line = line.strip() |
| 114 | if len(line) > 0 and line[0] != "#": |
| 115 | elems = line.split() |
| 116 | camera_id = int(elems[0]) |
| 117 | model = elems[1] |
| 118 | width = int(elems[2]) |
| 119 | height = int(elems[3]) |
| 120 | params = np.array(tuple(map(float, elems[4:]))) |
| 121 | cameras[camera_id] = Camera(id=camera_id, model=model, |
| 122 | width=width, height=height, |
| 123 | params=params) |
| 124 | return cameras |
| 125 | |
| 126 | |
| 127 | def read_cameras_binary(path_to_model_file): |