Exemplo n.º 1
0
        private void btnLoadImage_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                img = new RGBImage(openFileDialog1.FileName, ColorPlane.eGreen);

                AdvColor[,] new_pixels = img.MedianFilter(img.MirrorByKernel(3, 3, img.HistogramStretch(.1, .9, ColorPlane.eGreen)), 3);

                //RGBImage blurred = new RGBImage(img.GaussianBlur2D(15, 15, 1.5));
                RGBImage blurred = new RGBImage(img.GaussianBlur1D(1, 15, 1.5, img.GaussianBlur1D(15, 1, 1.5, new_pixels)));

                blurred.CalcSobel("sobel_mag.png", "sobel_dir.png");

                RGBImage mag_image = new RGBImage("sobel_mag.png", ColorPlane.eGreen);
                RGBImage dir_image = new RGBImage("sobel_dir.png", ColorPlane.eGreen);

                double threshold = mag_image.CalcOtsuThreshold();

                AdvColor[,] mag_image_prime = mag_image.Binarization(threshold, ColorPlane.eGreen);
                AdvColor[,] dir_image_prime = dir_image.Binzarization(255, ColorPlane.eGreen, mag_image_prime);

                mag_image.SaveToImage(mag_image_prime, "mag_image_prime.png");
                dir_image.SaveToImage(dir_image_prime, "dir_image_prime.png");

                RGBImage new_mag_image = new RGBImage(mag_image_prime);
                RGBImage new_dir_image = new RGBImage(dir_image_prime);

                mean = new_mag_image.Mean(ColorPlane.eGreen);

                textBox1.Text = "Mean: " + mean.ToString() + Environment.NewLine + "Mean - Dir: " + new_dir_image.Mean(ColorPlane.eGreen).ToString();
            }
        }
Exemplo n.º 2
0
        private void btnOutputImage_Click(object sender, EventArgs e)
        {
            AdvColor[,] new_pixels   = img.GaussianBlur1D(1, 15, 1.6, null);
            AdvColor[,] newer_pixels = img.GaussianBlur1D(15, 1, 1.6, new_pixels);

            img.SaveToImage(newer_pixels, "1DGaussianBlur.png");

            RGBImage img_1D = new RGBImage("1DGaussianBlur.png", ColorPlane.eGreen);
            double   mean   = img_1D.Mean(ColorPlane.eGreen);

            textBox1.Text += "1D Gaussian Image Mean: " + mean + System.Environment.NewLine;
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            AdvColor[,] new_pixels = img.GaussianBlur2D(15, 15, 1.6);

            img.SaveToImage(new_pixels, "2DGaussianBlur.png");

            RGBImage img_2D = new RGBImage("2DGaussianBlur.png", ColorPlane.eGreen);

            double mean = img_2D.Mean(ColorPlane.eGreen);

            textBox1.Text += "2D Gaussian Image Mean: " + mean + System.Environment.NewLine;
        }
Exemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            img.CalcSobel("mag_image.png", "dir_image.png");

            RGBImage mag = new RGBImage("mag_image.png", ColorPlane.eGreen);
            RGBImage dir = new RGBImage("mag_image.png", ColorPlane.eGreen);

            double mean_mag = mag.Mean(ColorPlane.eGreen);
            double mean_dir = dir.Mean(ColorPlane.eGreen);

            textBox1.Text += "Mag Image Mean: " + mean_mag + System.Environment.NewLine;
            textBox1.Text += "Dir Image Mean: " + mean_dir + System.Environment.NewLine;
        }
Exemplo n.º 5
0
        private void btnLoadImage_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                img     = new RGBImage(openFileDialog1.FileName, ColorPlane.eGreen);
                mean    = img.Mean(ColorPlane.eGreen);
                max     = img.Max(ColorPlane.eGreen);
                min     = img.Min(ColorPlane.eGreen);
                std_dev = img.StdDev(ColorPlane.eGreen);

                textBox1.Text = "Mean: " + mean.ToString() + Environment.NewLine + "Std. Dev.: " + std_dev.ToString() + Environment.NewLine + "Min: " + min.ToString()
                                + Environment.NewLine + "Max: " + max.ToString();
            }
        }