Getting Kinect sensor data from matlab

Asked by Amir on 13 May 2012
Latest activity Commented on by Laila Kazemi on 13 Jun 2013 at 12:45

I have kinect for PC and the new microsoft kinect SDK (not the beta). I was able to connect to the kinect from Matlab (using net.addassembly(<microsoft.kinect.dll>), and register an event listener (e.g., to DepthFrameReady event using addlistener). My event handler get called indeed (30 times a sec), but, when I copy the image data in the event handler to a matlab int8 array (using, DepthFrame.CopyPixelDataTo(frameBits)), the resulting matlab array, frameBits, is all zeros.

Any help on how to get the data from kinect sensor using microsft sdk would be highly appriciated.

1 Comment

Laila Kazemi on 13 Jun 2013 at 12:45

hello , im trying to get data from kinect into matlab, i had no luck yet, could you pls post ur code?

Amir

Products

1 Answer

Answer by Amir on 22 Jul 2012
Accepted answer

OK, found the solution to my problem.I guess there aren't many poeple out there working with the kinect through Matlab...

3 Comments

Walter Roberson on 22 Jul 2012

What was the solution?

Star Strider on 23 Jul 2012

Probably this:

http://www.mathworks.com/matlabcentral/fileexchange/32318-simulink-for-natural-interaction-device-nid

since all the TMW pages supporting Kinect seem to no longer exist, even though they're still indexed and appear on the TMW search results.

This is where I went first:

http://www.mathworks.com/academia/hardware-resources/

since it looks like fun when time eventually permits.

Amir on 14 Sep 2012

Actually I don't have Simulink, so I'm using the Kinect from a "barebone" Matlab.

The solution to my original questions (getting the data from the depthImageFrame object to matlab is the following:

netArray=NET.createArray('System.Int16',frame.PixelDataLength);
frame.CopyPixelDataTo(netArray);
frameBits=int16(netArray);
depthBits=int16(ceil(frameBits/8));%first 3 bits are the skelton index
depthFrame=reshape(depthBits,frame.Width,frame.Height)';

Amir

Amir

Contact us