see: src/base/reconstruction.cc void Reconstruction::ReadPoints3DText(const std::string& path) void Reconstruction::WritePoints3DText(const std::string& path)
(path)
| 309 | |
| 310 | |
| 311 | def read_points3D_text(path): |
| 312 | """ |
| 313 | see: src/base/reconstruction.cc |
| 314 | void Reconstruction::ReadPoints3DText(const std::string& path) |
| 315 | void Reconstruction::WritePoints3DText(const std::string& path) |
| 316 | """ |
| 317 | points3D = {} |
| 318 | with open(path, "r") as fid: |
| 319 | while True: |
| 320 | line = fid.readline() |
| 321 | if not line: |
| 322 | break |
| 323 | line = line.strip() |
| 324 | if len(line) > 0 and line[0] != "#": |
| 325 | elems = line.split() |
| 326 | point3D_id = int(elems[0]) |
| 327 | xyz = np.array(tuple(map(float, elems[1:4]))) |
| 328 | rgb = np.array(tuple(map(int, elems[4:7]))) |
| 329 | error = float(elems[7]) |
| 330 | image_ids = np.array(tuple(map(int, elems[8::2]))) |
| 331 | point2D_idxs = np.array(tuple(map(int, elems[9::2]))) |
| 332 | points3D[point3D_id] = Point3D(id=point3D_id, xyz=xyz, rgb=rgb, |
| 333 | error=error, image_ids=image_ids, |
| 334 | point2D_idxs=point2D_idxs) |
| 335 | return points3D |
| 336 | |
| 337 | |
| 338 | def read_points3D_binary(path_to_model_file): |