Exemplo n.º 1
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Dilation dilation = new Dilation(structElem, border);
            Bitmap   res2     = dilation.processImage(sourceImage, worker);
            Erosion  erosion  = new Erosion(structElem, border);
            Bitmap   res1     = erosion.processImage(res2, worker);

            return(res1);
        }
Exemplo n.º 2
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Erosion  erosion  = new Erosion(structElem, border);
            Dilation dilation = new Dilation(structElem, border);
            Bitmap   img1     = erosion.processImage(sourceImage, worker);
            Bitmap   img2     = dilation.processImage(sourceImage, worker);
            Bitmap   result   = new Bitmap(sourceImage.Width, sourceImage.Height);

            for (int i = 0; i < sourceImage.Width; ++i)
            {
                for (int j = 0; j < sourceImage.Height; ++j)
                {
                    Color clr1 = img1.GetPixel(i, j);
                    Color clr2 = img2.GetPixel(i, j);
                    Color c    = Color.FromArgb(Clamp(clr1.R - clr2.R, 0, 255), Clamp(clr1.G - clr2.G, 0, 255), Clamp(clr1.B - clr2.B, 0, 255));
                    result.SetPixel(i, j, c);
                }
            }
            return(result);
        }