2017-06-16 42 views
0

我正在尝试使用Kinext 1捕获视频。我正在寻找最简单的方法来执行此操作。什么是简单的解决方案?我看着通过stackoverflow并找到以下代码。RGB_D使用Kinect_v1捕获视频

import freenect 
import cv2 
import numpy as np 

def nothing(x): 
    pass 
kernel = np.ones((5, 5), np.uint8)  

def pretty_depth(depth): 
    np.clip(depth, 0, 2**10 - 1, depth) 
    depth >>= 2 
    depth = depth.astype(np.uint8) 
    return depth 

while 1: 

    dst = pretty_depth(freenect.sync_get_depth()[0])#input from kinect 
    cv2.imshow('Video', dst) 
    if cv2.waitKey(1) & 0xFF == ord('b'): 
     break 

我怎样才能修改上面的代码,以便我将RGB-D视频或RGB和深度帧与时间戳。

+1

哪一行是抛出分段错误,你调试了吗? – liquide

+0

@liquide我认为这一个dst = pretty_depth(freenect.sync_get_depth()[0])#从kinect输入。 Freenect_sync_get_depth – MIRMIX

+0

@liquide重启系统解决了问题。所以,但它不录制视频。我如何捕捉视频。我修改了这个问题 – MIRMIX

回答

0

使用下面的函数解决:

freenect.runloop(depth=display_depth, 
       video=display_rgb, 
          body=body) 

我使用imwrite方法与display_depth功能和display_rgb函数的参数保存的图像。在身体上,我刚杀死了自由泳。