a package for pcd
Project description
Easypcd使你更专注与代码本身,而不需要因为pcd格式所带来的烦恼。
v0.0.28更新:错误的rgb色彩空间
0、 安装easypcd
pip install easypcd
1、 调用easypcd
from easypcd import ep
import open3d as o3d
import numpy as np
2、 读取pcd文件
ep_pcd = ep.read_pcd("point.pcd")# 读取pcd文件
print("point indormation:", ep_pcd)# 打印所有信息
print("point:", ep_pcd.points)# 打印点云坐标
print("points type:", type(ep_pcd.points))# 打印点云类型
3、 写入pcd文件
ep.write_pcd(save_name="ep-sample.pcd", points=ep_pcd.points)
必要参数:
save_name:保存的文件名
points:需要保存的点云数据
可选参数
color:是否有颜色信息(True/False),默认False
normal:是否有向量信息(True/False),默认False
_SIZE:字节数量,默认为4
_TYPE:字符类型,默认为F
4、 其他用法
4.1、 open3d读取写入
o3d_read = o3d.io.read_point_cloud("point.pcd")# 加载三维点云
ep.write_pcd(save_name="sample.pcd", points=o3d_read.points)# 写入pcd
4.2、 创建有颜色信息的点云
points_xyz = np.random.randint(100, size=(100, 3)) # 点云坐标
points_color = np.random.randint(5, size=(100, 3)) # 点云颜色
points_nxyz = np.random.randint(100, size=(100, 3)) # 点云向量
ep_points = np.concatenate((points_xyz, points_color, points_nxyz), axis=1) # 拼接位置信息、颜色信息和向量信息
ep.write_pcd(save_name="ep-points.pcd", points=ep_points, color=True, normal=True) # 写入pcd
4.3、 点云信息转为open3d
o3d_object = o3d.geometry.PointCloud() # 初始化点云
o3d_object.points = o3d.utility.Vector3dVector(ep_points[:, 0:3]) # 转为open3d的坐标
o3d_object.colors = o3d.utility.Vector3dVector(ep_points[:, 3:6]) # 转为open3d的颜色信息
o3d.visualization.draw_geometries([o3d_object], window_name="POINT", width=400, height=300, mesh_show_back_face=True) # 显示
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.