Esempio n. 1
0
 private void Form5_Load(object sender, EventArgs e)
 {
     toolStripTextBox1.Text = iniFileOP.Read("System Run", "MaxTime");
     toolStripTextBox2.Text = iniFileOP.Read("System Run", "PhotoNs");
     toolStripTextBox3.Text = iniFileOP.Read("System Run", "PicN");
     if (!SerialFunc.OpenSerialPort())
     {
         this.Close();
     }
     if (SystemParam.cmosInfo == null)
     {
         SystemParam.cmosInfo = SerialFunc.SerialCommand1();
         if (SystemParam.cmosInfo == null)
         {
             MessageBox.Show("与采集器通信失败");
             this.Close();
         }
         SystemParam.Ts        = (double)SystemParam.cmosInfo.Ts / 100 / 1000 / 1000;//ms
         SystemParam.Pixel4Pic = (int)SystemParam.cmosInfo.ColPixels * SystemParam.cmosInfo.RowPixels;
     }
     if (!CreateObjects())
     {
         DisposeObjects();
         return;
     }
 }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            return;

            InitSystemParam();
//            TestReport.MakeReport();
            //this.Controls.Add(this.m_ImageBox);
            AcqConfigDlg acConfigDlg = new AcqConfigDlg(null, "", AcqConfigDlg.ServerCategory.ServerAcq);

            if (acConfigDlg.InitServerCombo())
            {
                m_online = true;
            }
            else
            {
                m_online = false;
            }
            if (m_online)
            {
                //SerialFunc.SerialPortName = "COM2";
                if (!SerialFunc.OpenSerialPort())
                {
                    this.Close();
                }
            }
            else
            {
                toolStripButton3.Enabled = false;
                toolStripButton6.Enabled = false;
                toolStripButton8.Enabled = false;
                toolStripButton7.Enabled = false;
                m_Buffers = new SapBuffer(1, 600, 480, SapFormat.Mono16, SapBuffer.MemoryType.ScatterGather);
                //m_View = new SapView(m_Buffers);
                StatusLabelInfo.Text = "offline... Load images";
                float WidthScalor  = (float)(splitContainer1.Panel2.Size.Width) / m_Buffers.Width;
                float HeightScalor = (float)(splitContainer1.Panel2.Size.Height) / m_Buffers.Height;
                //m_View.SetScalingMode(WidthScalor, HeightScalor);
            }
            //m_ImageBox.View = m_View;

            if (!CreateObjects())
            {
                DisposeObjects();
                return;
            }
            //m_ImageBox.OnSize();
            for (int i = 0; i < listView1.Items.Count; i++)
            {
                listView1.Items[i].SubItems.Add("");
                listView1.Items[i].SubItems.Add("");
            }
            //EnableSignalStatus();
        }
Esempio n. 3
0
        private void 自定义暗场测试_Click(object sender, EventArgs e)
        {
            SerialFunc.CloseSerialPort();
            DestroyObjects();
            DisposeObjects();
            Form5 f = new Form5();

            f.ShowDialog();
            if (!SerialFunc.OpenSerialPort())
            {
                this.Close();
            }
        }
Esempio n. 4
0
 private void Form4_Load(object sender, EventArgs e)
 {
     StatusLabelInfo.Text = "offline... Load images";
     if (!SerialFunc.OpenSerialPort())
     {
         this.Close();
     }
     if (SystemParam.cmosInfo == null)
     {
         SystemParam.cmosInfo = SerialFunc.SerialCommand1();
         if (SystemParam.cmosInfo == null)
         {
             MessageBox.Show("与采集器通信失败");
             this.Close();
         }
         SystemParam.Ts        = (double)SystemParam.cmosInfo.Ts / 100 / 1000 / 1000;//ms
         SystemParam.Pixel4Pic = (int)SystemParam.cmosInfo.ColPixels * SystemParam.cmosInfo.RowPixels;
     }
     InitCam(1);
     toolStripTextBox2.Text = (trackBar1.Value * SystemParam.Ts).ToString("F3");
 }
Esempio n. 5
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            /************************************************************************/
            /* 传感器参数                                                           */
            /************************************************************************/
            SystemParam.cmosInfo.PixelArea = int.Parse(tbPixelArea.Text);
            SystemParam.cmosInfo.Lambda    = int.Parse(tbLambda.Text);
            SystemParam.cmosInfo.RGB1      = RGB1.SelectedIndex;
            SystemParam.cmosInfo.RGB2      = RGB2.SelectedIndex;
            SystemParam.cmosInfo.RGB3      = RGB3.SelectedIndex;
            SystemParam.cmosInfo.RGB4      = RGB4.SelectedIndex;
            SystemParam.ccfPath            = tbPath.Text;
            iniFileOP.Write("CMOS Param", "PixelArea", SystemParam.cmosInfo.PixelArea.ToString());
            iniFileOP.Write("CMOS Param", "Lambda", SystemParam.cmosInfo.Lambda.ToString());
            iniFileOP.Write("CMOS Param", "RGB1", SystemParam.cmosInfo.RGB1.ToString());
            iniFileOP.Write("CMOS Param", "RGB2", SystemParam.cmosInfo.RGB2.ToString());
            iniFileOP.Write("CMOS Param", "RGB3", SystemParam.cmosInfo.RGB3.ToString());
            iniFileOP.Write("CMOS Param", "RGB4", SystemParam.cmosInfo.RGB4.ToString());
            iniFileOP.Write("CMOS Param", "ccfPath", tbPath.Text);
            if (bRGB.Checked)
            {
                SystemParam.cmosInfo.bRGB = 1;
                iniFileOP.Write("CMOS Param", "bRGB", "1");
            }
            else
            {
                SystemParam.cmosInfo.bRGB = 0;
                iniFileOP.Write("CMOS Param", "bRGB", "0");
            }
            /************************************************************************/
            /* 曝光测试																*/
            /************************************************************************/
            SystemParam.ExposureTest_Ns = (int)numericUpDown1.Value;
            Calc1.k1 = (int)numericUpDown7.Value;
            Calc1.k2 = (int)numericUpDown8.Value;
            SystemParam.ExposurePointThreshold = (double)numericUpDown6.Value;

            Calc1.percent_base      = (double)numericUpDown10.Value;
            Calc1.percent           = (double)numericUpDown9.Value;
            SystemParam.PicDelay    = (int)numericUpDown16.Value;
            SystemParam.WaitTimeOut = (int)numericUpDown21.Value;
            iniFileOP.Write("System Setting", "ExposureTest_Ns", SystemParam.ExposureTest_Ns.ToString());
            iniFileOP.Write("System Setting", "k1", Calc1.k1.ToString());
            iniFileOP.Write("System Setting", "k2", Calc1.k2.ToString());
            iniFileOP.Write("System Setting", "percent_base", Calc1.percent_base.ToString());
            iniFileOP.Write("System Setting", "percent", Calc1.percent.ToString());

            iniFileOP.Write("System Setting", "PicDelay", SystemParam.PicDelay.ToString(""));
            iniFileOP.Write("System Setting", "WaitTimeOut", SystemParam.WaitTimeOut.ToString(""));
            /************************************************************************/
            /* 50%曝光测试                                                          */
            /************************************************************************/
            SystemParam.L             = (ushort)numericUpDown2.Value;
            SystemParam.Step2_len     = (ushort)numericUpDown3.Value;
            SystemParam.DarkPointPer  = (double)numericUpDown4.Value;
            SystemParam.LightPointPer = (double)numericUpDown5.Value;
            iniFileOP.Write("System Setting", "L", SystemParam.L.ToString());
            iniFileOP.Write("System Setting", "Step2_len", SystemParam.Step2_len.ToString());
            iniFileOP.Write("System Setting", "DarkPointPer", SystemParam.DarkPointPer.ToString("F1"));
            iniFileOP.Write("System Setting", "LightPointPer", SystemParam.LightPointPer.ToString("F1"));


            iniFileOP.Write("System Setting", "FPN_Per", ((int)(numericUpDown13.Value)).ToString());
            iniFileOP.Write("System Setting", "FPN_NS", ((int)(numericUpDown12.Value)).ToString());
            iniFileOP.Write("System Setting", "FPN_L", ((int)(numericUpDown11.Value)).ToString());
            iniFileOP.Write("System Setting", "FPN_Len", ((int)(numericUpDown14.Value)).ToString());


            /************************************************************************/
            /*  辐照度计算                                                          */
            /************************************************************************/
            SystemParam.eInfo.Rf  = (double)numericUpDown24.Value;
            SystemParam.eInfo.rho = (double)numericUpDown23.Value;
            SystemParam.eInfo.S   = (double)numericUpDown22.Value;
            iniFileOP.Write("E Calc", "Rf", SystemParam.eInfo.Rf.ToString("F0"));
            iniFileOP.Write("E Calc", "rho", SystemParam.eInfo.rho.ToString("F0"));
            iniFileOP.Write("E Calc", "S", SystemParam.eInfo.S.ToString("F0"));


            SystemParam.eStart   = (uint)numericUpDown17.Value;
            SystemParam.eStep    = (uint)numericUpDown18.Value;
            SystemParam.BaudRate = (int)numericUpDown19.Value;


            iniFileOP.Write("System Run", "eStart", SystemParam.eStart.ToString());
            iniFileOP.Write("System Run", "eStep", SystemParam.eStep.ToString());
            iniFileOP.Write("System Run", "BaudRate", SystemParam.BaudRate.ToString());
            try
            {
                SerialFunc.CloseSerialPort();
                SerialFunc.OpenSerialPort();
            }
            catch
            {
            }

            this.Close();
        }