2 个版本
0.2.1 | 2020 年 12 月 3 日 |
---|---|
0.2.0 | 2020 年 12 月 3 日 |
#233 in 可视化
530KB
344 行
Viewercloud
Viewercloud
是一个库,也是一个 CLI 工具,用于读取和显示点云。最初用于显示 KITTI 点云。但它也测试过 Lyft Level 5 数据集 点云。
它还将能够显示您喜欢的算法计算出的 3D 注释和 3D BoundingBox。
Viewercloud 将打开一个 openGL 窗口来显示点云。按 q
关闭。
它还可以捕获当前视图的屏幕截图并保存为 png。按 s
捕获截图。
Python 使用
您可以通过 Pyo3 和 Pyo3-numpy 安装 pyviewercloud
,它是 viewercloud
的 Python 绑定。
poetry add pyviewercloud
pip install pyviewercloud
import numpy as np
import pyviewercloud as pyviewer
# Create a new viewer with a window size 1200x1800.
viewer = pyviewer.PointcloudViewer(1200, 1800, 15000)
# Load some pointcloud from the lyft perception dataset
# Currently only support pointcloud as numpy.ndarray Nx3 in np.float32
lyft_point_cloud_1 = np.fromfile("tests/data/lyft/host-a101_lidar0_1241893239502712366.bin", dtype=np.float32).reshape((-1, 5))[:,:3]
lyft_point_cloud_2= np.fromfile("tests/data/lyft/host-a101_lidar1_1241893239502712366.bin", dtype=np.float32).reshape((-1, 5))[:,:3]
lyft_point_cloud_3= np.fromfile("tests/data/lyft/host-a101_lidar2_1241893239502712366.bin", dtype=np.float32).reshape((-1, 5))[:,:3]
# Add them one by one to the viewer to have different color
viewer.add_pointcloud(lyft_point_cloud_1, [255, 0, 0])
viewer.add_pointcloud(lyft_point_cloud_2, [0, 0, 255])
viewer.add_pointcloud(lyft_point_cloud_3, [0, 255, 0])
# You can now display the window
viewer.show()
import numpy as np
import pyviewercloud as pyviewer
# Create a new viewer with a window size 1200x1800.
viewer = pyviewer.PointcloudViewer(1200, 1800, 15000)
# Load some pointcloud from the kitti dataset
kitti_point_cloud = np.fromfile("tests/data/kitti/velodyne/000001.bin", dtype=np.float32).reshape((-1, 4))[:,:3]
viewer.add_pointcloud(kitti_point_cloud, [255, 255, 255])
# Add some centroids to have the same color.
# Currently only support centroids as numpy.ndarray Nx3 in np.float32
centroids = np.array([[-11.5,0,-0.8]]).astype(np.float32)
viewer.add_centroid(centroids, [255, 0, 0])
viewer.show()
CLI 使用
> viewercloud --help
viewercloud 0.2.1
Thomaub <[email protected]>
Display KITTI 3D Pointcloud with annotations and your model inferences
USAGE:
viewercloud <pointcloud-file> [ARGS]
ARGS:
<pointcloud-file> Path to the kitti Pointcloud .bin or .txt file
<annotations-file> Path to the kitti 3D annotation .txt file
<inferences-file> Path to your model inferences .json file
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
构建
cargo build --release
可以从 GitHub 发布版和 brew 下载。
依赖项
~23–34MB
~372K SLoC