示例#1
0
 static void Configure(Camera camera)
 {
     if (camera.GetSfncVersion() < sfnc2_0_0)  // Handling for older cameras
     {
         regionSelector                    = PLCamera.AutoFunctionAOISelector;
         regionSelectorOffsetX             = PLCamera.AutoFunctionAOIOffsetX;
         regionSelectorOffsetY             = PLCamera.AutoFunctionAOIOffsetY;
         regionSelectorWidth               = PLCamera.AutoFunctionAOIWidth;
         regionSelectorHeight              = PLCamera.AutoFunctionAOIHeight;
         regionSelectorValue1              = PLCamera.AutoFunctionAOISelector.AOI1;
         regionSelectorValue2              = PLCamera.AutoFunctionAOISelector.AOI2;
         balanceRatio                      = PLCamera.BalanceRatioAbs;
         exposureTime                      = PLCamera.ExposureTimeAbs;
         autoFunctionAOIROIUseBrightness   = PLCamera.AutoFunctionAOIUsageIntensity;
         autoFunctionAOIROIUseWhiteBalance = PLCamera.AutoFunctionAOIUsageWhiteBalance;
     }
     else // Handling for newer cameras (using SFNC 2.0, e.g. USB3 Vision cameras)
     {
         regionSelector                    = PLCamera.AutoFunctionROISelector;
         regionSelectorOffsetX             = PLCamera.AutoFunctionROIOffsetX;
         regionSelectorOffsetY             = PLCamera.AutoFunctionROIOffsetY;
         regionSelectorWidth               = PLCamera.AutoFunctionROIWidth;
         regionSelectorHeight              = PLCamera.AutoFunctionROIHeight;
         regionSelectorValue1              = PLCamera.AutoFunctionROISelector.ROI1;
         regionSelectorValue2              = PLCamera.AutoFunctionROISelector.ROI2;
         balanceRatio                      = PLCamera.BalanceRatio;
         exposureTime                      = PLCamera.ExposureTime;
         autoFunctionAOIROIUseBrightness   = PLCamera.AutoFunctionROIUseBrightness;
         autoFunctionAOIROIUseWhiteBalance = PLCamera.AutoFunctionROIUseWhiteBalance;
     }
 }
        public override double?[] GetParam(string name, out double?value)
        {
            if (Enum.IsDefined(typeof(FloatName), name))
            {
                FloatName floatName = (FloatName)Enum.Parse(typeof(FloatName), name);

                if (!camera.Parameters[floatName].IsEmpty && camera.Parameters[floatName].IsReadable)
                {
                    double?[] param = new double?[3];
                    value    = camera.Parameters[floatName].GetValue();
                    param[0] = camera.Parameters[floatName].GetMinimum();
                    param[1] = camera.Parameters[floatName].GetMaximum();
                    param[2] = camera.Parameters[floatName].GetIncrement();
                    return(param);
                }
                else
                {
                    value = null;
                    return(null);
                }
            }
            else
            {
                value = null;
                return(null);
            }
        }
        public override void SetParam(string name, double value)
        {
            if (Enum.IsDefined(typeof(FloatName), name))
            {
                FloatName floatName = (FloatName)Enum.Parse(typeof(FloatName), name);

                if (!camera.Parameters[floatName].IsEmpty && camera.Parameters[floatName].IsWritable)
                {
                    camera.Parameters[floatName].SetValue(value);
                }
            }
        }
示例#4
0
        /// <summary>
        /// 获取Float类型属性的可设定范围
        /// </summary>
        /// <param name="property">属性名</param>
        /// <param name="min">最小值</param>
        /// <param name="max">最大值</param>
        /// <param name="increment">增长值</param>
        public void GetCameraParamValues(FloatName property, out double min, out double max, out double increment)
        {
            min = this._camera.Parameters[property].GetMinimum();
            max = this._camera.Parameters[property].GetMaximum();
            double?temp = this._camera.Parameters[property].GetIncrement();

            if (temp != null)
            {
                increment = (double)temp;
            }
            else
            {
                increment = 0;
            }
        }
示例#5
0
 public AtmosphereFloat(string themeID, FloatName floatName) : base(themeID)
 {
     Name = floatName;
 }
示例#6
0
 public AtmosphereFloat(FloatName floatName)
 {
     Name = floatName;
 }