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); } Bitmap afterGauss; if (checkBox1.Checked) { double sigma = 0; if (radioButton2.Checked) { sigma = (double)numericUpDown4.Value; } afterGauss = ImageProcessing.GaussianFilter(afterGrey, sigma); } else { afterGauss = afterGrey; } pictureBox3.Invoke(new Action(() => pictureBox3.Image = new Bitmap(afterGauss))); Bitmap afterSobel = ImageProcessing.SobelConvolve(afterGauss); pictureBox4.Invoke(new Action(() => pictureBox4.Image = new Bitmap(afterSobel))); afterSuppression = ImageProcessing.NonMaximumSuppression(afterSobel); pictureBox5.Invoke(new Action(() => pictureBox5.Image = new Bitmap(afterSuppression))); Bitmap afterThreshold = ImageProcessing.DoubleThreshold(afterSuppression, trackBar3.Value, trackBar2.Value); pictureBox6.Invoke(new Action(() => pictureBox6.Image = new Bitmap(afterThreshold))); afterEdgeTrack = ImageProcessing.EdgeTracking(afterThreshold); pictureBox7.Invoke(new Action(() => pictureBox7.Image = new Bitmap(afterEdgeTrack)));; Bitmap afterRestoration = ImageProcessing.BorderRestoration(afterEdgeTrack, trackBar4.Value); pictureBox8.Invoke(new Action(() => pictureBox8.Image = new Bitmap(afterRestoration))); ShowSelectedImage(); button1.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))); pictureBox8.Invoke(new Action(() => pictureBox8.Image = new Bitmap(bmp))); afterGrey = ImageProcessing.ImageToGrey(bmp); pictureBox2.Invoke(new Action(() => pictureBox2.Image = new Bitmap(afterGrey))); isFirstStart = false; } else { afterGrey = new Bitmap(pictureBox2.Image); } Bitmap afterGauss; if (checkBox1.Checked) { double sigma = 0; if (radioButton2.Checked) { sigma = (double)numericUpDown4.Value; } afterGauss = ImageProcessing.GaussianFilter(afterGrey, sigma); } else { afterGauss = afterGrey; } pictureBox3.Invoke(new Action(() => pictureBox3.Image = new Bitmap(afterGauss))); if (isGradient) { afterFade = ImageProcessing.FadeDetection(afterGauss); } else { afterFade = ImageProcessing.LaplassianDetection(afterGauss); } pictureBox4.Invoke(new Action(() => pictureBox4.Image = new Bitmap(afterFade))); Bitmap afterThreshold = ImageProcessing.FadeLaplassThreshold(afterFade, trackBar2.Value); pictureBox5.Invoke(new Action(() => pictureBox5.Image = new Bitmap(afterThreshold))); ShowSelectedImage(); button1.Enabled = groupBox2.Enabled = true; thread.Abort(); }