Example #1
0
        /// <summary>
        /// Update Control Values based on state
        /// </summary>
        /// <param name="state">Kinect state</param>
        private void UpdateControlValuesBasedOnState(kinect.KinectState state)
        {
            this.TransformSmooth.IsChecked = state.TransformSmooth;

            // we don't want to update those fields while user may be typing something
            if (!this.TiltDegrees.IsFocused)
            {
                this.TiltDegrees.Text = ((int)state.TiltDegrees).ToString();
            }

            if (!this.Smoothing.IsFocused)
            {
                this.Smoothing.Text = state.SkeletalEngineTransformSmoothParameters.Smoothing.ToString();
            }

            if (!this.Correction.IsFocused)
            {
                this.Correction.Text = state.SkeletalEngineTransformSmoothParameters.Correction.ToString();
            }

            if (!this.Prediction.IsFocused)
            {
                this.Prediction.Text = state.SkeletalEngineTransformSmoothParameters.Prediction.ToString();
            }

            if (!this.JitterRadius.IsFocused)
            {
                this.JitterRadius.Text = state.SkeletalEngineTransformSmoothParameters.JitterRadius.ToString();
            }

            if (!this.MaxDeviationRadius.IsFocused)
            {
                this.MaxDeviationRadius.Text = state.SkeletalEngineTransformSmoothParameters.MaxDeviationRadius.ToString();
            }
        }
Example #2
0
        /// <summary>
        /// We want to disable controls that can't be used due to config state (i.e. can't choose to view video if video frame read was not configured)
        /// </summary>
        /// <param name="state">Kinect state</param>
        private void UpdateImmutableControlsOnFirstStateRead(kinect.KinectState state)
        {
            if (!state.UseColor)
            {
                this.VideImageType.IsEnabled = false;
                this.VideoCB.IsEnabled = false;
                this.VideoCB.IsChecked = false;
            }

            if (!state.UseSkeletalTracking)
            {
                this.SkeletalCB.IsChecked = false;
                this.SkeletalCB.IsEnabled = false;
                this.TransformSmooth.IsEnabled = false;
                this.Smoothing.IsEnabled = false;
                this.Correction.IsEnabled = false;
                this.Prediction.IsEnabled = false;
                this.JitterRadius.IsEnabled = false;
                this.MaxDeviationRadius.IsEnabled = false;
            }

            if (!state.UseDepth)
            {
                this.DepthCB.IsChecked = false;
                this.DepthCB.IsEnabled = false;
            }

            this.DeviceID.Text = state.DeviceID.ToString();
            this.FrameRate.Text = state.FrameRate.ToString();
            this.VideImageType.Text = state.ColorImageFormat.ToString();
            this.DepthImageType.Text = state.DepthImageFormat.ToString();
            this.DepthCamAlternate.Text = state.IsDepthServiceUpdateEnabled == true ? "yes" : "no";
            this.WebCamAlternate.Text = state.IsWebCamServiceUpdateEnabled == true ? "yes" : "no";

            // cache the resolution of the color image
            switch (state.ColorImageFormat)
            {
                case ColorImageFormat.RgbResolution1280x960Fps12:
                    KinectUI.ColorImageWidth = 1280;
                    KinectUI.ColorImageHeight = 960;
                    break;
                case ColorImageFormat.RawYuvResolution640x480Fps15:
                case ColorImageFormat.RgbResolution640x480Fps30:
                case ColorImageFormat.YuvResolution640x480Fps15:
                default:
                    KinectUI.ColorImageWidth = 640;
                    KinectUI.ColorImageHeight = 480;
                    break;
            }
        }
Example #3
0
        /// <summary>
        /// Callback to update UI elements that represent KinectService state(config) such as image resolution, etc
        /// </summary>
        /// <param name="state">Kinect state</param>
        internal void UpdateState(kinect.KinectState state)
        {
            this.CalculateEffectiveFrameRate();

            this.UpdateControlValuesBasedOnState(state);

            if (!this.viewUpdatedAtLeastOnce)
            {
                this.UpdateImmutableControlsOnFirstStateRead(state);
            }

            this.viewUpdatedAtLeastOnce = true;
        }