知道如何上下移动Kinect吗?从理论上讲,
sensor.ElevationAngle = 20;
应该完成这项工作,但我收到以下错误:
InvalidOperationException
This API has returned an exception from an HRESULT: 0x8007000D
即使例如它也会崩溃读取当前的ElevationAngle是启动Kinect传感器后的第一件事...(the question here的答案表明这是因为太多的移动操作,但即使Kinect没有调整位置一段时间也会发生;如果是重复,对不起,但我无法评论上述问题。)
**编辑**代码:
using Microsoft.Kinect;
namespace pro02_01_streams.tilt
{
/// <summary>
/// Interaction logic for Tilt_test.xaml
/// </summary>
public partial class Tilt_test : Window
{
private KinectSensor sensor;
public Tilt_test()
{
InitializeComponent();
Test();
}
public void Test(){
if (KinectSensor.KinectSensors.Count == 0)
{
MessageBox.Show("No Kinects presents", "Error");
Application.Current.Shutdown();
}
try
{
sensor = KinectSensor.KinectSensors[0];
sensor.DepthStream.Enable();
sensor.ColorStream.Enable();
sensor.Start();
sensor.ElevationAngle = 1;
}
catch
{
MessageBox.Show("Failed to initialize kinect", "error");
Application.Current.Shutdown();
}
}
}
}
答案 0 :(得分:0)
您的代码适用于我。要了解您的Kinect是否正常工作,请打开Kinect Developer Toolkit浏览器并运行Kinect Explorer-WPF。在应用程序中,转到传感器设置并以所需角度移动Kinect。