Пример #1
0
        public override Bitmap proccessImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Erosion  er  = new Erosion(structureElement, threshold);
            Dilation dil = new Dilation(structureElement, threshold);
            Bitmap   img = er.proccessImage(sourceImage, worker);

            return(dil.proccessImage(img, worker));
        }
Пример #2
0
        public override Bitmap proccessImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Erosion  er     = new Erosion(structureElement, threshold);
            Dilation dil    = new Dilation(structureElement, threshold);
            Bitmap   img1   = er.proccessImage(sourceImage, worker);
            Bitmap   img2   = dil.proccessImage(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 c1 = img1.GetPixel(i, j);
                    Color c2 = img2.GetPixel(i, j);
                    Color c  = Color.FromArgb(Clamp(c1.R - c2.R, 0, 255), Clamp(c1.G - c2.G, 0, 255), Clamp(c1.B - c2.B, 0, 255));
                    result.SetPixel(i, j, c);
                }
            }
            return(result);
        }