Example #1
0
        void SkeletonFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
        {
            ReplaySkeletonData skeleton = e.SkeletonFrame.Skeletons[0];

            // Retrieve the tracked skeleton
            foreach (var s in e.SkeletonFrame.Skeletons)
            {
                if (s.TrackingState == SkeletonTrackingState.Tracked)
                {
                    skeleton = s;
                    break;
                }
            }

            for (int i = 0; i < skeleton.Joints.Count; i++)
            {
                switch (skeleton.Joints.ElementAt(i).ID)
                {
                    case (JointID.Head):
                        Head = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.HandLeft):
                        HandLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.HandRight):
                        HandRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ShoulderCenter):
                        ShoulderCenter = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ShoulderRight):
                        ShoulderRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ShoulderLeft):
                        ShoulderLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.AnkleLeft):
                        AnkleLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.AnkleRight):
                        AnkleRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.FootRight):
                        FootRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.FootLeft):
                        FootLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.WristLeft):
                        WristLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.WristRight):
                        WristRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.KneeRight):
                        KneeRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.KneeLeft):
                        KneeLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ElbowLeft):
                        ElbowLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ElbowRight):
                        ElbowRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.HipCenter):
                        HipCenter = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                }
            }
        }
 void replay_SkeletonFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
 {
     ProcessFrame(e.SkeletonFrame);
 }
Example #3
0
 void SkeletonFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
 {
 }
 internal void ReplayFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
 {
     frame += 1;
     FrameNumber.Text = "Frame Number: " + frame;
     ProcessSkeletons(e.SkeletonFrame.Skeletons);
 }
        void Replay_SkeletonFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs args)
        {
            // Reallocate if necessary
            if (null == skeletonData || skeletonData.Length != args.SkeletonFrame.Skeletons.Length)
            {
                skeletonData = new Skeleton[args.SkeletonFrame.Skeletons.Length];
            }

            args.SkeletonFrame.Skeletons.CopyTo(skeletonData, 0);
            skeletonDrawn = false;
        }
Example #6
0
        /// <summary>
        /// On replay skeleton event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ReplaySkeletonFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
        {
            ReplaySkeletonFrame replaySkeletonFrame = e.SkeletonFrame;

            if (replaySkeletonFrame == null)
            {
                return;
            }

            //this.SkeletonDisplayManager.Draw(replaySkeletonFrame.Skeletons, false);
        }
Example #7
0
        void SkeletonFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
        {
            ReplaySkeletonData skeleton = e.SkeletonFrame.Skeletons[0];

            // Retrieve the tracked skeleton
            foreach (var s in e.SkeletonFrame.Skeletons)
            {
                if (s.TrackingState == SkeletonTrackingState.Tracked)
                {
                    skeleton = s;
                    break;
                }
            }

            Joint leftHandUnscaled = new Joint();
            Joint rightHandUnscaled = new Joint();

            Vector3 skeletonPosition = new Vector3(skeleton.Position.X, skeleton.Position.Y, skeleton.Position.Z);
            barycenterHelper.Add(skeletonPosition, skeleton.TrackingID);
            IsStable = barycenterHelper.IsStable(skeleton.TrackingID);

            for (int i = 0; i < skeleton.Joints.Count; i++)
            {
                switch (skeleton.Joints.ElementAt(i).ID)
                {
                    case (JointID.Head):
                        Head = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.HandLeft):
                        HandLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        leftHandUnscaled = skeleton.Joints.ElementAt(i);
                        break;
                    case (JointID.HandRight):
                        HandRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        rightHandUnscaled = skeleton.Joints.ElementAt(i);
                        break;
                    case (JointID.ShoulderCenter):
                        ShoulderCenter = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ShoulderRight):
                        ShoulderRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ShoulderLeft):
                        ShoulderLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.AnkleLeft):
                        AnkleLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.AnkleRight):
                        AnkleRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.FootRight):
                        FootRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.FootLeft):
                        FootLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.WristLeft):
                        WristLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.WristRight):
                        WristRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.KneeRight):
                        KneeRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.KneeLeft):
                        KneeLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ElbowLeft):
                        ElbowLeft = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.ElbowRight):
                        ElbowRight = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                    case (JointID.HipCenter):
                        HipCenter = GetScaledPosition(skeleton.Joints.ElementAt(i));
                        break;
                }
            }
            RaiseSkeletonUpdate(new SkeletonEventArgs()
            {
                LeftHandPosition = leftHandUnscaled.Position,
                RightHandPosition = rightHandUnscaled.Position
            });
        }