2015-10-14 90 views
0

我正在使用Kinect进行三维骨架跟踪。我有一个关于Kinect校准的问题。我使用Kinect SDK进行骨架跟踪,但是当它投影到屏幕上时,我发现骨架关节偏离了它的实际位置。我怀疑如果我能调整Kinect的焦距和内在参数,它会准确地映射骨架是否正确?Kinect骨架跟踪内在校准

+0

你可以分享你预计骨架代码的一部分? –

+0

你使用kinect v2还是kinect v1? – JavaNullPointer

+0

我使用Kinect v2 – satish

回答

1

我认为你需要将骨骼关节的坐标映射到颜色/深度空间。

试试这个代码:

private Point BodyToColorPoint(Joint joint) 
    { 
     // 3D space point 
     CameraSpacePoint jointPosition = joint.Position; 

     // 2D space point 
     Point point = new Point(); 

     //you need to change the Image and Canvas dimensions 
     //because the resolution of Kinect2 color camera is 1920 X 1080 (too big for my screen) 
     //if your canvas size is 960 X 540, should dived point.X and point.Y by 2 
     if (_mode == CameraMode.Color) 
     { 
      ColorSpacePoint colorPoint = this.kinectSensor.CoordinateMapper.MapCameraPointToColorSpace(jointPosition); 

      point.X = float.IsInfinity(colorPoint.X) ? 0 : colorPoint.X; 
      point.Y = float.IsInfinity(colorPoint.Y) ? 0 : colorPoint.Y; 
     } 
     else if (_mode == CameraMode.Depth || _mode == CameraMode.Infrared) 
     { 
      DepthSpacePoint depthPoint = this.kinectSensor.CoordinateMapper.MapCameraPointToDepthSpace(jointPosition); 

      point.X = float.IsInfinity(depthPoint.X) ? 0 : depthPoint.X; 
      point.Y = float.IsInfinity(depthPoint.Y) ? 0 : depthPoint.Y; 
     } 
     return point; 
    }