Esempio n. 1
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Filters filter1 = new Dilation(mask);
            Bitmap  result  = filter1.processImage(sourceImage, worker);
            Filters filter2 = new Erosion(mask);

            result = filter2.processImage(result, worker);
            return(result);
        }
Esempio n. 2
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            float   resultR;
            float   resultG;
            float   resultB;
            Filters filter = new Erosion(mask);
            Bitmap  result = filter.processImage(sourceImage, worker);

            for (int i = 0; i < sourceImage.Width; i++)
            {
                for (int j = 0; j < sourceImage.Height; j++)
                {
                    resultR = sourceImage.GetPixel(i, j).R - result.GetPixel(i, j).R;
                    resultG = sourceImage.GetPixel(i, j).G - result.GetPixel(i, j).G;
                    resultB = sourceImage.GetPixel(i, j).B - result.GetPixel(i, j).B;
                    result.SetPixel(i, j, Color.FromArgb(
                                        Clamp((int)resultR, 0, 255),
                                        Clamp((int)resultG, 0, 255),
                                        Clamp((int)resultB, 0, 255)));
                }
            }
            return(result);
        }