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

Function read_array

scripts/python/read_write_dense.py:40–55  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

38
39
40def read_array(path):
41 with open(path, "rb") as fid:
42 width, height, channels = np.genfromtxt(fid, delimiter="&", max_rows=1,
43 usecols=(0, 1, 2), dtype=int)
44 fid.seek(0)
45 num_delimiter = 0
46 byte = fid.read(1)
47 while True:
48 if byte == b"&":
49 num_delimiter += 1
50 if num_delimiter >= 3:
51 break
52 byte = fid.read(1)
53 array = np.fromfile(fid, np.float32)
54 array = array.reshape((width, height, channels), order="F")
55 return np.transpose(array, (1, 0, 2)).squeeze()
56
57
58def write_array(array, path):

Callers 2

mainFunction · 0.90
mainFunction · 0.85

Calls 2

readMethod · 0.45
transposeMethod · 0.45

Tested by 1

mainFunction · 0.72