see: src/colmap/scene/reconstruction.cc void Reconstruction::ReadPoints3DText(const std::string& path) void Reconstruction::WritePoints3DText(const std::string& path)
(path)
| 355 | |
| 356 | |
| 357 | def read_points3D_text(path): |
| 358 | """ |
| 359 | see: src/colmap/scene/reconstruction.cc |
| 360 | void Reconstruction::ReadPoints3DText(const std::string& path) |
| 361 | void Reconstruction::WritePoints3DText(const std::string& path) |
| 362 | """ |
| 363 | points3D = {} |
| 364 | with open(path, "r") as fid: |
| 365 | while True: |
| 366 | line = fid.readline() |
| 367 | if not line: |
| 368 | break |
| 369 | line = line.strip() |
| 370 | if len(line) > 0 and line[0] != "#": |
| 371 | elems = line.split() |
| 372 | point3D_id = int(elems[0]) |
| 373 | xyz = np.array(tuple(map(float, elems[1:4]))) |
| 374 | rgb = np.array(tuple(map(int, elems[4:7]))) |
| 375 | error = float(elems[7]) |
| 376 | image_ids = np.array(tuple(map(int, elems[8::2]))) |
| 377 | point2D_idxs = np.array(tuple(map(int, elems[9::2]))) |
| 378 | points3D[point3D_id] = Point3D( |
| 379 | id=point3D_id, |
| 380 | xyz=xyz, |
| 381 | rgb=rgb, |
| 382 | error=error, |
| 383 | image_ids=image_ids, |
| 384 | point2D_idxs=point2D_idxs, |
| 385 | ) |
| 386 | return points3D |
| 387 | |
| 388 | |
| 389 | def read_points3D_binary(path_to_model_file): |