none
Storing kinect's v2.0 motion to BVH file RRS feed

  • Question

  • Hi all, I saw a post that got no answer and I saw wondering if the microsoft community would have an idea about this specific problem. The post (just under) was not written by me, I am simply trying to get an answer for the problem everywhere I can, and I thought here is a good place to start. 

    I want to store motion capture from kinect 2 to bvh file. I found code which implements motion capturing to bvh file but for kinect 1 which can be found https://bitbucket.org/nguyenivan/kinect2bvh.v2/src/d19ccd4e76318e86241351adada6b7752aa9e1b5?at=master. I study the code but I found Several things that I can not understand. Firstly is there any implementation for storing motion to bvh file in kinect 2.0. Secondly in the mention code I try to undestand what is exactly the Skeleton skel object which can be found in several places in code. Any idea about this?

    EDIT: I tried to change Skeleton skel to Body skel which I think is the correspondant object for kinect SDK 2.0. However I got error when I try to get the position of the body:

    tempMotionVektor[0] = -Math.Round( skel.Position.X * 100,2);
    tempMotionVektor[1] = Math.Round( skel.Position.Y * 100,2) + 120;
    tempMotionVektor[2] = 300 - Math.Round( skel.Position.Z * 100,2);

    I got errros when calling the function Position for the Body skel. How can I retrieve the X, Y, Z of the skeleton in sdk 2.0?? I tried to change the above three lines to:

    tempMotionVektor[0] = -Math.Round(skel.Joints[0].Position.X * 100, 2);
    tempMotionVektor[1] = Math.Round(skel.Joints[0].Position.Y * 100, 2) + 120;
    tempMotionVektor[2] = 300 - Math.Round(skel.Joints[0].Position.Z * 100, 2);

    EDIT: Basically I managed to store the a bvh file after combining bodyBasicsWPF and kinect2bvh. However it seems that the skeleton I am storing is not efficient. There are strange movements in elbows. I am trying to understand if I have to change something in the file kinectSkeletonBVH.cp. More specifically what are the changes in the joint axis orientation for the kinect 2 version. How can I change the following line: skel.BoneOrientations[JointType.ShoulderCenter].AbsoluteRotation.Quaternion; I tried to change that line with skel.JointOrientations[JointType.ShoulderCenter].Orientation. Am I right? I am using the following code to add the joint to BVHBone objects:

    BVHBone hipCenter = new BVHBone(null, JointType.SpineBase.ToString(), 6, TransAxis.None, true);
    BVHBone hipCenter2 = new BVHBone(hipCenter, "HipCenter2", 3, TransAxis.Y, false);
    BVHBone spine = new BVHBone(hipCenter2, JointType.SpineMid.ToString(), 3, TransAxis.Y, true);
    BVHBone shoulderCenter = new BVHBone(spine, JointType.SpineShoulder.ToString(), 3, TransAxis.Y, true);
    
    BVHBone collarLeft = new BVHBone(shoulderCenter, "CollarLeft", 3, TransAxis.X, false);
    BVHBone shoulderLeft = new BVHBone(collarLeft, JointType.ShoulderLeft.ToString(), 3, TransAxis.X, true);
    BVHBone elbowLeft = new BVHBone(shoulderLeft, JointType.ElbowLeft.ToString(), 3, TransAxis.X, true);
    BVHBone wristLeft = new BVHBone(elbowLeft, JointType.WristLeft.ToString(), 3, TransAxis.X, true);
    BVHBone handLeft = new BVHBone(wristLeft, JointType.HandLeft.ToString(), 0, TransAxis.X, true);
    
    BVHBone neck = new BVHBone(shoulderCenter, "Neck", 3, TransAxis.Y, false);
    BVHBone head = new BVHBone(neck, JointType.Head.ToString(), 3, TransAxis.Y, true);
    BVHBone headtop = new BVHBone(head, "Headtop", 0, TransAxis.None, false);

    I can't understand where inside the code calculate the axis for every Joint.

    Friday, June 24, 2016 9:06 AM