如何跟踪一个人连Kinect(trackingID) [英] How to track ONE person with Kinect (trackingID)

查看:2585
本文介绍了如何跟踪一个人连Kinect(trackingID)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想追踪的第一人,并利用这个人的右手,我提出的申请进行导航。



我可以接管光标,现在我只是想只有一个人被跟踪。所以基本上,当一个人在导航程序,并且还有人走在他身后,或正在寻求与这个家伙,如果他们移动,Kinect的不应该承认任何人。



我如何能实现这一点,我知道这件事情与 trackingId 但什么? :■

 的foreach(SkeletonData S IN allSkeletons.Skeletons)
{

如果( s.TrackingState == SkeletonTrackingState.Tracked)
{
如果(s.TrackingID == 0)
{

的foreach(在s.Joints联合联合)
{
}
}
}
}


解决方案

跟踪每个人都有一个播放器的索引。只是忽略玩家与其他索引。结果,
玩家指数是深度流的图像中的数据的一部分。你必须将其解压缩:

  INT playerIdx = depthFrame16 [I16]放大器; 0×07; 

为了得到这个信息,你必须初始化Kinect的运行正常:

  _kinectNui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | ... 

在这里看到更多的相关信息:
HTTP: //www.codeproject.com/KB/dotnet/KinectGettingStarted.aspx



我完全从MS推荐这个视频教程:
http://research.microsoft.com/apps/video/?id=152249



如果您在与该SDK来的ShapeGameDemo看你可以看到他们是如何做到这一点(他们仅仅使用了skeletion的索引数组中):

  INT playerId = 0; 
的foreach(在skeletonFrame.Skeletons SkeletonData数据){
如果(SkeletonTrackingState.Tracked == data.TrackingState){
Player播放器;
如果(players.ContainsKey(playerId))
球员=玩家[playerId]
,否则
球员=新播放器(playerId);
}
playerId ++;
}



简化的东西,你可以做到这一点(使用代码):

  INT myPlayerIndex = 0; //可能为0,因为你是第一个人进入了Kinect的范围
INT playerId = 0;
的foreach(SkeletonData S IN allSkeletons.Skeletons){
如果(playerId = myPlayerIndex!)
继续;

如果(s.TrackingState == SkeletonTrackingState.Tracked){
的foreach(在s.Joints联合联合)
{
}
}
playerId ++;
}

要在这里圆东西是在MS论坛,解释了它一个类似的问题:
HTTP: //social.msdn.microsoft.com/Forums/en-US/kinectsdk/thread/d821df8d-39ca-44e3-81e7-c907d94acfca


I would like to track the first person, and use this person's right hand to navigate in the application that I made.

I can take over the cursor, now I just want only one person being tracked. So basically when one person is navigating in the program, and there are people walking behind him or are looking with this guy, if they move, the kinect shouldn't recognise anyone else.

How can I implement this, I know it's something with the trackingId but what? :s

        foreach (SkeletonData s in allSkeletons.Skeletons)
        {

                if (s.TrackingState == SkeletonTrackingState.Tracked)
                {
                    if (s.TrackingID == 0)
                    {

                        foreach (Joint joint in s.Joints)
                        {
                        }
                    }
                }
        }

解决方案

Every tracked person has a player index. Just ignore players with other indexes.
The player index is part of the data in the depth stream image. You have to extract it:

int playerIdx = depthFrame16[i16] & 0x07;

In order to get this info you have to initialize your Kinect Runtime correctly:

_kinectNui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | ....

See here for more infos: http://www.codeproject.com/KB/dotnet/KinectGettingStarted.aspx

I totally recommend this video tutorial from MS: http://research.microsoft.com/apps/video/?id=152249

If you look in the ShapeGameDemo that is coming with the SDK you can see how they do it. (They just use the index of the skeletion in the array):

int playerId = 0;
foreach (SkeletonData data in skeletonFrame.Skeletons) {
   if (SkeletonTrackingState.Tracked == data.TrackingState) {
      Player player;
      if (players.ContainsKey(playerId))
         player = players[playerId];
      else
         player = new Player(playerId);
   }
   playerId++;
}

Simplifying things you can do that (using your code):

int myPlayerIndex = 0; //probably 0 since you are the first person entered the kinect scope
int playerId = 0;
foreach (SkeletonData s in allSkeletons.Skeletons) {
   if(playerId != myPlayerIndex)
      continue;       

   if (s.TrackingState == SkeletonTrackingState.Tracked) {
      foreach (Joint joint in s.Joints)
      {
      }
   }
   playerId++;
}

To round things up here is a similar question in an MS forum that explains it: http://social.msdn.microsoft.com/Forums/en-US/kinectsdk/thread/d821df8d-39ca-44e3-81e7-c907d94acfca

这篇关于如何跟踪一个人连Kinect(trackingID)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆