Metadata-Version: 2.1
Name: easypcd
Version: 0.0.32
Summary: a package for pcd
Home-page: https://gitee.com/wang2wan/easypcd_project
Author: GentleWang
Author-email: 189030005@stu.just.edu.cn
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: scipy

#### 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')`  
