我遇到了 Kinect SDK 的问题,因为我想使用的一些代码使用了过时的类。我在 Windows7 的 VS2010 中将其构建为 x86 程序。当前的 Kinect SDK 版本为 1.7。
我正在使用的文件可以在这里找到: 链接
这是我专门用来修复错误的代码:
private Point GetPosition2DLocation(DepthImageFrame depthFrame, SkeletonPoint skeletonPoint)
{
DepthImagePoint depthPoint = depthFrame.MapFromSkeletonPoint(skeletonPoint);
switch (ImageType)
{
case ImageType.Color:
ColorImagePoint colorPoint = depthFrame.MapToColorImagePoint(depthPoint.X, depthPoint.Y, this.Kinect.ColorStream.Format);
// map back to skeleton.Width & skeleton.Height
return new Point(
(int)(this.RenderSize.Width * colorPoint.X / this.Kinect.ColorStream.FrameWidth),
(int)(this.RenderSize.Height * colorPoint.Y / this.Kinect.ColorStream.FrameHeight));
case ImageType.Depth:
return new Point(
(int)(this.RenderSize.Width * depthPoint.X / depthFrame.Width),
(int)(this.RenderSize.Height * depthPoint.Y / depthFrame.Height));
default:
throw new ArgumentOutOfRangeException("ImageType was a not expected value: " + ImageType.ToString());
}
}
它使用的过时类是: Microsoft.Kinect.DepthImageFrame.MapFromSkeletonPoint(Microsoft.Kinect.SkeletonPoint) & Microsoft.Kinect.DepthImageFrame.MapToColorImagePoint(int, int, Microsoft.Kinect.ColorImageFormat)
这些是我应该在修复中使用的类方法,我只是还不知道该怎么做:
public DepthImagePoint MapSkeletonPointToDepthPoint (
SkeletonPoint skeletonPoint,
DepthImageFormat depthImageFormat
)
public ColorImagePoint MapDepthPointToColorPoint (
DepthImageFormat depthImageFormat,
DepthImagePoint depthPoint,
ColorImageFormat colorImageFormat
)
这是我在构建 RobosapianKinect 文件夹时收到的错误报告:
警告 1 已分配字段“Com.Enterprisecoding.RobosapienKinect.MainWindow.kinectStream”,但从未使用其值 C:\Robosapien\Robosapien-master\RobosapienKinect\MainWindow.xaml.cs 50 24 RobosapienKinect
警告 2 'Microsoft.Kinect.DepthImageFrame.MapFromSkeletonPoint(Microsoft.Kinect.SkeletonPoint)' 已过时:'此方法已替换为 Microsoft.Kinect.CoordinateMapper.MapSkeletonPointToDepthPoint' C:\Robosapien\Robosapien-master\RobosapienKinect\Viewers\KinectSkeletonViewer。 xaml.cs 172 42 RobosapienKinect
警告 3 'Microsoft.Kinect.DepthImageFrame.MapToColorImagePoint(int, int, Microsoft.Kinect.ColorImageFormat)' 已过时:'此方法已替换为 Microsoft.Kinect.CoordinateMapper.MapDepthPointToColorPoint' C:\Robosapien-master\RobosapienKinect\Viewers\ KinectSkeletonViewer.xaml.cs 177 50 RobosapienKinect
警告 4 'Microsoft.Kinect.DepthImageFrame.MapFromSkeletonPoint(Microsoft.Kinect.SkeletonPoint)' 已过时:'此方法已替换为 Microsoft.Kinect.CoordinateMapper.MapSkeletonPointToDepthPoint' C:\Robosapien-master\RobosapienKinect\Viewers\KinectSkeletonViewer.xaml。 cs 172 42 RobosapienKinect
警告 5 'Microsoft.Kinect.DepthImageFrame.MapToColorImagePoint(int, int, Microsoft.Kinect.ColorImageFormat)' 已过时:'此方法已替换为 Microsoft.Kinect.CoordinateMapper.MapDepthPointToColorPoint' C:\Robosapien\Robosapien-master\RobosapienKinect\查看器\KinectSkeletonViewer.xaml.cs 177 50 RobosapienKinect
警告 6 分配了“Com.Enterprisecoding.RobosapienKinect.MainWindow.kinectStream”字段,但从未使用其值 C:\Robosapien\Robosapien-master\RobosapienKinect\MainWindow.xaml.cs 50 24 RobosapienKinect