Beispiel #1
0
        override public Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            MedainFilter  medainFilter = new MedainFilter();
            Bitmap        resultImage  = medainFilter.processImage(sourceImage, worker);
            PruittFilter  pruitt       = new PruittFilter();
            Bitmap        resultImageA = pruitt.processImage(resultImage, worker);
            MaximumFilter maximum      = new MaximumFilter();

            return(maximum.processImage(resultImageA, worker));

            for (int i = 0; i < sourceImage.Width; ++i)
            {
                worker.ReportProgress((int)((float)i / resultImage.Width * 100));
                if (worker.CancellationPending)
                {
                    return(null);
                }
                for (int j = 0; j < sourceImage.Height; j++)
                {
                    resultImage.SetPixel(i, j, calculateNewPixelColor(sourceImage, i, j));
                }
            }
            Bitmap resultImage2 = new Bitmap(sourceImage.Width, sourceImage.Height);

            for (int i = 0; i < sourceImage.Width; ++i)
            {
                worker.ReportProgress((int)((float)i / resultImage2.Width * 100));
                if (worker.CancellationPending)
                {
                    return(null);
                }
                for (int j = 0; j < sourceImage.Height; j++)
                {
                    resultImage2.SetPixel(i, j, calculateNewPixelColorEdges(resultImage, i, j));
                }
            }
            Bitmap resultImage3 = new Bitmap(sourceImage.Width, sourceImage.Height);

            for (int i = 0; i < sourceImage.Width; ++i)
            {
                worker.ReportProgress((int)((float)i / resultImage2.Width * 100));
                if (worker.CancellationPending)
                {
                    return(null);
                }
                for (int j = 0; j < sourceImage.Height; j++)
                {
                    resultImage3.SetPixel(i, j, calculateNewPixelColorMax(resultImage2, i, j));
                }
            }

            return(resultImage3);
        }
Beispiel #2
0
        private void медианныйToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Filters filter = new MedainFilter();

            backgroundWorker1.RunWorkerAsync(filter);
        }