示例#1
0
        public override Bitmap processImg(Bitmap img, BackgroundWorker worker)
        {
            Filter filter1 = new Dilatation(kernel);
            Bitmap res     = filter1.processImg(img, worker);
            Filter filter2 = new Erosion(kernel);

            res = filter2.processImg(res, worker);

            return(res);
        }
示例#2
0
        public override Bitmap processImg(Bitmap img, BackgroundWorker worker)
        {
            float  resR; float resG; float resB;
            Filter filter = new Erosion(kernel);
            Bitmap res    = filter.processImg(img, worker);

            for (int i = 0; i < img.Width; i++)
            {
                for (int j = 0; j < img.Height; j++)
                {
                    resR = img.GetPixel(i, j).R - res.GetPixel(i, j).R;
                    resG = img.GetPixel(i, j).G - res.GetPixel(i, j).G;
                    resB = img.GetPixel(i, j).B - res.GetPixel(i, j).B;
                    res.SetPixel(i, j, Color.FromArgb(Clamp((int)resR, 0, 255), Clamp((int)resG, 0, 255), Clamp((int)resB, 0, 255)));
                }
            }

            return(res);
        }