Inheritance: KinectBase.IKinectCore
示例#1
0
文件: KV1Core.cs 项目: vancegroup/KVR
        //Constructor to setup the real KinectV1Core object
        public Core(ref MasterSettings settings, bool isGUILaunched, int? kinectNumber = null)
        {
            realCore = new KinectCoreV1(ref settings, isGUILaunched, kinectNumber);

            //Subscribe to the events so they can be forwarded
            realCore.SkeletonChanged += realCore_SkeletonChanged;
            realCore.DepthFrameReceived += realCore_DepthFrameReceived;
            realCore.ColorFrameReceived += realCore_ColorFrameReceived;
            realCore.AccelerationChanged += realCore_AccelerationChanged;
            realCore.AudioPositionChanged += realCore_AudioPositionChanged;
            realCore.LogMessageGenerated += realCore_LogMessageGenerated;
        }
        public KinectV1SettingsControl(int kinectNumber, ref KinectBase.MasterSettings settings, KinectBase.IKinectCore kinect)
        {
            if (settings != null)
            {
                if (settings.kinectOptionsList[kinectNumber].version == KinectBase.KinectVersion.KinectV1)
                {
                    masterSettings = settings;
                    dynamic tempSettings = settings.kinectOptionsList[kinectNumber];
                    kinectSettings = (KinectV1Settings)tempSettings;
                    kinectID = kinectNumber;
                    kinectCore = (KinectCoreV1)kinect;
                    kinectCore.AccelerationChanged += kinectCore_AccelerationChanged;
                    uniqueKinectID = kinect.uniqueKinectID;

                    InitializeComponent();

                    this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    this.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
                    //This moved to the wrapper
                    //Grid.SetColumn(this, 2);
                    //this.Visibility = System.Windows.Visibility.Collapsed;

                    if (kinectCore.isXbox360Kinect != null && (bool)kinectCore.isXbox360Kinect)
                    {
                        DisableK4WOnlyOptions();
                    }
                }
                else
                {
                    throw new ArgumentException("The provided KinectID is not for a Kinect v1 sensor.");
                }
            }
            else
            {
                throw new ArgumentNullException("settings");
            }
        }
        public KinectV1SettingsControl(int kinectNumber, ref KinectBase.MasterSettings settings, KinectBase.IKinectCore kinect)
        {
            if (settings != null)
            {
                if (settings.kinectOptionsList[kinectNumber].version == KinectBase.KinectVersion.KinectV1)
                {
                    masterSettings = settings;
                    dynamic tempSettings = settings.kinectOptionsList[kinectNumber];
                    kinectSettings = (KinectV1Settings)tempSettings;
                    kinectID       = kinectNumber;
                    kinectCore     = (KinectCoreV1)kinect;
                    kinectCore.AccelerationChanged += kinectCore_AccelerationChanged;
                    uniqueKinectID = kinect.uniqueKinectID;

                    InitializeComponent();

                    this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    this.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
                    //This moved to the wrapper
                    //Grid.SetColumn(this, 2);
                    //this.Visibility = System.Windows.Visibility.Collapsed;

                    if (kinectCore.isXbox360Kinect != null && (bool)kinectCore.isXbox360Kinect)
                    {
                        DisableK4WOnlyOptions();
                    }
                }
                else
                {
                    throw new ArgumentException("The provided KinectID is not for a Kinect v1 sensor.");
                }
            }
            else
            {
                throw new ArgumentNullException("settings");
            }
        }
        public AdvancedColorWindow(KinectCoreV1 kinectV1Core)
        {
            if (kinectV1Core == null)
            {
                throw new ArgumentNullException("kinectV1Core");
            }

            InitializeComponent();

            kinectCore = kinectV1Core;

            WhiteBalSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.WhiteBalance;
            WhiteBalManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.WhiteBalance.ToString();
            WhiteBalAutoCheckBox.IsChecked = kinectCore.kinect.ColorStream.CameraSettings.AutoWhiteBalance;
            SaturationSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.Saturation;
            SaturationManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.Saturation.ToString();
            GammaSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.Gamma;
            GammaManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.Gamma.ToString();
            HueSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.Hue;
            HueManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.Hue.ToString();
            SharpnessSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.Sharpness;
            SharpnessManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.Sharpness.ToString();
            ContrastSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.Contrast;
            ContrastManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.Contrast.ToString();
            ExposureSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.ExposureTime / 10.0;
            ExposureManSet.Text = (kinectCore.kinect.ColorStream.CameraSettings.ExposureTime / 10.0).ToString();
            ExposureAutoCheckBox.IsChecked = kinectCore.kinect.ColorStream.CameraSettings.AutoExposure;
            FrameIntervalSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.FrameInterval / 10.0;
            FrameIntervalManSet.Text = (kinectCore.kinect.ColorStream.CameraSettings.FrameInterval / 10.0).ToString();
            BrightSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.Brightness;
            BrightManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.Brightness.ToString();
            GainSlider.Value = kinectCore.kinect.ColorStream.CameraSettings.Gain;
            GainManSet.Text = kinectCore.kinect.ColorStream.CameraSettings.Gain.ToString();

            switch (kinectCore.kinect.ColorStream.CameraSettings.PowerLineFrequency)
            {
                case PowerLineFrequency.SixtyHertz:
                {
                    powerLineComboBox.SelectedIndex = 0;
                    break;
                }
                case PowerLineFrequency.FiftyHertz:
                {
                    powerLineComboBox.SelectedIndex = 1;
                    break;
                }
                case PowerLineFrequency.Disabled:
                {
                    powerLineComboBox.SelectedIndex = 2;
                    break;
                }
            }
            switch (kinectCore.kinect.ColorStream.CameraSettings.BacklightCompensationMode)
            {
                case BacklightCompensationMode.AverageBrightness:
                {
                    BacklightCompComboBox.SelectedIndex = 0;
                    break;
                }
                case BacklightCompensationMode.CenterOnly:
                {
                    BacklightCompComboBox.SelectedIndex = 1;
                    break;
                }
                case BacklightCompensationMode.CenterPriority:
                {
                    BacklightCompComboBox.SelectedIndex = 2;
                    break;
                }
                case BacklightCompensationMode.LowlightsPriority:
                {
                    BacklightCompComboBox.SelectedIndex = 3;
                    break;
                }
            }
        }
示例#5
0
        public AdvancedColorWindow(KinectCoreV1 kinectV1Core)
        {
            if (kinectV1Core == null)
            {
                throw new ArgumentNullException("kinectV1Core");
            }

            InitializeComponent();

            kinectCore = kinectV1Core;

            WhiteBalSlider.Value           = kinectCore.kinect.ColorStream.CameraSettings.WhiteBalance;
            WhiteBalManSet.Text            = kinectCore.kinect.ColorStream.CameraSettings.WhiteBalance.ToString();
            WhiteBalAutoCheckBox.IsChecked = kinectCore.kinect.ColorStream.CameraSettings.AutoWhiteBalance;
            SaturationSlider.Value         = kinectCore.kinect.ColorStream.CameraSettings.Saturation;
            SaturationManSet.Text          = kinectCore.kinect.ColorStream.CameraSettings.Saturation.ToString();
            GammaSlider.Value              = kinectCore.kinect.ColorStream.CameraSettings.Gamma;
            GammaManSet.Text               = kinectCore.kinect.ColorStream.CameraSettings.Gamma.ToString();
            HueSlider.Value                = kinectCore.kinect.ColorStream.CameraSettings.Hue;
            HueManSet.Text                 = kinectCore.kinect.ColorStream.CameraSettings.Hue.ToString();
            SharpnessSlider.Value          = kinectCore.kinect.ColorStream.CameraSettings.Sharpness;
            SharpnessManSet.Text           = kinectCore.kinect.ColorStream.CameraSettings.Sharpness.ToString();
            ContrastSlider.Value           = kinectCore.kinect.ColorStream.CameraSettings.Contrast;
            ContrastManSet.Text            = kinectCore.kinect.ColorStream.CameraSettings.Contrast.ToString();
            ExposureSlider.Value           = kinectCore.kinect.ColorStream.CameraSettings.ExposureTime / 10.0;
            ExposureManSet.Text            = (kinectCore.kinect.ColorStream.CameraSettings.ExposureTime / 10.0).ToString();
            ExposureAutoCheckBox.IsChecked = kinectCore.kinect.ColorStream.CameraSettings.AutoExposure;
            FrameIntervalSlider.Value      = kinectCore.kinect.ColorStream.CameraSettings.FrameInterval / 10.0;
            FrameIntervalManSet.Text       = (kinectCore.kinect.ColorStream.CameraSettings.FrameInterval / 10.0).ToString();
            BrightSlider.Value             = kinectCore.kinect.ColorStream.CameraSettings.Brightness;
            BrightManSet.Text              = kinectCore.kinect.ColorStream.CameraSettings.Brightness.ToString();
            GainSlider.Value               = kinectCore.kinect.ColorStream.CameraSettings.Gain;
            GainManSet.Text                = kinectCore.kinect.ColorStream.CameraSettings.Gain.ToString();

            switch (kinectCore.kinect.ColorStream.CameraSettings.PowerLineFrequency)
            {
            case PowerLineFrequency.SixtyHertz:
            {
                powerLineComboBox.SelectedIndex = 0;
                break;
            }

            case PowerLineFrequency.FiftyHertz:
            {
                powerLineComboBox.SelectedIndex = 1;
                break;
            }

            case PowerLineFrequency.Disabled:
            {
                powerLineComboBox.SelectedIndex = 2;
                break;
            }
            }
            switch (kinectCore.kinect.ColorStream.CameraSettings.BacklightCompensationMode)
            {
            case BacklightCompensationMode.AverageBrightness:
            {
                BacklightCompComboBox.SelectedIndex = 0;
                break;
            }

            case BacklightCompensationMode.CenterOnly:
            {
                BacklightCompComboBox.SelectedIndex = 1;
                break;
            }

            case BacklightCompensationMode.CenterPriority:
            {
                BacklightCompComboBox.SelectedIndex = 2;
                break;
            }

            case BacklightCompensationMode.LowlightsPriority:
            {
                BacklightCompComboBox.SelectedIndex = 3;
                break;
            }
            }
        }