Beispiel #1
0
        public void apply(Bitmap image)
        {
            Bitmap dilated = ( Bitmap )image.Clone();
            Bitmap eroded  = ( Bitmap )image.Clone();

            Dilation dilation = new Dilation();
            Erosion  erosion  = new Erosion();

            int i, j;

            Color p1, p2;

            erosion.setParameters(B, B_offset_h, B_offset_v);
            dilation.setParameters(B, B_offset_h, B_offset_v);
            erosion.apply(eroded);
            dilation.apply(dilated);

            for (i = 0; i < image.Height; i++)
            {
                for (j = 0; j < image.Width; j++)
                {
                    p1 = dilated.GetPixel(j, i);
                    p2 = eroded.GetPixel(j, i);
                    image.SetPixel(j, i, Color.FromArgb(p1.R - p2.R, p1.G - p2.G, p1.B - p2.B));
                }
            }
        }
Beispiel #2
0
        public void apply(System.Drawing.Bitmap image)
        {
            Erosion  er = new Erosion();
            Dilation di = new Dilation();

            er.setParameters(B, B_offset_h, B_offset_v);
            di.setParameters(B, B_offset_h, B_offset_v);
            di.apply(image);
            er.apply(image);
        }