import numpy as np
# Function to create point cloud file
def create_output(vertices, colors, filename):
colors = colors.reshape(-1, 3)
vertices = np.hstack([vertices.reshape(-1, 3), colors])
np.savetxt(filename, vertices, fmt='%f %f %f %d %d %d') # 必须先写入,然后利用write()在头部插入ply header
1