private void useHaarInsideExternalContour_button_Click(object sender, EventArgs e)
        {
            Bitmap   bmpWidthGivenEdge   = new Bitmap(pictureBox4.Image);
            Bitmap   bmpInsideTheContour = CannyWithHaarWavelet.FindEdgesInsideGivenEdge(bmpWidthGivenEdge, this.imageArray);
            HaarForm newHaarForm         = new HaarForm(Int32.Parse(waveletLength_textBox.Text), Convert.ToDouble(bottomThresholdHaar_textBox.Text),
                                                        Convert.ToDouble(upperThresholdHaar_textBox.Text), bmp = bmpInsideTheContour);

            newHaarForm.Show();
        }
        public static double[] DoTheAnalysis(double sigma, double bottomThresholdCanny, double upperThresholdCanny,
                                             int waveletLength, double bottomThresholdHaar, double upperThresholdHaar, int widthOfBrightnessDiffer, double snr = -1)
        {
            decimal[,] origImage            = MakeOriginImArr(widthOfBrightnessDiffer);
            decimal[,] origImageCopyForHaar = MakeOriginImArr(widthOfBrightnessDiffer);

            double[,] perfectEdgeImage = MakePerfectEdgeImArr();

            Bitmap bmpToSaveForTest = new Bitmap(origImage.GetLength(1), origImage.GetLength(0));

            for (int i = 0; i < origImage.GetLength(0); i++)
            {
                for (int j = 0; j < origImage.GetLength(1); j++)
                {
                    bmpToSaveForTest.SetPixel(j, i, Color.FromArgb((int)Math.Ceiling(origImage[i, j]), (int)Math.Ceiling(origImage[i, j]), (int)Math.Ceiling(origImage[i, j])));
                }
            }

            if (snr > -1)
            {
                origImage            = AddGausNoise(origImage, snr);// зашумляем изображение
                origImageCopyForHaar = AddGausNoise(origImageCopyForHaar, snr);
            }

            CannyForm = new CannyForm(sigma, bottomThresholdCanny, upperThresholdCanny, bmp: null, imageArray: origImage); //создаем окно для вывода результатов метода Канни, передавая путь к выбранному файлу

            double[,] cannyResult = new double[CannyForm.cannyResult.Height, CannyForm.cannyResult.Width];
            for (int i = 0; i < cannyResult.GetLength(0); i++)
            {
                for (int j = 0; j < cannyResult.GetLength(1); j++)
                {
                    cannyResult[i, j] = CannyForm.cannyResult.GetPixel(j, i).R;
                }
            }
            HaarForm = new HaarForm(waveletLength, bottomThresholdHaar, upperThresholdHaar, bmp: null, imageArray: origImageCopyForHaar); //создаем окно для вывода результатов метода Хаара, передавая путь к выбранному файлу

            double[,] haarResult = new double[HaarForm.resultBmp.Height, HaarForm.resultBmp.Width];
            for (int i = 0; i < haarResult.GetLength(0); i++)
            {
                for (int j = 0; j < haarResult.GetLength(1); j++)
                {
                    haarResult[i, j] = HaarForm.resultBmp.GetPixel(j, i).R;
                }
            }

            double cannyPrettCrit = CountPrettCriteriaWithoutBorderPixels(perfectEdgeImage, cannyResult, waveletLength);
            double haarPrettCrit  = CountPrettCriteriaWithoutBorderPixels(perfectEdgeImage, haarResult, waveletLength);

            double[] prettCrit = new double[2];
            prettCrit[0] = cannyPrettCrit;
            prettCrit[1] = haarPrettCrit;

            return(prettCrit);
        }
Exemple #3
0
        private void useHaarInCannyMethod_button_Click(object sender, EventArgs e)
        {
            HaarForm HaarForm = new HaarForm(filePath, Int32.Parse(waveletLength_textBox.Text), Convert.ToDouble(bottomThresholdHaar_textBox.Text), Convert.ToDouble(upperThresholdHaar_textBox.Text)); //создаем окно для вывода результатов метода Канни, передавая путь к выбранному файлу

            HaarForm.Show();
        }