Ejemplo n.º 1
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            Filters filter;

            switch (buttonMode)
            {
            case 1:
                filter = new SepiaFilter(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 2:
                filter = new BrightnessFilter(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 3:
                filter = new SobelFilter(orientMode);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 4:
                if (textBoxHor.Text == "")
                {
                    textBoxHor.Text = "0";
                }
                if (textBoxVert.Text == "")
                {
                    textBoxVert.Text = "0";
                }
                filter = new Move(Convert.ToInt32(textBoxHor.Text), Convert.ToInt32(textBoxVert.Text));
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 5:
                if (textBoxHor.Text == "")
                {
                    textBoxHor.Text = "0";
                }
                if (textBoxVert.Text == "")
                {
                    textBoxVert.Text = "0";
                }
                filter = new Turn(Convert.ToInt32(textBoxHor.Text) - Convert.ToInt32(textBoxVert.Text));
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 6:
                filter = new Waves(trackBar1.Value, orientMode);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 7:
                filter = new Glass(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 8:
                filter = new BorderSelection(trackBar1.Value, orientMode);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 9:
                filter = new MedianFilter();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 10:
                filter = new MaximumFilter();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 11:
                filter = new GlowingBorders(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 12:
                filter = new Dilation(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 13:
                filter = new Erosion(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 14:
                filter = new InvertFilter();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 15:
                filter = new BlurFilter();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 16:
                filter = new GaussianFilter();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 17:
                filter = new GreyScaleFilter();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 18:
                filter = new SharpnessFilter();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 19:
                filter = new SharpnessFilter2();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 20:
                EmbossingFilter filter_ = new EmbossingFilter();
                backgroundWorker1.RunWorkerAsync(filter_);
                break;

            case 21:
                GreyWorldFilter _filter_ = new GreyWorldFilter();
                backgroundWorker1.RunWorkerAsync(_filter_);
                break;

            case 22:
                filter = new HistogramSretching();
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 23:
                filter = new Opening(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 24:
                filter = new Closing(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 25:
                filter = new Grad(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 26:
                filter = new TopHat(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;

            case 27:
                filter = new BlackHat(trackBar1.Value);
                backgroundWorker1.RunWorkerAsync(filter);
                break;
            }
        }
Ejemplo n.º 2
0
Archivo: Form1.cs Proyecto: katsapov/CG
        private void topHatToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Filters filter = new TopHat();

            backgroundWorker1.RunWorkerAsync(filter);
        }