Two Kinect v2 Tips from El Bruno - Disconnected Dev and Body Counts
- Posted: Jan 07, 2015 at 6:00AM
Today we've got two tips from Friend of the Gallery, Bruno Capuano. The first is how you can build and test Kinect v2 App's without having a Kinect device attached and the other, a tip on handling body counts...
A long time ago, a very interesting tool was added in KinectSdk version 1.5: “Kinect Studio” (I wrote a review 2 years ago here). This tool allows us to record Kinect sessions including all sensor captured information, like camera feed or infrared feed. If you develop Kinect apps wich require very repetitive testing, this type of recording is very good, since with them we avoid us having to put us in front of the sensor and do again and again the same gestures.
The problem in the Kinect V1 SDK is that you had to have a Kinect V1 SENSOR connected to the computer where you record and play KINECT STUDIO. This force to have a Kinect for each developer. That’s why because Kinect Studio was a sort of hack and “strained” the feed from the sensor usb where it was connected the Kinect to send information.
The new Kinect V2 SDK has changed that in a great way. Now is not the USB which sends information of the Kinect, instead there is a Windows service which manages the information registered from the sensor and the service publish this information. So, taking advantage of this, the new Kinect Studio allows us to be able to use Kinect Studio without a Kinect V2 sensor.
The following animation shows app example “Body Basis” included with the SDK on a computer without a connected V2 Kinect sensor, and how to open a recording Studio Kinect, connect it, the app starts to display information as if the sensor was connected.
When you work with apps on Kinect that require a special code for each body recognized by the sensor, the entry point tends to be the collection of bodies returning to us in the line 15 of the first block in the following code example
The problem with these lines is the collection of bodies it is usually complete by 6 elements, however there are no 6 people in front of the Kinect. The following image shows the collection and at the same, the 6th element is a correct body, but with the property IsTracked = False .
The solution is quite simple, a small array preprocessing, filtering by the bodies that are correctly identified. In line 16 of the second block of code we obtain the total number of bodies where IsTracked == True and from there to be processed.