void TestImage() { WriteableBitmap b = LChartPhoto.getPhoto(); if (b == null) { SilverlightLFC.common.Environment.ShowMessage("没有要测试的照片"); return; } decimal d = 0m; try { d = xt.getAberration(b); } catch (Exception xe) //未知的异常 { if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("广角端畸变测试错误"); } } try{ double leftCirclePoint = Convert.ToDouble(xt.ProcessInfor["AberrationLCP"]); double rightCirclePoint = Convert.ToDouble(xt.ProcessInfor["AberrationRCP"]); double lv = Convert.ToDouble(xt.ProcessInfor["AberrationLVP"]); double rv = Convert.ToDouble(xt.ProcessInfor["AberrationRVP"]); leftCirclePoint = leftCirclePoint / b.PixelWidth; rightCirclePoint = rightCirclePoint / b.PixelWidth; lv = lv / b.PixelWidth; rv = rv / b.PixelWidth; dg.DrawLine(leftCirclePoint * LChartPhoto.Width, 0, leftCirclePoint * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Green)); dg.DrawLine(rightCirclePoint * LChartPhoto.Width, 0, rightCirclePoint * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Green)); dg.DrawLine(lv * LChartPhoto.Width, 0, lv * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Red)); dg.DrawLine(rv * LChartPhoto.Width, 0, rv * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Red)); textBlockAberration.Text = d.ToString(); textBlockStandardLong.Text = (rightCirclePoint - leftCirclePoint).ToString(); textBlockTrueLong.Text = (rv - lv).ToString(); } catch (Exception xe) //未知的异常 { if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("广角端畸变测试错误"); } } }
public void XMarkTest()//测试XMark卡的各种参数 { processbar.Value = 0; ResultPanel.Children.Clear(); sw.Stop(); sw.Start(); Button li; XMarkChart xm = new XMarkChart(SourcePhoto); xm.CorrectChart(); xm.BeginAnalyse(); processbar.Value = 10; decimal r; r = xm.getAberration() * 100; li = new Button(); li.Click += new RoutedEventHandler(XMarkMTF_Click); li.Name = "WAberration"; li.Content = "广角端畸变:" + r.ToString() + " %"; li.SetValue(ToolTipService.ToolTipProperty, "数据表示照片里面几何变形程度,正表示桶形畸变,负表示枕型畸变,0为无畸变"); ResultPanel.Children.Add(li); processbar.Value = 20; r = Convert.ToDecimal(xm.getLatitude()); li = new Button(); li.Name = "DynamicLatitude"; li.Content = "动态范围:" + r.ToString() + " 级"; li.Click += new RoutedEventHandler(XMarkLatitude_Click); li.SetValue(ToolTipService.ToolTipProperty, "数据表示在一张照片里面可以分辨的灰度等级的数量"); ResultPanel.Children.Add(li); processbar.Value = 30; r = xm.getColorDis(); li = new Button(); li.Name = "ColorTrendValue"; li.Content = "色彩趋向差异:" + r.ToString() + " 度"; li.Click += new RoutedEventHandler(XMarkColorDis_Click); li.SetValue(ToolTipService.ToolTipProperty, "数据表示在拍摄标准颜色时候色调的偏差,完全准确时为0"); ResultPanel.Children.Add(li); processbar.Value = 40; r = xm.getNoiseNum() * 100; li = new Button(); li.Name = "Noise"; li.Content = "噪点:" + r.ToString() + " %"; li.SetValue(ToolTipService.ToolTipProperty, "数据表示在一张照片里面可以分辨的噪点数量"); ResultPanel.Children.Add(li); processbar.Value = 50; r = xm.getWhiteBanlance() * 100; li = new Button(); li.Name = "AutoWhiteBalanceDistance"; li.Content = "白平衡能力:" + r.ToString() + " %"; li.Click += new RoutedEventHandler(XMarkWhiteBalance_Click); li.SetValue(ToolTipService.ToolTipProperty, "数据表示拍摄灰度的时刻偏离灰度的程度,完全准确时为0"); ResultPanel.Children.Add(li); processbar.Value = 60; r = Convert.ToDecimal(xm.getVEdgeDispersiveness()); li = new Button(); li.Name = "Dispersiveness"; li.Content = "色散:" + r.ToString() + " Pxl"; li.SetValue(ToolTipService.ToolTipProperty, "数据表示红绿蓝三原色在边界分离的程度,也就是平均分离到几个像素,无色散时为0"); li.Click += new RoutedEventHandler(XMarkDispersiveness_Click); ResultPanel.Children.Add(li); processbar.Value = 70; r = xm.getBrightChanges() * 100; li = new Button(); li.Name = "TLightingEquality"; li.Content = "亮度一致性:" + r.ToString() + " %"; li.Click += new RoutedEventHandler(XMarkBrightChanges_Click); li.SetValue(ToolTipService.ToolTipProperty, "数据表示在照片里面中心亮度和四周亮度的差异,无差异时为0"); ResultPanel.Children.Add(li); processbar.Value = 80; r = xm.getHEdgeResoveLines(); li = new Button(); li.Name = "ResolvingPower"; li.Content = "分辨率:" + r.ToString() + " lw/ph"; li.Click += new RoutedEventHandler(XMarkMTF_Click); li.SetValue(ToolTipService.ToolTipProperty, "数据表示在一张照片里面可以分辨的水平线条的数量"); ResultPanel.Children.Add(li); processbar.Value = 90; r = xm.getWaveQ() * 100; li = new Button(); li.Name = "WaveQ"; li.Content = "成像一致性:" + r.ToString() + " %"; li.Click += new RoutedEventHandler(XMarkWaveQ_Click); li.SetValue(ToolTipService.ToolTipProperty, "数据表示照片里面还原正弦灰度区域的能力,完全还原时为0,差异越大数据越大"); ResultPanel.Children.Add(li); processbar.Value = 100; sw.Stop(); li.SetValue(ToolTipService.ToolTipProperty, "测试共花费" + sw.Interval.Milliseconds.ToString() + "ms"); Logo.Source = xm.AnalysePhoto; }