Skip to main content

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) # 显示

5、 合并多个点云
point_cloud = [[[-710.34927002, -237.10757877, 215.2757621 ], [-709.46899019, -236.99056383, 214.81596639], [[-708.6379193 , -238.05448845, 219.71073159], [-706.88288009, -237.81858778, 218.7811006 ]], [[-707.06327968, -239.84758949, 222.8262728 ], [-706.18809347, -239.72758696, 222.35760756]]]
contract_point_list(point_cloud)

6、移动最小二乘法平滑点云
points = np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]])
smooth_points = ep.Moving_Least_Squares_Smoothing(points, radius=1, tau=0.5, weights_name='gaussian')

7、移动最小二乘法上采样点云
points = np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]])
or
ep_pcd = ep.read_pcd("point.pcd")
points = ep.points
up_sample_points = ep.Moving_Least_Squares_UpSampling(points, radius=50, tau=0.2, upsampling_rate=2, setUpsamplingRadius=1.0, weights_name='gaussian')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easypcd-0.0.33-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file easypcd-0.0.33-py3-none-any.whl.

File metadata

  • Download URL: easypcd-0.0.33-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for easypcd-0.0.33-py3-none-any.whl
Algorithm Hash digest
SHA256 a475b970d66ae9605a3655845183ead25255d85e9e993af1459230d3c8854353
MD5 ed1ff3d8d04deb1b1027b7ef27e64561
BLAKE2b-256 c3e1500537fa73ddfdd072a516d3e6a72e1df11dcb1ce03a32aa42bd8ef7b61b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page