带有属性更改的 Xbox 360 kinect 光束角度问题

Posted

技术标签:

【中文标题】带有属性更改的 Xbox 360 kinect 光束角度问题【英文标题】:xbox 360 kinect beam angle issue with property change 【发布时间】:2015-04-02 15:02:55 【问题描述】:

尝试在 C# wpf 中获取光束角度,并且在 If PropertyChange 上引发异常。有没有人有这个项目的例子,如果需要,我可以提供更多信息。我正在尝试让麦克风更改属性,但它却抛出异常

        InitializeComponent();
        //Beam Angle Code
        this.DataContext = this.Rect;
        this.Loaded += delegate  ListenForBeamChanges(); ;
    

    private KinectAudiosource CreateAudioSource()
    
        var source = KinectSensor.KinectSensors[0].AudioSource;
        source.NoiseSuppression = true;
        source.AutomaticGainControlEnabled = true;
        source.BeamAngleMode = BeamAngleMode.Adaptive;
        return source;
    

    private KinectAudioSource audioSource;
    private void ListenForBeamChanges()
    
        KinectSensor.KinectSensors[0].Start();
        audioSource = CreateAudioSource();
        audioSource.BeamAngleChanged += audioSource_BeamChanged;
        audioSource.Start();
    

    public double _beamAngle;
    public double BeamAngle
    
        get  return _beamAngle; 
        set
        
            _beamAngle = value;
            OnPropertyChanged("BeamAngle");
        
    

    void audioSource_BeamChanged(object sender, BeamAngleChangedEventArgs e)
    
        BeamAngle = e.Angle * -1;
    

    public event PropertyChangedEventHandler PropertyChanged;

    public void OnPropertyChanged(string propName)
    
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propName));
    

  

【问题讨论】:

你能补充一下抛出了什么异常吗? 表示属性更改为空 【参考方案1】:

见http://kinectaudioposition.codeplex.com

从http://channel9.msdn.com/coding4fun/kinect/Kinect-Audio-Positioning复制示例使用代码

/// <summary>
/// Event handler to care Window loaded
/// Construct KinectMicArray and draw contents
/// </summary>
private void Window_Loaded(object sender, RoutedEventArgs e)

    kinectMic = new KinectMicArray();
    kinectMic.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(kinectMic_PropertyChanged);
    DrawContents();

/// <summary>
/// Event handler to care KinectMicArray property changed
/// Showing angles as number for debug
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void kinectMic_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)

    KinectMicArray ka = sender as KinectMicArray;
    this.myLabel.Content = string.Format("Beam = 0:F; Source = 1:F;  ", ka.BeamAngleProperty, ka.SourceAngleProperty); 

【讨论】:

该示例基于较旧的 Kinect SDK(使用 Microsoft.Research.Kinect 命名空间),但我目前正在研究分叉并修复它以与 Kinect SDK 1.8 一起使用(适用于 Kinect v1 和 Kinect对于 Xbox 360 传感器)。您可以签出的其他代码是 Kinect SDK 中的 Kinect Explorer WPF 示例,请参阅 KinectManager.cs 和 AudioVisualizer.cs 我已将该 KinectAudioPositioning 示例移植到 Kinect SDK v1.8 - 请参阅我在 zoomicon.wordpress.com/2015/10/24/… 的帖子,了解有关从旧版 Microsoft Research Kinect Beta SDK 移植需要进行哪些更改的更多信息。我已将我的版本上传到kinectaudioposition.codeplex.com/SourceControl/list/patches

以上是关于带有属性更改的 Xbox 360 kinect 光束角度问题的主要内容,如果未能解决你的问题,请参考以下文章

xbox360体感器离地多高为最佳距离?广角多大范围?

跪求《KINECT法式滚球2》欧版ISO版XBOX360版游戏百度云资源

XBOX 360 连接上kinect运行后一次 kinect就一直连接不上一直报错显示错误是 c0022d 官网看了也没用 求解!

Kinect for Xbox one(v2) + Ubuntu 14.04 +ROS

xbox 360+kinect套装港版外壳上为啥写着仅供台湾消费者使用?

玩转树莓派——支持XBOX手柄