Skip to content

Instantly share code, notes, and snippets.

@musimab
Created January 13, 2022 08:56
Show Gist options
  • Save musimab/8a00810b14b0ad132ea32a8187b1799a to your computer and use it in GitHub Desktop.
Save musimab/8a00810b14b0ad132ea32a8187b1799a to your computer and use it in GitHub Desktop.
def create_point_cloud_file2(vertices, filename):
ply_header = '''ply
format ascii 1.0
element vertex %(vert_num)d
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
'''
with open(filename, 'w') as f:
f.write(ply_header %dict(vert_num=len(vertices)))
np.savetxt(f,vertices,'%f %f %f %d %d %d')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment