Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to Save RGBD video from Kinect using OpenCV

Hello Everyone,

I tried saving the depth video from the below code but I am not able to , could anyone help me as how can I save the Depth frames/video.

import freenect
import cv2
import numpy as np

def get_video():
     array,_ = freenect.sync_get_video()
     array = cv2.cvtColor(array,cv2.COLOR_RGB2BGR)
     return array

def get_depth():
    array,_ = freenect.sync_get_depth()
    array = array.astype(np.uint8)
    return array
if __name__ == "__main__":
   while 1:
       #get a frame from RGB camera
       frame = get_video()
       #get a frame from depth sensor
       depth = get_depth()
       #display RGB image
       cv2.imshow('RGB image',frame)
       #display depth image
       cv2.imshow('Depth image',depth)

       # quit program when 'esc' key is pressed
       k = cv2.waitKey(5) & 0xFF
        if k == 27:
            break
   cv2.destroyAllWindows()