示例#1
0
        void layer_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var layer = sender as Canvas;

            if (layer == null)
            {
                return;
            }
            if (layer.Children.Contains(ReferenceLine))
            {
                layer.Children.Remove(ReferenceLine);
            }
            layer.PointerMoved   -= layer_PointerMoved;
            layer.PointerPressed -= layer_PointerPressed;

            ActiveHeight = Convert.ToInt32(
                e.GetCurrentPoint(layer).Position.Y / layer.ActualHeight * CurrentPhoto.PixelHeight
                );
            TestChart.setChart(CurrentPhoto);
            if (GradeDis == 0)
            {
                GradeDis = 7;
            }
            ActiveLatitudeValue = (TestChart as KDGrayChart).getLatitude(GradeDis);
            DrawLatitude(CurrentPhoto);
        }
示例#2
0
        List <Result> TestGray(WriteableBitmap chart)
        {
            var rl = new List <Result>();

            TestChart.setChart(chart);
            var Chart = TestChart as GrayChart;

            BrightChangesValue = Chart.getBrightChangesValue();

            rl.Add(new Result()
            {
                Value     = BrightChangesValue,
                TestTime  = DateTime.Now,
                Name      = "Bright changes",
                Memo      = "",
                TestCount = 1,
                Dimension = "%"
            });
            rl.Add(new Result()
            {
                Value     = GBValue = Chart.ptp.getGBBrightChangedValue(CurrentPhoto, GBSelectAreaNum),
                TestTime  = DateTime.Now,
                Name      = "GB bright changes value",
                Memo      = "",
                TestCount = 1,
                Dimension = "%"
            });
            TestGB(chart);
            return(rl);
        }
示例#3
0
        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);
            }
        }
示例#4
0
        List <Result> TestISO12233(WriteableBitmap chart)
        {
            var rl = new List <Result>();

            TestChart.setChart(chart);
            var Chart = TestChart as ISO12233Chart;

            rl.Add(new Result()
            {
                Value     = Chart.getLPResoveLines(),
                Name      = "Resolution",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "LW/PH",
            });

            rl.Add(new Result()
            {
                Value     = Chart.getHEdgeResoveLines(),
                Name      = "Horizontal Resolution",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "LW/PH",
            });

            rl.Add(new Result()
            {
                Value     = Chart.getVEdgeResoveLines(),
                Name      = "Vertical Resolution",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "LW/PH"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getHDispersiveness(),
                Name      = "Horizontal Dispersiveness",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "Pix"
            });
            rl.Add(new Result()
            {
                Value     = Chart.getVDispersiveness(),
                Name      = "Vertical Dispersiveness",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "Pix"
            });

            return(rl);
        }
示例#5
0
        void c_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            Canvas c = sender as Canvas;

            if (c.Children.Contains(hl))
            {
                c.Children.Remove(hl);
            }
            if (c.Children.Contains(vl))
            {
                c.Children.Remove(vl);
            }
            CustomButtonBrush = DeactiveBrush;
            c.PointerMoved   -= c_PointerMoved;
            c.PointerPressed -= c_PointerPressed;
            if (CurrentPhoto == null)
            {
                return;
            }
            DrawGraphic dg = new DrawGraphic();
            Point       tp = e.GetCurrentPoint(c).Position;
            Point       ip = DrawGraphic.getImagePosition(tp, currentPhotoControl.getImage());

            Color cc = TestChart.GetPixel(currentPhotoControl.getPhoto(), (int)ip.X, (int)ip.Y);

            //TempPhoto =new WriteableBitmap( ChartPhoto.getPhoto());//复制一份保留
            try
            {
                WriteableBitmap oi;
                CustomSelectPointSimularPixelNum = TestChart.getFloodBrightEdge(currentPhotoControl.getPhoto(), out oi, ip, BrightGradeDistance);
                //IsNeedSave = false;
                currentPhotoControl.setPhoto(oi);
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("Calculate error:" + xe.Message);
                    //MessageBox.Show("计算亮度变化错误");
                }
            }
        }
示例#6
0
 public void TestUpdate(int dx, params double[] t)
 {
     if (TestChart.InvokeRequired)
     {
         TestChart.Invoke((MenuModel.UpdateCallback)TestUpdate, dx, t);
     }
     else
     {
         double x = dx;
         if (TestChart.Series[0].Points.Count > 0)
         {
             x += TestChart.Series[0].Points.Last().XValue;
         }
         TestChart.Series[0].Points.AddXY(
             x,
             t[0]);
     }
 }
        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;
        }
示例#8
0
        public List <Result> TestLatitude(WriteableBitmap photo)
        {
            var rl = new List <Result>();

            TestChart.setChart(photo);
            if (GradeDis == 0)
            {
                GradeDis = 7;
            }
            LatitudeValue = (TestChart as KDGrayChart).getLatitude(GradeDis);
            DrawLatitude(photo);

            var lp = new Result();

            lp.Name      = "宽容度";
            lp.Memo      = "数据表示在一张照片里面可以分辨的亮度级别";
            lp.Dimension = "Grade";
            lp.Value     = LatitudeValue;
            rl.Add(lp);
            return(rl);
        }
示例#9
0
        List <Result> TestXRite(WriteableBitmap chart)
        {
            var rl = new List <Result>();

            TestChart.setChart(chart);
            var Chart = TestChart as XRiteColorChart;

            rl.Add(new Result()
            {
                Value     = Chart.getWhiteBanlance() * 100,
                Name      = "Write banlance error percent",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getNoiseNum() * 100,
                Name      = "Noise percent",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getColorDistance(),
                Name      = "Average color trend error",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "degree"
            });

            return(rl);
        }
示例#10
0
        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);
        }
        List <Result> TestXMark(WriteableBitmap chart)
        {
            var rl = new List <Result>();

            TestChart.setChart(chart);
            var Chart = TestChart as XMarkChart;

            rl.Add(new Result()
            {
                Value     = Chart.getAberration() * 100,
                Name      = "Aberration",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getBrightChanges() * 100,
                Name      = "Bright Changes",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getColorDis(),
                Name      = "Average color trend error",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "degree"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getHEdgeDispersiveness(),
                Name      = "Center Horizontal Dispersiveness",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "Pix"
            });
            rl.Add(new Result()
            {
                Value     = Chart.getVEdgeDispersiveness(),
                Name      = "Border Vertical Dispersiveness",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "Pix"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getHEdgeResoveLines(),
                Name      = "Center Horizontal Resolution",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "LW/PH"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getVEdgeResoveLines(),
                Name      = "Border Vertical Resolution",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "LW/PH"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getLatitude(),
                Name      = "Photo Latitude",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "degree"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getNoiseNum() * 100,
                Name      = "Noise percent",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getPurplePercent() * 100,
                Name      = "Purple pixel percent",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getWaveQ() * 100,
                Name      = "Wave bright error percent",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            rl.Add(new Result()
            {
                Value     = Chart.getWhiteBanlance() * 100,
                Name      = "White banlance error percent",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            return(rl);
        }
        void ShowAberration()
        {
            Aberration v = new Aberration();

            ShowParameterView(v, TestChart.getCorrectPhoto());
        }
 private void btnChartPrint_Click(object sender, RoutedEventArgs e)
 {
     TestChart.Print();
 }
示例#14
0
        //public WriteableBitmap Icon { get; set; }

        //ObservableCollection<WriteableBitmap> photoList = new ObservableCollection<WriteableBitmap>();
        //public ObservableCollection<WriteableBitmap> PhotoList { get { return photoList; } }

        //WriteableBitmap currentPhoto;
        //public WriteableBitmap CurrentPhoto
        //{
        //    get { return currentPhoto; }
        //    set
        //    {
        //        currentPhoto = value;
        //        CurrentResult = ResultList[value];
        //        OnPropertyChanged("CurrentPhoto");
        //    }
        //}

        //public DelegateCommand AddPhotoCommand
        //{
        //    get
        //    {
        //        return new DelegateCommand(async () =>
        //        {
        //            var photolist = await SilverlightLFC.common.Environment.getEnvironment().OpenImage();
        //            foreach (var photo in photolist)
        //            {
        //                PhotoList.Add(photo);
        //            }
        //        });
        //    }
        //}

        //public DelegateCommand RemovePhotoCommand
        //{
        //    get
        //    {
        //        return new DelegateCommand(() =>
        //        {
        //            if (CurrentPhoto != null && PhotoList.Contains(CurrentPhoto))
        //            {
        //                PhotoList.Remove(CurrentPhoto);
        //                CurrentPhoto = PhotoList.FirstOrDefault();
        //            }
        //        });
        //    }
        //}

        //bool isShowPhotoListNaviator = false;
        //public bool IsShowPhotoListNaviator
        //{
        //    get { return isShowPhotoListNaviator; }
        //    set { isShowPhotoListNaviator = value; OnPropertyChanged("IsShowPhotoListNaviator"); }
        //}

        //bool isShowCurrentResult = false;
        //public bool IsShowCurrentResult
        //{
        //    get { return isShowCurrentResult; }
        //    set
        //    {
        //        isShowCurrentResult = value;
        //        if (value)
        //        {
        //            CurrentResult = ResultList[CurrentPhoto];
        //        }
        //        else
        //        {
        //            CurrentResult = Average;
        //        }

        //        OnPropertyChanged("IsShowCurrentResult");
        //    }
        //}

        //public Func<WriteableBitmap, List<Result>> Test { get; set; } //one photo test multi results
        //public DelegateCommand TestAllCommand
        //{
        //    get
        //    {
        //        return new DelegateCommand(() =>
        //        {
        //            ResultList.Clear();
        //            Task.Factory.StartNew(() =>
        //            {
        //                foreach (var p in PhotoList)
        //                {
        //                    Task.Factory.StartNew(() =>
        //                    {
        //                        var rl = Test(p);
        //                        var or = new ObservableCollection<Result>(rl);
        //                        ResultList.Add(p, or);
        //                    });
        //                }
        //            }).ContinueWith(o =>
        //            {
        //                GetAverage();
        //            });
        //        });
        //    }
        //}
        //public DelegateCommand TestCurrent
        //{
        //    get
        //    {
        //        return new DelegateCommand(() =>
        //        {
        //            if (CurrentPhoto == null) return;
        //            ResultList.Remove(currentPhoto);
        //            Task.Factory.StartNew(() =>
        //            {
        //                var rl = Test(currentPhoto);
        //                CurrentResult.Clear();
        //                foreach (var r in rl) { CurrentResult.Add(r); }
        //                ResultList.Add(currentPhoto, CurrentResult);

        //            });
        //        });
        //    }
        //}

        //ObservableCollection<Result> currentResult = new ObservableCollection<Result>();
        //public ObservableCollection<Result> CurrentResult
        //{
        //    get { return currentResult; }
        //    set
        //    {
        //        currentResult = value;
        //        OnPropertyChanged("CurrentResult");
        //    }
        //}
        //Dictionary<WriteableBitmap, ObservableCollection<Result>> resultList = new Dictionary<WriteableBitmap, ObservableCollection<Result>>();
        //public Dictionary<WriteableBitmap, ObservableCollection<Result>> ResultList { get { return resultList; } }

        //ObservableCollection<Result> average = new ObservableCollection<Result>();
        //public ObservableCollection<Result> Average { get { return average; } }

        //public void GetAverage()//auto calculate result average value
        //{
        //    Average.Clear();
        //    foreach (var rl in ResultList)
        //    {
        //        foreach (var r in rl.Value)
        //        {
        //            if (r.CanSupportOperator)
        //            {
        //                if (Average.Any(v => v.Name == r.Name))
        //                {
        //                    Average.FirstOrDefault(v => v.Name == r.Name).DoubleValue += r.DoubleValue;
        //                }
        //                else
        //                {
        //                    Average.Add(new Result()
        //                    {
        //                        Name = r.Name,
        //                        Memo = r.Memo,
        //                        Value = r.Value,
        //                        Dimension = r.Dimension,
        //                        TestCount = 1
        //                    });
        //                }
        //            }
        //        }
        //    }
        //    foreach (var r in Average)
        //    {
        //        r.Value = r.DoubleValue / r.TestCount;
        //    }
        //}

        //public double ProcessPercent { get; set; }
        public void PreProcess()
        {
            TestChart.CorrectChart();
            TestChart.BeginAnalyse();
        }
        List <Result> TestAberration(WriteableBitmap chart)
        {
            var rl = new List <Result>();

            TestChart.setChart(chart);
            var Chart = TestChart as AberrationChart;

            AberrationValue = Chart.getAberration();

            rl.Add(new Result()
            {
                Value     = BottomBlackLineDistance = Chart.getBottomBlackLinePix(),
                TestTime  = DateTime.Now,
                Name      = "Bottom black line max distance",
                Memo      = "",
                TestCount = 1,
                Dimension = "Pix"
            });

            rl.Add(new Result()
            {
                Value     = BottomBlackLineNumber = Chart.getBottomBlackLineNum(),
                TestTime  = DateTime.Now,
                Name      = "Bottom black line number",
                Memo      = "",
                TestCount = 1,
                Dimension = ""
            });

            rl.Add(new Result()
            {
                Value     = TopBlackLineDistance = Chart.getTopBlackLinePix(),
                TestTime  = DateTime.Now,
                Name      = "Top black line max distance",
                Memo      = "",
                TestCount = 1,
                Dimension = "Pix"
            });

            rl.Add(new Result()
            {
                Value     = TopBlackLineNumber = Chart.getTopBlackLineNum(),
                TestTime  = DateTime.Now,
                Name      = "Top black line number",
                Memo      = "",
                TestCount = 1,
                Dimension = ""
            });

            rl.Add(new Result()
            {
                Value     = MiddleBlackLineDistance = Chart.getCenterBlackLinePix(),
                TestTime  = DateTime.Now,
                Name      = "Center black line max distance",
                Memo      = "",
                TestCount = 1,
                Dimension = "Pix"
            });

            rl.Add(new Result()
            {
                Value     = MiddleBlackLineNumber = Chart.getCenterBlackLineNum(),
                TestTime  = DateTime.Now,
                Name      = "Bottom black line number",
                Memo      = "",
                TestCount = 1,
                Dimension = ""
            });


            rl.Add(new Result()
            {
                Value     = AberrationValue = Chart.getAberration(),
                Name      = "Aberration percent",
                Memo      = "",
                TestTime  = DateTime.Now,
                TestCount = 1,
                Dimension = "%"
            });

            return(rl);
        }