Exemplo n.º 1
0
        private void InitAdvancedImageControls(ref tDSCameraCapability capbility)
        {
            try
            {
                XCamera cam = XCamera.GetInstance();
                //gamma
                _trackBarGamma.SetRange(capbility.sGammaRange.iMin, capbility.sGammaRange.iMax);
                byte gamma;
                cam.GetGamma(out gamma);
                _trackBarGamma.Value = Convert.ToInt32(gamma);
                //contrast
                _trackBarContrast.SetRange(capbility.sContrastRange.iMin, capbility.sContrastRange.iMax);
                byte contrast;
                cam.GetContrast(out contrast);
                _trackBarContrast.Value = Convert.ToInt32(contrast);
                //saturation
                bool enableColorEnhance = false;
                cam.GetColorEnhancement(out enableColorEnhance);
                _checkEnableColorEnhance.Checked = enableColorEnhance;
                _trackBarSaturation.Enabled      = enableColorEnhance;
                _trackBarSaturation.SetRange(capbility.sSaturationRange.iMin, capbility.sSaturationRange.iMax);
                byte saturation;
                cam.GetSaturation(out saturation);
                _trackBarSaturation.Value = Convert.ToInt32(saturation);
                //sharpness
                _trackBarSharpness.SetRange(capbility.sSharpnessRange.iMin, capbility.sSharpnessRange.iMax);
                bool enableSharp = false;
                byte sharpness   = 0;
                cam.GetEdgeEnhancement(out enableSharp);
                cam.GetEdgeGain(out sharpness);
                _checkEnableSharp.Checked  = enableSharp;
                _trackBarSharpness.Enabled = enableSharp;
                _trackBarSharpness.Value   = Convert.ToInt32(sharpness);
                //noise reduction
                _trackBarAntiNoise.SetRange(capbility.sNoiseReductionRange.iMin, capbility.sNoiseReductionRange.iMax);
                bool enableNoiseReduction = false;
                cam.GetNoiseReductionState(out enableNoiseReduction);
                _checkEnableAntiNoise.Checked = enableNoiseReduction;
                _trackBarAntiNoise.Enabled    = enableNoiseReduction;
                int noiseReductionGain;
                cam.GetNoiseReductionGain(out noiseReductionGain);
                _trackBarAntiNoise.Value = noiseReductionGain;

                var cameraCamType = Convert.ToInt32(xview.utils.ConfigManager.GetAppConfig("CameraType"));
                if (cameraCamType == 2)
                {
                    //3D noise reduction,暂时未从文档中找到3D降噪参数范围值
                    //_trackBar3DAntiNoise.SetRange(capbility.sNoiseReductionRange.iMin, capbility.sNoiseReductionRange.iMax);
                    _trackBar3DAntiNoise.SetRange(0, 255);
                    bool enable3DNoiseReduction = false;
                    cam.Get3DNoiseReductionState(out enable3DNoiseReduction);
                    _checkEnable3DAntiNoise.Checked = enable3DNoiseReduction;
                    _trackBar3DAntiNoise.Enabled    = enable3DNoiseReduction;
                    int noiseReductionGain3D;
                    cam.Get3DNoiseReductionGain(out noiseReductionGain3D);
                    _trackBar3DAntiNoise.Value = noiseReductionGain3D;
                }
                else
                {
                    _checkEnable3DAntiNoise.Visible = false;
                    emptySpaceItem14.Visibility     = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    _label3DAntiNoise.Visible       = false;
                    layoutControlItem28.Visibility  = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                }
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.Message);
            }
        }