Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kinect Manipulate Skeleton Data

Tags:

c#

.net

kinect

I have a Skeleton skeleton which comes from the SkeletonFrameReady event. And I have a function to draw skeletons on the windows,

void DrawSkeleton(Skeleton s),

which takes the Skeleton as the input and draws 2D image of skeleton to my window.

Now, I want to change, for example, x and y value of the right hand and draw it on the window using the same function, void DrawSkeleton(Skeleton s).

However, when I try to do something like:

skeleton.Joints[JointType.HandRight].Position.X = 3;

It doesn't allow me to do that:

Cannot modify the return value of 'Microsoft.Kinect.Joint.Position' because it is not a variable.

which is probably because Position is not a variable, is a property.

Question:

How can I duplicate a Skeleton object and change the Position values of Joints on that object.

like image 721
Sait Avatar asked Jul 31 '12 12:07

Sait


1 Answers

Yes you can.

You simply make a new Position object and overwrite the Position you like.

var movedPosition = new SkeletonPoint
{
    X = (float)(mouseJoint.Position.X - 0.4),
    Y = (float)(mouseJoint.Position.Y - 0.3)
};

var movedJoint = new Joint
{
    Position = movedPosition
};

This is an example from an actual project where we wanted to correct the position of the hand to adjust the mouse without actually modifying the skeleton

like image 111
Yoeri Avatar answered Oct 17 '22 22:10

Yoeri