Open hongju-jeong opened 2 months ago
def fetchPly(path): plydata = PlyData.read(path) vertices = plydata['vertex'] positions = np.vstack([vertices['x'], vertices['y'], vertices['z']]).T #colors = np.vstack([vertices['red'], vertices['green'], vertices['blue']]).T / 255.0 colors = np.vstack([vertices['red'], vertices['green'], vertices['blue']]).T normals = np.vstack([vertices['nx'], vertices['ny'], vertices['nz']]).T return BasicPointCloud(points=positions, colors=colors, normals=normals) def storePly(path, xyz, rgb): # Define the dtype for the structured array dtype = [('x', 'f4'), ('y', 'f4'), ('z', 'f4'), ('nx', 'f4'), ('ny', 'f4'), ('nz', 'f4'), #('red', 'u1'), ('green', 'u1'), ('blue', 'u1')] ('red', 'f4'), ('green', 'f4'), ('blue', 'f4')]
The extracted RGB values are already normalized floating-point numbers, so by changing the dtype and removing the normalization process, the results can be assured to some extent.
The extracted RGB values are already normalized floating-point numbers, so by changing the dtype and removing the normalization process, the results can be assured to some extent.