【发布时间】:2021-02-09 11:44:05
【问题描述】:
我想做的是实时可视化从我的 xbox360 kinect 流式传输的数据。
基本上我是从数据中创建一个点云,然后将其可视化。我的代码可以运行,但速度很慢。
基本上,一旦从 kinect 接收到该代码,它就会添加一个点云。每当接收到另一个点云时,就会删除之前的点云并添加一个新的点云。
有没有更好的方法来做到这一点?具有更高帧速率的响应速度更快
mat = rendering.Material()
mat.base_color = [
0,
0,
0, 1.0
]
mat.shader = "defaultLit"
pcl = o3d.geometry.PointCloud()
# This line recieves the data from the kinect in the format [x,y,z,r,g,b]
pcl.points = o3d.utility.Vector3dVector(kinect.streamCloud())
self.scene.scene.remove_geometry("kinect")
self.scene.scene.add_geometry("kinect", pcl, mat)
这是从 kinect 流式传输数据的代码
def streamCloud():
depth = freenect.sync_get_depth()
pcl = np.zeros(shape=(307200,3))
c = 0
for i in range(480):
for j in range(640):
z = depth[0][i,j]
#z = 1.0 / (d[i,j] * -0.0030711016 + 3.3309495161)
#z = depth[0][i,j].astype(np.uint8)
#x = (i - cx) * z / fx
x = j
y = i
#y = (j - cy) * z / fy
pcl[c] = [x,y,z]
c = c+1
return pcl
【问题讨论】: