MCPcopy Create free account
hub / github.com/Anttwo/SuGaR / read_points3D_binary

Function read_points3D_binary

gaussian_splatting/scene/colmap_loader.py:125–154  ·  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

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

Callers 1

readColmapSceneInfoFunction · 0.90

Calls 2

emptyMethod · 0.80
read_next_bytesFunction · 0.70

Tested by

no test coverage detected