Correction Matrix RRS feed

  • General discussion

  • My questions are about this code posted by Mr. Carmine Sirignano:

    Windows.Kinect.Vector4 clipPlane = bodyFrame.FloorClipPlane; Vector3 normal = new Vector3(clipPlane.X, clipPlane.Y, clipPlane.Z); float height = clipPlane.W // be sure the values are valid if( (Mathf.Abs(height) > float.Epsilon) && (Mathf.Abs(normal.magnitude) > float.Epsilon)) { Matrix4x4 correctionMatrix = Matrix4x4.identity; Vector3 up = -normal; up.Normalize(); Vector3 forward = Vector3.Cross(up, Vector3.right); forward.Normalize(); Vector3 right = Vector3.Cross(forward, up); right.Normalize(); // validate this works for you matrix.m00 = right.x; matrix.m01 = right.y; matrix.m02 = right.z; matrix.m10 = up.x; matrix.m11 = up.y; matrix.m12 = up.z; matrix.m20 = forward.x; matrix.m21 = forward.y; matrix.m22 = forward.z; matrix.m13 = -height; // when y=0, should be a point on floor // since feet should be on the floor, you may only need to check the head joint }

    1. In the line:

    Vector3 up = -normal;

    Why is put as negative? Kinect estimates the plane equation with the normal point down?

    2. Because of this definition:

    Vector3 forward = Vector3.Cross(up, Vector3.right);

    I notice that the new X and Z axes are flipped with respect to the originals. that is, the new right is what the kinect sees at its right and not the user's right. Am i correct?

    What i mean is that, in order to the axes to remain with the same orientation 

    this line had to be:

    Vector3 forward = Vector3.Cross(Vector3.right, up);

    But, again, this proposed definition would make the vector "forward" to not point to the user's forward direction.

    3. So my final statement (silly question since it depends on the application purposes ) would be: Why this change of reference frame?

    Thanks beforehand for all support given.

    Fito - DeFacto Ing.

    Thursday, November 27, 2014 9:24 PM

All replies

  • The code is provided as a sample of how to interpret the values returned from the API(hence the comment // validate this works for you).

    Remember Kinect is returning joint information based on the Kinect world space. This function is to negate that information and align the body to the camera plane. If you have your own implementation for another scenario, feel free to share.

    Carmine Sirignano - MSFT

    Monday, December 1, 2014 7:26 PM