MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / storePly

Function storePly

utils/sfm_utils.py:495–510  ·  view source on GitHub ↗
(path, xyz, rgb)

Source from the content-addressed store, hash-verified

493 return mtx1, mtx2, R
494
495def storePly(path, xyz, rgb):
496 # Define the dtype for the structured array
497 dtype = [('x', 'f4'), ('y', 'f4'), ('z', 'f4'),
498 ('nx', 'f4'), ('ny', 'f4'), ('nz', 'f4'),
499 ('red', 'u1'), ('green', 'u1'), ('blue', 'u1')]
500
501 normals = np.zeros_like(xyz)
502
503 elements = np.empty(xyz.shape[0], dtype=dtype)
504 attributes = np.concatenate((xyz, normals, rgb), axis=1)
505 elements[:] = list(map(tuple, attributes))
506
507 # Create the PlyData object and write to file
508 vertex_element = PlyElement.describe(elements, 'vertex')
509 ply_data = PlyData([vertex_element])
510 ply_data.write(path)

Callers 1

save_points3DFunction · 0.70

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected