Ejemplo n.º 1
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Bitmap  resultImage = sourceImage;
            Bitmap  tmp1        = sourceImage;
            Bitmap  tmp2        = sourceImage;
            Filters filter      = new Dilation();

            tmp1   = filter.processImage(tmp1, worker);
            filter = new Erosion();
            tmp2   = filter.processImage(tmp2, worker);

            for (int i = 0; i < sourceImage.Width; i++)
            {
                for (int j = 0; j < sourceImage.Height; j++)
                {
                    int r = Clamp(tmp1.GetPixel(i, j).R - tmp2.GetPixel(i, j).R, 0, 255);
                    int g = Clamp(tmp1.GetPixel(i, j).G - tmp2.GetPixel(i, j).G, 0, 255);
                    int b = Clamp(tmp1.GetPixel(i, j).B - tmp2.GetPixel(i, j).B, 0, 255);

                    resultImage.SetPixel(i, j, Color.FromArgb(r, g, b));
                }
            }

            return(resultImage);
        }
Ejemplo n.º 2
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Bitmap  resultImage = new Bitmap(sourceImage.Width, sourceImage.Height);
            Filters filter      = new Dilation();

            sourceImage = filter.processImage(sourceImage, worker);

            return(base.processImage(sourceImage, worker));
        }
Ejemplo n.º 3
0
        private void расширениеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool[,] kernel = new bool[3, 3] {
                { false, true, false }, { true, true, true }, { false, true, false }
            };
            Filters filter = new Dilation(kernel);

            backgroundWorker1.RunWorkerAsync(filter);
        }
Ejemplo n.º 4
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Bitmap  resultImage = sourceImage;
            Filters filter      = new Dilation();

            resultImage = filter.processImage(resultImage, worker);
            filter      = new Erosion();
            resultImage = filter.processImage(resultImage, worker);
            return(resultImage);
        }
Ejemplo n.º 5
0
Archivo: Form1.cs Proyecto: orcyyy/lab1
        private void dilationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Filters filter = new Dilation();

            backgroundWorker1.RunWorkerAsync(filter);
        }