private void dilationButton_Click(object sender, EventArgs e) { DilationFilter filter = new DilationFilter(structElement); backgroundWorker.RunWorkerAsync(filter); changeFiltersEnabled(true); }
private void closingButton_Click(object sender, EventArgs e) { DilationFilter firstFilter = new DilationFilter(structElement); backgroundWorker.RunWorkerAsync(firstFilter); extraOperation = "erosion"; changeFiltersEnabled(true); }
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (extraOperation == "erosion") { ErosionFilter firstFilter = new ErosionFilter(structElement); backgroundWorker.RunWorkerAsync(firstFilter); extraOperation = "none"; } else if (extraOperation == "dilation") { DilationFilter firstFilter = new DilationFilter(structElement); backgroundWorker.RunWorkerAsync(firstFilter); extraOperation = "none"; } else { pictureBox.Image = bmp.image; pictureBox.Refresh(); changeFiltersEnabled(false); } }