MCPcopy
hub / github.com/cvg/Hierarchical-Localization / read_points3D_text

Function read_points3D_text

hloc/utils/read_write_model.py:311–335  ·  view source on GitHub ↗

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

(path)

Source from the content-addressed store, hash-verified

309
310
311def read_points3D_text(path):
312 """
313 see: src/base/reconstruction.cc
314 void Reconstruction::ReadPoints3DText(const std::string& path)
315 void Reconstruction::WritePoints3DText(const std::string& path)
316 """
317 points3D = {}
318 with open(path, "r") as fid:
319 while True:
320 line = fid.readline()
321 if not line:
322 break
323 line = line.strip()
324 if len(line) > 0 and line[0] != "#":
325 elems = line.split()
326 point3D_id = int(elems[0])
327 xyz = np.array(tuple(map(float, elems[1:4])))
328 rgb = np.array(tuple(map(int, elems[4:7])))
329 error = float(elems[7])
330 image_ids = np.array(tuple(map(int, elems[8::2])))
331 point2D_idxs = np.array(tuple(map(int, elems[9::2])))
332 points3D[point3D_id] = Point3D(id=point3D_id, xyz=xyz, rgb=rgb,
333 error=error, image_ids=image_ids,
334 point2D_idxs=point2D_idxs)
335 return points3D
336
337
338def read_points3D_binary(path_to_model_file):

Callers 1

read_modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected