예제 #1
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Filtres erosion     = new Erosion();
            Filtres dilation    = new Dilation();
            Bitmap  resultImage = erosion.processImage(sourceImage, worker);

            resultImage = dilation.processImage(resultImage, worker);
            return(resultImage);
        }
예제 #2
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Filtres erosion     = new Erosion();
            Bitmap  resultImage = new Bitmap(sourceImage.Width, sourceImage.Height);

            resultImage = erosion.processImage(sourceImage, worker);

            for (int i = 0; i < resultImage.Width; ++i)
            {
                for (int j = 0; j < resultImage.Height; ++j)
                {
                    Color erosionColor = resultImage.GetPixel(i, j);
                    Color sourceColor  = sourceImage.GetPixel(i, j);
                    Color resultColor  = Color.FromArgb(Clamp(sourceColor.R - erosionColor.R, 0, 255),
                                                        Clamp(sourceColor.G - erosionColor.G, 0, 255),
                                                        Clamp(sourceColor.B - erosionColor.B, 0, 255));
                    resultImage.SetPixel(i, j, resultColor);
                }
            }
            return(resultImage);
        }
예제 #3
0
        private void сужениеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Filtres filter = new Erosion();

            backgroundWorker1.RunWorkerAsync(filter);
        }