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 = Filters.GaussianFilter(afterGrey, sigma); } else { afterGauss = afterGrey; } pictureBox3.Invoke(new Action(() => pictureBox3.Image = new Bitmap(afterGauss))); if (isGradient) { afterFade = Edges.FadeDetection(afterGauss); } else { afterFade = Edges.LaplacianDetection(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(); }
private void button1_ClickTest(object sender, EventArgs e) { Bitmap afterGrey; var bmp = new Bitmap(uploadedImage); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(bmp), "Исходное изображение"))); afterGrey = ImageProcessing.ImageToGrey(bmp); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGrey), "Оттенки серого"))); double sigma = 0; Bitmap afterGauss = Filters.GaussianFilter(afterGrey, sigma); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGauss), "Фильтр Гаусса"))); Bitmap afterMedian = Filters.MedianFilter(afterGrey, 5); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterMedian), "Медианный фильтр"))); }
public void FadeLaplacianDetecting() { Bitmap afterGrey; var bmp = new Bitmap(uploadedImage); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(bmp), "Исходное изображение"))); afterGrey = ImageProcessing.ImageToGrey(bmp); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGrey), "Оттенки серого"))); Bitmap afterGauss; if (checkBox2.Checked) { double sigma = 0; if (radioButton6.Checked) { sigma = (double)numericUpDown4.Value; } afterGauss = Filters.GaussianFilter(afterGrey, sigma); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGauss), "Фильтр Гаусса"))); } else { afterGauss = afterGrey; } var afterFade = Edges.FadeDetection(new Bitmap(afterGauss)); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterFade), "Метод на основе градиента"))); Bitmap afterThreshold = ImageProcessing.FadeLaplassThreshold(afterFade, trackBar2.Value); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterThreshold), "Пороговая фильтрация"))); }
private void MarrHildrethDetecting() { Bitmap afterGrey; var bmp = new Bitmap(uploadedImage); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(bmp), "Исходное изображение"))); afterGrey = ImageProcessing.ImageToGrey(bmp); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGrey), "Оттенки серого"))); Bitmap afterGauss; if (checkBox2.Checked) { double sigma = 0; if (radioButton6.Checked) { sigma = (double)numericUpDown4.Value; } afterGauss = Filters.GaussianFilter(afterGrey, sigma); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGauss), "Фильтр Гаусса"))); } else { afterGauss = afterGrey; } var afterMarrHildreth = LoG.MarrHildrethEdge(new Bitmap(afterGauss)); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterMarrHildreth), "Метод Марр-Хилдрет"))); Bitmap afterThreshold = ImageProcessing.FadeLaplassThreshold(afterMarrHildreth, trackBar2.Value); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterThreshold), "Пороговая фильтрация"))); }
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(); }
private void CannyEdgeDetecting() { Bitmap afterGrey; //if (isFirstStart) //{ var bmp = new Bitmap(uploadedImage); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(bmp), "Исходное изображение"))); afterGrey = ImageProcessing.ImageToGrey(bmp); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGrey), "Оттенки серого"))); //pictureBox9.Invoke(new Action(() => pictureBox9.Image = new Bitmap(afterGrey))); //isFirstStart = false; //} //else // afterGrey = new Bitmap(pictureBox2.Image); //ShowSelectedImage(); Bitmap afterGauss; if (checkBox2.Checked) { double sigma = 0; if (radioButton6.Checked) { sigma = (double)numericUpDown4.Value; } afterGauss = Filters.GaussianFilter(afterGrey, sigma); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterGauss), "Фильтр Гаусса"))); } else { afterGauss = afterGrey; } //ShowSelectedImage(); Bitmap afterSobel = Edges.SobelConvolve(afterGauss); //Bitmap afterSobel2 = Edges.Sobel(afterGauss); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterSobel), "Фильтр Собеля"))); //pictureBox14.Invoke(new Action(() => pictureBox14.Image = new Bitmap(afterSobel2))); //ShowSelectedImage(); Bitmap afterSuppression = Edges.NonMaximumSuppression(afterSobel); //Bitmap afterSuppression2 = Edges.NonMaximumSuppression(afterSobel2); panel1.Invoke(new Action(() => AddImageOnPanel(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); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterThreshold), "Двойная проговая фильтрация"))); //pictureBox16.Invoke(new Action(() => pictureBox16.Image = new Bitmap(afterThreshold2))); //ShowSelectedImage(); Bitmap afterEdgeTrack = Edges.EdgeTracking(afterThreshold); //Bitmap afterEdgeTrack2 = Edges.EdgeTracking(afterThreshold2); panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterEdgeTrack), "Трассировка области неоднозначности"))); //pictureBox17.Invoke(new Action(() => pictureBox17.Image = new Bitmap(afterEdgeTrack2))); //ShowSelectedImage(); //Bitmap afterRestoration = Edges.BorderRestoration(afterEdgeTrack, trackBar4.Value); //panel1.Invoke(new Action(() => AddImageOnPanel(new Bitmap(afterRestoration), "Восстановление границ"))); //ShowSelectedImage(); //button1.Enabled = button6.Enabled = groupBox1.Enabled = true; }