简体   繁体   English

如何从存储为 numpy 数组的顶点创建点云文件(.ply)?

[英]How to create point cloud file(.ply) from vertices stored as numpy array?

I have some vertices whose coordinates were stored as NumPy array.我有一些顶点的坐标存储为 NumPy 数组。

xyz_np: xyz_np:

array([[  7,  53,  31],
       [ 61, 130, 116],
       [ 89,  65, 120],
       ...,
       [ 28,  72,  88],
       [ 77,  65,  82],
       [117,  90,  72]], dtype=int32)

I want to save these vertices as a point cloud file(such as.ply) and visualize it in Blender.我想将这些顶点保存为点云文件(例如.ply)并在 Blender 中可视化。

I don't have face information.我没有人脸信息。

You can use Open3D to do this.您可以使用Open3D来执行此操作。

# Pass numpy array to Open3D.o3d.geometry.PointCloud and visualize
xyz = np.random.rand(100, 3)
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(xyz)
o3d.io.write_point_cloud("./data.ply", pcd)

You can also visualize the point cloud using Open3D .您还可以使用 Open3D 可视化点云

o3d.visualization.draw_geometries([pcd])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM