Hello!

today I have been struggling a bit with an app for the new KinectSDK v2 and after giving him a couple of minutes I came to the conclusion, like always: the error It was my fault.

I explain the detail, in previous post I have shown as initializing READERS for the body, camera or the IR. However I think that I didn’t have any example code of what you should do whenever we not use more an object. It’s basically what we learned with .net Fwk 1.0:

Make a Dispose() and then Null.

   1: void MainWindow_Closing(object sender, CancelEventArgs e)

   2: {

   3:     if (_bodyReader != null)

   4:     {

   5:         _bodyReader.Dispose();

   6:         _bodyReader = null;

   7:     }

   8:     if (_colorReader != null)

   9:     {

  10:         _colorReader.Dispose();

  11:         _colorReader = null;

  12:     }

  13:     if (_kinectSensor != null)

  14:     {

  15:         _kinectSensor.Close();

  16:         _kinectSensor = null;

  17:     }

  18: }

What seems patently obvious, with the KinectSDK V2 is quite important because we now have the ability to run multiple apps using the sensor at the same time. To allow this there is an app called KinectService which is in charge of “distributing” the information from the sensor to the other apps. If you create an app that does not correctly free resources of the sensor, what you’re doing is leaving extra work for KinectService… and well, you can imagine the rest. Winking smile

Disclaimer:

“This is preliminary software and/or hardware and APIs are preliminary and subject to change

Saludos @ Home

El Bruno

image image image Google

2 responses to “[#KINECTSDK] Be careful when you don’t use a Kinect V2 App anymore”

  1. […] Be careful when you don’t use a Kinect V2 App anymorehttps://elbruno.com/category/msn-microsoft/kinect/kinect-sdk-v2/ […]

    Like

  2. […] time ago I wrote a post about the importance of properly destroy the objects of the KinectSdk when you close an app. The lesson today is similar, but bounded to work with a […]

    Like

Leave a reply to [#KINECTSDK] Caution when you work with frames! (dispose objects correctly) | El Bruno Cancel reply

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading