Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to lock in a single skeleton

Tags:

c#

sdk

kinect

I'm creating an application using the SDK, in which I must have only one user and lock it so if somebody else comes along, even if that person is closer to Kinect, the application keeps tracking the first skeleton it tracked.

From the msdn library I found I could use the Skeletom Stream Class:

Property: AppChoosesSkeletons = Gets or sets a Boolean value that determines whether the application chooses which skeletons to track.

Method: SkeletonStream.ChooseSkeletons (Int32) = Chooses one skeleton to track. Syntax: public void ChooseSkeletons (int trackingId1)

I'm not very good at programming and I'm using C#, I thought of writing something like the code down, but it says that I'm using an Invalid Expression.

SkeletonFrame SFrame = e.OpenSkeletonFrame();
if (SFrame == null) return;

Skeleton[] Skeletons = new Skeleton[SFrame.SkeletonArrayLength];
SFrame.CopySkeletonDataTo(Skeletons);

int firstSkeleton = Skeletons[0].TrackingId;
sensor.SkeletonStream.ChooseSkeletons(int firstSkeleton);

if (firstSkeleton == null)
return;

if (SkeletonTrackingState.Tracked == firstSkeleton.TrackingState)
{
//body...

The problem is with the sensor.SkeletonStream.ChooseSkeletons(int firstSkeleton, it says int firstSkeleton cannot be used.
Could someone please help me? Thanks!

like image 631
Paola Avatar asked Apr 17 '12 10:04

Paola


1 Answers

sensor.SkeletonStream.ChooseSkeletons(int firstSkeleton);

What do you want to achive with this line ?

Imo if you want to cast firstSkeleton to int write it like this:

sensor.SkeletonStream.ChooseSkeletons((int) firstSkeleton);

if you don`t want to cast it and just to give and int variable to methid just write:

sensor.SkeletonStream.ChooseSkeletons(firstSkeleton);
like image 134
Fixus Avatar answered Sep 21 '22 18:09

Fixus