点云数据显示_vispy 显示 kitti 点云数据
生活随笔
收集整理的這篇文章主要介紹了
点云数据显示_vispy 显示 kitti 点云数据
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
國內博客找了一圈,居然沒有發現有用 vispy 做可視化的代碼,這里做一個簡單的示例,代碼大部分來自官方。
import numpy as np import vispy.scene from vispy.scene import visuals import sys# Make a canvas and add simple view canvas = vispy.scene.SceneCanvas(keys='interactive', show=True) view = canvas.central_widget.add_view()# # generate data 使用隨機數據的話把這塊反注釋掉 # pos = np.random.normal(size=(100000, 3), scale=0.2) # # one could stop here for the data generation, the rest is just to make the # # data look more interesting. Copied over from magnify.py # centers = np.random.normal(size=(50, 3)) # indexes = np.random.normal(size=100000, loc=centers.shape[0]/2., # scale=centers.shape[0]/3.) # indexes = np.clip(indexes, 0, centers.shape[0]-1).astype(int) # scales = 10**(np.linspace(-2, 0.5, centers.shape[0]))[indexes][:, np.newaxis] # pos *= scales # pos += centers[indexes] # scatter = visuals.Markers() # scatter.set_data(pos, edge_color=None, face_color=(1, 1, 1, .5), size=5)# 使用 kitti 數據, n*3 img_id = 17 # 2,3 is not able for pcl; path = r'D:KITTIObjecttrainingvelodyne%06d.bin' % img_id ## Path ## need to be changed points = np.fromfile(path, dtype=np.float32).reshape(-1, 4)# create scatter object and fill in the data scatter = visuals.Markers() scatter.set_data(points[:,:3], edge_color=None, face_color=(1, 1, 1, .5), size=5)view.add(scatter) view.camera = 'turntable' # or try 'arcball'# add a colored 3D axis for orientation axis = visuals.XYZAxis(parent=view.scene)if __name__ == '__main__':if sys.flags.interactive != 1:vispy.app.run()效果如如下,比pcl 顯示效果略微差點,但是十多萬個點滾動也很流暢:
總結
以上是生活随笔為你收集整理的点云数据显示_vispy 显示 kitti 点云数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 日期加减加1天_2小时整理了13个时间日
- 下一篇: 楚乔传宇文怀喜欢萧玉还是元淳公主 结局被