viewercloud的Python绑定
pyviewercloud的Python项目详细描述
pyviewercloud
pyviewercloud是直接在python中使用viewercloud的绑定。在
Viewercloud
是一个库,也是一个用于读取和显示点云的cli。
它最初用于显示KITTI点云。
不过,它也在Lyft Level 5 Dataset点云上进行了测试。在
它还可以显示3D注释和由您最喜欢的算法计算的3D边界框。在
Viewercloud将打开一个openGL窗口来显示点云。按q
关闭。在
它还可以拍摄当前视图的屏幕快照以另存为png。按s
截图。在
Python用法
由于Pyo3和{a4},您可以将pyviewercloud
的python绑定安装到viewercloud
poetry add pyviewercloud^{pr2}$
importnumpyasnpimportpyviewercloudaspyviewer# 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.float32lyft_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 colorviewer.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 windowviewer.show()
importnumpyasnpimportpyviewercloudaspyviewer# Create a new viewer with a window size 1200x1800.viewer=pyviewer.PointcloudViewer(1200,1800,15000)# Load some pointcloud from the kitti datasetkitti_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.float32centroids=np.array([[-11.5,0,-0.8]]).astype(np.float32)viewer.add_centroid(centroids,[255,0,0])viewer.show()
- 项目
标签: