private void UpdateExpsoureControls() { uint uState = 0; MvApi.CameraGetAeState(m_hCamera, ref uState); if (uState == 1) { textBox_AnalogGain.Enabled = false; textBox_ExposureTime.Enabled = false; trackBar_AnalogGain.Enabled = false; } else { textBox_AnalogGain.Enabled = true; textBox_ExposureTime.Enabled = true; trackBar_AnalogGain.Enabled = true; int iAnalogGain = 0; MvApi.CameraGetAnalogGain(m_hCamera, ref iAnalogGain); trackBar_AnalogGain.Value = iAnalogGain; textBox_AnalogGain.Text = iAnalogGain.ToString(); double dCameraExpTime = 0; MvApi.CameraGetExposureTime(m_hCamera, ref dCameraExpTime); textBox_ExposureTime.Text = dCameraExpTime.ToString(); } }
public void cameraparam() { if (!cameraopen()) { return; } try { double ept = 0.0; int rgain = 0; int ggain = 0; int bgain = 0; int ctt = 0; int gm = 0; MvApi.CameraGetExposureTime(m_hCamera, ref ept); MvApi.CameraGetGain(m_hCamera, ref rgain, ref ggain, ref bgain); MvApi.CameraGetContrast(m_hCamera, ref ctt); MvApi.CameraGetGamma(m_hCamera, ref gm); exposuretime = ept; gain = rgain; contrast = ctt; gamma = gm; //exposuretime = hfg.GetFramegrabberParam("ExposureTime"); //gain = hfg.GetFramegrabberParam("Gain")*100; //gamma = hfg.GetFramegrabberParam("Gamma"); //contrast = hfg.GetFramegrabberParam("Contrast"); } catch { } }
private void timer1_Tick(object sender, EventArgs e) { if (m_hCamera <= 0 || m_bInited == false) { return; } uint AeMode = 0; MvApi.CameraGetAeState(m_hCamera, ref AeMode); if (AeMode == 1) { int iGain = 0; double dExpTime = 0; MvApi.CameraGetAnalogGain(m_hCamera, ref iGain); MvApi.CameraGetExposureTime(m_hCamera, ref dExpTime); textBox_AnalogGain.Text = iGain.ToString(); trackBar_AnalogGain.Value = iGain; textBox_ExposureTime.Text = dExpTime.ToString(); } }