Beispiel #1
0
        //public List<IParameter> ParameterList = new List<IParameter>();
        //public void WriteToHTML()
        //{

        //    string s = "";

        //    s = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN/\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">";
        //    s = s + "<head><meta http-equiv=\"Content-Language\" content=\"zh-cn\" /><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
        //    s = s + "<title>shiyan</title><style type=\"text/css\">.style1 {text-align: left;}.style2 {margin-left: 40px;}.style3 {	text-decoration: underline;	margin-left: 40px;}</style></head>";
        //    s = s + "<body>";

        //    s = s + "<h2>测试结果信息:</h2>";
        //    foreach (LParameter lp in ParameterList)
        //    {
        //        s = s + "指标名称:" + lp.Name;
        //        s = s + "<p class=\"style2\">说明:" + lp.Memo + "</p>";
        //        s = s + "<p>测试时间:" + lp.TestTime.ToString() + "</p>";
        //        if (lp.Value != Double.NaN)
        //        {
        //            s = s + "<p>测试值:" + lp.Value.ToString() + lp.Dimension + "</p>";
        //        }
        //    }
        //    s = s + "</body></html>";
        //    SilverlightLFC.common.Environment.getEnvironment().SaveFileString(s, "HTML文件|*.html");

        //    //SaveFileDialog of = new SaveFileDialog();
        //    //of.Filter = "HTML文件|*.html";
        //    //of.ShowDialog();
        //    //byte[] sb = System.Text.Encoding.Unicode.GetBytes(s);
        //    //Stream fs = of.OpenFile();
        //    //if (fs != null)
        //    //{
        //    //    fs.Write(sb, 0, sb.Length);
        //    //}
        //}

        //System.Windows.Threading.DispatcherTimer time = new System.Windows.Threading.DispatcherTimer();
        //int pi = 0;
        //void autoTest()
        //{
        //    if (!TestChartNull()) { return; }
        //    BeginTime = DateTime.Now;
        //    Begin();
        //    EndTime = DateTime.Now;
        //}
        //bool IsTesting = false;
        //public void Begin()
        //{
        //    if (IsTesting) { return; }
        //    IsTesting = true;
        //    ParameterList.Clear();
        //    time.Interval = TimeSpan.FromSeconds(2);
        //    time.Tick += new EventHandler(time_Tick);
        //    PreProcess();
        //    pi = 0;
        //    time.Start();
        //}
        //public void PreProcess()
        //{
        //    try
        //    {
        //        t.setChart(ChartPhoto.getPhoto());
        //        t.PhotoTestProc += new PhotoTestProcessHandler(t_PhotoTestProc);
        //        //t.corrCorrectXMark();
        //        t.BeginAnalyse();
        //        processbar.Value = 5;
        //    }
        //    catch (Exception xe)//未知的异常
        //    {
        //        if (xe is LFCException)//已经是系统约定的错误类型,直接往上抛
        //        {
        //            SilverlightLFC.common.Environment.ShowMessage(xe.Message);
        //        }
        //        else
        //        {
        //            SilverlightLFC.common.Environment.ShowMessage("测试卡矫正错误,请检查照片");
        //            //throw new SilverlightLFC.common.LFCException("测试卡矫正错误", null);
        //        }
        //    }
        //}
        //public void TestFinish()
        //{
        //    time.Tick -= new EventHandler(time_Tick);
        //    processbar.Value = 100;
        //    IsTesting = false;
        //    EndTime = DateTime.Now;
        //    pi = 0;
        //    ToolTipService.SetToolTip(processbar, "本次测试耗时(ms):" + (EndTime - BeginTime).TotalMilliseconds.ToString());

        //}
        //void time_Tick(object sender, EventArgs e)
        //{
        //    time.Stop();
        //    pi++;
        //    if (pi == 1) { TestWhiteBalance(); }
        //    if (pi == 2) { TestColorTrendValue(); }
        //    if (pi == 3) { TestNoise(); }
        //    if (pi == 4) { TestFinish(); return; }
        //    time.Start();
        //}
        void TestWhiteBalance()
        {
            try
            {
                BeginTime = DateTime.Now;
                decimal d = Convert.ToDecimal((testHelper.CurrentChart as XRiteColorChart).getWhiteBanlance()) * 100;
                buttonWhiteBalance.Content = "白平衡误差:" + d.ToString();
                buttonWhiteBalance.Content = buttonWhiteBalance.Content + " %";
                buttonWhiteBalance.SetValue(ToolTipService.ToolTipProperty, "数据表示拍摄灰度的时刻偏离灰度的程度,完全准确时为0");
                EndTime = DateTime.Now;
                LParameter lp = testHelper.getNewParameter("XRite色标测试卡", Convert.ToDouble(d), BeginTime, EndTime);
                lp.Name      = "白平衡误差";
                lp.Memo      = "数据表示拍摄灰度的时刻偏离灰度的程度,完全准确时为0";
                lp.Dimension = "%";
                //lp.TestWay = "XRite色标测试卡";
                //lp.TestTime = EndTime;
                //lp.SpendTime = (EndTime - BeginTime).TotalMilliseconds;
                //lp.Value = Convert.ToDouble(d);
                testHelper.ParameterList.Add(lp);
                //processbar.Value = 20;
                //time.Start();
            }
            catch (Exception xe)//未知的异常
            {
                testHelper.ProcessError(xe, "计算白平衡误差错误");
            }
        }
Beispiel #2
0
        //public List<string> ParameterHtml = new List<string>();

        //public void WriteToHTML()
        //{

        //    string s = "";

        //    s = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN/\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">";
        //    s = s + "<head><meta http-equiv=\"Content-Language\" content=\"zh-cn\" /><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
        //    s = s + "<title>shiyan</title><style type=\"text/css\">.style1 {text-align: left;}.style2 {margin-left: 40px;}.style3 {	text-decoration: underline;	margin-left: 40px;}</style></head>";
        //    s = s + "<body>";

        //    s = s + "<h2>测试结果信息:</h2>";
        //    foreach (LParameter lp in ParameterList)
        //    {
        //        s = s + "指标名称:" + lp.Name;
        //        s = s + "<p class=\"style2\">说明:" + lp.Memo + "</p>";
        //        s = s + "<p>测试时间:" + lp.TestTime.ToString() + "</p>";
        //        if (lp.Value != Double.NaN)
        //        {
        //            s = s + "<p>测试值:" + lp.Value.ToString() + lp.Dimension + "</p>";
        //        }
        //    }
        //    s = s + "</body></html>";
        //    SilverlightLFC.common.Environment.getEnvironment().SaveFileString(s, "HTML文件|*.html");

        //    //SaveFileDialog of = new SaveFileDialog();
        //    //of.Filter = "HTML文件|*.html";
        //    //of.ShowDialog();
        //    //byte[] sb = System.Text.Encoding.Unicode.GetBytes(s);
        //    //Stream fs = of.OpenFile();
        //    //if (fs != null)
        //    //{
        //    //    fs.Write(sb, 0, sb.Length);
        //    //}
        //}

        //ISO12233Chart t = new ISO12233Chart();

        void TestRayleiResolution()
        {
            try
            {
                BeginTime = DateTime.Now;

                long r = (testHelper.CurrentChart as ISO12233Chart).getLPResoveLines();
                buttonRayleiResolution.Content = "分辨率(中央):" + r.ToString() + " LW/PH";
                buttonRayleiResolution.SetValue(ToolTipService.ToolTipProperty, "利用瑞利判据,直观判断相机分辨率,数据表示在一张照片里面可以分辨的垂直线条的数量");
                EndTime = DateTime.Now;
                LParameter lp = testHelper.getNewParameter("ISO2233测试卡", Convert.ToDouble(r), BeginTime, EndTime);
                lp.Name      = "中央瑞利分辨率";
                lp.Memo      = "利用瑞利判据,直观判断相机分辨率,数据表示在一张照片里面可以分辨的垂直线条的数量";
                lp.Dimension = "LW/PH";

                //lp.TestWay = "ISO2233测试卡";
                //lp.TestTime = EndTime;
                //lp.SpendTime = (EndTime - BeginTime).TotalMilliseconds;
                //lp.Value = r;
                testHelper.ParameterList.Add(lp);
                //processbar.Value = 20;
                //time.Start();
            }
            catch (Exception xe)//未知的异常
            {
                testHelper.ProcessError(xe, "中央分辨率(瑞利判据)测试错误");
                //if (xe is LFCException)//已经是系统约定的错误类型,直接往上抛
                //{
                //    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                //}
                //else
                //{
                //    SilverlightLFC.common.Environment.ShowMessage("中央分辨率(瑞利判据)测试错误");
                //    //throw new SilverlightLFC.common.LFCException("中央分辨率(瑞利判据)测试错误", null);
                //}
            }
        }
Beispiel #3
0
        //public List<IParameter> ParameterList = new List<IParameter>();
        //BackgroundWorker bw = new BackgroundWorker();
        //public event DefE ce;
        //void autoTest()
        //{
        //if (!TestChartNull()) { return; }
        //try{

        //    Begin();
        //EndTime = DateTime.Now;
        //}
        //catch (Exception e)
        //{
        //    SilverlightLFC.common.Environment.ShowMessage(e.Message);
        //}
        //}

        //void InitChartTestList()
        //{
        //    tl.Clear();
        //    foreach (WriteableBitmap tb in lPhotoList1.PhotoList)
        //    {
        //        XMarkChart t = new XMarkChart(tb);
        //        tl.Add(tb, t);
        //    }
        //}
        //bool IsTesting = false;
        //public void BeginAll()
        //{
        //    if (IsTesting) { return; }
        //    BeginTime = DateTime.Now;
        //    IsTesting = true;
        //    ParameterList.Clear();
        //    time.Interval = TimeSpan.FromSeconds(2);
        //    processbar.Value = 0;
        //    time.Tick += new EventHandler(time_Tick);
        //    TaskList.Clear();
        //    foreach (WriteableBitmap tb in lPhotoList1.PhotoList)
        //    {
        //        TaskList.Add(MoveToNextPhoto);
        //        TaskList.Add(PreProcess);
        //        TaskList.Add(TestAberration);
        //        TaskList.Add(TestBrightChanges);
        //        TaskList.Add(TestColorTrend);
        //        TaskList.Add(TestHEdgeDispersiveness);
        //        TaskList.Add(TestVEdgeDispersiveness);
        //        TaskList.Add(TestHEdgeResoveLines);
        //        TaskList.Add(TestVEdgeResoveLines);
        //        TaskList.Add(TestLatitude);
        //        TaskList.Add(TestNoise);
        //        TaskList.Add(TestPurplePercent);
        //        TaskList.Add(TestWaveQ);
        //        TaskList.Add(TestWhiteBanlance);
        //    }
        //    pi = -1;
        //    PhotoIndex = -1;
        //    time.Start();
        //}
        //public void Begin()
        //{
        //    if (IsTesting) { return; }
        //    BeginTime = DateTime.Now;
        //    IsTesting = true;
        //    ParameterList.Clear();
        //    processbar.Value = 0;
        //    time.Interval = TimeSpan.FromSeconds(2);
        //    time.Tick += new EventHandler(time_Tick);
        //    //PreProcess();
        //    TaskList.Clear();

        //    PhotoIndex = lPhotoList1.getPhotoIndex(ChartPhoto.getPhoto());

        //    CurrentChart = tl[ChartPhoto.getPhoto()];
        //    TaskList.Add(PreProcess);
        //    TaskList.Add(TestAberration);
        //    TaskList.Add(TestBrightChanges);
        //    TaskList.Add(TestColorTrend);
        //    TaskList.Add(TestHEdgeDispersiveness);
        //    TaskList.Add(TestVEdgeDispersiveness);
        //    TaskList.Add(TestHEdgeResoveLines);
        //    TaskList.Add(TestVEdgeResoveLines);
        //    TaskList.Add(TestLatitude);
        //    TaskList.Add(TestNoise);
        //    TaskList.Add(TestPurplePercent);
        //    TaskList.Add(TestWaveQ);
        //    TaskList.Add(TestWhiteBanlance);
        //    pi = -1;
        //    time.Start();
        //}
        //int pi = 0;
        //List<ParameterTest> TaskList = new List<ParameterTest>();
        //double stepPercent;
        //void time_Tick(object sender, EventArgs e)
        //{
        //    time.Stop();
        //    pi++;
        //    if (pi < TaskList.Count )
        //    {
        //        //pi++;
        //        TaskList[pi]();
        //        processbar.Value = processbar.Value + (100d / TaskList.Count);
        //        time.Start();
        //    }
        //    else
        //    {
        //        TestFinish();
        //        ShowTestResult();
        //        return;
        //    }
        //    //if (pi == 1) { TestAberration(); }
        //    //if (pi == 2) { TestBrightChanges(); }
        //    //if (pi == 3) { TestColorTrend(); }
        //    //if (pi == 4) { TestHEdgeDispersiveness(); }
        //    //if (pi == 5) { TestVEdgeDispersiveness(); }
        //    //if (pi == 6) { TestHEdgeResoveLines(); }
        //    //if (pi == 7) { TestVEdgeResoveLines(); }
        //    //if (pi == 8) { TestLatitude(); }
        //    //if (pi == 9) { TestNoise(); }
        //    //if (pi == 10) { TestPurplePercent(); }
        //    //if (pi == 11) { TestWaveQ(); }
        //    //if (pi == 12) { TestWhiteBanlance(); }
        //    //if (pi == 13) { TestFinish(); return; }
        //    //time.Start();
        //}
        //int PhotoIndex = -1;
        //public void MoveToNextPhoto()
        //{
        //    PhotoIndex++;
        //    CurrentChart = tl[lPhotoList1.getPhoto(PhotoIndex)];
        //}
        //void ProcessError(Exception xe, string DefaultStr)
        //{
        //    IsTesting = false;
        //    time.Stop();
        //    time.Tick -= new EventHandler(time_Tick);
        //    if (xe is LFCException)//已经是系统约定的错误类型,直接往上抛
        //    {
        //        SilverlightLFC.common.Environment.ShowMessage(xe.Message);
        //    }
        //    else
        //    {
        //        SilverlightLFC.common.Environment.ShowMessage(DefaultStr);
        //    }
        //}
        //XMarkChart CurrentChart;
        //public void PreProcess()
        //{
        //    try
        //    {
        //        //CurrentChart = tl[lPhotoList1.getPhoto(PhotoIndex)];
        //        //t.setChart();
        //        //t.PhotoTestProc += new PhotoTestProcessHandler(t_PhotoTestProc);
        //        CurrentChart.CorrectChart();
        //        CurrentChart.BeginAnalyse();
        //        //processbar.Value = 5;
        //        //time.Start();
        //    }
        //    catch (Exception xe)//未知的异常
        //    {
        //        ProcessError(xe,"测试卡矫正错误,请检查照片");

        //    }
        //}
        //DateTime _BeginTime, _EndTime;
        //LParameter getNewParameter(double r)
        //{
        //    LParameter lp = new LParameter();
        //    lp.TestTime = _EndTime;
        //    lp.SpendTime = (_EndTime - _BeginTime).TotalMilliseconds;
        //    lp.Value = r;
        //    lp.TestChart = testHelper.CurrentChart.ChartPhoto;
        //    lp.TestWay = "XMark测试卡";
        //    return lp;
        //}
        public void TestAberration()
        {
            try
            {
                BeginTime = DateTime.Now;
                //Button li = new Button();
                decimal r = (testHelper.CurrentChart as XMarkChart).getAberration() * 100;
                //ShowTestResult(buttonAberration, "畸变");
                buttonAberration.Content = "畸变:" + r.ToString() + " %";
                buttonAberration.SetValue(ToolTipService.ToolTipProperty, "数据表示照片里面几何变形程度,正表示桶形畸变,负表示枕型畸变,0为无畸变");
                //ResultPanel.Children.Add(li);
                //t.sendProcEvent(true, "");
                EndTime = DateTime.Now;
                LParameter lp = testHelper.getNewParameter("XMark测试卡", Convert.ToDouble(r), BeginTime, EndTime);
                lp.Name      = "畸变";
                lp.Memo      = "数据表示照片里面几何变形程度,正表示桶形畸变,负表示枕型畸变,0为无畸变";
                lp.Dimension = "%";
                //lp.TestWay = "XMark测试卡";
                //lp.TestTime = _EndTime;
                //lp.SpendTime = (_EndTime - _BeginTime).TotalMilliseconds;
                //lp.Value = Convert.ToDouble(r);
                //lp.TestWay = t.ChartPhoto;
                //lp.TestChart = testHelper.CurrentChart.ChartPhoto;
                testHelper.ParameterList.Add(lp);
                //processbar.Value = 10;
                //time.Start();
            }
            catch (Exception xe)//未知的异常
            {
                testHelper.ProcessError(xe, "测试畸变错误");
            }
        }