用于骨骼跟踪的Kinect固有校准



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

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

试试这个代码:

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;
    }

相关内容

  • 没有找到相关文章

最新更新