LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft Kinect Development SDK 1.0: Accessing element of KinectSensors collection.

Hello,

 

With the creation of the released Microsoft Kinect SDK, there have been some fundamental changes to how we can access the functionality of the Kinect.

Here is the example labview code from LabView hackers, that I am trying to modify for the new SDK.

http://labviewhacker.com/kinect.php (Attachment Initialize Kinect)

 

Now the issue I am having is as follows:

Previously the SDK accessed a Runtime object with a public constructor, this constructor then allowed use of such methods as initialize.

This follows what we can find at: http://www.i-programmer.info/programming/hardware/2623-getting-started-with-microsoft-kinect-sdk.htm...

 

Now wtih the new SDK the object I am trying to access is the static object KinectSensor, which as a collection of KinectSensors. 

I used this document to figure out how to do this: http://zone.ni.com/reference/en-XX/help/371361F-01/lvhowto/create_net_object/

 

For reference, here is how I need to initialize the kinect in the new SDK: http://www.i-programmer.info/ebooks/practical-windows-kinect-in-c/3725-getting-started-with-windows-...

 

Now the problem is, I can access the object KinectSensors, which is the static collection of all the kinects attached to my computer.  But I do not know how to access a single kinect out of that collection.  (As seen in the attached file initialize)

In this attachment, I can access the KinectSensors collection, but I do not know how to access a single element of that collection.

I wish this were as easy as accessing the first element in an array, but I'm afraid it isn't.  

 

Thank you for reading this, and please forgive my lack of knowledge on this subject.  I am learning C++ at the moment and have no experience working with .net.

 

Download All
Message 1 of 16
(4,120 Views)

Here's a little update for anyone following this.

 

I can access a specific Kinect sensor now, and I believe I should be initializing it correctly. 

My initialization sub vi is attached as well as what I have for my callback handler vi's.

This is early alpha software and I will hopefully be editing this tomorrow with a much more complete API.  But at least looking at this will help anyone who is working on getting the SDK 1.0 to work.

 

Message 2 of 16
(4,096 Views)

Sorry, I lost track of this.  I'll look over your work (tomorrow hopefully) with my own Kinect and see where it gets me.  Thanks for your efforts.  Perhaps, I can be of assistance after looking through your code.

The Colex Group
Lead Software Engineer
Certified LabVIEW Developer
0 Kudos
Message 3 of 16
(3,949 Views)

Please look at the attached files.  I have modified your callback vi's to both work (mostly).  Things are a bit cleaned up.  Run code.vi is a simple vi that does the initialization, pulls from the queues, and closes everything down, though it doesn't seem to close everything just yet.

 

On my machine, the images are duplicated and take up the top two quarters of the image control.  Does this behavior exist on your machine?

The Colex Group
Lead Software Engineer
Certified LabVIEW Developer
0 Kudos
Message 4 of 16
(3,936 Views)

Rather, this attachment.

The Colex Group
Lead Software Engineer
Certified LabVIEW Developer
0 Kudos
Message 5 of 16
(3,932 Views)

I just thought I was done for the day.  Here is yet another version that works.  Both color image and depth image.  I have taken the liberty of coloring the depth image to provide information regarding too close/far.  Close (<900mm) is red (255), far (>4000mm) is blue (255), and in range displays as green (varies with distance).  You'll notice that some resolution is lost by doing this, as the 13 bit depth number is reduced to 8.  I have placed the grayscale code in a case structure for easy access.

 

I cleaned up all of the VI's.  Feel free to reorganize as desired.

 

Remaining issues:

 

- sometimes the kinect hangs

- the modification used to fix the color image does not make sense to me

- I would propose moving these loose vi's into a project or library and standardizing them a bit

- images flicker some

 

Note:

 

This is using the latest SDK from Microsoft.

The Colex Group
Lead Software Engineer
Certified LabVIEW Developer
0 Kudos
Message 6 of 16
(3,925 Views)

Jordankuehn, Thanks for your contribution.

 

I also tried to use sdk 1.0 with labview but I found it is not that easy.

 

Your code works well with my machine.

 

Then, how could we call joint tracking data from the library??

0 Kudos
Message 7 of 16
(3,911 Views)

Thank you very much for this work.  I had no idea what I was doing wrong that made my version not work.

0 Kudos
Message 8 of 16
(3,873 Views)

I have modified the software to take care of the hanging issue.  It had to do with generating a new image for every frame and not disposing of them, rapidly eating up the memory. 

 

I have begun working on a skeleton tracking setup, but it is not as easy as the other two images.  Feel free to look through the skeleton event callback VI and see what I'm working on.  I got it to track my hand once, but have not had great success since then, but haven't had time to figure out what's going wrong. This site provides a decent walkthough of the different function calls.

 

I haven't had time to revisit the old NI API and see if they handle skeletons or not, but at some point this could probably be merged into that API to make it work again.  Not sure how much of this is duplicate work.

 

 

The Colex Group
Lead Software Engineer
Certified LabVIEW Developer
0 Kudos
Message 9 of 16
(3,852 Views)

Hello,

I have a problem with the dll of the Kinect. I have the Kinect for Windows that use the SDK v1.0 and I tryed to use the files you posted on this forum but they don't work in my machine.

I found the dll of the Kinect in C:\Programmi\MIcrosoft SDKs\Kinect\v1.0\Assemblies\Microsoft.Kinect.dll and Labview found an error in the file.

I send you my error, can you help me? Thanks

0 Kudos
Message 10 of 16
(3,766 Views)