示例#1
0
            private void BuildFrame(SkeletonRenderFrame frame)
            {
                // Converts the frame into a collection of GestureTrees and adds it to the MovingGestureTree.

                int      milliseconds = DateTimeUtilities.DifferenceInMilliseconds(gestureStartDateTime, frame.TimeStamp);
                TimeSpan frameTime    = TimeSpan.FromMilliseconds(milliseconds);
                TimeSpan minDeltaTime = frameTime < captureTimeTolerance ? TimeSpan.Zero : frameTime.Subtract(captureTimeTolerance);
                TimeSpan maxDeltaTime = frameTime.Add(captureTimeTolerance);

                // RBakerFlag -> Ignore head and spine for now.
                //GestureTree headAndSpineTree = new GestureTree(
                //    SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.HeadAndSpine),
                //    GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                //movingGestureTree.GestureTrees.Add(headAndSpineTree);

                GestureTree rightArmTree = new GestureTree(
                    SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.RightArm),
                    GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);

                movingGestureTree.GestureTrees.Add(rightArmTree);

                GestureTree leftArmTree = new GestureTree(
                    SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.LeftArm),
                    GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);

                movingGestureTree.GestureTrees.Add(leftArmTree);

                // RBakerFlag -> Ignore legs for now.
                //GestureTree rightLegTree = new GestureTree(
                //   SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.RightLeg),
                //   GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                //movingGestureTree.GestureTrees.Add(rightLegTree);

                //GestureTree leftLegTree = new GestureTree(
                //   SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.LeftLeg),
                //   GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                //movingGestureTree.GestureTrees.Add(leftLegTree);
            }
            private void BuildFrame(SkeletonRenderFrame frame)
            {
                // Converts the frame into a collection of GestureTrees and adds it to the MovingGestureTree.

                int milliseconds = DateTimeUtilities.DifferenceInMilliseconds(gestureStartDateTime, frame.TimeStamp);
                TimeSpan frameTime = TimeSpan.FromMilliseconds(milliseconds);
                TimeSpan minDeltaTime = frameTime < captureTimeTolerance ? TimeSpan.Zero : frameTime.Subtract(captureTimeTolerance);
                TimeSpan maxDeltaTime = frameTime.Add(captureTimeTolerance);

                // RBakerFlag -> Ignore head and spine for now.
                //GestureTree headAndSpineTree = new GestureTree(
                //    SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.HeadAndSpine),
                //    GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                //movingGestureTree.GestureTrees.Add(headAndSpineTree);

                GestureTree rightArmTree = new GestureTree(
                    SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.RightArm),
                    GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                movingGestureTree.GestureTrees.Add(rightArmTree);

                GestureTree leftArmTree = new GestureTree(
                    SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.LeftArm),
                    GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                movingGestureTree.GestureTrees.Add(leftArmTree);

                // RBakerFlag -> Ignore legs for now.
                //GestureTree rightLegTree = new GestureTree(
                //   SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.RightLeg),
                //   GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                //movingGestureTree.GestureTrees.Add(rightLegTree);

                //GestureTree leftLegTree = new GestureTree(
                //   SkeletonMiningUtilities.GetJointCollection(frame.Skeleton, SkeletonMiningUtilities.SkeletonJointCollection.LeftLeg),
                //   GestureStandardToleranceParameters.JointAngleTolerance, minDeltaTime, maxDeltaTime);
                //movingGestureTree.GestureTrees.Add(leftLegTree);
            }