0
votes

I currently have a functioning Kinect skeleton. On the bones, I want to place an image of a character's arm, leg, head, etc. How would I go about doing this? I assume I have to somehow add the image when I'm drawing the bones, but other than that I'm not sure what to do. Here is the function where I draw the bones. Any help would be appreciated.

 private void DrawBonesAndJoints(DrawingContext drawingContext)
        {
            if (this.ShowBones)
            {
                // Render Torso
                this.DrawBone(drawingContext, JointType.Head, JointType.ShoulderCenter);
                this.DrawBone(drawingContext, JointType.ShoulderCenter, JointType.ShoulderLeft);
                this.DrawBone(drawingContext, JointType.ShoulderCenter, JointType.ShoulderRight);
                this.DrawBone(drawingContext, JointType.ShoulderCenter, JointType.Spine);
                this.DrawBone(drawingContext, JointType.Spine, JointType.HipCenter);
                this.DrawBone(drawingContext, JointType.HipCenter, JointType.HipLeft);
                this.DrawBone(drawingContext, JointType.HipCenter, JointType.HipRight);

                // Left Arm
                this.DrawBone(drawingContext, JointType.ShoulderLeft, JointType.ElbowLeft);
                this.DrawBone(drawingContext, JointType.ElbowLeft, JointType.WristLeft);
                this.DrawBone(drawingContext, JointType.WristLeft, JointType.HandLeft);

                // Right Arm
                this.DrawBone(drawingContext, JointType.ShoulderRight, JointType.ElbowRight);
                this.DrawBone(drawingContext, JointType.ElbowRight, JointType.WristRight);
                this.DrawBone(drawingContext, JointType.WristRight, JointType.HandRight);

                // Left Leg
                this.DrawBone(drawingContext, JointType.HipLeft, JointType.KneeLeft);
                this.DrawBone(drawingContext, JointType.KneeLeft, JointType.AnkleLeft);
                this.DrawBone(drawingContext, JointType.AnkleLeft, JointType.FootLeft);

                // Right Leg
                this.DrawBone(drawingContext, JointType.HipRight, JointType.KneeRight);
                this.DrawBone(drawingContext, JointType.KneeRight, JointType.AnkleRight);
                this.DrawBone(drawingContext, JointType.AnkleRight, JointType.FootRight);
            }

            if (this.ShowJoints)
            {
                // Render Joints
                foreach (JointMapping joint in this.JointMappings.Values)
                {
                    Brush drawBrush = null;
                    switch (joint.Joint.TrackingState)
                    {
                        case JointTrackingState.Tracked:
                            drawBrush = this.trackedJointBrush;
                            break;
                        case JointTrackingState.Inferred:
                            drawBrush = this.inferredJointBrush;
                            break;
                    }

                    if (drawBrush != null)
                    {
                        drawingContext.DrawEllipse(drawBrush, null, joint.MappedPoint, JointThickness * this.ScaleFactor, JointThickness * this.ScaleFactor);
                    }
                }
            }
        }
1

1 Answers

0
votes

First go through some basic animation procedures like in this skeletal tracking scenarios. Skeletal Tracking Fundamentals . It contains what you want like drawing images on skeletons.