Kinect: Convert Joint.Position.Z to Millimeters

I know how to convert in pixels the value obtained from Joint.Position.X and Joint.Position.Y . There is an example in which I do this:

 void kinectSensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame()) { if (skeletonFrame != null) { Skeleton[] skeletonData = new Skeleton[skeletonFrame.SkeletonArrayLength]; //conterrà tutti gli skeleton skeletonFrame.CopySkeletonDataTo(skeletonData); Skeleton playerSkeleton = (from s in skeletonData where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault(); if (playerSkeleton != null) { Joint rightHand = playerSkeleton.Joints[JointType.HandRight]; Joint leftHand = playerSkeleton.Joints[JointType.HandLeft]; //EDIT: The following formulas used to convert X and Y coordinates in pixels are wrong. //Please, see the answer for details rightHandPosition = new float[] { (((0.5f * rightHand.Position.X) + 0.5f) * (640)), (((-0.5f * rightHand.Position.Y) + 0.5f) * (480)) }; leftHandPosition = new float[] { (((0.5f * leftHand.Position.X) + 0.5f) * (640)), (((-0.5f * leftHand.Position.Y) + 0.5f) * (480)), leftHand.Position.Z }; } } } } 

Now what I want to do is get the real depth (in millimeters) using Joint.Depth.Z . Referring to the previous example, I want to get two 3D arrays for rightHandPosition and leftHandPosition , with the last coordinate representing the depth. What is the correct formula for converting the value returned from rightHand.Position.Z and leftHand.Position.Z to the corresponding value in millimeters?

EDIT: The formulas used to convert the X and Y coordinates in pixels in the above code are incorrect. Please read the following answer from me.

+4
source share
2 answers

I realized that Joint.Position.X and Joint.Position.Y not limited between -1 and 1. This incorrect information is quite common on the Internet, and it is for this reason that I answer myself.

As Evil Closet Monkey mentioned in the comments above, the official documentation says that "the coordinates of the skeleton space are expressed in meters ." He also confirmed a member of the Kinect for Windows team in this post .

This means that to convert the X, Y, and Z coordinates obtained with Joint.Position.X , Joint.Position.Y and Joint.Position.Z , in millimeters you just need to divide these values ​​by 1000 (or you can also work in meters, without the need for conversion).

+8
source

As mentioned earlier, the positions are indicated in meters. Just multiply by 1000 to convert meters to millimeters. Google conversion

0
source

Source: https://habr.com/ru/post/1469026/


All Articles