예제 #1
0
        private void textBox_RedGain_TextChanged(object sender, EventArgs e)
        {
            if (this.ActiveControl != sender)
            {
                return;
            }

            if (textBox_RedGain.Text == "" ||
                textBox_GreenGain.Text == "" ||
                textBox_BlueGain.Text == ""
                )
            {
                return;
            }

            string s1 = textBox_RedGain.Text;
            int    r  = Convert.ToInt32(s1);

            string s2 = textBox_GreenGain.Text;
            int    g  = Convert.ToInt32(s2);

            string s3 = textBox_BlueGain.Text;
            int    b  = Convert.ToInt32(s3);

            //输入框里的值改变后,更新滚动条。
            trackBar_RedGain.Value   = r;
            trackBar_GreenGain.Value = g;
            trackBar_BlueGain.Value  = b;

            MvApi.CameraSetGain(m_hCamera, r, g, b);
        }
예제 #2
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 { }
 }
예제 #3
0
        private void trackBar_RedGain_Scroll(object sender, EventArgs e)
        {
            if (this.ActiveControl != sender)
            {
                return;
            }

            int r = trackBar_RedGain.Value;
            int g = trackBar_GreenGain.Value;
            int b = trackBar_BlueGain.Value;

            //滚动后更新左边输入框的里值
            textBox_RedGain.Text   = r.ToString();
            textBox_GreenGain.Text = g.ToString();
            textBox_BlueGain.Text  = b.ToString();

            MvApi.CameraSetGain(m_hCamera, r, g, b);
        }