示例#1
0
        private void openingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            temp_image = new Bitmap(pictureBox1.Image);

            if (toolStripTextBox1.Text != "" && Convert.ToInt32(toolStripTextBox1.Text) > 0)
            {
                Filters filter = new OpeningFilter(MatrixFilter.generateUnitMatrix(Convert.ToInt32(toolStripTextBox1.Text)));
                backgroundWorker1.RunWorkerAsync(filter);
            }
            else
            {
                Filters filter = new OpeningFilter();
                backgroundWorker1.RunWorkerAsync(filter);
            }
        }
示例#2
0
        public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            OpeningFilter opening;

            if (this.kernel == null)
            {
                opening = new OpeningFilter();
            }
            else
            {
                opening = new OpeningFilter(this.kernel);
            }

            SubtractionFilter subtraction = new SubtractionFilter(sourceImage);

            return(subtraction.processImage(opening.processImage(sourceImage, worker), worker));
        }
示例#3
0
        private void openingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpeningFilter filter = new OpeningFilter(tmp);
            Bitmap        newImage;

            if (tmp == null)
            {
                newImage = filter.ProcessImage(image);
            }
            else
            {
                newImage = filter.processImage(image);
            }
            if (backgroundWorker1.CancellationPending != true)
            {
                image = newImage;
            }
            pictureBox1.Image = image;
            pictureBox1.Refresh();
        }