[#KINECTSDK] Be careful when you don’t use a Kinect V2 App anymore

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 thoughts on “[#KINECTSDK] Be careful when you don’t use a Kinect V2 App anymore

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.