Exemplo n.º 1
0
        /// <summary>
        /// Draws joint points. Uses different colors to indicate the quality of joint tracking
        /// </summary>
        /// <param name="theSkeleton">The Skeleton Info</param>
        private void DrawJoints(VisualizableSkeletonInformation theSkeleton)
        {
            int thickness = 5;

            foreach (VisualizableJoint joint in theSkeleton.JointPoints.Values)
            {
                Line jointLine = new Line();

                jointLine.X1 = joint.JointCoordiantes.X - thickness;
                jointLine.X2 = joint.JointCoordiantes.X + thickness;
                jointLine.Y1 = joint.JointCoordiantes.Y;
                jointLine.Y2 = joint.JointCoordiantes.Y;
                jointLine.StrokeThickness = thickness * 2;

                jointLine.Stroke = this.greenBrush;

                if (JointTrackingState.Inferred == joint.TrackingState)
                {
                    jointLine.Stroke = this.yellowBrush;
                }
                else if (JointTrackingState.NotTracked == joint.TrackingState)
                {
                    jointLine.Stroke = this.redBrush;
                }

                this.SkeletonCanvas.Children.Add(jointLine);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Draws bones
        /// </summary>
        /// <param name="skeleton">PreProcessed Skeleton data</param>
        /// <param name="currentSkeletonBrush">Brush for the skeleton</param>
        private void DrawBodySegments(VisualizableSkeletonInformation skeleton, Brush currentSkeletonBrush)
        {
            this.DrawBodySegment(
                skeleton,
                currentSkeletonBrush,
                10,
                JointType.ShoulderCenter,
                JointType.Head);

            this.DrawBodySegment(
                skeleton,
                currentSkeletonBrush,
                5,
                JointType.HipCenter,
                JointType.Spine,
                JointType.ShoulderCenter);

            this.DrawBodySegment(
                skeleton,
                currentSkeletonBrush,
                2,
                JointType.ShoulderCenter,
                JointType.ShoulderLeft,
                JointType.ElbowLeft,
                JointType.WristLeft,
                JointType.HandLeft);

            this.DrawBodySegment(
                skeleton,
                currentSkeletonBrush,
                2,
                JointType.ShoulderCenter,
                JointType.ShoulderRight,
                JointType.ElbowRight,
                JointType.WristRight,
                JointType.HandRight);

            this.DrawBodySegment(
                skeleton,
                currentSkeletonBrush,
                4,
                JointType.HipCenter,
                JointType.HipLeft,
                JointType.KneeLeft,
                JointType.AnkleLeft,
                JointType.FootLeft);

            this.DrawBodySegment(
                skeleton,
                currentSkeletonBrush,
                4,
                JointType.HipCenter,
                JointType.HipRight,
                JointType.KneeRight,
                JointType.AnkleRight,
                JointType.FootRight);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Draw a collection of connected bones
        /// </summary>
        /// <param name="theSkeleton">Skeletal data</param>
        /// <param name="brush">Brush color</param>
        /// <param name="thickness">Thickness of the bone (we may use different thickenss for better visualization)</param>
        /// <param name="ids">Joint IDs to connect</param>
        private void DrawBodySegment(VisualizableSkeletonInformation theSkeleton, Brush brush, int thickness, params JointType[] ids)
        {
            Polyline polyline = new Polyline();

            for (int i = 0; i < ids.Length; ++i)
            {
                polyline.Points.Add(theSkeleton.JointPoints[ids[i]].JointCoordiantes);
            }

            polyline.Stroke          = brush;
            polyline.StrokeThickness = thickness;

            this.SkeletonCanvas.Children.Add(polyline);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the text for skeletal tracking quality (i.e. clipped bottom, etc)
 /// </summary>
 /// <param name="theSkeleton">Skeleton data</param>
 private void UpdateAdditionalSkeletalInfoField(VisualizableSkeletonInformation theSkeleton)
 {
     this.SkeletonQualityText.Text += theSkeleton.SkeletonQuality;
 }