private void closingToolStripMenuItem_Click(object sender, EventArgs e) { temp_image = new Bitmap(pictureBox1.Image); if (toolStripTextBox1.Text != "" && Convert.ToInt32(toolStripTextBox1.Text) > 0) { Filters filter = new ClosingFilter(MatrixFilter.generateUnitMatrix(Convert.ToInt32(toolStripTextBox1.Text))); backgroundWorker1.RunWorkerAsync(filter); } else { Filters filter = new ClosingFilter(); backgroundWorker1.RunWorkerAsync(filter); } }
public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker) { ClosingFilter closing; if (this.kernel == null) { closing = new ClosingFilter(); } else { closing = new ClosingFilter(this.kernel); } SubtractionFilter subtraction = new SubtractionFilter(closing.processImage(sourceImage, worker)); return(subtraction.processImage(sourceImage, worker)); }
private void closingToolStripMenuItem_Click(object sender, EventArgs e) { ClosingFilter filter = new ClosingFilter(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(); }