//设置曝光 public void SetExposure(TIS.Imaging.ICImagingControl icImagingControl1, float ExposureTime) { ExposureSwitch = (TIS.Imaging.VCDSwitchProperty)icImagingControl1.VCDPropertyItems.FindInterface(TIS.Imaging.VCDIDs.VCDID_Exposure + ":" + TIS.Imaging.VCDIDs.VCDElement_Auto + ":" + TIS.Imaging.VCDIDs.VCDInterface_Switch); if (ExposureSwitch != null) { ExposureSwitch.Switch = false; //取消自动曝光 ExposureAbsoluteValue = (TIS.Imaging.VCDAbsoluteValueProperty)icImagingControl1.VCDPropertyItems.FindInterface(TIS.Imaging.VCDIDs.VCDID_Exposure + ":" + TIS.Imaging.VCDIDs.VCDElement_Value + ":" + TIS.Imaging.VCDIDs.VCDInterface_AbsoluteValue); if (ExposureAbsoluteValue != null) { if (ExposureTime <= ExposureAbsoluteValue.RangeMin) { ExposureAbsoluteValue.Value = ExposureAbsoluteValue.RangeMin; } else if (ExposureTime >= ExposureAbsoluteValue.RangeMax) { ExposureAbsoluteValue.Value = ExposureAbsoluteValue.RangeMax; } else { ExposureAbsoluteValue.Value = ExposureTime; } } } }
//Debounce 防反跳() public void TriDebounce(TIS.Imaging.ICImagingControl icImagingControl1, double DeTime) { Trigger_Debounce_Time = (TIS.Imaging.VCDAbsoluteValueProperty)icImagingControl1.VCDPropertyItems.FindInterface(TIS.Imaging.VCDIDs.VCDID_TriggerMode + ":" + TIS.Imaging.VCDIDs.VCDElement_TriggerDebounceTime + ":" + TIS.Imaging.VCDIDs.VCDInterface_AbsoluteValue); if (DeTime <= Trigger_Debounce_Time.RangeMin) { Trigger_Debounce_Time.Value = Trigger_Debounce_Time.RangeMin; } else if (DeTime >= Trigger_Debounce_Time.RangeMax) { Trigger_Debounce_Time.Value = Trigger_Debounce_Time.RangeMax; } else { Trigger_Debounce_Time.Value = DeTime; } }
public bool SetCamParam(CamParam eParam, string strParamValue) { try { switch (eParam) { case CamParam.Exposure: //VCDProp.RangeValue[VCDIDs.VCDID_Exposure] = Convert.ToInt32(strParamValue); ExposureSwith = (TIS.Imaging.VCDSwitchProperty)m_ImageControl.VCDPropertyItems.FindInterface(VCDIDs.VCDID_Exposure + ":" + VCDIDs.VCDElement_Auto + ":" + VCDIDs.VCDInterface_Switch); ExposureSwith.Switch = false; //关闭自动曝光 //绝对曝光对象初始化 ExposureAbsoluteValue = (TIS.Imaging.VCDAbsoluteValueProperty)m_ImageControl.VCDPropertyItems.FindInterface(VCDIDs.VCDID_Exposure + ":" + VCDIDs.VCDElement_Value + ":" + VCDIDs.VCDInterface_AbsoluteValue); double time = 1 / Convert.ToDouble(strParamValue); if (time <= ExposureAbsoluteValue.RangeMin) { ExposureAbsoluteValue.Value = ExposureAbsoluteValue.RangeMin; } else if (time >= ExposureAbsoluteValue.RangeMax) { ExposureAbsoluteValue.Value = ExposureAbsoluteValue.RangeMax; } else { ExposureAbsoluteValue.Value = time; } break; case CamParam.FrameRate: //m_ImageControl.DeviceFrameRate = float.Parse(strParamValue); break; case CamParam.Gain: //VCDProp.RangeValue[VCDIDs.VCDID_Gain] = Convert.ToInt32(strParamValue); GainSwith = (TIS.Imaging.VCDSwitchProperty)m_ImageControl.VCDPropertyItems.FindInterface(VCDIDs.VCDID_Gain + ":" + VCDIDs.VCDElement_Auto + ":" + VCDIDs.VCDInterface_Switch); GainSwith.Switch = false; //关闭自动增益 //绝对增益对象初始化 GainAbsoluteValue = (TIS.Imaging.VCDAbsoluteValueProperty)m_ImageControl.VCDPropertyItems.FindInterface(VCDIDs.VCDID_Gain + ":" + VCDIDs.VCDElement_Value + ":" + VCDIDs.VCDInterface_AbsoluteValue); double GValue = Convert.ToDouble(strParamValue) / 1000; if (GValue <= GainAbsoluteValue.RangeMin) { GainAbsoluteValue.Value = GainAbsoluteValue.RangeMin; } else if (GValue >= GainAbsoluteValue.RangeMax) { GainAbsoluteValue.Value = GainAbsoluteValue.RangeMax; } else { GainAbsoluteValue.Value = GValue; } break; default: break; } return(true); } catch (Exception ex) { // m_strLastErr = ex.Message; return(false); } }