Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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("测试错误,请检查照片");
                }
            }
        }
Esempio n. 3
0
        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("测试错误,请检查照片");
                }
            }
        }
Esempio n. 4
0
        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("色散");
        }
Esempio n. 5
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();
        }
Esempio n. 6
0
 public void DrawBrightChangesCurve(WriteableBitmap b, string ChartType)//绘制亮度变化的分析图
 {
     this.ChartType = ChartType;
     if (ChartType == "XMark")
     {
         List <List <int> > al = new List <List <int> >();
         try
         {
             XMarkChart xm = new XMarkChart(b);
             al = xm.getCurveBrightnessChange();
         }
         catch (Exception ex)
         {
             if (ex is SilverlightLFC.common.LFCException)
             {
                 SilverlightLFC.common.Environment.ShowMessage(ex.Message);
             }
             else
             {
                 SilverlightLFC.common.Environment.ShowMessage("Error Process Image");
             }
         }
         DrawGraphic dg = new DrawGraphic(DrawCanvas);
         //dg.InitCanvas(picCanvas.Width, picCanvas.Height);
         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 <int> val, hal;
         val          = al[1];
         hal          = al[0];
         dg.ForeColor = Colors.Blue;
         dg.DrawLines(SilverlightLFC.common.Environment.getDoubleList <int>(hal));
         dg.ForeColor = Colors.Red;
         dg.DrawLines(SilverlightLFC.common.Environment.getDoubleList <int>(val));
         dg.DrawTitle("亮度一致性变化");
         //picCanvas.Image = dg.Canvas;
     }
 }
Esempio n. 7
0
        public void DrawWaveQCurve(int no, WriteableBitmap b, string ChartType)//绘制成像一致性的分析图
        {
            this.ChartType = ChartType;
            List <List <decimal> > al = new List <List <decimal> >();

            if (ChartType == "XMark")
            {
                XMarkChart xm = new XMarkChart(b);
                al = xm.getCurveWaveQ();
            }
            DrawGraphic dg = new DrawGraphic(DrawCanvas);

            dg.DrawX();
            List <double> MarkList = new List <double>();
            int           step     = (al[(no - 1) * 2]).Count / 5;

            for (int i = 0; i < (al[(no - 1) * 2]).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[(no - 1) * 2];
            Val          = al[(no - 1) * 2 + 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("成像品质");
        }
Esempio n. 8
0
        public void DrawLatitudeCurve(WriteableBitmap b, string ChartType)//绘制动态范围的分析图
        {
            this.ChartType = ChartType;
            List <decimal> al = new List <decimal>();

            if (ChartType == "XMark")
            {
                XMarkChart xm = new XMarkChart(b);
                al = xm.getCurveLatitude();
            }
            if (ChartType == "XRite")
            {
                XRiteColorChart xr = new XRiteColorChart(b);
                al = xr.getCurveLatitude();
            }
            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);
            dg.ForeColor = Colors.Red;
            dg.DrawStepPoint(SilverlightLFC.common.Environment.getDoubleList <decimal>(al));
            dg.DrawTitle("宽容度");
            //picCanvas.Image = dg.Canvas;
        }