コード例 #1
0
ファイル: Opening.cs プロジェクト: ls-pepper/Image_processing
        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
ファイル: TopHat.cs プロジェクト: ls-pepper/Image_processing
        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);
        }