void LoadPhoto(WriteableBitmap TargetPhoto) { if (TargetPhoto == null) { return; } lChartPhoto1.setPhoto(TargetPhoto); Color c = pt.getAverageColor(TargetPhoto); textBlockR.Text = c.R.ToString(); textBlockG.Text = c.G.ToString(); textBlockB.Text = c.B.ToString(); double rg = (Convert.ToDouble(c.R) / Convert.ToDouble(c.G)); double bg = (Convert.ToDouble(c.R) / Convert.ToDouble(c.G)); textBlockJBBG.Text = bg.ToString(); textBlockJBRG.Text = rg.ToString(); if (rg > 0.8 && rg < 1.2 && bg > 0.8 && bg < 1.2) { ChartTestHelper.setGBSign(true, gridGB); } else { ChartTestHelper.setGBSign(false, gridGB); } DrawGraphic dg = new DrawGraphic(DrawCanvas); dg.ForeColor = Colors.Blue; dg.DrawColorPoint(c, 0.9f, 3); }
void TestGB(WriteableBitmap b) { GBValue = (TestChart as GrayChart).ptp.getGBBrightChangedValue(b, GBSelectAreaNum); if (IsLongFocus) { if (GBValue > 0.7) { ChartTestHelper.setGBSign(true, GBControl); } else { ChartTestHelper.setGBSign(false, GBControl); } } else { if (GBValue > 0.5) { ChartTestHelper.setGBSign(true, GBControl); } else { ChartTestHelper.setGBSign(false, GBControl); } } }
public List <Result> TestLatitude(WriteableBitmap chart) { try { var rl = new List <Result>(); TestChart.setChart(chart); (TestChart as ITEGrayscaleChart).ConstGradeL = ConstL; LatitudeValue = (TestChart as ITEGrayscaleChart).getGrayGrade(TestAreaHeight, TestAreaWidth); Result lp = new Result(); lp.Name = "Latitude"; lp.Memo = "数据表示在一张照片里面可以分辨的灰阶亮度级别"; lp.Dimension = "Grade"; lp.Value = LatitudeValue; rl.Add(lp); if (LatitudeValue == 11) { ChartTestHelper.setGBSign(true, GBControl); } else { ChartTestHelper.setGBSign(false, GBControl); } ShowLatitude(); return(rl); } catch (Exception xe) { SilverlightLFC.common.Environment.ShowMessage(xe.Message); //testHelper.ProcessError(xe, "灰阶计算错误,请检查照片"); return(null); } }
void control_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) { var control = sender as LynxPhotoViewControl; control.PointerPressed -= control_PointerPressed; control.PointerMoved -= control_PointerMoved; ActiveButtonBackground = DeactiveBrush; if (control.getDrawObjectCanvas().Children.Contains(tl)) { control.getDrawObjectCanvas().Children.Remove(tl); } (TestChart as ITEGrayscaleChart).ConstGradeL = ConstL; double h = e.GetCurrentPoint(control.getDrawObjectCanvas()).Position.Y / control.getImage().Height *control.getPhoto().PixelHeight; ActiveHeight = Convert.ToInt32(h); int v = (TestChart as ITEGrayscaleChart).getGrayGrade(ActiveHeight, TestAreaHeight, TestAreaWidth); LatitudeValue = v; ShowLatitude(ActiveHeight); if (LatitudeValue == 11) { ChartTestHelper.setGBSign(true, GBControl); } else { ChartTestHelper.setGBSign(false, GBControl); } }
List<Result> TestGBAberration(WriteableBitmap photo) { var rl = new List<Result>(); TestChart.setChart(photo); var Chart = TestChart as AberrationChart; double _1l = getDistance(L10.Value, R10.Value); double _5l = getDistance(L50.Value, R50.Value); double _9l = getDistance(L90.Value, R90.Value); GBResult5 = Chart.ptp.getGBAberration(_5l, _1l, 5); GBResult9 = Chart.ptp.getGBAberration(_9l, _1l, 9); double h = 0.05; if (!IsLongFocus) { h = 0.07; } if (Math.Abs(GBResult5) < h && Math.Abs(GBResult9) < h) { ChartTestHelper.setGBSign(true, GBControl); } else { ChartTestHelper.setGBSign(false, GBControl); } Result lp = new Result(); lp.Name = "国标畸变测试0.5处"; lp.Memo = "计算照片变形程度测算畸变"; lp.Dimension = ""; lp.Value = GBResult5; rl.Add(lp); lp = new Result(); lp.Name = "国标畸变测试0.9处"; lp.Memo = "计算照片变形程度测算畸变"; lp.Dimension = ""; lp.Value = GBResult9; rl.Add(lp); return rl; }
public void Test(List <WriteableBitmap> b) { if (b.Count == 0 || b == null) { return; } pl = b; try { //pt.CurrentLabMode = getCurrentLabMode(); RefreshShow(); textBlockAverageDifferentHSB.Text = pt.getAverageColorTrend(sl, pl).ToString(); textBlockAverageDifferentRGB.Text = pt.getAverageRGBColorTrend(sl, pl).ToString(); textBlockAverageDifferentLab.Text = pt.getAverageLabColorTrend(sl, pl).ToString(); double gbr = pt.getMaxLabColorTrend(sl, pl); textBlockMaxDifferentLab.Text = gbr.ToString(); textBlockMaxDifferentRGB.Text = pt.getMaxRGBColorTrend(sl, pl).ToString(); textBlockMaxDifferentHSB.Text = pt.getMaxColorTrend(sl, pl).ToString(); if (gbr > 35) { ChartTestHelper.setGBSign(false, gridGB); } else { ChartTestHelper.setGBSign(true, gridGB); } } catch (Exception xe) //未知的异常 { if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片"); } } }
void ShowGBBadInfor() { textBlockJBBadPixNum.Text = JBBadPixList.Count.ToString(); int c = 0; foreach (PixInfor p in JBBadPixList) { if (p.XPosition > (lChartPhotoBadPix.Photo).PixelWidth * 0.25 && p.XPosition < (lChartPhotoBadPix.Photo).PixelWidth * 0.75 && p.YPosition > lChartPhotoBadPix.getPhoto().PixelHeight * 0.25 && p.YPosition < lChartPhotoBadPix.getPhoto().PixelHeight * 0.75) { c++; } } textBlockJBCenterBadPixNum.Text = c.ToString(); if (JBBadPixList.Count > 2 || c > 0) { ChartTestHelper.setGBSign(false, gridGB); } else { ChartTestHelper.setGBSign(true, gridGB); } }
void Calculate(FlipView list) { var ChartPhoto = GetCurrentPhotoViewControl(list); if (ChartPhoto.IsSelect) { EVDistance = (TestChart as GrayChart).ptp.getDEv(ChartPhoto.getSelectArea(), gama, TestParameter); CenterL = (TestChart as GrayChart).ptp.getAverageColorL(ChartPhoto.getSelectArea()); if (Math.Abs(EVDistance) >= 1) { ChartTestHelper.setGBSign(false, GBControl); } else { ChartTestHelper.setGBSign(true, GBControl); } } else { TestGBEv(CurrentPhoto); } }
List <Result> TestGBEv(WriteableBitmap photo) { var rl = new List <Result>(); TestChart.setChart(photo); EVDistance = (TestChart as GrayChart).ptp.getGBDEv(photo, gama, TestParameter); Result lp = new Result(); lp.Name = "曝光量误差"; lp.Memo = "计算照片中央明度来确定曝光量"; lp.Dimension = ""; lp.Value = EVDistance; rl.Add(lp); WriteableBitmap cb = (TestChart as GrayChart).ptp.getImageArea(photo, photo.PixelWidth / 4, photo.PixelHeight / 4, photo.PixelWidth / 2, photo.PixelHeight / 2); CenterL = (TestChart as GrayChart).ptp.getAverageColorL(cb); lp = new Result(); lp.Name = "中央平均明度"; lp.Memo = "照片中央明度"; lp.Dimension = ""; lp.Value = CenterL; rl.Add(lp); if (Math.Abs(EVDistance) >= 1) { ChartTestHelper.setGBSign(false, GBControl); } else { ChartTestHelper.setGBSign(true, GBControl); } return(rl); }