Example #1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            try
            {
                rxNeed = ushort.Parse(toolStripTextBox1.Text);
                if (rxNeed > 20)
                {
                    MessageBox.Show("拍照张数不能超过20");
                }
            }
            catch
            {
                MessageBox.Show("拍照张数设定有误");
            }
            if (folderBrowserDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            saveFileFolder = folderBrowserDialog1.SelectedPath;
            uint t = uint.Parse(toolStripTextBox2.Text);

            ls                   = (uint)(t / SystemParam.Ts);//trackBar1.Value;
            rxFrame              = 0;
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = rxNeed;
            CMOSTestLib.WaitingProcFunc wpf = new CMOSTestLib.WaitingProcFunc(手动拍照);
            if (!waitProc.Execute(wpf, "手动拍照", CMOSTestLib.WaitingType.None, ""))
            {
                toolStrip1.Enabled = true;
                m_ImageBox.OnSize();
                return;
            }
            m_ImageBox.OnSize();
        }
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     MessageBox.Show("请转入暗场,点击确定继续");
     chart1.Series[0].Points.Clear();
     chart1.Series[1].Points.Clear();
     chart1.ChartAreas[0].AxisY.Title = "暗场均值";
     chart1.ChartAreas[1].AxisY.Title = "暗场方差";
     toolStrip1.Enabled = false;
     try
     {
         MaxTime = int.Parse(toolStripTextBox1.Text);
         PhotoNs = int.Parse(toolStripTextBox2.Text);
         PicN    = int.Parse(toolStripTextBox3.Text);
         iniFileOP.Write("System Run", "MaxTime", toolStripTextBox1.Text);
         iniFileOP.Write("System Run", "PhotoNs", toolStripTextBox2.Text);
         iniFileOP.Write("System Run", "PicN", toolStripTextBox3.Text);
     }
     catch //(System.Exception ex)
     {
         return;
     }
     dtStart  = DateTime.Now;
     fileName = SystemParam.TxtCustomDarkDataPath + dtStart.ToString("yyyyMMdd_HHmmss") + "\\数据" + ".txt";
     TextLog.AddTextLog("--------------" + dtStart.ToString() + "----------------", fileName, false);
     TextLog.AddTextLog(String.Format(SystemParam.TxtCustomDarkDataTitleFormat, "曝光时间(ms)", "暗场均值", "暗场方差"), fileName, false);
     //第一步、采集图像
     InitCam(PicN + 1);
     StatusLabelInfoTrash.Text = "";
     m_Xfer.Grab();
     waitProc             = new CMOSTestLib.WaitingProc();
     waitProc.MaxProgress = PhotoNs;
     CMOSTestLib.WaitingProcFunc wpf = new CMOSTestLib.WaitingProcFunc(暗场采集);
     if (!waitProc.Execute(wpf, "自定义暗场测试", CMOSTestLib.WaitingType.None, ""))
     {
         MessageBox.Show("用户终止自定义暗场测试");
         toolStrip1.Enabled = true;
         return;
     }
     MessageBox.Show("自定义暗场测试完成");
     toolStrip1.Enabled = true;
 }
Example #3
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     try
     {
         rxNeed = ushort.Parse(toolStripTextBox1.Text);
     }
     catch
     {
         MessageBox.Show("拍照张数设定有误");
     }
     ls                   = (uint)trackBar1.Value;
     rxFrame              = 0;
     waitProc             = new CMOSTestLib.WaitingProc();
     waitProc.MaxProgress = rxNeed;
     CMOSTestLib.WaitingProcFunc wpf = new CMOSTestLib.WaitingProcFunc(手动拍照);
     if (!waitProc.Execute(wpf, "手动拍照", CMOSTestLib.WaitingType.None, ""))
     {
         toolStrip1.Enabled = true;
         m_ImageBox.OnSize();
         return;
     }
     m_ImageBox.OnSize();
 }
        private void FPN测试_Click(object sender, EventArgs e)
        {
            int      saveindex = 0;
            string   fileName  = FPNFile_Path + "TempPic\\Light\\" + saveindex.ToString() + ".bmp";
            FileInfo f         = new FileInfo(fileName);

            if (!Directory.Exists(f.DirectoryName))
            {
                Directory.CreateDirectory(f.DirectoryName);
            }
            fileName = FPNFile_Path + "TempData\\Light\\" + "1.tif";
            f        = new FileInfo(fileName);
            if (!Directory.Exists(f.DirectoryName))
            {
                Directory.CreateDirectory(f.DirectoryName);
            }
            fileName = FPNFile_Path + "TempPic\\Dark\\" + "1.tif";
            f        = new FileInfo(fileName);
            if (!Directory.Exists(f.DirectoryName))
            {
                Directory.CreateDirectory(f.DirectoryName);
            }
            fileName = FPNFile_Path + "TempData\\Dark\\" + "1.tif";
            f        = new FileInfo(fileName);
            if (!Directory.Exists(f.DirectoryName))
            {
                Directory.CreateDirectory(f.DirectoryName);
            }

            iniFileOP.iniFilePath = System.Windows.Forms.Application.StartupPath + "\\Config.ini";
            FPN_Per = int.Parse(iniFileOP.Read("System Setting", "FPN_Per"));
            FPN_Ns  = int.Parse(iniFileOP.Read("System Setting", "FPN_Ns"));
            FPN_L   = int.Parse(iniFileOP.Read("System Setting", "FPN_L"));
            FPN_Len = int.Parse(iniFileOP.Read("System Setting", "FPN_Len"));
            MessageBox.Show("请转入明场,点击确定继续");
            textBox1.AppendText("-------------------------------------------------\r\n");
            chart1.Series[0].Points.Clear();
            chart1.Series[1].Points.Clear();
            chart1.Series[2].Points.Clear();
            toolStrip1.Enabled   = false;
            Calc1.p1             = (int)((Calc1.percent_base - Calc1.percent) * SystemParam.ExposureTest_Ns / 100);
            Calc1.p2             = (int)((Calc1.percent_base + Calc1.percent) * SystemParam.ExposureTest_Ns / 100);
            SystemParam.cmosInfo = SerialFunc.SerialCommand1();
            if (SystemParam.cmosInfo == null)
            {
                MessageBox.Show("与采集器通信失败");
                this.Close();
            }
            //第一步、采集图像
            testStep = 1;
            InitCam(2 + CamEx);
            StatusLabelInfoTrash.Text = "";
            m_Xfer.Grab();
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = SystemParam.ExposureTest_Ns;
            CMOSTestLib.WaitingProcFunc wpf = new CMOSTestLib.WaitingProcFunc(曝光测试);
            if (!waitProc.Execute(wpf, "曝光时间测试", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }
            testStep = 3;
            bLight   = true;
            InitCam(FPN_Len + +CamEx);
            m_Xfer.Grab();
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = FPN_L;
            wpf = new CMOSTestLib.WaitingProcFunc(FPNTest_Light);
            if (!waitProc.Execute(wpf, "FPN明场采集", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }
            MessageBox.Show("请转入暗场,点击确定继续");
            bLight               = false;
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = FPN_L;
            wpf = new CMOSTestLib.WaitingProcFunc(FPNTest_Light);
            if (!waitProc.Execute(wpf, "FPN暗场采集", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }


            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = 2 * FPN_L * FPN_Ns;
            wpf = new CMOSTestLib.WaitingProcFunc(FPNTest_ProcData);
            if (!waitProc.Execute(wpf, "FPN数据处理", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }
            MessageBox.Show("FPN测试完成");
        }
Example #5
0
        private void 开始测试_Click(object sender, EventArgs e)
        {
            //EnvironmentInfo ei = SerialFunc.SerialCommand2();
            MessageBox.Show("请转入明场,点击确定继续");
            /************************************************************************/
            /* 界面初始化                                                           */
            /************************************************************************/
            textBox1.AppendText("-------------------------------------------------\r\n");
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                chart1.Series[i].Points.Clear();
            }
            chart1.ChartAreas[0].AxisY.Title = "明场均值";
            chart1.ChartAreas[1].AxisY.Title = "明场方差";
            toolStrip1.Enabled = false;
            /************************************************************************/
            /*                                                                      */
            /************************************************************************/
            SystemParam.DeviceID = InputBox.ShowInputBox("请设定当前测试器件ID", SystemParam.DeviceID);
            iniFileOP.Write("System Run", "DeviceID", SystemParam.DeviceID);
            Calc1.p1 = (int)((Calc1.percent_base - Calc1.percent) * SystemParam.ExposureTest_Ns / 100);
            Calc1.p2 = (int)((Calc1.percent_base + Calc1.percent) * SystemParam.ExposureTest_Ns / 100);
            InitListView();
            if (m_online)
            {
                CMOSInfo cmosInfo = SerialFunc.SerialCommand1();
                if (cmosInfo == null)
                {
                    MessageBox.Show("与采集器通信失败");
                    toolStrip1.Enabled = true;
                    return;
                }
                SystemParam.cmosInfo.Ts = cmosInfo.Ts;

                SystemParam.Ts = (double)SystemParam.cmosInfo.Ts / 100 / 1000 / 1000;//ms
                //SystemParam.Pixel4Pic = (int)SystemParam.cmosInfo.ColPixels * SystemParam.cmosInfo.RowPixels;
            }

            /************************************************************************/
            /*                                                                      */
            /************************************************************************/
            //第一步、采集图像
            testStep = 1;
            InitCam(2 + CamEx);
            if (SystemParam.cmosInfo.bRGB != 0)
            {
                wfSapGUI.GetRGBPixelInfo(SystemParam.cmosInfo.RowPixels, SystemParam.cmosInfo.ColPixels, SystemParam.cmosInfo.RGB1, SystemParam.cmosInfo.RGB2, SystemParam.cmosInfo.RGB3, SystemParam.cmosInfo.RGB4);
            }
            StatusLabelInfoTrash.Text = "";
            m_Xfer.Grab();
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = SystemParam.ExposureTest_Ns;
            CMOSTestLib.WaitingProcFunc wpf = new CMOSTestLib.WaitingProcFunc(曝光测试);
            if (!waitProc.Execute(wpf, "曝光时间测试", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }

            MessageBox.Show("请转入暗场,点击确定继续");
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = SystemParam.ExposureTest_Ns;
            wpf = new CMOSTestLib.WaitingProcFunc(暗场采集);
            if (!waitProc.Execute(wpf, "曝光递进暗场采集", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }


            waitProc = new CMOSTestLib.WaitingProc();
            if (SystemParam.cmosInfo.bRGB == 0)
            {
                wpf = new CMOSTestLib.WaitingProcFunc(计算饱和输出电压_动态范围_平均暗信号_暗信号均方差);
                if (!waitProc.Execute(wpf, "计算饱和输出电压_动态范围_平均暗信号_暗信号均方差", CMOSTestLib.WaitingType.None, ""))
                {
                    textBox1.AppendText("用户终止自动测试\r\n");
                    toolStrip1.Enabled = true;
                    return;
                }
            }
            else
            {
                wpf = new CMOSTestLib.WaitingProcFunc(计算饱和输出电压_动态范围_平均暗信号_暗信号均方差);
                if (!waitProc.Execute(wpf, "灰度:计算饱和输出电压_动态范围_平均暗信号_暗信号均方差", CMOSTestLib.WaitingType.None, ""))
                {
                    textBox1.AppendText("用户终止自动测试\r\n");
                    toolStrip1.Enabled = true;
                    return;
                }

                wpf = new CMOSTestLib.WaitingProcFunc(RGB_计算饱和输出电压_动态范围_平均暗信号_暗信号均方差);
                if (!waitProc.Execute(wpf, "RGB:计算饱和输出电压_动态范围_平均暗信号_暗信号均方差", CMOSTestLib.WaitingType.None, ""))
                {
                    textBox1.AppendText("用户终止自动测试\r\n");
                    toolStrip1.Enabled = true;
                    return;
                }
            }
            m_Xfer.Freeze();
//
//             计算饱和输出电压_动态范围_平均暗信号_暗信号均方差();

            //Calc1.Saturated50Index = 118 / 2;
            //Calc1.OverAllGain_K = 0.01;
            //第二步、在同一曝光时间下,采集某一光照条件下和无光照条件下的L组数据
            testStep = 2;
            InitCam(SystemParam.Step2_len + CamEx);
            m_Xfer.Grab();
            toolStripLabel3.Text = SystemParam.GetTime(Calc1.Saturated50Index).ToString("F2") + " ms";
            SystemParam.CreateTempFile(m_Buffers.Height, m_Buffers.Width, m_Buffers.BytesPerPixel, SystemParam.L, Calc2.LightTempFile);
            SystemParam.CreateTempFile(m_Buffers.Height, m_Buffers.Width, m_Buffers.BytesPerPixel, SystemParam.L, Calc2.DarkTempFile);
            MessageBox.Show("曝光测试完成,请转入明场,点击确定进行下一步测试");
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = SystemParam.L;
            /*CMOSTestLib.WaitingProcFunc*/ wpf = new CMOSTestLib.WaitingProcFunc(第二步明场采集);
            if (!waitProc.Execute(wpf, "相同曝光条件下,明场采集", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }


            MessageBox.Show("请转入暗场,点击确定继续");
            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = SystemParam.L;
            wpf = new CMOSTestLib.WaitingProcFunc(第二步暗场采集);
            if (!waitProc.Execute(wpf, "相同曝光条件下,暗场采集", CMOSTestLib.WaitingType.None, ""))
            {
                textBox1.AppendText("用户终止自动测试\r\n");
                toolStrip1.Enabled = true;
                return;
            }


            waitProc             = new CMOSTestLib.WaitingProc();
            waitProc.MaxProgress = SystemParam.L;
            if (SystemParam.cmosInfo.bRGB == 0)
            {
                wpf = new CMOSTestLib.WaitingProcFunc(第二步数据处理);
                if (!waitProc.Execute(wpf, "相同曝光条件下数据处理", CMOSTestLib.WaitingType.None, ""))
                {
                    textBox1.AppendText("用户终止自动测试\r\n");
                    toolStrip1.Enabled = true;
                    return;
                }
            }
            else
            {
                wpf = new CMOSTestLib.WaitingProcFunc(RGB_第二步数据处理);
                if (!waitProc.Execute(wpf, "相同曝光条件下数据处理", CMOSTestLib.WaitingType.None, ""))
                {
                    textBox1.AppendText("用户终止自动测试\r\n");
                    toolStrip1.Enabled = true;
                    return;
                }
            }
            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                textBox1.AppendText("自动测试结束,用户未保存报告\r\n");
                MessageBox.Show("CMOS测试完成");
                toolStrip1.Enabled = true;
                return;
            }
            if (SystemParam.cmosInfo.bRGB == 0)
            {
                /************************************************************************/
                /* 生成报告用图片                                                        */
                /************************************************************************/
                double t;
                for (int i = 0; i < chart2.Series.Count; i++)
                {
                    chart2.Series[i].Points.Clear();
                }
                chart2.ChartAreas[0].AxisY.Title   = "明场均值";
                chart2.ChartAreas[0].AxisY.Minimum = double.NaN;
                for (int i = 0; i < SystemParam.ExposureTest_Ns; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.miu_y[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.ChartAreas[0].AxisY.Title   = "平均暗信号";
                chart2.ChartAreas[0].AxisY.Minimum = Calc1.miu_d.Min <double>();
                chart2.Series[0].Points.Clear();
                for (int i = 0; i < SystemParam.ExposureTest_Ns; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.miu_d[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "2.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);


                chart2.ChartAreas[0].AxisY.Title = "暗信号均方差";
                List <double> axhjfc = new List <double>();
                for (int i = 0; i < SystemParam.ExposureTest_Ns; i++)
                {
                    axhjfc.Add(Math.Sqrt(Calc1.delta_y_dark[i]) / Calc1.OverAllGain_K);
                }
                chart2.Series[0].Points.Clear();
                chart2.ChartAreas[0].AxisY.Minimum = axhjfc.Min <double>();
                for (int i = 0; i < SystemParam.ExposureTest_Ns; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, axhjfc[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "3.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.ChartAreas[0].AxisY.Title = "信噪比";
                chart2.Series[0].Points.Clear();
                chart2.ChartAreas[0].AxisY.Minimum = double.NaN;
                for (int i = 0; i < SystemParam.ExposureTest_Ns; i++)
                {
                    t = SystemParam.GetTime(i);
                    if (Calc1.SNR[i] == double.MaxValue)
                    {
                        int p = chart2.Series[0].Points.AddXY(t, 0);
                        chart2.Series[0].Points[p].IsEmpty = true;
                    }
                    else
                    {
                        chart2.Series[0].Points.AddXY(t, Calc1.SNR[i]);
                    }
                }
                chart2.SaveImage(SystemParam.TempPicPath + "4.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                TestReport.MakeReport(saveFileDialog1.FileName);
            }
            else
            {
                /************************************************************************/
                /* 生成报告用图片                                                        */
                /************************************************************************/
                double t;
                for (int i = 0; i < chart2.Series.Count; i++)
                {
                    chart2.Series[i].Points.Clear();
                }
                chart2.ChartAreas[0].AxisY.Title   = "明场均值";
                chart2.ChartAreas[0].AxisY.Minimum = double.NaN;
                chart2.Series[0].Color             = System.Drawing.Color.Red;
                for (int i = 0; i < Calc1.R_miu_y.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.R_miu_y[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "1_R.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.Series[0].Points.Clear();
                chart2.Series[0].Color = System.Drawing.Color.Lime;
                for (int i = 0; i < Calc1.G_miu_y.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.G_miu_y[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "1_G.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.Series[0].Points.Clear();
                chart2.Series[0].Color = System.Drawing.Color.Blue;
                for (int i = 0; i < Calc1.B_miu_y.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.B_miu_y[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "1_B.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                /************************************************************************/
                /*                                                                      */
                /************************************************************************/
                chart2.ChartAreas[0].AxisY.Title = "平均暗信号";
                chart2.Series[0].Points.Clear();
                chart2.Series[0].Color             = System.Drawing.Color.Red;
                chart2.ChartAreas[0].AxisY.Minimum = Calc1.R_miu_d.Min <double>();
                for (int i = 0; i < Calc1.R_miu_d.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.R_miu_d[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "2_R.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.Series[0].Points.Clear();
                chart2.Series[0].Color             = System.Drawing.Color.Lime;
                chart2.ChartAreas[0].AxisY.Minimum = Calc1.G_miu_d.Min <double>();
                for (int i = 0; i < Calc1.G_miu_d.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.G_miu_d[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "2_G.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.Series[0].Points.Clear();
                chart2.Series[0].Color             = System.Drawing.Color.Blue;
                chart2.ChartAreas[0].AxisY.Minimum = Calc1.B_miu_d.Min <double>();
                for (int i = 0; i < Calc1.B_miu_d.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, Calc1.B_miu_d[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "2_B.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                /************************************************************************/
                /*                                                                      */
                /************************************************************************/


                chart2.ChartAreas[0].AxisY.Title = "暗信号均方差";
                chart2.Series[0].Color           = System.Drawing.Color.Red;
                List <double> axhjfc = new List <double>();
                for (int i = 0; i < Calc1.R_delta_y_dark.Count; i++)
                {
                    axhjfc.Add(Math.Sqrt(Calc1.R_delta_y_dark[i]) / Calc1.R_OverAllGain_K);
                }
                chart2.Series[0].Points.Clear();
                chart2.ChartAreas[0].AxisY.Minimum = axhjfc.Min <double>();
                for (int i = 0; i < axhjfc.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, axhjfc[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "3_R.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                axhjfc = new List <double>();
                for (int i = 0; i < Calc1.G_delta_y_dark.Count; i++)
                {
                    axhjfc.Add(Math.Sqrt(Calc1.G_delta_y_dark[i]) / Calc1.G_OverAllGain_K);
                }
                chart2.Series[0].Points.Clear();
                chart2.ChartAreas[0].AxisY.Minimum = axhjfc.Min <double>();
                chart2.Series[0].Color             = System.Drawing.Color.Lime;
                for (int i = 0; i < axhjfc.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, axhjfc[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "3_G.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                axhjfc = new List <double>();
                for (int i = 0; i < Calc1.B_delta_y_dark.Count; i++)
                {
                    axhjfc.Add(Math.Sqrt(Calc1.B_delta_y_dark[i]) / Calc1.B_OverAllGain_K);
                }
                chart2.Series[0].Points.Clear();
                chart2.ChartAreas[0].AxisY.Minimum = axhjfc.Min <double>();
                chart2.Series[0].Color             = System.Drawing.Color.Blue;
                for (int i = 0; i < axhjfc.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    chart2.Series[0].Points.AddXY(t, axhjfc[i]);
                }
                chart2.SaveImage(SystemParam.TempPicPath + "3_B.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                /************************************************************************/
                /*                                                                      */
                /************************************************************************/

                chart2.ChartAreas[0].AxisY.Title = "信噪比";
                chart2.Series[0].Points.Clear();
                chart2.Series[0].Color             = System.Drawing.Color.Red;
                chart2.ChartAreas[0].AxisY.Minimum = double.NaN;
                for (int i = 0; i < Calc1.R_SNR.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    if (Calc1.R_SNR[i] == double.MaxValue)
                    {
                        int p = chart2.Series[0].Points.AddXY(t, 0);
                        chart2.Series[0].Points[p].IsEmpty = true;
                    }
                    else
                    {
                        chart2.Series[0].Points.AddXY(t, Calc1.R_SNR[i]);
                    }
                }
                chart2.SaveImage(SystemParam.TempPicPath + "4_R.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.Series[0].Points.Clear();
                chart2.ChartAreas[0].AxisY.Minimum = double.NaN;
                chart2.Series[0].Color             = System.Drawing.Color.Lime;
                for (int i = 0; i < Calc1.G_SNR.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    if (Calc1.G_SNR[i] == double.MaxValue)
                    {
                        int p = chart2.Series[0].Points.AddXY(t, 0);
                        chart2.Series[0].Points[p].IsEmpty = true;
                    }
                    else
                    {
                        chart2.Series[0].Points.AddXY(t, Calc1.G_SNR[i]);
                    }
                }
                chart2.SaveImage(SystemParam.TempPicPath + "4_G.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                chart2.Series[0].Points.Clear();
                chart2.ChartAreas[0].AxisY.Minimum = double.NaN;
                chart2.Series[0].Color             = System.Drawing.Color.Blue;
                for (int i = 0; i < Calc1.B_SNR.Count; i++)
                {
                    t = SystemParam.GetTime(i);
                    if (Calc1.B_SNR[i] == double.MaxValue)
                    {
                        int p = chart2.Series[0].Points.AddXY(t, 0);
                        chart2.Series[0].Points[p].IsEmpty = true;
                    }
                    else
                    {
                        chart2.Series[0].Points.AddXY(t, Calc1.B_SNR[i]);
                    }
                }
                chart2.SaveImage(SystemParam.TempPicPath + "4_B.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                TestReport.RGBMakeReport(saveFileDialog1.FileName);
            }
            textBox1.AppendText("自动测试结束,测试报告保存位置为:\r\n");
            textBox1.AppendText(saveFileDialog1.FileName);
            MessageBox.Show("CMOS测试完成");
            toolStrip1.Enabled = true;
        }