我正在尝试使用PyKinect2模块从Kinect v2设备获取深度帧。我遵循了here提供的示例。我可以看到深度帧,但是它们出现在PyGame窗口中被截断,尽管帧的大小应该是512x424。在
我使用PyKinect2提供的get_last_depth_frame()
方法,并用下面的代码在曲面上绘制它。在
def draw_depth_frame(self, frame, target_surface):
target_surface.lock()
address = self._kinect.surface_as_array(target_surface.get_buffer())
ctypes.memmove(address, frame.ctypes.data, frame.size)
del address
target_surface.unlock()
首先,您必须将
Surface
大小更改为24位:在
__init__(self)
函数中:然后您应该更改
^{pr2}$self._screen
以获取深度帧宽度和高度:最后,画出深度框架,如@双君建议:
我没什么好评论的。所以我写在这里。 我想你需要3个通道来填充内存到所需的长度。 试试这个
然后memmove from frame8bit而不是原来的frame。在
相关问题 更多 >
编程相关推荐