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); }
public void PreclisionTest1() { DateTime dt1 = DateTime.UtcNow; double count = 0; List <double> temp = new List <double>(); List <double> temp2 = new List <double>(); for (double i = -1; i < 1; i++) { for (int l = 1; l < 4; l++) { var for_test = TestImageGenerator.GetTestPair(1000, 2000, Math.PI / 2 * i, l); for_test.Item1.CalculatePhaseImage(); DateTime dt2 = DateTime.UtcNow; Unwrapping.Unwrap(for_test.Item1.Image); //for_test.Item1.Unwrap(); double time = DateTime.UtcNow.Subtract(dt2).TotalSeconds; temp.Add(time); ImageSource.subtract_min(for_test.Item1.Image); ImageSource.subtract_min(for_test.Item2); double[,] difference = ImageSource.diff(for_test.Item1.Image, for_test.Item2); var q = ImageSource.GetNoZero(difference, 2); double res1 = ImageSource.std(for_test.Item1.Image, for_test.Item2); Assert.IsTrue(res1 < Math.PI / 100); count++; } } double res2 = temp.Sum() / temp.Count(); double res = count / DateTime.UtcNow.Subtract(dt1).TotalSeconds; }
public void FFT2_test1() { var tuple = TestImageGenerator.GetTestPair(1024, 1024, 4); Complex[,] test_image = Complex.CreateComplexArray(tuple.Item1.images[0]); FourierTransform.FFT2(test_image, FourierTransform.Direction.Forward); Complex[,] reserv = (Complex[, ])test_image.Clone(); FourierTransform.FFT2(test_image, FourierTransform.Direction.Backward); double[,] inverse_result = Complex.CreateDoubleArray(test_image); double std = ImageSource.std(tuple.Item1.images[0], inverse_result); Assert.IsTrue(std < ImageSource.mean(tuple.Item1.images[0]) / 1000); }
public void FFT2_test2() { var tuple = TestImageGenerator.GetTestPair(1024, 2048, 4); //DateTime dt1 = DateTime.UtcNow; Complex[,] test_image = Complex.CreateComplexArray(tuple.Item1.images[0]); DateTime dt1 = DateTime.UtcNow; FourierTransform.FFT2(test_image, FourierTransform.Direction.Forward); Complex[,] reserv = (Complex[, ])test_image.Clone(); FourierTransform.FFT2(test_image, FourierTransform.Direction.Backward); double[,] inverse_result = Complex.CreateDoubleArray(test_image); double resss = dt1.Subtract(DateTime.UtcNow).TotalSeconds; double std = ImageSource.std(tuple.Item1.images[0], inverse_result); Assert.IsTrue(std < ImageSource.mean(tuple.Item1.images[0]) / 1000); }