欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

点云处理库pyntcloud

程序员文章站 2022-06-02 21:43:10
...

pyntcloud是一个python3库,用于利用python科学堆栈的强大功能处理3d点云

与open3d相互转换:

import open3d as o3d
from pyntcloud import PyntCloud

# FROM Open3D
original_triangle_mesh = o3d.io.read_triangle_mesh("diamond.ply")
cloud = PyntCloud.from_instance("open3d", original_triangle_mesh)

# TO Open3D
cloud = PyntCloud.from_file("diamond.ply")
converted_triangle_mesh = cloud.to_instance("open3d", mesh=True)  # mesh=True by default

pyvista相互转换:

import pyvista as pv
from pyntcloud import PyntCloud

# FROM PyVista
original_point_cloud = pv.read("diamond.ply")
cloud = PyntCloud.from_instance("pyvista", original_point_cloud)

# TO PyVista
cloud = PyntCloud.from_file("diamond.ply")
converted_triangle_mesh = cloud.to_instance("pyvista", mesh=True)

保存ply或者npz:

predicted_labels = user.infer(scan)

cloud = pd.DataFrame(scan[:, :3], columns=['x', 'y', 'z'])
cloud['seg_id'] = predicted_labels
pcloud = pyntcloud.PyntCloud(cloud)
pcloud.plot(use_as_color='seg_id', cmap="cool", backend="pythreejs")
pcloud.to_file("out1.ply")

相关标签: 3D视觉