Example #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);
        }
Example #2
0
        private void сужениеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool[,] stru = new bool[3, 3] {
                { true, true, true }, { true, true, true }, { true, true, true }
            };
            Filters fiilter = new Erosion(stru, 12);

            backgroundWorker1.RunWorkerAsync(fiilter);
        }
Example #3
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);
        }