Kinect:仅跟踪使用骨骼跟踪的第一个玩家 [英] Kinect: Tracking only the first player using skeletal tracking

查看:74
本文介绍了Kinect:仅跟踪使用骨骼跟踪的第一个玩家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助,从kinect骨架基础教程视频中获取代码。

Hi i need some help with codes taken from a kinect skeletal basic tutorial video.

我尝试了代码,但有些错误是我无法解决的,有人可以帮助我,如果可能的话,请提前感谢。对于带有"

I tried the codes but there are errors that i couldnt solve, can someone help me with it if possible thanks in advance. For the line with "

Skeleton first = (from s in allSkeletons
                                  where s.TrackingState == SkeletonTrackingState.Tracked
                                  select s).FirstOrDefault();

" allSkeletons单词带有下划线,表示错误,无法找到源类型的查询模式的实现  "Microsoft.Kinect.Skeleton []。 '哪里'找不到。你错过了'System.Linq'的引用或using指令吗?

" the allSkeletons word is underlined with the error stated as, could not find an implementation of the query pattern for source type  'Microsoft.Kinect.Skeleton[]. 'Where' not found. Are you missing a reference or a using directive for 'System.Linq'?

基本上我想编写一个代码来跟踪第一个玩家,当第一个跟踪的玩家离开使用骨骼跟踪时做某事。下一个进入的骨架将不会被跟踪。无论如何我能做到吗?

Basically i wanted to write a code to be able to track the first player and do something when the first player that is track leaves using skeletal tracking. Which ever next skeleton that steps in will not be tracked. Is there anyway i can do this?

以下是完整的代码。感谢您花时间阅读!
$

Below is the full code. Thanks for taking time to read!

Zong Li

void sensor_AllFrameReady(Object sender, AllFramesReadyEventArgs e)
        {
            bool Closing = false;
            const int skeletonCount = 0;
            Skeleton[] allSkeletons = new Skeleton[skeletonCount];

            if (Closing)
            {
                return;
            }

            //Get a skeleton
            Skeleton First = GetFirstSkeleton(e);

            if (First == null)
            {
                Process.Start("wmplayer.exe", "C:\\Users\\User\\Downloads\\Test.wma");
                return;
            }
        }


        Skeleton GetFirstSkeleton(AllFramesReadyEventArgs e)
        {
            bool Closing = false;
            const int skeletonCount = 0;
            Skeleton[] allSkeletons = new Skeleton[skeletonCount];

            using (SkeletonFrame skeletonFrameData = e.OpenSkeletonFrame())
            {
                if (skeletonFrameData == null)
                {
                    return null;
                }


                skeletonFrameData.CopySkeletonDataTo(allSkeletons);
                //get first tracked skeleton
                Skeleton first = (from s in allSkeletons
                                  where s.TrackingState == SkeletonTrackingState.Tracked
                                  select s).FirstOrDefault();

                return first;
            }
        }

推荐答案

您需要构建其他技术来唯一地识别骨架是否属于特定的人。 Kinect不保留关于如何为一个人生成骨架的状态信息。它所能做的只是分析数据并查找人类
表格并绘制该地区的联合位置。

You need to build additional technology to uniquely identify if a skeleton belongs to a particular person. The Kinect does not retain state information about how the skeleton was generated for a person. All it can do is analyze the data and look for human forms and plot joint locations for the area.

如果一个人离开视野并返回,Kinect将不会知道它是同一个人。

If a person leaves the Field of View and returns, the Kinect will not know it is the same person.


这篇关于Kinect:仅跟踪使用骨骼跟踪的第一个玩家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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