Monday, 7 December 2015

Extracting data from Kinect V2 .xef files

The Kinect V2 easily allows users to record and store stream data using .xef (extended event files) but getting any data out of that file once it has been recorded has proven to be quite a task. While traditional video data can be looped through frame by frame at your own leisure, the .xef file does not allow (or at least not for me despite my best efforts) this kind of analysis. At first, it seemed that RGB, Depth, or Body Frame data could only be intercepted at run time and, therefore, if I didn't get the data I wanted I would have to record it all again.

Fortunately, playback of stored Kinect data is actually interpreted by the Kinect Service as a live feed and applications designed to extract data at run time can be used to do so with recorded data. The only problem here is that the applications must be efficient enough to allow my machine to cope with handling the playback and data extraction simultaneously without dropping any frames. So far I have been able to extract the X, Y, and Z values of each of the 25 joints in the Body Frames in metres, which should be enough data for what I need but there is still the issue of working out which joint belongs to which body in the scene so we know who is moving in what way.



I'm not a big C# fan and don't enjoy programming in Visual Studio so I was looking at some alternative ways to access the Kinect Service API and found a really nice Python package that even came with a demo game that showed off its neat implementation:


I've spent the last few days getting my head around it and seem to be getting somewhere and I'm really excited to record a group of singers and seeing if I can get all the data I need. I can then easily store joint co-ordinates in a SQL database (Probably will do one for each recording) and run a few scripts on the these to get some nice pretty graphs. Can't wait to get started!

Ryan