Kinect User Discovery

I am developing an application. When the kinect sensor detects a skeleton that can work on it, if another person approaches an existing user, it detects a second person.
I want to limit the user when the kinect sensor first detects it, if another user comes in, it should not detect another.
thank you in advance

+3
source share
4 answers

Also see Jurgeon D's answer to finding the Kinect SDK player as it deals with the skeleton index. @Fixus is also right as you can use an ID. But if you mean more than two people, then only one is detected, that is, not programming, that is, in the Kinect and @FelixK equipment. was right.

Skeleton index

void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { SkeletonFrame sf = e.SkeletonFrame; //check which skeletons in array are active and // use that array indexes for player index SkeletonData player1 = sf.Skeletons[playerIndex1]; SkeletonData player2 = sf.Skeletons[playerIndex2]; } 

Skeletal identifiers

 void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { SkeletonFrame sf = e.SkeletonFrame; if (sf.TrackingState == SkeletalTrackingState.Tracked) { int ID1 = sf.TrackingID; } 

Also a code for detecting people

  DepthImageFrame depthFrame; short[] rawDepthData = new short[depthFrame.PixelDataLength]; depthFrame.CopyPixelDataTo(rawDepthData); Byte[] pixels = new byte[depthFrame.Height * depthFrame.Width * 4]; int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask; if (player > 0) { //do something } 
+7
source

Kinect will identify a new user because it is his job :) BUT remember that each user has his own identifier, so you always know that the first user is the first and the second is the second. Thus, you can only work on the skeleton of the user with whom you want to work with

+4
source

If I understand your question correctly, this is impossible, you cannot change the behavior of Kinects and how it detects users (if there is nothing in the Framework, I don’t think there is anything).

You must solve this in your code.

+3
source

In one of kinect quick launch tutorials, there is a method for detecting only one user. I tried this for my application and it worked.

 using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame()) { if (skeletonFrame == null) return; Skeleton[] skeletons= new Skeleton[skeletonFrame.SkeletonArrayLength]; skeletonFrame.CopySkeletonDataTo(skeletons); if (skeletons.All(s => s.TrackingState == SkeletonTrackingState.NotTracked)) return; Skeleton skeleton = (from s in skeletons where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault(); if (skeleton == null) return; // TODO: Do something to the skeleton data... } 
0
source

Source: https://habr.com/ru/post/980740/


All Articles