Kinect骨骼跟踪不起作用

时间:2012-05-04 15:07:10

标签: c# kinect

所以目前我有一个bool PersonDetected,总是设置为false 除非检测到骨架。但目前,SkeletonTrackingState被标记为Tracked,但PersonDetected仍设为false。提前致谢

我的代码

Skeleton skeletons = new Skeleton();

            if ((skeletons.TrackingState == SkeletonTrackingState.Tracked ||
                skeletons.TrackingState == SkeletonTrackingState.PositionOnly) &
                skeletons.TrackingState != SkeletonTrackingState.NotTracked)
                {
                    PersonDetected = true;
                }

2 个答案:

答案 0 :(得分:1)

我发现它没有注册的原因是因为skeletons只是一个变量而不是Skeleton被跟踪,所以我添加了以下代码以确保它有效:

Skeleton skeletons = new Skeleton();

            skeletons = (from s in allSkeletons
                         where s.TrackingState == SkeletonTrackingState.Tracked ||
                         s.TrackingState == SkeletonTrackingState.PositionOnly
                         select s).FirstOrDefault();

            if (skeletons == null)
            {
                return;
            }

            if ((skeletons.TrackingState == SkeletonTrackingState.Tracked ||
                skeletons.TrackingState == SkeletonTrackingState.PositionOnly))
            {
                PersonDetected = true;
            }

答案 1 :(得分:0)

调试“diff”。我敢打赌它高于9

之后调试部分,你正在增加diff。