see: src/base/reconstruction.cc void Reconstruction::ReadPoints3DBinary(const std::string& path) void Reconstruction::WritePoints3DBinary(const std::string& path)
(path_to_model_file)
| 365 | |
| 366 | |
| 367 | def read_points3D_binary(path_to_model_file): |
| 368 | """ |
| 369 | see: src/base/reconstruction.cc |
| 370 | void Reconstruction::ReadPoints3DBinary(const std::string& path) |
| 371 | void Reconstruction::WritePoints3DBinary(const std::string& path) |
| 372 | """ |
| 373 | points3D = {} |
| 374 | with open(path_to_model_file, "rb") as fid: |
| 375 | num_points = read_next_bytes(fid, 8, "Q")[0] |
| 376 | for point_line_index in range(num_points): |
| 377 | binary_point_line_properties = read_next_bytes( |
| 378 | fid, num_bytes=43, format_char_sequence="QdddBBBd") |
| 379 | point3D_id = binary_point_line_properties[0] |
| 380 | xyz = np.array(binary_point_line_properties[1:4]) |
| 381 | rgb = np.array(binary_point_line_properties[4:7]) |
| 382 | error = np.array(binary_point_line_properties[7]) |
| 383 | track_length = read_next_bytes( |
| 384 | fid, num_bytes=8, format_char_sequence="Q")[0] |
| 385 | track_elems = read_next_bytes( |
| 386 | fid, num_bytes=8 * track_length, |
| 387 | format_char_sequence="ii" * track_length) |
| 388 | image_ids = np.array(tuple(map(int, track_elems[0::2]))) |
| 389 | point2D_idxs = np.array(tuple(map(int, track_elems[1::2]))) |
| 390 | points3D[point3D_id] = Point3D( |
| 391 | id=point3D_id, xyz=xyz, rgb=rgb, |
| 392 | error=error, image_ids=image_ids, |
| 393 | point2D_idxs=point2D_idxs) |
| 394 | return points3D |
| 395 | |
| 396 | |
| 397 | def write_points3D_text(points3D, path): |
no test coverage detected