MCPcopy Create free account
hub / github.com/cdcseacave/openMVS / load_ply

Function load_ply

scripts/python/MvsPointCloud2TSDF.py:22–36  ·  view source on GitHub ↗

Load points and normals from a PLY file.

(path)

Source from the content-addressed store, hash-verified

20from scipy.spatial import cKDTree
21
22def load_ply(path):
23 """
24 Load points and normals from a PLY file.
25 """
26 plydata = PlyData.read(path)
27 vertex = plydata['vertex']
28
29 points = np.stack([vertex['x'], vertex['y'], vertex['z']], axis=-1)
30
31 if 'nx' in vertex.data.dtype.names and 'ny' in vertex.data.dtype.names and 'nz' in vertex.data.dtype.names:
32 normals = np.stack([vertex['nx'], vertex['ny'], vertex['nz']], axis=-1)
33 else:
34 raise ValueError("PLY file must contain normals (nx, ny, nz).")
35
36 return points, normals
37
38def estimate_voxel_size(points, num_samples=3000):
39 """

Callers 1

mainFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected