private void WorkBorderRestorOnly() { Bitmap afterRestoration = Edges.BorderRestoration(afterEdgeTrack, trackBar4.Value); pictureBox8.Invoke(new Action(() => pictureBox8.Image = new Bitmap(afterRestoration))); ShowSelectedImage(); button1.Enabled = button6.Enabled = groupBox1.Enabled = true; thread.Abort(); }
private void WorkFromThreshold() { Bitmap afterThreshold = Edges.DoubleThreshold(afterSuppression, trackBar3.Value, trackBar2.Value); pictureBox6.Invoke(new Action(() => pictureBox6.Image = new Bitmap(afterThreshold))); afterEdgeTrack = Edges.EdgeTracking(afterThreshold); pictureBox7.Invoke(new Action(() => pictureBox7.Image = new Bitmap(afterEdgeTrack))); Bitmap afterRestoration = Edges.BorderRestoration(afterEdgeTrack, trackBar4.Value); pictureBox8.Invoke(new Action(() => pictureBox8.Image = new Bitmap(afterRestoration))); ShowSelectedImage(); button1.Enabled = button6.Enabled = groupBox1.Enabled = true; thread.Abort(); }
public void StartProcessing() { Bitmap afterGrey; if (isFirstStart) { var bmp = new Bitmap(uploadedImage); pictureBox1.Invoke(new Action(() => pictureBox1.Image = new Bitmap(bmp))); afterGrey = ImageProcessing.ImageToGrey(bmp); pictureBox2.Invoke(new Action(() => pictureBox2.Image = new Bitmap(afterGrey))); pictureBox9.Invoke(new Action(() => pictureBox9.Image = new Bitmap(afterGrey))); isFirstStart = false; } else { afterGrey = new Bitmap(pictureBox2.Image); } ShowSelectedImage(); Bitmap afterGauss; if (checkBox1.Checked) { double sigma = 0; if (radioButton2.Checked) { sigma = (double)numericUpDown4.Value; } afterGauss = Filters.GaussianFilter(afterGrey, sigma); } else { afterGauss = afterGrey; } ShowSelectedImage(); pictureBox3.Invoke(new Action(() => pictureBox3.Image = new Bitmap(afterGauss))); ShowSelectedImage(); Bitmap afterSobel = Edges.SobelConvolve(afterGauss); Bitmap afterSobel2 = Edges.Sobel(afterGauss); pictureBox4.Invoke(new Action(() => pictureBox4.Image = new Bitmap(afterSobel))); pictureBox14.Invoke(new Action(() => pictureBox14.Image = new Bitmap(afterSobel2))); ShowSelectedImage(); afterSuppression = Edges.NonMaximumSuppression(afterSobel); Bitmap afterSuppression2 = Edges.NonMaximumSuppression(afterSobel2); pictureBox5.Invoke(new Action(() => pictureBox5.Image = new Bitmap(afterSuppression))); pictureBox15.Invoke(new Action(() => pictureBox15.Image = new Bitmap(afterSuppression2))); ShowSelectedImage(); Bitmap afterThreshold = Edges.DoubleThreshold(afterSuppression, trackBar3.Value, trackBar2.Value); Bitmap afterThreshold2 = Edges.DoubleThreshold(afterSuppression2, trackBar3.Value, trackBar2.Value); pictureBox6.Invoke(new Action(() => pictureBox6.Image = new Bitmap(afterThreshold))); pictureBox16.Invoke(new Action(() => pictureBox16.Image = new Bitmap(afterThreshold2))); ShowSelectedImage(); afterEdgeTrack = Edges.EdgeTracking(afterThreshold); Bitmap afterEdgeTrack2 = Edges.EdgeTracking(afterThreshold2); pictureBox7.Invoke(new Action(() => pictureBox7.Image = new Bitmap(afterEdgeTrack))); pictureBox17.Invoke(new Action(() => pictureBox17.Image = new Bitmap(afterEdgeTrack2))); ShowSelectedImage(); Bitmap afterRestoration = Edges.BorderRestoration(afterEdgeTrack, trackBar4.Value); pictureBox8.Invoke(new Action(() => pictureBox8.Image = new Bitmap(afterRestoration))); ShowSelectedImage(); button1.Enabled = button6.Enabled = groupBox1.Enabled = true; thread.Abort(); }