Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public void Test(List <WriteableBitmap> b)
        {
            if (b.Count == 0 || b == null)
            {
                return;
            }
            bl = b;
            try
            {
                HB.Photo = (b[1]);
                VB.Photo = (b[2]);
                xt       = new XMarkChart();
                decimal d = xt.getBrightChanges(b[0]);//原始
                textBoxBrightChanges.Text = d.ToString();
                textBoxBB.Text            = xt.ProcessInfor["BrightChanges_BorderBright"].ToString();
                textBoxCB.Text            = xt.ProcessInfor["BrightChanges_CBright"].ToString();
                LT.Text = xt.ProcessInfor["BrightChanges_LT"].ToString();
                LB.Text = xt.ProcessInfor["BrightChanges_LB"].ToString();
                RT.Text = xt.ProcessInfor["BrightChanges_RT"].ToString();
                RB.Text = xt.ProcessInfor["BrightChanges_RB"].ToString();

                List <int> hl, vl;
                DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
                hl           = pt.getImageGrayHLine(b[1], b[1].PixelHeight / 2);
                vl           = pt.getImageGrayVLine(b[2], b[2].PixelWidth / 2);
                dg.ForeColor = Colors.Blue;
                dg.DrawBrightLines(hl);
                dg.ForeColor = Colors.Red;
                dg.DrawBrightLines(vl);
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片");
                }
            }
        }
Exemplo n.º 3
0
        void li_MouseLeftButtonDown(object sender, PointerRoutedEventArgs e)
        {
            Image im = sender as Image;
            int   no = Convert.ToInt32(im.Tag);

            lChartPhoto1.Photo = (im.Source as WriteableBitmap);

            canvasBright.Children.Clear();
            DrawGraphic dgb = new DrawGraphic(canvasBright);

            DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
            List <int> hl = pt.getImageGrayHLine(im.Source as WriteableBitmap, (im.Source as WriteableBitmap).PixelHeight / 2);

            dgb.DrawBrightLines(hl);

            List <List <decimal> > al = new List <List <decimal> >();

            al = ptp.getCurveWaveQ(im.Source as WriteableBitmap, no);
            DrawCanvas.Children.Clear();
            DrawGraphic dg = new DrawGraphic(DrawCanvas);

            dg.DrawX();
            List <double> MarkList = new List <double>();
            int           step     = (al[0]).Count / 5;

            for (int i = 0; i < al[0].Count; i = i + step)
            {
                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 <decimal> Sal, Val;

            Sal          = al[0];
            Val          = al[1];
            dg.ForeColor = Colors.Blue;
            dg.DrawLines(SilverlightLFC.common.Environment.getDoubleList <decimal>(Sal));
            dg.ForeColor = Colors.Red;
            dg.DrawLines(SilverlightLFC.common.Environment.getDoubleList <decimal>(Val));
            dg.DrawTitle("成像品质");

            textBlockCurrentBrightDis.Text = ptp.getWaveQ(im.Source as WriteableBitmap, no).ToString();
        }
Exemplo n.º 4
0
        void image_MouseLeftButtonDown(object sender, PointerRoutedEventArgs e)
        {
            if (lChartPhoto1.Photo == null)
            {
                return;
            }
            double h = e.GetCurrentPoint(lChartPhoto1).Position.Y;
            int    H = Convert.ToInt32((lChartPhoto1.Photo).PixelHeight * (1 - h / lChartPhoto1.Height));

            canvasBright.Children.Clear();
            DrawGraphic dgb = new DrawGraphic(canvasBright);

            DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
            List <int> hl = pt.getImageGrayHLine((lChartPhoto1.Photo), H);

            dgb.DrawBrightLines(hl);
            //throw new NotImplementedException();
        }
Exemplo n.º 5
0
        public void Test(List <WriteableBitmap> bList)
        {
            if (bList == null || bList.Count == 0)
            {
                return;
            }
            var b = bList.FirstOrDefault();

            sb = WriteableBitmapHelper.Clone(b);
            if (!IsLeft)
            {
                b = isoc.FlipYImage(b);
            }

            lChartPhoto1.Photo = (b);
            try
            {
                long l = isoc.getResoveLines(sb, 0.735f, IsLeft);
                if (IsLeft)
                {
                    textBlockIsLeft.Text = "左";
                }
                else
                {
                    textBlockIsLeft.Text = "右";
                }

                testResult.Text = l.ToString() + "LP";

                BorderLeft  = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionLeftBorder"]);
                BorderRight = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionRightBorder"]);
                double p = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionRightPosition"]);



                string st = isoc.ptp.ProcessInfor["ISOCardType"].ToString();
                if (st == "100-600")
                {
                    comboBox1.SelectedIndex = 2;
                }
                if (st == "500-2000")
                {
                    comboBox1.SelectedIndex = 0;
                }
                if (st == "1000-4000")
                {
                    comboBox1.SelectedIndex = 1;
                }

                leftBorder.Text  = BorderLeft.ToString();
                rightBorder.Text = BorderRight.ToString();
                RayleP.Text      = p.ToString();

                ll.Y1 = 0;
                ll.Y2 = lChartPhoto1.Height;
                ll.X1 = BorderLeft / b.PixelWidth * lChartPhoto1.Width;
                ll.X2 = ll.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(ll))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(ll);
                }

                rl.Y1 = 0;
                rl.Y2 = lChartPhoto1.Height;
                rl.X1 = BorderRight / b.PixelWidth * lChartPhoto1.Width;
                rl.X2 = rl.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(rl))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(rl);
                }

                pl.Y1 = 0;
                pl.Y2 = lChartPhoto1.Height;
                pl.X1 = p / b.PixelWidth * lChartPhoto1.Width;
                pl.X2 = pl.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(pl))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(pl);
                }

                canvasBright.Children.Clear();
                DrawGraphic dg = new DrawGraphic(canvasBright);
                dg.DrawBrightLines(isoc.getImageGrayVLine(b, Convert.ToInt64(p)));
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片");
                }
            }
        }