void DrawLatitude() { List <double> dl = (testHelper.CurrentChart as KDGrayChart).getHLine(ChartPhoto.getPhoto().PixelHeight / 2); DrawGraphic dg = new DrawGraphic(canvasLatitude); dg.DrawBrightHistogram(dl); }
private void image_MouseLeftButtonDown(object sender, PointerRoutedEventArgs e) { lChartPhoto1.getDrawObjectCanvas().PointerMoved -= (image_MouseMove); lChartPhoto1.getDrawObjectCanvas().PointerPressed -= (image_MouseLeftButtonDown); Select.Foreground = Disactive; WriteableBitmap b = lChartPhoto1.Photo; if (b == null) { return; } int p = Convert.ToInt32(e.GetCurrentPoint(lChartPhoto1).Position.X / lChartPhoto1.ActualWidth * (b).PixelWidth); DrawGraphic dg = new DrawGraphic(canvasBright); ISO12233ExChart isoc = new ISO12233ExChart(); canvasBright.Children.Clear(); List <int> al = isoc.getImageGrayVLine(b, p); dg.DrawBrightLines(al); if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(Selectl)) { lChartPhoto1.getDrawObjectCanvas().Children.Add(Selectl); Selectl.Fill = new SolidColorBrush(Colors.Green); Selectl.StrokeThickness = 3; Selectl.Stroke = Selectl.Fill; } PhotoTestParameter ptp = new PhotoTestParameter(); textBlockCurrentPercent.Text = ptp.getContrast(al).ToString(); }
public void DrawMTFCurve(WriteableBitmap b, string ChartType)//绘制MTF的分析图 { this.ChartType = ChartType; List <double> al = new List <double>(); if (ChartType == "XMark") { XMarkChart xm = new XMarkChart(b); al = xm.getCurveMTF(); } if (ChartType == "ISO12233") { ISO12233ExChart x = new ISO12233ExChart(b); al = x.getCurveMTF(); } DrawGraphic dg = new DrawGraphic(DrawCanvas); //dg.InitCanvas(picCanvas.Width, picCanvas.Height);//需要先设置画布 dg.DrawX(); dg.DrawY(); List <double> dlist = new List <double>(); dlist.Add(0.0); dlist.Add(0.5); dlist.Add(1.0); dg.DrawYMark(dlist); dg.DrawXMark(dlist); dg.DrawTitle("MTF 曲线图"); dg.DrawLines(al); //dg.DrawCurve(al); //picCanvas.Image = dg.Canvas; }
public void DrawColorDisCurve(int cNo, WriteableBitmap b, string ChartType)//绘制单个色差 { this.ChartType = ChartType; List <List <Color> > al = new List <List <Color> >(); if (ChartType == "XMark") { XMarkChart xm = new XMarkChart(b); al = xm.getCurveColorDis(); cNo = cNo - 7; } if (ChartType == "XRite") { XRiteColorChart x = new XRiteColorChart(b); al = x.getCurveColorDis(); cNo = cNo - 1; } DrawGraphic dg = new DrawGraphic(DrawCanvas); dg.DrawColorCy(0.9f); List <Color> tal = al[cNo]; Color c0 = (Color)tal[0]; Color c1 = (Color)tal[1]; //picS.BackColor = c0; //picV.BackColor = c1; dg.DrawColorMoveHue(c0, c1, 0.9f); }
private void buttonClear_Click(object sender, RoutedEventArgs e) { DrawCanvas.Children.Clear(); DrawGraphic dg = new DrawGraphic(DrawCanvas); dg.DrawColorCy(0.9f); }
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); }
public ITEGrayscaleChartTest() { InitializeComponent(); testHelper = new ChartTestHelper(this); //photoInforTool1.setTarget(ChartPhoto); am = new ActionMove(this, Title); //photoEditToolbar.setChartControl(ChartPhoto);//设置图版和工具栏的关联 //photoEditToolbar.saveChartTestResult = WriteToHTML; //ChartPhoto.InitTest(autoTest); //ChartPhoto.InitSaveTest(WriteToHTML); ci = new CameraTestIcon(this, null, "ITEGrayscaleChart", "ITE灰阶"); ci.release = CloseWindow; CameraTestDesktop cd = CameraTestDesktop.getDesktop(); if (!cd.TaskList.Children.Contains(ci)) { cd.TaskList.Children.Add(ci); } else { ci.Active(); } dg = new DrawGraphic(canvasLatitude); }
public void DrawWhiteBalanceCurve(WriteableBitmap b, string ChartType)//绘制白平衡的分析图 { this.ChartType = ChartType; List <Color> al = new List <Color>(); if (ChartType == "XMark") { XMarkChart xm = new XMarkChart(b); al = xm.getCurveWhiteBalance(); } if (ChartType == "XRite") { XRiteColorChart x = new XRiteColorChart(b); al = x.getCurveWhiteBalance(); } DrawGraphic dg = new DrawGraphic(DrawCanvas); //dg.InitCanvas(picCanvas.Width, picCanvas.Height);//需要先设置画布 dg.DrawColorCy(0.9f); for (int i = 0; i < al.Count; i++) { Color c = (Color)al[i]; dg.DrawColorPoint(c, 0.9f, 3); } }
void SwitchShowBrightCurve(FlipView control) { var photoview = GetCurrentPhotoViewControl(control); if (photoview == null) { return; } if (IsShowCurve) { photoview.Clear(); } else { List <WriteableBitmap> bl = (TestChart as GrayChart).ptp.getGBBrightChangedTestArea(CurrentPhoto, GBSelectAreaNum); List <double> l = (TestChart as GrayChart).ptp.getGBBrightChanged(bl); Canvas c = photoview.getDrawObjectCanvas(); c.Children.Clear(); DrawGraphic dg = new DrawGraphic(c); dg.ForeColor = Colors.Blue; dg.DrawLines(l, 0, 100); } IsShowCurve = !IsShowCurve; }
public Noise() { InitializeComponent(); am = new ActionMove(this, this); dg = new DrawGraphic(DrawCanvas); dg1 = new DrawGraphic(lChartPhoto1.getDrawObjectCanvas()); }
public PhotoColorInfor() { InitializeComponent(); dg = new DrawGraphic(DrawCanvas); ShowCC(); acm = new ActionMove(this, this); }
Color cc = Colors.Transparent; //当前颜色 void li_MouseLeftButtonDown(object sender, PointerRoutedEventArgs e) { Image im = sender as Image; currentImage = im; Color?tl = im.Tag as Color?; if (tl != null) { sc = tl.Value; } ShowSourceInfor(sc); WriteableBitmap tb = im.Source as WriteableBitmap; if (tb == null) { return; } lChartPhoto.Source = (tb); cc = pt.getAverageColor(tb); ShowTrueColorInfor(cc); ShowTrueColorDiffrent(cc, sc); DrawGraphic dg = new DrawGraphic(CC); CC.Children.Clear(); dg.DrawColorCy(0.9f); dg.DrawColorMoveHue(sc, cc, 0.9f); }
public List <Color> getPathLine() { DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest(); Point sp, cp; List <Color> cl = new List <Color>(); if (p == null) { return(null); } PathGeometry pg = p.Data as PathGeometry; if (pg == null) { return(null); } foreach (PathFigure pf in pg.Figures) { sp = DrawGraphic.getImagePosition(pf.StartPoint, TargetImage); foreach (LineSegment ls in pf.Segments) { cp = DrawGraphic.getImagePosition(ls.Point, TargetImage); List <Color> scl = pt.getLine(TargetImage.Source as WriteableBitmap, sp, cp); foreach (Color cc in scl) { cl.Add(cc); } sp = new Point(cp.X, cp.Y); } } return(cl); }
public void DrawColorDisCurve(WriteableBitmap b, string ChartType)//绘制描述色差的图形 { this.ChartType = ChartType; List <List <Color> > al = new List <List <Color> >(); if (ChartType == "XMark") { XMarkChart xm = new XMarkChart(b); al = xm.getCurveColorDis(); } if (ChartType == "XRite") { XRiteColorChart x = new XRiteColorChart(b); al = x.getCurveColorDis(); } DrawGraphic dg = new DrawGraphic(DrawCanvas); dg.DrawColorCy(0.9f); for (int i = 7; i < 19; i++) { List <Color> tal = al[i - 7]; Color c0 = (Color)tal[0]; Color c1 = (Color)tal[1]; //picS.BackColor = c0; //picV.BackColor = c1; dg.DrawColorMoveHue(c0, c1, 0.9f); } }
public void Test(List <WriteableBitmap> bList) { if (bList == null || bList.Count == 0) { return; } var b = bList.FirstOrDefault(); lChartPhoto1.Photo = (b); lChartPhoto1.PointerPressed += (image_MouseLeftButtonDown); DrawGraphic dg = new DrawGraphic(SFRCanvas); DrawGraphic edg = new DrawGraphic(EdgeBrightCanvas); DrawGraphic ldg = new DrawGraphic(LSFCanvas); List <double> al = new List <double>(); List <double> EdgeBrightList; List <double> LSF; try { ptp.setEdgeResoveStopFrequency(lynxUpDown1.IntValue);//只要测试就加载参数 if (IsV) { EdgeBrightList = SilverlightLFC.common.Environment.getDoubleList <int>(ptp.getImageGrayHLine(b, b.PixelHeight / 2)); LSF = SilverlightLFC.common.Environment.getDoubleList <decimal>(ptp.getDdx(EdgeBrightList)); al = ptp.getCurveMTF(b, false); } else { EdgeBrightList = SilverlightLFC.common.Environment.getDoubleList <int>(ptp.getImageGrayVLine(b, b.PixelWidth / 2)); LSF = SilverlightLFC.common.Environment.getDoubleList <decimal>(ptp.getDdx(EdgeBrightList)); al = ptp.getCurveMTF(b, true); } edg.DrawLines(EdgeBrightList); ldg.DrawLines(LSF); dg.DrawX(); dg.DrawY(); List <double> dlist = new List <double>(); dlist.Add(0.0); dlist.Add(0.5); dlist.Add(1.0); dg.DrawYMark(dlist); dg.DrawXMark(dlist); dg.DrawTitle("MTF 曲线图"); dg.DrawLines(al); textBlockResovLines.Text = ptp.getEdgeResoveEffect(b, !IsV).ToString(); } catch (Exception xe) //未知的异常 { if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片"); } } }
public void DrawCurve(int p) { if (sb == null) { return; } canvasCurve.Children.Clear(); DrawGraphic dg = new DrawGraphic(canvasCurve); List <List <int> > al = new List <List <int> >(); try { if (IsV) { al = ptp.getCurveVDispersiveness(sb, p); } else { al = ptp.getCurveHDispersiveness(sb, p); } dg.DrawX(); List <double> MarkList = new List <double>(); for (int i = 0; i < 101; i = i + 20) { MarkList.Add(i); } dg.DrawXMark(MarkList); MarkList.Clear(); for (int i = 0; i < 255; i = i + 40) { MarkList.Add(i); } dg.DrawY(); dg.DrawYMark(MarkList); List <double> ral, gal, bal; ral = SilverlightLFC.common.Environment.getDoubleList <int>(al[0]); gal = SilverlightLFC.common.Environment.getDoubleList <int>(al[1]); bal = SilverlightLFC.common.Environment.getDoubleList <int>(al[2]); dg.ForeColor = Colors.Blue; dg.DrawLines(bal); dg.ForeColor = Colors.Red; dg.DrawLines(ral); dg.ForeColor = Colors.Green; dg.DrawLines(gal); dg.DrawTitle("色散"); } catch (Exception xe) //未知的异常 { if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片"); } } }
public BadPixTest() { InitializeComponent(); am = new ActionMove(this, this); dg = new DrawGraphic(lChartPhotoBadPix.getDrawObjectCanvas()); //am1 = new ActionMove(ProcPhoto, ProcPhoto); //am1.Enable = false; }
void DrawLatitude(WriteableBitmap photo) { DrawCanvas.Children.Clear(); List <double> dl = (TestChart as KDGrayChart).getHLine(photo.PixelHeight / 2); DrawGraphic dg = new DrawGraphic(DrawCanvas); dg.DrawBrightHistogram(dl); }
void img_PointerReleased(object sender, PointerRoutedEventArgs e) { si = Target.SelectLayer.getImage(); if (si.Source == null) { return; } //double dx = Canvas.GetLeft(si) + Canvas.GetLeft(Target.SelectLayer); //double dy = Canvas.GetTop(si) + Canvas.GetTop(Target.SelectLayer); Point ep = e.GetCurrentPoint(si).Position; if (Math.Abs(sp.X - ep.X) < 1.1 && Math.Abs(sp.Y - ep.Y) < 1.1) { Point tp = DrawGraphic.getImagePosition(sp, si); Color c = pt.GetPixel(si.Source as WriteableBitmap, Convert.ToInt32(tp.X), Convert.ToInt32(tp.Y)); ShowColor(c); } else { int sx, sy, w, h; Point isp = DrawGraphic.getImagePosition(sp, si); Point iep = DrawGraphic.getImagePosition(ep, si); if (isp.X < iep.X) { sx = Convert.ToInt32(isp.X); w = Convert.ToInt32(iep.X - isp.X); } else { sx = Convert.ToInt32(iep.X); w = Convert.ToInt32(isp.X - iep.X); } if (isp.Y < iep.Y) { sy = Convert.ToInt32(isp.Y); h = Convert.ToInt32(iep.Y - isp.Y); } else { sy = Convert.ToInt32(iep.Y); h = Convert.ToInt32(isp.Y - iep.Y); } WriteableBitmap sb; if (w == 0) { w = 1; } if (h == 0) { h = 1; } sb = pt.getImageArea(si.Source as WriteableBitmap, sx, sy, w, h); ColorImg.Source = sb; Color c = pt.getAverageColor(sb); ShowColor(c); } sp = DrawGraphic.getImagePosition(sp, si); }
public Latitude() { InitializeComponent(); am = new ActionMove(this, Title); photoTestToolbar1.setTarget(lChartPhoto1); photoTestToolbar1.autoTest = ParameterAutoTest; photoTestToolbar1.addPhoto = AddPhoto; photoTestToolbar1.removePhoto = RemovePhoto; dg = new DrawGraphic(DrawCanvas); }
public BrightDistance() { InitializeComponent(); am = new ActionMove(this, this); //photoTestToolbar1.setTarget(HB); //photoTestToolbar1.autoTest = ParameterAutoTest; //photoTestToolbar1.addPhoto = AddPhoto; //photoTestToolbar1.removePhoto = RemovePhoto; dg = new DrawGraphic(ImageBrightCurve); }
private void buttonEllips_Click(object sender, RoutedEventArgs e) { Canvas c = pc.SelectLayer.getDrawCanvas(); dg = new DrawGraphic(c); type = 3; c.PointerPressed += new PointerEventHandler(c_PointerPressed); c.PointerReleased += new PointerEventHandler(c_PointerReleased); }
public ColorTrend() { InitializeComponent(); am = new ActionMove(this, this); dg = new DrawGraphic(CC); //photoTestToolbar1.setTarget(lChartPhoto); //photoTestToolbar1.autoTest = ParameterAutoTest; //photoTestToolbar1.addPhoto = AddPhoto; //photoTestToolbar1.removePhoto = RemovePhoto; }
public List <Point> getImagePathPointList(List <Point> pl) { List <Point> ipl = new List <Point>(); foreach (Point tp in pl) { Point ip = DrawGraphic.getImagePosition(tp, TargetImage); ipl.Add(ip); } return(ipl); }
private void buttonClose_Click(object sender, RoutedEventArgs e) { LChartPhoto.Clear(); dg = null; Panel p = this.Parent as Panel; if (p != null) { p.Children.Remove(this); } }
public Aberration() { InitializeComponent(); am = new ActionMove(this, Title); //am1 = new ActionMove(PhotoClip, image); photoTestToolbar1.setTarget(LChartPhoto); photoTestToolbar1.autoTest = TestImage; photoTestToolbar1.addPhoto = AddPhoto; photoTestToolbar1.removePhoto = RemovePhoto; dg = new DrawGraphic(LChartPhoto.getDrawObjectCanvas()); }
public BadPixTest() { InitializeComponent(); am = new ActionMove(this, Title); photoTestToolbar1.setTarget(lChartPhotoBadPix); photoTestToolbar1.autoTest = Test; photoTestToolbar1.addPhoto = AddPhoto; photoTestToolbar1.removePhoto = RemovePhoto; dg = new DrawGraphic(lChartPhotoBadPix.getDrawObjectCanvas()); //am1 = new ActionMove(ProcPhoto, ProcPhoto); //am1.Enable = false; }
private void buttonLine_Click(object sender, RoutedEventArgs e) { c = pc.SelectLayer.getDrawCanvas(); if (c == null) { return; } dg = new DrawGraphic(c); type = 1; c.PointerPressed += new PointerEventHandler(c_PointerPressed); c.PointerReleased += new PointerEventHandler(c_PointerReleased); }
public void DrawDispersivenessCurve(WriteableBitmap b, string ChartType)//绘制色散分析图 { this.ChartType = ChartType; List <List <int> > al = new List <List <int> >(); WriteableBitmap subB; if (ChartType == "XMark") { XMarkChart x = new XMarkChart(b); subB = x.getAreaHEdge(); PhotoTestParameter xm = new PhotoTestParameter(); al = xm.getCurveVDispersiveness(subB); } if (ChartType == "ISO12233") { ISO12233ExChart x = new ISO12233ExChart(b); subB = x.getAreaHEdge(); PhotoTestParameter xm = new PhotoTestParameter(); al = xm.getCurveHDispersiveness(b); } DrawGraphic dg = new DrawGraphic(DrawCanvas); dg.DrawX(); List <double> MarkList = new List <double>(); for (int i = 0; i < 101; i = i + 20) { MarkList.Add(i); } dg.DrawXMark(MarkList); MarkList.Clear(); for (int i = 0; i < 255; i = i + 40) { MarkList.Add(i); } dg.DrawY(); dg.DrawYMark(MarkList); List <double> ral, gal, bal; ral = SilverlightLFC.common.Environment.getDoubleList <int>(al[0]); gal = SilverlightLFC.common.Environment.getDoubleList <int>(al[1]); bal = SilverlightLFC.common.Environment.getDoubleList <int>(al[2]); dg.ForeColor = Colors.Blue; dg.DrawLines(bal); dg.ForeColor = Colors.Red; dg.DrawLines(ral); dg.ForeColor = Colors.Green; dg.DrawLines(gal); dg.DrawTitle("色散"); }
void image_PointerPressed(object sender, PointerRoutedEventArgs e) { DrawGraphic dg = new DrawGraphic(); Point? p = ptp.PointToPix(sb, lChartPhoto1.getImage(), e.GetCurrentPoint(lChartPhoto1.getImage()).Position, false); if (p == null) { return; } Color c = ptp.GetPixel(sb, Convert.ToInt32(p.Value.X), Convert.ToInt32(p.Value.Y)); textBlockB.Text = c.B.ToString(); textBlockG.Text = c.G.ToString(); textBlockR.Text = c.R.ToString(); SelectLine.Stroke = new SolidColorBrush(Colors.Red); SelectLine.StrokeThickness = 3; if (IsV) { SelectLine.X1 = 0; SelectLine.X2 = lChartPhoto1.getImage().Width; SelectLine.Y1 = e.GetCurrentPoint(lChartPhoto1.getImage()).Position.Y; SelectLine.Y2 = e.GetCurrentPoint(lChartPhoto1.getImage()).Position.Y; } else { SelectLine.X1 = e.GetCurrentPoint(lChartPhoto1.getImage()).Position.X; SelectLine.X2 = e.GetCurrentPoint(lChartPhoto1.getImage()).Position.X; SelectLine.Y1 = 0; SelectLine.Y2 = lChartPhoto1.getImage().Height; } if (lChartPhoto1.getDrawObjectCanvas().Children.Contains(SelectLine)) { } else { lChartPhoto1.getDrawObjectCanvas().Children.Add(SelectLine); } int tp = 0; if (IsV) { tp = Convert.ToInt32(p.Value.Y); } else { tp = Convert.ToInt32(p.Value.X); } DrawCurve(tp); }