MCPcopy Create free account
hub / github.com/OpenImagingLab/4DSloMo / read_points3D_binary

Function read_points3D_binary

scene/colmap_loader.py:113–142  ·  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

111 return xyzs, rgbs, errors
112
113def read_points3D_binary(path_to_model_file):
114 """
115 see: src/base/reconstruction.cc
116 void Reconstruction::ReadPoints3DBinary(const std::string& path)
117 void Reconstruction::WritePoints3DBinary(const std::string& path)
118 """
119
120
121 with open(path_to_model_file, "rb") as fid:
122 num_points = read_next_bytes(fid, 8, "Q")[0]
123
124 xyzs = np.empty((num_points, 3))
125 rgbs = np.empty((num_points, 3))
126 errors = np.empty((num_points, 1))
127
128 for p_id in range(num_points):
129 binary_point_line_properties = read_next_bytes(
130 fid, num_bytes=43, format_char_sequence="QdddBBBd")
131 xyz = np.array(binary_point_line_properties[1:4])
132 rgb = np.array(binary_point_line_properties[4:7])
133 error = np.array(binary_point_line_properties[7])
134 track_length = read_next_bytes(
135 fid, num_bytes=8, format_char_sequence="Q")[0]
136 track_elems = read_next_bytes(
137 fid, num_bytes=8*track_length,
138 format_char_sequence="ii"*track_length)
139 xyzs[p_id] = xyz
140 rgbs[p_id] = rgb
141 errors[p_id] = error
142 return xyzs, rgbs, errors
143
144def read_intrinsics_text(path):
145 """

Callers 1

readColmapSceneInfoFunction · 0.90

Calls 1

read_next_bytesFunction · 0.85

Tested by

no test coverage detected