Beispiel #1
0
        public void Erode(System.Drawing.Bitmap srcImage, Infrastructure.FilterWindowType type)
        {
            Byte[] rgbBytes    = LockBits(srcImage, System.Drawing.Imaging.ImageLockMode.ReadWrite);
            Int32  singleWidth = RealWidth / 3;
            Int32  length      = singleWidth * Height;

            Byte[] tempb = new Byte[length];
            Byte[] tempg = new Byte[length];
            Byte[] tempr = new Byte[length];
            for (int i = 0; i < Height; i++)
            {
                for (int j = 0; j < singleWidth; j++)
                {
                    tempb[i * singleWidth + j] = rgbBytes[i * Width + j * 3];
                    tempg[i * singleWidth + j] = rgbBytes[i * Width + j * 3 + 1];
                    tempr[i * singleWidth + j] = rgbBytes[i * Width + j * 3 + 2];
                }
            }
            Byte[] resub, resug, resur;
            base.erode(ref tempb, singleWidth, Height, type, out resub);
            base.erode(ref tempg, singleWidth, Height, type, out resug);
            base.erode(ref tempr, singleWidth, Height, type, out resur);

            for (int i = 0; i < Height; i++)
            {
                for (int j = 0; j < singleWidth; j++)
                {
                    rgbBytes[i * Width + j * 3]     = resub[i * singleWidth + j];
                    rgbBytes[i * Width + j * 3 + 1] = resug[i * singleWidth + j];
                    rgbBytes[i * Width + j * 3 + 2] = resur[i * singleWidth + j];
                }
            }
            UnlockBits(rgbBytes);
        }
Beispiel #2
0
 public void Close(System.Drawing.Bitmap srcImage, Infrastructure.FilterWindowType type)
 {
     this.Delation(srcImage, type);
     this.Erode(srcImage, type);
 }