MCPcopy Create free account
hub / github.com/XiaoBaiiiiii/colmap-pcd / read_points3D_text

Function read_points3D_text

scripts/python/read_write_model.py:308–332  ·  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

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

Callers 1

read_modelFunction · 0.85

Calls 1

Point3DClass · 0.50

Tested by

no test coverage detected