see: src/base/reconstruction.cc void Reconstruction::ReadPoints3DBinary(const std::string& path) void Reconstruction::WritePoints3DBinary(const std::string& path)
(path_to_model_file)
| 336 | |
| 337 | |
| 338 | def read_points3D_binary(path_to_model_file): |
| 339 | """ |
| 340 | see: src/base/reconstruction.cc |
| 341 | void Reconstruction::ReadPoints3DBinary(const std::string& path) |
| 342 | void Reconstruction::WritePoints3DBinary(const std::string& path) |
| 343 | """ |
| 344 | points3D = {} |
| 345 | with open(path_to_model_file, "rb") as fid: |
| 346 | num_points = read_next_bytes(fid, 8, "Q")[0] |
| 347 | for _ in range(num_points): |
| 348 | binary_point_line_properties = read_next_bytes( |
| 349 | fid, num_bytes=43, format_char_sequence="QdddBBBd") |
| 350 | point3D_id = binary_point_line_properties[0] |
| 351 | xyz = np.array(binary_point_line_properties[1:4]) |
| 352 | rgb = np.array(binary_point_line_properties[4:7]) |
| 353 | error = np.array(binary_point_line_properties[7]) |
| 354 | track_length = read_next_bytes( |
| 355 | fid, num_bytes=8, format_char_sequence="Q")[0] |
| 356 | track_elems = read_next_bytes( |
| 357 | fid, num_bytes=8*track_length, |
| 358 | format_char_sequence="ii"*track_length) |
| 359 | image_ids = np.array(tuple(map(int, track_elems[0::2]))) |
| 360 | point2D_idxs = np.array(tuple(map(int, track_elems[1::2]))) |
| 361 | points3D[point3D_id] = Point3D( |
| 362 | id=point3D_id, xyz=xyz, rgb=rgb, |
| 363 | error=error, image_ids=image_ids, |
| 364 | point2D_idxs=point2D_idxs) |
| 365 | return points3D |
| 366 | |
| 367 | |
| 368 | def write_points3D_text(points3D, path): |
no test coverage detected