see: src/base/reconstruction.cc void Reconstruction::ReadPoints3DText(const std::string& path) void Reconstruction::WritePoints3DText(const std::string& path)
(path)
| 83 | |
| 84 | |
| 85 | def read_points3D_text(path): |
| 86 | """ |
| 87 | see: src/base/reconstruction.cc |
| 88 | void Reconstruction::ReadPoints3DText(const std::string& path) |
| 89 | void Reconstruction::WritePoints3DText(const std::string& path) |
| 90 | """ |
| 91 | xyzs = None |
| 92 | rgbs = None |
| 93 | errors = None |
| 94 | num_points = 0 |
| 95 | with open(path, "r") as fid: |
| 96 | while True: |
| 97 | line = fid.readline() |
| 98 | if not line: |
| 99 | break |
| 100 | line = line.strip() |
| 101 | if len(line) > 0 and line[0] != "#": |
| 102 | num_points += 1 |
| 103 | |
| 104 | xyzs = np.empty((num_points, 3)) |
| 105 | rgbs = np.empty((num_points, 3)) |
| 106 | errors = np.empty((num_points, 1)) |
| 107 | count = 0 |
| 108 | with open(path, "r") as fid: |
| 109 | while True: |
| 110 | line = fid.readline() |
| 111 | if not line: |
| 112 | break |
| 113 | line = line.strip() |
| 114 | if len(line) > 0 and line[0] != "#": |
| 115 | elems = line.split() |
| 116 | xyz = np.array(tuple(map(float, elems[1:4]))) |
| 117 | rgb = np.array(tuple(map(int, elems[4:7]))) |
| 118 | error = np.array(float(elems[7])) |
| 119 | xyzs[count] = xyz |
| 120 | rgbs[count] = rgb |
| 121 | errors[count] = error |
| 122 | count += 1 |
| 123 | |
| 124 | return xyzs, rgbs, errors |
| 125 | |
| 126 | |
| 127 | def read_points3D_binary(path_to_model_file): |
no outgoing calls
no test coverage detected