public override Bitmap proccessImage(Bitmap sourceImage, BackgroundWorker worker) { Erosion er = new Erosion(structureElement, threshold); Dilation dil = new Dilation(structureElement, threshold); Bitmap img = er.proccessImage(sourceImage, worker); return(dil.proccessImage(img, worker)); }
public Bitmap ProcessImage(Bitmap sourceImage) { Dilation dilation = new Dilation(); Erosion erosion = new Erosion(); HelperClass subtraction = new HelperClass(dilation.processImage(sourceImage)); return(subtraction.processImage(erosion.processImage(sourceImage))); }
public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker) { Bitmap resultImage = new Bitmap(sourceImage.Width, sourceImage.Height); Filters filter = new Dilation(); sourceImage = filter.processImage(sourceImage, worker); return(base.processImage(sourceImage, worker)); }
private void расширениеToolStripMenuItem_Click(object sender, EventArgs e) { bool[,] structureElement = new bool[3, 3] { { true, true, true }, { true, true, true }, { true, true, true } }; Filters filter = new Dilation(structureElement, 0.6f); backgroundWorker1.RunWorkerAsync(filter); }
public Bitmap ProcessImage(Bitmap sourceImage) { Dilation dilation; Erosion erosion; if (kernel != null) { dilation = new Dilation(this.kernel); erosion = new Erosion(this.kernel); } else { dilation = new Dilation(); erosion = new Erosion(); } return(erosion.processImage(dilation.processImage(sourceImage))); }
public override Bitmap proccessImage(Bitmap sourceImage, BackgroundWorker worker) { Erosion er = new Erosion(structureElement, threshold); Dilation dil = new Dilation(structureElement, threshold); Bitmap img1 = er.proccessImage(sourceImage, worker); Bitmap img2 = dil.proccessImage(sourceImage, worker); Bitmap result = new Bitmap(sourceImage.Width, sourceImage.Height); for (int i = 0; i < sourceImage.Width; ++i) { for (int j = 0; j < sourceImage.Height; ++j) { Color c1 = img1.GetPixel(i, j); Color c2 = img2.GetPixel(i, j); Color c = Color.FromArgb(Clamp(c1.R - c2.R, 0, 255), Clamp(c1.G - c2.G, 0, 255), Clamp(c1.B - c2.B, 0, 255)); result.SetPixel(i, j, c); } } return(result); }
private void dilationToolStripMenuItem_Click(object sender, EventArgs e) { Filters filter = new Dilation(); backgroundWorker1.RunWorkerAsync(filter); }