Open3D生成随机点云,并保存PLY文件

发布时间:2023年12月27日

?write_ascii=true表示以ascii格式保存PLY文件否则是二进制保存

import time
import open3d as o3d;
import numpy as np; 

x = np.linspace(-3, 3, 501)
mesh_x, mesh_y = np.meshgrid(x, x)
z = np.sinc((np.power(mesh_x, 2) + np.power(mesh_y, 2)))
z_norm = (z - z.min()) / (z.max() - z.min())
xyz = np.zeros((np.size(mesh_x), 3))
xyz[:, 0] = np.reshape(mesh_x, -1)
xyz[:, 1] = np.reshape(mesh_y, -1)
xyz[:, 2] = np.reshape(z_norm, -1)
print('xyz')
print(xyz)

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(xyz) 
o3d.io.write_point_cloud("sync1.ply", pcd, write_ascii=True) 

o3d.visualization.draw_geometries([pcd]) 

pcdsync = o3d.io.read_point_cloud("sync1.ply")

o3d.visualization.draw_geometries([pcdsync]) 

文章来源:https://blog.csdn.net/easyboot/article/details/135238051
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。