BodyHelper.cpp in KinectImageProcessor sample do not send Z position to Javasript raw data RRS feed

  • Question

  • I've made an HTML5 project with the new SDK K4W and unfortunately i had to modify the KinectImageProcessor (BodyHelper.cpp) in the the Body Basics HTML source to send back the Z position raw data to Javascript.

    You can see my changes here:

    Maybe i miss something ?  It's work for me, but i want to know if it's a good way to fix the issue.


    Thursday, May 21, 2015 3:05 PM


  • You will notice that we are using the coordinate mapper to map the Body joint positions into Depth Space.  This allows us to render the body images in a 2D texture the size of a body frame, and optionally overlay the skeleton on top of the depth or IR image.  If we used the coordinate mapper to map to Color space, you could overlay the skeleton on top of the color frames.

    A DepthSpacePoint only has an x and a y component.  By passing in position.Z to a new z value, you are changing the space that the z component is in with respect to the x and y, so it will not be accurate.

    Additionally, we are rendering the body as a 2D image, so the z component would not be used - see default.js:

    // Draw a bone line on canvas
    var drawBone = function (
            bodyContext.strokeStyle = boneColor;
            bodyContext.lineWidth = boneThickness;
            bodyContext.moveTo(startPoint.x, startPoint.y);
            bodyContext.lineTo(endPoint.x, endPoint.y);
    If you wanted to use a 3D renderer with the X, Y, and Z of each body joint, then you would want to use the CameraSpacePoints directly.

    Friday, May 22, 2015 2:07 AM