0

知道如何上下移动 Kinect 吗?理论上,

sensor.ElevationAngle = 20;

应该做这项工作,但我收到以下错误:

InvalidOperationException
This API has returned an exception from an HRESULT: 0x8007000D

即使例如读取当前的 ElevationAngle 是启动 Kinect 传感器后的第一件事,它也会崩溃......(此处问题的答案表明这是因为移动操作过多,但即使 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();
        }
    }
}

}

4

1 回答 1

0

你的代码对我来说很好。要确定您的 Kinect 是否正常工作,请打开 Kinect 开发者工具包浏览器并运行 Kinect Explorer-WPF。在应用程序中,转到传感器设置并以所需角度移动 Kinect。

于 2014-09-26T12:03:44.987 回答