예제 #1
0
 public void cameraparamset()
 {
     if (!cameraopen())
     {
         return;
     }
     try { if (exposuretime > 0)
           {
               MvApi.CameraSetExposureTime(m_hCamera, exposuretime);
           }
     } catch { }
     try { if (gain > 0)
           {
               MvApi.CameraSetGain(m_hCamera, Convert.ToInt32(gain / 100), Convert.ToInt32(gain / 100), Convert.ToInt32(gain / 100));
           }
     } catch { }
     try { if (contrast > 0)
           {
               MvApi.CameraSetContrast(m_hCamera, contrast);
           }
     } catch { }
     try { if (gamma > 0)
           {
               MvApi.CameraSetGamma(m_hCamera, Convert.ToInt32(gamma));
           }
     } catch { }
     //try{if (exposuretime > 0) hfg.SetFramegrabberParam("ExposureTime", exposuretime);}catch{}
     //try{if (gain > 0) hfg.SetFramegrabberParam("Gain", gain / 100);}catch{}
     //try{if (contrast > 0) hfg.SetFramegrabberParam("Contrast", contrast);}catch{}
     //try{if (gamma > 0) hfg.SetFramegrabberParam("Gamma", gamma);}catch { }
 }
예제 #2
0
        //修改相机曝光参数
        private void textBox_ExposureTime_TextChanged(object sender, EventArgs e)
        {
            if (textBox_ExposureTime.Text == "")
            {
                return;
            }

            double dExpTime = System.Convert.ToDouble(textBox_ExposureTime.Text);

            MvApi.CameraSetExposureTime(m_hCamera, dExpTime);
        }