public void HilbertTests1()
        {
            int size0 = 1024;
            int size1 = 1024;
            var tuple = TestImageGenerator.GetTestPair2(size0, size1, 4, 15);

            HilbertPhaseImage2 hpi = new HilbertPhaseImage2(tuple.Item1, 0, 2 * Math.PI);

            hpi.Convert();
            hpi.Calc();
            hpi.Unwrapp();
            hpi.ReverseConvert();


            ImageSource.subtract_min(tuple.Item2);
            ImageSource.subtract_min(hpi.images[0]);
            double _min  = ImageSource.min(tuple.Item2);
            double _max  = ImageSource.max(tuple.Item2);
            double _mean = ImageSource.mean(tuple.Item2);


            double min  = ImageSource.min(hpi.images[0]);
            double max  = ImageSource.max(hpi.images[0]);
            double mean = ImageSource.mean(hpi.images[0]);
            double std  = ImageSource.std(tuple.Item2, hpi.images[0]);

            Assert.IsTrue(std < ImageSource.mean(tuple.Item2) / 1000);
        }
示例#2
0
        private void execute()
        {
            set_defaults();
            if (radioButton4.Checked)
            {
                int x = trackBar3.Value;
                int y = trackBar6.Value;
                int w = int.Parse(comboBox6.Text);
                int h = int.Parse(comboBox5.Text);;

                byte[,,] arr = new byte[h, w, 3];

                for (int i = y; i < h + y; i++)
                {
                    for (int j = x; j < w + x; j++)
                    {
                        arr[i - y, j - x, 0] = image[i, j, 0];
                        arr[i - y, j - x, 1] = image[i, j, 1];
                        arr[i - y, j - x, 2] = image[i, j, 2];
                    }
                }
                hpi2 = new HilbertPhaseImage2(arr, (int)numericUpDown3.Value, settings != null ? settings.wavelength : 632.8, checkBox10.Checked)
                {
                    calc         = checkBox11.Checked,
                    del_trend    = checkBox9.Checked,
                    smooth       = checkBox8.Checked,
                    delete_value = subtractiong_value
                };
            }
            else
            {
                hpi2 = new HilbertPhaseImage2(image, (int)numericUpDown3.Value, settings != null ? settings.wavelength : 632.8, checkBox10.Checked)
                {
                    calc         = checkBox11.Checked,
                    del_trend    = checkBox9.Checked,
                    smooth       = checkBox8.Checked,
                    delete_value = subtractiong_value
                };
            }

            hpi2.Convert();
            hpi2.Calc();
            hpi2.Unwrapp();
            hpi2.ReverseConvert();
            framing();
        }