赞
踩
在计算机视觉和三维几何处理中,点云是一种重要的数据表示形式。点云由许多离散的点组成,每个点都有三维坐标,通常还包括其他信息。
import open3d as o3d def read_txt_space(txt_file): # 读取点云数据 pcd = o3d.io.read_point_cloud(txt_file, format='xyz') # 设置统一颜色 pcd.paint_uniform_color([0, 1, 1]) # 可视化点云 o3d.visualization.draw_geometries([pcd]) # 示例文件路径 txt_file_space = "path/to/your/space_delimited.txt" read_txt_space(txt_file_space)
import numpy as np import open3d as o3d def read_txt_comma(txt_file): # 读取点云数据 data = np.genfromtxt(txt_file, delimiter=',') # 创建 Open3D 点云对象 pcd = o3d.geometry.PointCloud() pcd.points = o3d.utility.Vector3dVector(data[:, :3]) # 只取前三列作为点的坐标 # 设置统一颜色 pcd.paint_uniform_color([0, 1, 1]) # 可视化点云 o3d.visualization.draw_geometries([pcd]) #保存 #o3d.io.write_point_cloud("path\\air_ply"+".ply", pcd) # 示例文件路径 txt_file_comma = "path/to/your/comma_delimited.txt" read_txt_comma(txt_file_comma)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。