我正在使用 Kinect 进行 3d 骨架跟踪。我有一个关于 Kinect 校准的问题。我使用 Kinect SDK 进行骨骼跟踪,但是当它投影到屏幕上时,我看到骨骼关节偏离了它的实际位置。我怀疑我是否可以调整 Kinect 的焦距和内在参数,它会准确地映射骨架,对吗?
问问题
452 次
1 回答
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;
}
于 2017-02-06T20:03:04.607 回答