gpt4 book ai didi

c# - MapFromSkeletonPoint 在 Kinect 中已过时

转载 作者:行者123 更新时间:2023-11-30 20:59:00 26 4
gpt4 key购买 nike

我遇到了 Kinect SDK 的问题,因为我想使用的一些代码使用了过时的类。我在 Windows7 的 VS2010 中将它构建为 x86 程序。当前的 Kinect SDK 是 1.7 版本。

我正在使用的文件可以在这里找到: a link

这是我专门用来修复错误的代码:

       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)' is obsolete: 'This method is replaced by 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)' is obsolete: 'This method is replaced by Microsoft.Kinect.CoordinateMapper.MapDepthPointToColorPoint' C:\Robosapien-master\RobosapienKinect\查看器\KinectSkeletonViewer.xaml.cs 177 50 RobosapienKinect

警告 4 'Microsoft.Kinect.DepthImageFrame.MapFromSkeletonPoint(Microsoft.Kinect.SkeletonPoint)' is obsolete: 'This method is replaced by 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)' is obsolete: 'This method is replaced by Microsoft.Kinect.CoordinateMapper.MapDepthPointToColorPoint' C:\Robosapien\Robosapien-master\RobosapienKinect\Viewers\KinectSkeletonViewer.xaml.cs 177 50 RobosapienKinect

警告 6 字段 'Com.Enterprisecoding.RobosapienKinect.MainWindow.kinectStream' 已分配但其值从未使用过 C:\Robosapien\Robosapien-master\RobosapienKinect\MainWindow.xaml.cs 50 24 RobosapienKinect

最佳答案

MapToColorImagePointMapFromSkeletonPoint 方法已过时。过时的方法是旧的,不再使用了。相反,它们被另一种几乎做同样事情的方法所取代。

在这种情况下,MapToColorImagePoint 被替换为 MapDepthPointToColorPointMapFromSkeletonPoint 被替换为 MapSkeletonPointToDepthPoint。您应该使用这些方法而不是旧方法。

将骨架点映射到深度点:

DepthImagePoint depthPoint = this.Kinect.CoordinateMapper.MapSkeletonPointToDepthPoint(skeletonPoint, this.Kinect.DepthStream.Format);

将深度点映射到颜色点:

ColorImagePoint colorPoint = this.Kinect.CoordinateMapper.MapDepthPointToColorPoint (this.Kinect.DepthStream.Format, depthPoint, this.Kinect.ColorStream.Format);

关于c# - MapFromSkeletonPoint 在 Kinect 中已过时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15693056/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com