(path)
| 17 | ) |
| 18 | |
| 19 | def fetchPly(path): |
| 20 | plydata = PlyData.read(path) |
| 21 | vertices = plydata['vertex'] |
| 22 | positions = np.vstack([vertices['x'], vertices['y'], vertices['z']]).T |
| 23 | colors = np.vstack([vertices['red'], vertices['green'], vertices['blue']]).T / 255.0 |
| 24 | if 'nx' in vertices: |
| 25 | normals = np.vstack([vertices['nx'], vertices['ny'], vertices['nz']]).T |
| 26 | else: |
| 27 | normals = np.zeros_like(positions) |
| 28 | if 'time' in vertices: |
| 29 | timestamp = vertices['time'][:, None] |
| 30 | else: |
| 31 | timestamp = None |
| 32 | return BasicPointCloud(points=positions, colors=colors, normals=normals, time=timestamp) |
| 33 | |
| 34 | class BasicPointCloud(NamedTuple): |
| 35 | points : np.array |
no test coverage detected