Пример #1
0
        public ThreadedDriver(DeviceSettings settings)
        {
            // FIXME: Dangerous. We should do this only on Player.
            K4aExtensions.DisableSafeCopyNativeBuffers();

            Settings = settings;

            this.provider = new BodyProvider();

            this.bodyObj = GameObject.Find("Kinect4AzureTracker"); //TODO: Remove later

            _captureThread = new Thread(CaptureThread);
            _captureThread.Start();
        }
Пример #2
0
        void ApplyInternal(Device device, DeviceSettings settings, bool forceApply)
        {
            _exposure = ApplyControl(
                device, ColorControlCommand.ExposureTimeAbsolute,
                settings.ExposureDeviceValue, _exposure, forceApply
                );

            _whiteBalance = ApplyControl(
                device, ColorControlCommand.Whitebalance,
                settings.WhiteBalanceDeviceValue, _whiteBalance, forceApply
                );

            _brightness = ApplyControl(
                device, ColorControlCommand.Brightness,
                settings.BrightnessDeviceValue, _brightness, forceApply
                );

            _contrast = ApplyControl(
                device, ColorControlCommand.Contrast,
                settings.ContrastDeviceValue, _contrast, forceApply
                );

            _saturation = ApplyControl(
                device, ColorControlCommand.Saturation,
                settings.SaturationDeviceValue, _saturation, forceApply
                );

            _sharpness = ApplyControl(
                device, ColorControlCommand.Sharpness,
                settings.SharpnessDeviceValue, _sharpness, forceApply
                );

            _gain = ApplyControl(
                device, ColorControlCommand.Gain,
                settings.GainDeviceValue, _gain, forceApply
                );

            _blc = ApplyControl(
                device, ColorControlCommand.BacklightCompensation,
                settings.BlcDeviceValue, _blc, forceApply
                );

            _powerFreq = ApplyControl(
                device, ColorControlCommand.PowerlineFrequency,
                settings.PowerFreqDeviceValue, _powerFreq, forceApply
                );
        }
        void ApplyInternal(Device device, DeviceSettings settings, bool forceApply)
        {
            // PowerFreq must be updated before Exposure because it affects
            // the maximum allowed exposure time.
            _powerFreq = ApplyControl
                             (device, ColorControlCommand.PowerlineFrequency,
                             settings.PowerFreqDeviceValue, _powerFreq, forceApply);

            _exposure = ApplyControl
                            (device, ColorControlCommand.ExposureTimeAbsolute,
                            settings.ExposureDeviceValue, _exposure, forceApply);

            // This is not documented, but the gain parameter can't update
            // while the auto exposure is enabled. To delay updates, we do a
            // bit tricky thing here.
            _gain = (_exposure < 0 || forceApply) ? -1 : ApplyControl
                        (device, ColorControlCommand.Gain,
                        settings.GainDeviceValue, _gain, false);

            _whiteBalance = ApplyControl
                                (device, ColorControlCommand.Whitebalance,
                                settings.WhiteBalanceDeviceValue, _whiteBalance, forceApply);

            _brightness = ApplyControl
                              (device, ColorControlCommand.Brightness,
                              settings.BrightnessDeviceValue, _brightness, forceApply);

            _contrast = ApplyControl
                            (device, ColorControlCommand.Contrast,
                            settings.ContrastDeviceValue, _contrast, forceApply);

            _saturation = ApplyControl
                              (device, ColorControlCommand.Saturation,
                              settings.SaturationDeviceValue, _saturation, forceApply);

            _sharpness = ApplyControl
                             (device, ColorControlCommand.Sharpness,
                             settings.SharpnessDeviceValue, _sharpness, forceApply);

            _blc = ApplyControl
                       (device, ColorControlCommand.BacklightCompensation,
                       settings.BlcDeviceValue, _blc, forceApply);
        }
 public DeviceSettingController(Device device, DeviceSettings initial)
 => ApplyInternal(device, initial, true);
 public void ApplySettings(Device device, DeviceSettings settings)
 => ApplyInternal(device, settings, false);