This project has moved. For the latest updates, please go here.

Depth Data

Apr 10, 2012 at 10:00 PM

Hey Everyone, 

I am very new to pykinect and I keep on running into the same problem: I cannot find the depth matrix. I see that there is a depth video stream but where is the actual 320x240 matrix with the depth values. An example would be really helpful. 


Apr 10, 2012 at 11:05 PM

When you get the frame it will have an image property on it which gives you access to the bits - this is a PlanarImage object which includes the width, height, bytes_per_pixel, bits, buffer_length, and pitch properties.  It also has a copy_bits function which will use ctypes to copy the bits to another location (which ctypes.memmove needs to be able to write to).  The easiest thing to do is just frame.image.bits which will return a ctypes array with all of the data.

The demo in the KinectDemos download contains an example of using the copy_bits method to copy the bits into the PyGame screen.