Ejemplo n.º 1
0
        public List <PixInfor> getExceptionPix(WriteableBitmap b)
        {
            List <PixInfor> pl = new List <PixInfor>();
            double          l  = pt.getAverageColorL(b);

            byte[] p = b.PixelBuffer.ToArray();
            for (int y = 0; y < b.PixelHeight; y++)//遍历每一个像素
            {
                for (int x = 0; x < b.PixelWidth; x++)
                {
                    byte[] components = new byte[4];
                    components = BitConverter.GetBytes(p[y * b.PixelWidth + x]);
                    Color c = new Color();
                    c.R = components[2];
                    c.G = components[1];
                    c.B = components[0];
                    double cpl = ColorManager.getLabL(c, CurrentLabMode);

                    if ((cpl < l * (1 - hPercent)) || (cpl > l * (1 + hPercent)))
                    {
                        PixInfor pi = new PixInfor();
                        pi.colorValue = c;
                        pi.XPosition  = x;
                        pi.YPosition  = y;
                        pl.Add(pi);
                    }
                }
            }
            return(pl);
        }
Ejemplo n.º 2
0
 bool IsSame(PixInfor p1, PixInfor p2)
 {
     if ((Math.Abs(p1.XPosition - p2.XPosition) < EqualLength) && (Math.Abs(p1.YPosition - p2.YPosition) < EqualLength))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
 bool IsContains(PixInfor p)
 {
     foreach (PixInfor cp in ExceptionPixList)
     {
         if (IsSame(p, cp))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
        void ShowBadCombInfor(List <PixInfor> pl, ComboBox cb)//显示疑似坏点
        {
            cb.Items.Clear();
            int tc = 3000;//最多加3000

            if (pl.Count < tc)
            {
                tc = pl.Count;
            }
            for (int i = 0; i < tc; i++)
            {
                PixInfor pi = pl[i];

                ComboBoxItem ci = new ComboBoxItem();
                ci.Content = pi.getDescription();
                cb.Items.Add(ci);
            }
        }