Beispiel #1
0
        void TestGB()
        {
            double x = (testHelper.CurrentChart as GrayChart).ptp.getGBBrightChangedValue(ChartPhoto.getPhoto(), lynxUpDownAreaNum.IntValue);

            textBlockGBValue.Text = x.ToString();


            if (checkBoxFocus.IsChecked.Value)
            {
                if (x > 0.7)
                {
                    ChartTestHelper.setGBSign(true, gridGB);
                }
                else
                {
                    ChartTestHelper.setGBSign(false, gridGB);
                }
            }
            else
            {
                if (x > 0.5)
                {
                    ChartTestHelper.setGBSign(true, gridGB);
                }
                else
                {
                    ChartTestHelper.setGBSign(false, gridGB);
                }
            }
        }
        void c_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            Canvas c = sender as Canvas;

            try
            {
                (testHelper.CurrentChart as ITEGrayscaleChart).ConstGradeL = lynxUpDownConstL.DoubleValue;
                double h = e.GetCurrentPoint(ChartPhoto.getDrawObjectCanvas()).Position.Y / ChartPhoto.getImage().Height *ChartPhoto.getPhoto().PixelHeight;
                textBlockHeight.Text = Convert.ToInt32(h).ToString();
                int v = (testHelper.CurrentChart as ITEGrayscaleChart).getGrayGrade(Convert.ToInt32(h), lynxUpDownH.IntValue, lynxUpDownW.IntValue);
                textBlockLatitude.Text = v.ToString();
                ToolTipService.SetToolTip(textBlockLatitude, "交互测试结果:" + v.ToString());
                ShowLatitude(Convert.ToInt32(h));
                //List<double> dl = (testHelper.CurrentChart as ITEGrayscaleChart).getHLineAveL(Convert.ToInt32(h),lynxUpDownH.IntValue,lynxUpDownW.IntValue);
                //canvasLatitude.Children.Clear();
                //dg.DrawBrightHistogram(dl);
                buttonInteractiveTest.Foreground = new SolidColorBrush(Colors.Blue);
                if (c.Children.Contains(tl))
                {
                    c.Children.Remove(tl);
                }
                if (v == 11)
                {
                    ChartTestHelper.setGBSign(true, gridGB);
                }
                else
                {
                    ChartTestHelper.setGBSign(false, gridGB);
                }
            }
            catch (Exception xe)
            {
                if (xe is LFCException)//已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片");
                }
            }
            finally
            {
                c.PointerPressed -= c_PointerPressed;
                c.PointerMoved   -= c_PointerMoved;
            }
        }
        public void TestLatitude()
        {
            if (!testHelper.TestChartNull())
            {
                return;
            }
            //processbar.Value = 0;
            BeginTime = DateTime.Now;
            try
            {
                (testHelper.CurrentChart as ITEGrayscaleChart).ConstGradeL = lynxUpDownConstL.DoubleValue;
                int v = (testHelper.CurrentChart as ITEGrayscaleChart).getGrayGrade(lynxUpDownH.IntValue, lynxUpDownW.IntValue);
                EndTime = DateTime.Now;
                //textBlockLatitude.Text = v.ToString();
                LParameter lp = testHelper.getNewParameter("ITE灰阶", v, BeginTime, EndTime);
                lp.Name      = "灰阶";
                lp.Memo      = "数据表示在一张照片里面可以分辨的灰阶亮度级别";
                lp.Dimension = "级";
                testHelper.ParameterList.Add(lp);
                ShowTestResult(lChartPhoto.getPhoto());
                //List<double> dl = (testHelper.CurrentChart as ITEGrayscaleChart).getHLineAveL(lynxUpDownH.IntValue, lynxUpDownW.IntValue);
                //comboBoxLGrade.Items.Clear();

                //canvasLatitude.Children.Clear();
                //dg.DrawBrightHistogram(dl);

                if (v == 11)
                {
                    ChartTestHelper.setGBSign(true, gridGB);
                }
                else
                {
                    ChartTestHelper.setGBSign(false, gridGB);
                }
            }
            catch (Exception xe)
            {
                testHelper.ProcessError(xe, "灰阶计算错误,请检查照片");
            }
            EndTime = DateTime.Now;
            //processbar.Value = 100;
        }
Beispiel #4
0
        void TestDEV()
        {
            try
            {
                BeginTime = DateTime.Now;
                double r = (testHelper.CurrentChart as GrayChart).ptp.getGBDEv(lChartPhoto1.getPhoto(), lynxUpDownGamma.DoubleValue, lynxUpDownP.DoubleValue);
                EndTime = DateTime.Now;
                LParameter lp = testHelper.getNewParameter("灰度测试卡", r, BeginTime, EndTime);
                lp.Name      = "曝光量误差";
                lp.Memo      = "计算照片中央明度来确定曝光量";
                lp.Dimension = "";
                testHelper.ParameterList.Add(lp);

                WriteableBitmap cb = (testHelper.CurrentChart as GrayChart).ptp.getImageArea(lChartPhoto1.getPhoto(), lChartPhoto1.getPhoto().PixelWidth / 4, lChartPhoto1.getPhoto().PixelHeight / 4, lChartPhoto1.getPhoto().PixelWidth / 2, lChartPhoto1.getPhoto().PixelHeight / 2);
                double          l  = (testHelper.CurrentChart as GrayChart).ptp.getAverageColorL(cb);

                lp           = testHelper.getNewParameter("灰度测试卡", l, BeginTime, EndTime);
                lp.Name      = "中央平均明度";
                lp.Memo      = "照片中央明度";
                lp.Dimension = "";
                testHelper.ParameterList.Add(lp);


                if (Math.Abs(r) >= 1)
                {
                    ChartTestHelper.setGBSign(false, gridGB);
                }
                else
                {
                    ChartTestHelper.setGBSign(true, gridGB);
                }
                //testHelper.ShowTestResult(TextAberration, "曝光量", null);
                ShowTestResult(lChartPhoto1.getPhoto());
            }
            catch (Exception xe)//未知的异常
            {
                testHelper.ProcessError(xe, "曝光量计算错误");
            }
        }
Beispiel #5
0
        private void buttonTest_Click(object sender, RoutedEventArgs e)
        {
            if (ChartPhoto.IsSelect)
            {
                double r = (testHelper.CurrentChart as GrayChart).ptp.getDEv(lChartPhoto1.getSelectArea(), lynxUpDownGamma.DoubleValue, lynxUpDownP.DoubleValue);
                double l = (testHelper.CurrentChart as GrayChart).ptp.getAverageColorL(lChartPhoto1.getSelectArea());

                textBlockDE.Text = r.ToString();
                TextCenterL.Text = l.ToString();
                if (Math.Abs(r) >= 1)
                {
                    ChartTestHelper.setGBSign(false, gridGB);
                }
                else
                {
                    ChartTestHelper.setGBSign(true, gridGB);
                }
            }
            else
            {
                TestDEV();
            }
        }
        void Test()
        {
            if (button1LS.Tag == null)
            {
                SilverlightLFC.common.Environment.ShowMessage("请选择0.1半径对角线左边界");
            }
            if (button1RS.Tag == null)
            {
                SilverlightLFC.common.Environment.ShowMessage("请选择0.1半径对角线右边界");
            }
            if (button5LS.Tag == null)
            {
                SilverlightLFC.common.Environment.ShowMessage("请选择0.5半径对角线左边界");
            }
            if (button5RS.Tag == null)
            {
                SilverlightLFC.common.Environment.ShowMessage("请选择0.5半径对角线右边界");
            }
            if (button9LS.Tag == null)
            {
                SilverlightLFC.common.Environment.ShowMessage("请选择0.9半径对角线左边界");
            }
            if (button9RS.Tag == null)
            {
                SilverlightLFC.common.Environment.ShowMessage("请选择0.9半径对角线右边界");
            }
            BeginTime = DateTime.Now;



            double _1l = getDistance((button1LS.Tag as Point?).Value, (button1RS.Tag as Point?).Value);
            double _5l = getDistance((button5LS.Tag as Point?).Value, (button5RS.Tag as Point?).Value);
            double _9l = getDistance((button9LS.Tag as Point?).Value, (button9RS.Tag as Point?).Value);

            double r5 = (testHelper.CurrentChart as AbstractTestChart).ptp.getGBAberration(_5l, _1l, 5);
            double r9 = (testHelper.CurrentChart as AbstractTestChart).ptp.getGBAberration(_9l, _1l, 9);



            double h = 0.05;

            if (!checkBoxFocus.IsChecked.Value)
            {
                h = 0.07;
            }
            if (Math.Abs(r5) < h && Math.Abs(r9) < h)
            {
                ChartTestHelper.setGBSign(true, gridGB);
            }
            else
            {
                ChartTestHelper.setGBSign(false, gridGB);
            }
            EndTime = DateTime.Now;
            LParameter lp = testHelper.getNewParameter("畸变测试卡0.5处", r5, BeginTime, EndTime);

            lp.Name      = "国标畸变测试0.5处";
            lp.Memo      = "计算照片变形程度测算畸变";
            lp.Dimension = "";
            testHelper.ParameterList.Add(lp);

            lp           = testHelper.getNewParameter("畸变测试卡0.9处", r9, BeginTime, EndTime);
            lp.Name      = "国标畸变测试0.9处";
            lp.Memo      = "计算照片变形程度测算畸变";
            lp.Dimension = "";
            testHelper.ParameterList.Add(lp);

            ShowTestResult(lChartPhoto1.getPhoto());
        }