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

Function read_extrinsics_text

scene/colmap_loader.py:232–258  ·  view source on GitHub ↗

Taken from https://github.com/colmap/colmap/blob/dev/scripts/python/read_write_model.py

(path)

Source from the content-addressed store, hash-verified

230
231
232def read_extrinsics_text(path):
233 """
234 Taken from https://github.com/colmap/colmap/blob/dev/scripts/python/read_write_model.py
235 """
236 images = {}
237 with open(path, "r") as fid:
238 while True:
239 line = fid.readline()
240 if not line:
241 break
242 line = line.strip()
243 if len(line) > 0 and line[0] != "#":
244 elems = line.split()
245 image_id = int(elems[0])
246 qvec = np.array(tuple(map(float, elems[1:5])))
247 tvec = np.array(tuple(map(float, elems[5:8])))
248 camera_id = int(elems[8])
249 image_name = elems[9]
250 elems = fid.readline().split()
251 xys = np.column_stack([tuple(map(float, elems[0::3])),
252 tuple(map(float, elems[1::3]))])
253 point3D_ids = np.array(tuple(map(int, elems[2::3])))
254 images[image_id] = Image(
255 id=image_id, qvec=qvec, tvec=tvec,
256 camera_id=camera_id, name=image_name,
257 xys=xys, point3D_ids=point3D_ids)
258 return images
259
260
261def read_colmap_bin_array(path):

Callers 1

readColmapSceneInfoFunction · 0.90

Calls 1

ImageClass · 0.85

Tested by

no test coverage detected