private void closingToolStripMenuItem_Click(object sender, EventArgs e) { Filters filter1 = new Dilation(structElem()); Filters filter2 = new Erosion(structElem()); Bitmap resultImage = filter1.processImage(Image, backgroundWorker1); resultImage = filter2.processImage(resultImage, backgroundWorker1); pictureBox2.Image = resultImage; pictureBox2.Refresh(); progressBar1.Value = 0; }
private void gradientToolStripMenuItem_Click(object sender, EventArgs e) { Filters filter1 = new Dilation(structElem()); Filters filter2 = new Erosion(structElem()); Bitmap resultImage1 = filter1.processImage(Image, backgroundWorker1); Bitmap resultImage2 = filter2.processImage(Image, backgroundWorker1); Bitmap resultImage = new Bitmap(Image.Width, Image.Height); for (int i = 0; i < Image.Width; i++) { for (int j = 0; j < Image.Height; j++) { resultImage.SetPixel(i, j, Color.FromArgb(resultImage1.GetPixel(i, j).R - resultImage2.GetPixel(i, j).R, resultImage1.GetPixel(i, j).G - resultImage2.GetPixel(i, j).G, resultImage1.GetPixel(i, j).B - resultImage2.GetPixel(i, j).B)); } } pictureBox2.Image = resultImage; pictureBox2.Refresh(); progressBar1.Value = 0; }
private void dilationToolStripMenuItem_Click(object sender, EventArgs e) { Filters filter = new Dilation(structElem()); backgroundWorker1.RunWorkerAsync(filter); }