Exemplo n.º 1
0
        public decimal getColorDis()//给出色差测试的结果
        {
            List <float>    al   = new List <float>();
            decimal         x    = 0;
            WriteableBitmap subB = null;
            Color           c;

            for (int i = 7; i < 19; i++)//仅仅测试7-18,前面6个是RGB的,后面才是CMYK模式的,表示了真实的色差
            {
                subB = getAreaColor(i);
                c    = getAverageColor(subB);
                Color c0 = (Color)ColorList[i - 1];
                float f  = Math.Abs(PhotoTest.getHue(c0) - PhotoTest.getHue(c));//这里的色差仅仅看色相的差异,不管亮度和饱和度的差异
                al.Add(f);
                //subB.Dispose();
            }

            for (int i = 0; i < al.Count; i++)//求平均值
            {
                decimal dx = Convert.ToDecimal(al[i]);
                if (dx > 180)//大于180度,就从色相环的另一个方向去绕更快
                {
                    dx = 360 - dx;
                }
                x = x + dx;
            }
            x = x / al.Count;
            return(x);
        }
Exemplo n.º 2
0
        public List <decimal> getCurveLatitude()
        {
            ProcBWValue();
            List <decimal> al = new List <decimal>();

            for (int i = 0; i < ValueBWList.Count; i++)
            {
                al.Add(Convert.ToDecimal(PhotoTest.getBrightness(ValueBWList[i]) * 255));
            }

            return(al);
        }
Exemplo n.º 3
0
        public decimal getBrightChanges(WriteableBitmap b) //测试亮度一致性
        {                                                  //使用中央点的亮度减去四角点的亮度平均值,需要使用CropPhoto
            Color c   = GetPixel(b, b.PixelWidth / 2, b.PixelHeight / 2);
            Color clt = GetPixel(b, 0, 0);
            Color crt = GetPixel(b, b.PixelWidth - 1, 0);
            Color clb = GetPixel(b, 0, b.PixelHeight - 1);
            Color crb = GetPixel(b, b.PixelWidth - 1, b.PixelHeight - 1);
            float lt  = PhotoTest.getBrightness(clt);
            float lb  = PhotoTest.getBrightness(clb);
            float rt  = PhotoTest.getBrightness(crt);
            float rb  = PhotoTest.getBrightness(crb);
            float bb  = lt + lb + rt + rb;

            bb = bb / 4;
            setProcessInfor("BrightChanges_BorderBright", bb);
            setProcessInfor("BrightChanges_LT", lt);
            setProcessInfor("BrightChanges_LB", lb);
            setProcessInfor("BrightChanges_RT", rt);
            setProcessInfor("BrightChanges_RB", rb);
            float cb = PhotoTest.getBrightness(c);

            setProcessInfor("BrightChanges_CBright", cb);
            return(Convert.ToDecimal(Math.Abs(cb - bb) / cb));//相当于四周变暗的比例
        }
Exemplo n.º 4
0
        public decimal getColorDistance()//测试色差,使用XRite的色标卡
        {
            List <float>    al = new List <float>();
            decimal         x = 0;
            WriteableBitmap subB = null;
            Color           c, c0;
            float           f = 0f;

            subB = getAreaSubCorrect(ChartPhoto, 1, 1);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[0];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 1, 2);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[1];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 1, 3);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[2];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 1, 4);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[3];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 1, 5);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[4];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 1, 6);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[5];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 2, 1);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[6];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 2, 2);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[7];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 2, 3);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[8];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 2, 4);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[9];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 2, 5);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[10];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 2, 6);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[11];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 3, 1);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[12];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 3, 2);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[13];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 3, 3);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[14];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 3, 4);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[15];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 3, 5);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[16];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            subB = getAreaSubCorrect(ChartPhoto, 3, 6);
            c    = getAverageColor(subB);
            c0   = (Color)ColorList[17];
            f    = Math.Abs(PhotoTest.getHue(c) - PhotoTest.getHue(c0));
            al.Add(f);
            //subB.Dispose();

            for (int i = 0; i < al.Count; i++)
            {
                decimal dx = Convert.ToDecimal(al[i]);
                if (dx > 180)
                {
                    dx = 360 - dx;
                }
                x = x + dx;
            }
            x = x / al.Count;
            return(x);
        }