2015-10-14 155 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; 
    }