References: Musawir Ali, An Introduction to Wavelets and the Haar Transform. Available on: http://www.cs.ucf.edu/~mali/haar/
public void wavletHaartInverseSoft(double[] w) { deNoisedSignalSoft = new double[w.Length]; Array.Copy(w, 0, deNoisedSignalSoft, 0, w.Length); IWavelet wavelet = new Accord.Math.Wavelets.Haar(m); WaveletTransform target = new WaveletTransform(wavelet); wavelet.Backward(deNoisedSignalSoft); }
public void wavletHaarForward() { wavlet = new double[n]; dij = new double[n / 2]; Array.Copy(dataForExamination, 0, wavlet, 0, dataForExamination.Length); IWavelet wavelet = new Accord.Math.Wavelets.Haar(m); WaveletTransform target = new WaveletTransform(wavelet); wavelet.Forward(wavlet); Array.Copy(wavlet, n / 2, dij, 0, dij.Length / 2); }
public void WaveletTransformConstructorTest() { // Start with a grayscale image Bitmap src = Properties.Resources.lena512; // Create a wavelet filter IWavelet wavelet = new Accord.Math.Wavelets.Haar(2); WaveletTransform target = new WaveletTransform(wavelet); // Apply the transformation Bitmap dst = target.Apply(src); // Revert the transformation target.Backward = true; Bitmap org = target.Apply(dst); double[,] actual = org.ToDoubleMatrix(0); double[,] expected = src.ToDoubleMatrix(0); Assert.IsTrue(actual.IsEqual(expected, 0.102)); }
public void WaveletTransformConstructorTest() { // Start with a grayscale image Bitmap src = Accord.Imaging.Image.Clone(Resources.lena512); // Create a wavelet filter IWavelet wavelet = new Accord.Math.Wavelets.Haar(2); WaveletTransform target = new WaveletTransform(wavelet); // Apply the transformation Bitmap dst = target.Apply(src); // Revert the transformation target.Backward = true; Bitmap org = target.Apply(dst); double[,] actual; new ImageToMatrix().Convert(org, out actual); double[,] expected; new ImageToMatrix().Convert(src, out expected); Assert.IsTrue(actual.IsEqual(expected, atol: 0.102)); }