MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / read_points3D_binary

Function read_points3D_binary

scene/colmap_loader.py:127–156  ·  view source on GitHub ↗

see: src/base/reconstruction.cc void Reconstruction::ReadPoints3DBinary(const std::string& path) void Reconstruction::WritePoints3DBinary(const std::string& path)

(path_to_model_file)

Source from the content-addressed store, hash-verified

125
126
127def read_points3D_binary(path_to_model_file):
128 """
129 see: src/base/reconstruction.cc
130 void Reconstruction::ReadPoints3DBinary(const std::string& path)
131 void Reconstruction::WritePoints3DBinary(const std::string& path)
132 """
133
134
135 with open(path_to_model_file, "rb") as fid:
136 num_points = read_next_bytes(fid, 8, "Q")[0]
137
138 xyzs = np.empty((num_points, 3))
139 rgbs = np.empty((num_points, 3))
140 errors = np.empty((num_points, 1))
141
142 for p_id in range(num_points):
143 binary_point_line_properties = read_next_bytes(
144 fid, num_bytes=43, format_char_sequence="QdddBBBd")
145 xyz = np.array(binary_point_line_properties[1:4])
146 rgb = np.array(binary_point_line_properties[4:7])
147 error = np.array(binary_point_line_properties[7])
148 track_length = read_next_bytes(
149 fid, num_bytes=8, format_char_sequence="Q")[0]
150 track_elems = read_next_bytes(
151 fid, num_bytes=8*track_length,
152 format_char_sequence="ii"*track_length)
153 xyzs[p_id] = xyz
154 rgbs[p_id] = rgb
155 errors[p_id] = error
156 return xyzs, rgbs, errors
157
158
159def read_intrinsics_text(path):

Callers 1

readColmapSceneInfoFunction · 0.90

Calls 1

read_next_bytesFunction · 0.85

Tested by

no test coverage detected