1. 文章信息
(1)标题:Open3D: A Modern Library for 3D Data Processing (2018)
(2)文章链接:https://arxiv.org/pdf/1801.09847.pdf
(3)Open3D 库网址:http://www.open3d.org/
2. Open3D 库简介
- Open3D 是一个开源库,支持快速开发处理 3D 数据的软件。Open3D 前端在 C++ 和 Python 中公开了一组精心选择的数据结构和算法。后端经过高度优化,并设置为并行化。Open3D 是从一块干净的石板上开发出来的,有一个小的、经过仔细考虑的依赖项集。它可以在不同的平台上设置,并从源代码进行编译,只需很少的工作量。代码干净、样式一致,并通过清晰的代码审查机制进行维护。Open3D已经在许多已发表的研究项目中使用,并积极部署在云端。我们欢迎开源社区的贡献。核心特性如下:
- Simple installation via conda and pip
- 3D data structures
- 3D data processing algorithms
- Scene reconstruction
- Surface alignment
- PBR rendering
- 3D visualization
- Python binding
conda install open3d 或者 pip install open3d
2. 3D 可视化使用
2.1 单帧点云
import numpy as np
import open3d as o3d
colormap = np.array([[150, 150, 150],
[255, 0, 255],
[0, 255, 0],
[0, 200, 255],
[255, 255, 0]]) / 255.0
path = '/home/hjw/PointCloudTest/PointCloudTestData.npy'
pointCloud = np.load(path).astype(np.float32, copy=False)
point3D = pointCloud[:, :3]
pointIntensity = pointCloud[:, 3]
pointColor = [colormap[int(pointIntensity[i]) % colormap.shape[0]] for i in range(pointIntensity.shape[0])]
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(point3D)
pcd.colors = o3d.utility.Vector3dVector(pointColor)
vis = o3d.visualization.Visualizer()
vis.create_window(width=800, height=600)
render_option = vis.get_render_option()
render_option.background_color = np.array([0, 0, 0])
render_option.point_size = 1.0
vis.add_geometry(pcd)
view_control = vis.get_view_control()
view_control.set_zoom(0.2)
vis.run()
vis.destroy_window()
详细参数介绍见 API 网址:http://www.open3d.org/docs/release/python_api/open3d.visualization.ViewControl.html
2.2 多帧点云
import os
import numpy as np
import open3d as o3d
path = '/home/hjw/PointCloudTest/'
files = os.listdir(path)
vis = o3d.visualization.Visualizer()
vis.create_window()
pcd = o3d.geometry.PointCloud()
toReset = True
vis.add_geometry(pointcloud)
for f in files:
pointCloud = np.load(path + f).astype(np.float32, copy=False)
point3D = pointCloud[:, :3]
pointIntensity = pointCloud[:, 3]
pcd.points = o3d.utility.Vector3dVector(point3D)
vis.update_geometry(pcd)
if toReset:
vis.reset_view_point(True)
toReset = False
vis.poll_events()
vis.update_renderer()
|