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

Function read_points3D_text

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

81 return struct.unpack(endian_character + format_char_sequence, data)
82
83def read_points3D_text(path):
84 """
85 see: src/base/reconstruction.cc
86 void Reconstruction::ReadPoints3DText(const std::string& path)
87 void Reconstruction::WritePoints3DText(const std::string& path)
88 """
89 xyzs = None
90 rgbs = None
91 errors = None
92 with open(path, "r") as fid:
93 while True:
94 line = fid.readline()
95 if not line:
96 break
97 line = line.strip()
98 if len(line) > 0 and line[0] != "#":
99 elems = line.split()
100 xyz = np.array(tuple(map(float, elems[1:4])))
101 rgb = np.array(tuple(map(int, elems[4:7])))
102 error = np.array(float(elems[7]))
103 if xyzs is None:
104 xyzs = xyz[None, ...]
105 rgbs = rgb[None, ...]
106 errors = error[None, ...]
107 else:
108 xyzs = np.append(xyzs, xyz[None, ...], axis=0)
109 rgbs = np.append(rgbs, rgb[None, ...], axis=0)
110 errors = np.append(errors, error[None, ...], axis=0)
111 return xyzs, rgbs, errors
112
113def read_points3D_binary(path_to_model_file):
114 """

Callers 1

readColmapSceneInfoFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected