[英]Kinect exception has been thrown by the target of an invocation
I'm trying to upgrade my Kinect SDK to the new version and having some troubles which I can't figure why. 我正在尝试将我的Kinect SDK升级到新版本并遇到一些我无法理解的麻烦。
It breaks as soon as it reaches kinectSensor.SkeletonFrameReady += this.KinectAllFramesReady;
它一到达
kinectSensor.SkeletonFrameReady += this.KinectAllFramesReady;
private KinectSensor kinectSensor;
public MainWindow()
{
InitializeComponent();
kinectSensor.SkeletonFrameReady += this.KinectAllFramesReady;
kinectSensor.SkeletonStream.Enable(new TransformSmoothParameters()
{
Smoothing = 0.5f,
Correction = 0.5f,
Prediction = 0.5f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.04f
});
kinectSensor.Start();
}
Already solved in the comments, but an answer is better for anyone with the same problem; 已经在评论中解决了,但对于遇到同样问题的人来说答案更好;
The problem with the code is that it declares the kinectSensor variable, but never sets it to anything. 代码的问题在于它声明了kinectSensor变量,但从未将其设置为任何东西。 There's a pretty good code example at MSDN Social on how to do detection of connected/disconnected devices, but a very simple version just to get started playing around is to just use the first entry in the static
KinectSensor.KinectSensors
collection which will be your first connected sensor. 在MSDN Social上有关于如何检测连接/断开连接设备的一个非常好的代码示例,但是一个非常简单的版本只是为了开始使用静态
KinectSensor.KinectSensors
集合中的第一个条目,这将是你的第一个连接传感器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.