コード例 #1
0
        private void WorkThresholdOnly()
        {
            Bitmap afterThreshold = ImageProcessing.FadeLaplassThreshold(afterFade, trackBar2.Value);

            pictureBox5.Invoke(new Action(() => pictureBox5.Image = afterThreshold));

            ShowSelectedImage();
            button1.Enabled = groupBox2.Enabled = true;
            thread.Abort();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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), "Пороговая фильтрация")));
        }
コード例 #4
0
        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), "Пороговая фильтрация")));
        }