Taken from https://github.com/colmap/colmap/blob/dev/scripts/python/read_write_model.py
(path)
| 142 | return xyzs, rgbs, errors |
| 143 | |
| 144 | def read_intrinsics_text(path): |
| 145 | """ |
| 146 | Taken from https://github.com/colmap/colmap/blob/dev/scripts/python/read_write_model.py |
| 147 | """ |
| 148 | cameras = {} |
| 149 | with open(path, "r") as fid: |
| 150 | while True: |
| 151 | line = fid.readline() |
| 152 | if not line: |
| 153 | break |
| 154 | line = line.strip() |
| 155 | if len(line) > 0 and line[0] != "#": |
| 156 | elems = line.split() |
| 157 | camera_id = int(elems[0]) |
| 158 | model = elems[1] |
| 159 | assert model == "PINHOLE", "While the loader support other types, the rest of the code assumes PINHOLE" |
| 160 | width = int(elems[2]) |
| 161 | height = int(elems[3]) |
| 162 | params = np.array(tuple(map(float, elems[4:]))) |
| 163 | cameras[camera_id] = Camera(id=camera_id, model=model, |
| 164 | width=width, height=height, |
| 165 | params=params) |
| 166 | return cameras |
| 167 | |
| 168 | def read_extrinsics_binary(path_to_model_file): |
| 169 | """ |
no test coverage detected