public static void Start(Func <double, double> func, Wavelet.Wavelets wavelets, double omega, FuncMethods.DefInteg.GaussKronrod.NodesCount nodesCount, NetOnDouble X, NetOnDouble Y, NetOnDouble T) { Wavelet.countNodes = nodesCount; var wavel = Wavelet.Create(wavelets, omega); Func <double, double, Complex> f = wavel.GetAnalys(func); IProgress <int> progress = new Progress <int>(number => Console.WriteLine(Expendator.GetProcent(number, X.Count * Y.Count).ToString(2) + "%")); Create3DGrafics.MakeGrafic(Create3DGrafics.GraficType.PdfPngHtml, $"wavelets{wavelets}", (a, b) => f(a, b).Abs, X, Y, progress, new System.Threading.CancellationToken(), new StringsForGrafic($"Wavelet {wavelets}", "a", "b", "|values|"), true); Func <double, double> func2 = wavel.GetSyntesis(); new MostSimpleGrafic(new Func <double, double>[] { func, func2 }, T, new string[] { "Исходная функция", "Её преобразование туда-сюда" }, true).ShowDialog(); }
private void buttonCompute_Click(object sender, EventArgs e) { var size = int.Parse(textBoxSize.Text); var family = (WaveletFamily)comboBoxFamily.SelectedIndex; var taps = comboBoxTaps.SelectedIndex + 1; var wavelet = new Wavelet(family, taps); var fwt = new Fwt(size, wavelet); var output = new float[size]; var reconstructed = new float[size]; fwt.Direct(Enumerable.Range(0, size).Select(x => (float)x).ToArray(), output); fwt.Inverse(output, reconstructed); var res = string.Join("\r\n", output.Select(o => o.ToString())); textBoxResult.Text = res; var inv = string.Join("\r\n", reconstructed.Select(o => o.ToString())); textBoxResultInv.Text = inv; labelWaveletName.Text = wavelet.Name; linePlotWavelet.Thickness = 2; linePlotWavelet.Stride = 8; linePlotWavelet.Line = wavelet.LoD; linePlotWavelet.Markline = wavelet.HiD; var coeffs = string.Join("\r\n", wavelet.LoD.Select(o => o.ToString())); textBoxCoeffs.Text = coeffs; }
public static unsafe SKPixmap WaveletUpscale(this SKImage image, Wavelet wavelet) { int width = image.Width; int height = image.Height; int upscaledWidth = width * 2; int upscaledHeight = height * 2; float[,] y = new float[upscaledWidth, upscaledWidth]; float[,] cb = new float[upscaledWidth, upscaledWidth]; float[,] cr = new float[upscaledWidth, upscaledWidth]; float[,] a = new float[upscaledWidth, upscaledWidth]; image.ToYCbCrAArrays(y, cb, cr, a); WaveletTransform2D wavelet2D; WaveletTransform2D upscaledWavelet2D; switch (wavelet) { case Wavelet.Haar: wavelet2D = new HaarWavelet2D(width, height); upscaledWavelet2D = new HaarWavelet2D(upscaledWidth, upscaledHeight); break; case Wavelet.Biorthogonal53: default: wavelet2D = new Biorthogonal53Wavelet2D(width, height); upscaledWavelet2D = new Biorthogonal53Wavelet2D(upscaledWidth, upscaledHeight); break; } wavelet2D.Transform2D(y); wavelet2D.Transform2D(cb); wavelet2D.Transform2D(cr); wavelet2D.Transform2D(a); upscaledWavelet2D.ReverseTransform2D(y); upscaledWavelet2D.ReverseTransform2D(cb); upscaledWavelet2D.ReverseTransform2D(cr); upscaledWavelet2D.ReverseTransform2D(a); for (int row = 0; row < upscaledHeight; row++) { for (int col = 0; col < upscaledWidth; col++) { y[col, row] *= 4.0f; cb[col, row] *= 4.0f; cr[col, row] *= 4.0f; a[col, row] *= 4.0f; } } SKImageInfo info = new SKImageInfo(upscaledWidth, upscaledHeight, SKColorType.Rgba8888); SKImage output = SKImage.Create(info); SKPixmap pixmap = output.ToRGBAPixmap(y, cb, cr, a); return(pixmap); }
private BitmapSource LoadWavelet() { var savePath = GetSavePath("Wavelet Image Files (*.wlt)|*.wlt"); if (savePath == null) { return(null); } return(Wavelet.OpenWavelet(savePath)); }
public static void Test() { StreamReader sReader = new StreamReader("test.txt"); List<double> dt = new List<double>(); string buff; while ((buff = sReader.ReadLine()) != null) { if (dt.Count == 256) break; dt.Add(double.Parse(buff)); } sReader.Close(); double[] data = dt.ToArray(); Wavelet wavelet = new Wavelet(Wavelet.WaveletType.Daubechies, 4); wavelet.Transform(ref data, Wavelet.WaveletDirection.Forward); uint[] ui = new uint[data.Length]; double[] dbAbs = new double[data.Length]; for (int i = 0; i < data.Length; i++) dbAbs[i] = Math.Abs(data[i]); Sort.SortDataIndex(dbAbs, ref ui); double[] dt1 = new double[data.Length]; double[] dt2 = new double[data.Length]; double[] dt3 = new double[data.Length]; double[] dt4 = new double[data.Length]; Array.Copy(data, dt1, data.Length - 1); Array.Copy(data, dt2, data.Length - 1); Array.Copy(data, dt3, data.Length - 1); Array.Copy(data, dt4, data.Length - 1); for (int i = 0; i < dt1.Length - 40; i++) dt1[ui[i]] = 0; for (int i = 0; i < dt2.Length - 80; i++) dt2[ui[i]] = 0; for (int i = 0; i < dt3.Length - 60; i++) dt3[ui[i]] = 0; for (int i = 0; i < dt4.Length - 40; i++) dt4[ui[i]] = 0; wavelet.Transform(ref data, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt1, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt2, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt3, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt4, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref data, Wavelet.WaveletDirection.Forward); StreamWriter sWriter = new StreamWriter("ttt.csv"); for (int i = 0; i < data.Length; i++) { sWriter.WriteLine(data[i] + "," + dt1[i] + "," + dt2[i] + "," + dt3[i] + "," + dt4[i]); } sWriter.Close(); }
public static void Start(double begin, double step, int count, string filename, string path, Wavelet.Wavelets wavelets, double omega, FuncMethods.DefInteg.GaussKronrod.NodesCount nodesCount, NetOnDouble X, NetOnDouble Y) { Wavelet.countNodes = nodesCount; var wavel = Wavelet.Create(wavelets, omega); var mas = Point.CreatePointArray(begin, step, count, filename, path); Func <double, double, Complex> f = wavel.GetAnalys(mas); IProgress <int> progress = new Progress <int>(number => Console.WriteLine(Expendator.GetProcent(number, X.Count * Y.Count).ToString(2) + "%")); Create3DGrafics.MakeGrafic(Create3DGrafics.GraficType.PdfPngHtml, $"wavelets{wavelets}", (a, b) => f(a, b).Abs, X, Y, progress, new System.Threading.CancellationToken(), new StringsForGrafic($"Wavelet {wavelets}", "a", "b", "|values|"), true); //Func<double, double> func2 = wavel.GetSyntesis(); //new MostSimpleGrafic( func2, mas, "Преобразование", true).ShowDialog(); }
/// <summary> /// Constructs FWT transformer. /// </summary> /// <param name="size">FWT size</param> /// <param name="wavelet">Mother wavelet</param> public Fwt(int size, Wavelet wavelet) { Size = size; _waveletLength = wavelet.Length; _loD = wavelet.LoD.Reverse().ToArray(); // reverse due to a specific processing later _hiD = wavelet.HiD.Reverse().ToArray(); _loR = wavelet.LoR.ToArray(); // in orthonormal case: loR = loD and hiR = hiD _hiR = wavelet.HiR.ToArray(); _temp = new float[size]; // For future: // - reserve memory for all modes of signal extension // (so far only 'periodization' mode is coded) //var halflen = (int)((size + _waveletLength - 1) * 0.5); // convolution length: N + M - 1 //_temp = new float[halflen * 2]; }
public void BuildMesh() { //Debug.Log(size_x); wl = new Wavelet(); int numTiles = size_x * size_z; int numTri = numTiles * 2; int vsize_x = size_x + 1; int vsize_z = size_z + 1; int numVert = vsize_x * vsize_z; Vector3[] vertecies = new Vector3[numVert]; int[] triangles = new int[numTri * 3]; Vector3[] normals = new Vector3[numVert]; // vertecies [0] = new Vector3 (0, 0, 0); // vertecies [1] = new Vector3 (1, 0, 0); // vertecies [2] = new Vector3 (0, 0, -1); // vertecies [3] = new Vector3 (1, 0, -1); // // triangles [0] = 0; // triangles [1] = 3; // triangles [2] = 2; // // triangles [3] = 0; // triangles [4] = 1; // triangles [5] = 3; // // normals [0] = Vector3.up; // normals [1] = Vector3.up; // normals [2] = Vector3.up; // normals [3] = Vector3.up; int z = 0; int x = 0; //int tind = 0; for (z = 0; z < vsize_z; z++) { for (x = 0; x < vsize_x; x++) { vertecies [z * vsize_x + x] = new Vector3(x * tileSize, 0, z * tileSize); wl.addDrawnPoint(vertecies [z * vsize_x + x]); normals [z * vsize_x + x] = Vector3.up; } } for (z = 0; z < size_z; z++) { for (x = 0; x < size_x; x++) { int square = z * size_x + x; int triIndex = square * 6; triangles[triIndex] = z * vsize_x + x; triangles[triIndex + 1] = (z + 1) * vsize_x + x; triangles[triIndex + 2] = (z + 1) * vsize_x + x + 1; triangles[triIndex + 3] = z * vsize_x + x; triangles[triIndex + 4] = (z + 1) * vsize_x + x + 1; triangles[triIndex + 5] = z * vsize_x + x + 1; } } wl.determineLevelOfDetail(); Mesh m = new Mesh(); m.vertices = vertecies; m.triangles = triangles; m.normals = normals; MeshFilter mf = GetComponent <MeshFilter>(); MeshRenderer mr = GetComponent <MeshRenderer>(); MeshCollider mc = GetComponent <MeshCollider>(); mf.mesh = m; mc.sharedMesh = m; if (numVert % 2 != 0) { array = new Vector3[numVert + 1]; wl.addDrawnPoint(vertecies[numVert - 1]); wl.setMaxPoints(numVert + 1); array = wl.getPoints(); } else { array = new Vector3[numVert]; wl.setMaxPoints(numVert); array = wl.getPoints(); } }
///<summary> /// Constructor taking Wavelet object for performing the transform. ///</summary> ///<remarks> /// Christian ([email protected]) 15.02.2016 23:12:55 ///</remarks> public ShiftingWaveletTransform(Wavelet wavelet) : base("Shifting Wavelet Transform", wavelet) { } // method
public static void Test() { StreamReader sReader = new StreamReader("test.txt"); List <double> dt = new List <double>(); string buff; while ((buff = sReader.ReadLine()) != null) { if (dt.Count == 256) { break; } dt.Add(double.Parse(buff)); } sReader.Close(); double[] data = dt.ToArray(); Wavelet wavelet = new Wavelet(Wavelet.WaveletType.Daubechies, 4); wavelet.Transform(ref data, Wavelet.WaveletDirection.Forward); uint[] ui = new uint[data.Length]; double[] dbAbs = new double[data.Length]; for (int i = 0; i < data.Length; i++) { dbAbs[i] = Math.Abs(data[i]); } Sort.SortDataIndex(dbAbs, ref ui); double[] dt1 = new double[data.Length]; double[] dt2 = new double[data.Length]; double[] dt3 = new double[data.Length]; double[] dt4 = new double[data.Length]; Array.Copy(data, dt1, data.Length - 1); Array.Copy(data, dt2, data.Length - 1); Array.Copy(data, dt3, data.Length - 1); Array.Copy(data, dt4, data.Length - 1); for (int i = 0; i < dt1.Length - 40; i++) { dt1[ui[i]] = 0; } for (int i = 0; i < dt2.Length - 80; i++) { dt2[ui[i]] = 0; } for (int i = 0; i < dt3.Length - 60; i++) { dt3[ui[i]] = 0; } for (int i = 0; i < dt4.Length - 40; i++) { dt4[ui[i]] = 0; } wavelet.Transform(ref data, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt1, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt2, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt3, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref dt4, Wavelet.WaveletDirection.Inverse); wavelet.Transform(ref data, Wavelet.WaveletDirection.Forward); StreamWriter sWriter = new StreamWriter("ttt.csv"); for (int i = 0; i < data.Length; i++) { sWriter.WriteLine(data[i] + "," + dt1[i] + "," + dt2[i] + "," + dt3[i] + "," + dt4[i]); } sWriter.Close(); }
public static BitmapSource ApplyWaveletCompression(BitmapSource bitmap, object parameter) { var waveletParameters = parameter as WaveletParameters; return(Wavelet.ApplyWavelet(bitmap, waveletParameters)); }
private async void button2_Click(object sender, EventArgs e) { DateTime time = DateTime.Now; //Func<double,double> f = t => Math.Sin(t*9) / Math.Exp(t * t / 3) * Math.Sign(Math.Max(0, (2*Math.PI- t.Abs()))); Func <double, double> f = t => Math.Cos(t * 9) * t / Math.Exp(t * t / 3) * Math.Sign(Math.Max(0, (Math.PI / 2 - t.Abs()))); //Func<double,double> f = t => Math.Sin(20*Math.PI*t)* Math.Sign(Math.Max(0, (1 - t.Abs()))); Func <double, double, Complex>[] f1 = new Func <double, double, Complex> [7]; Func <double, double>[] f2 = new Func <double, double> [7]; Wavelet[] w = new Wavelet[7]; //await Task.Run(() => //{ // for (int i = 0; i < 7; i++) // { // w[i] = new Wavelet((Wavelet.Wavelets)i); // f1[i] = w[i].GetAnalys(f); // f2[i] = w[i].GetSyntesis(f1[i]); // } //} //); w[3] = new Wavelet((Wavelet.Wavelets) 3); f1[3] = w[3].GetAnalys(f); f2[3] = w[3].GetSyntesis(/*f1[3]*/); //Wavelet w = new Wavelet(); //var f1 = w.GetAnalys(f); //var f2 = w.GetSyntesis(f1); //ИнтеграцияСДругимиПрограммами.CreatTableInExcel((double a, double b) => f1[3](a, b).Re, 0.01, 5, 100, 0.01, 7, 100); var p = OptimizationDCompFunc.GetMaxOnRectangle((double a, double b) => f1[3](a, b).Abs, 0.01, 5, 0.01, 10, eps: 1e-14, ogr: 5, nodescount: 15); new nzy3d_winformsDemo.Form1("", 0.01, 5, 70, 0.01, 10, 70, (double a, double b) => f1[3](a, b).Abs).Show(); // ИнтеграцияСДругимиПрограммами.CreatTableInExcel(f1[3], 0.01, 3, 100, 0.01, 3, 100); //ИнтеграцияСДругимиПрограммами.CreatTableInExcel(w[3].Dic,"Test Page",Number.Complex.ComplMode.Abs); //c1Chart3D1.ChartGroups.Group0.ChartType = Chart3DTypeEnum.Surface; //double[,] z = new double[100, 100]; //for (int s = 0; s < 31; s++) // for (int n = 0; n < 21; n++) // { // z[s, n] = f1[3](0.01 + 0.01 * s, 0.01 + 0.01 * n).Re; // } // create dataset and put it to the chart //Chart3DDataSetGrid gridset = new Chart3DDataSetGrid(0, 0, 1, 1, z); //c1Chart3D1.ChartGroups[0].ChartData.Set = gridset; //var o = w[3].Dic; //МатКлассы.Point[] u = o.Keys.ToArray(); //var c = o.Values.ToArray(); //Chart3DPoint[] points1 = new Chart3DPoint[o.Count]; //for (int i = 0; i < o.Count; i++) // points1[i] = new Chart3DPoint(u[i].x, u[i].y, 7/*(double)c[i].Value*/); //Chart3DDataSetPoint pointset = new Chart3DDataSetPoint(); //pointset.AddSeries(points1); //c1Chart3D1.ChartGroups[0].ChartData.Set = pointset; List <double> tm = new List <double>(), m = new List <double>(); for (double i = beg; i < end; i += step) { double tmp0 = f(i);//,tmp2=f2(i);$"f = {tmp0} \tWf-1 = {tmp2} \teps = {(tmp2-tmp0)} \t f/f0 = {tmp0/tmp2}".Show(); double[] mas = new double[7]; await Task.Run(() => { //for (int j = 0; j < 7; j++) // mas[j] = f2[j](i); mas[3] = f2[3](i); }); (new Vectors(mas) - tmp0).Show(); chart1.Series[0].Points.AddXY(i, tmp0); for (int j = 0; j < 7; j++) { chart1.Series[j + 1].Points.AddXY(i, mas[j]); } progressBar1.Value = (int)((i - beg) / (end - beg) * 100); m.Add(mas[3]); tm.Add(tmp0); } label1.Text = "Время работы (минуты полторы ушло на Excel): " + (DateTime.Now - time).ToString(); label2.Text = "Точность в евклидовой норме: " + (new Vectors(m.ToArray()) - new Vectors(tm.ToArray())).Sort.EuqlidNorm.ToString(); var s = new МатКлассы.Point(p.Item1, p.Item2); label3.Text = "Точка максимума: " + s.ToString(); label4.Text = "Максимальное по модулю значение: " + f1[3](p.Item1, p.Item2).ToString(); }
public static void Main(string[] args) { try { Wavelet wavelet = null; wavelet = new Haar1Orthogonal( ); // wavelet = new Haar1( ); // wavelet = new Coiflet1( ); // wavelet = new Coiflet2( ); // wavelet = new Coiflet3( ); // wavelet = new Coiflet4( ); // wavelet = new Coiflet5( ); // wavelet = new Legendre1( ); // wavelet = new Legendre2( ); // wavelet = new Legendre3( ); // wavelet = new Daubechies2( ); // wavelet = new Daubechies3( ); // wavelet = new Daubechies4( ); // wavelet = new Daubechies5( ); // wavelet = new Daubechies6( ); // wavelet = new Daubechies7( ); // wavelet = new Daubechies8( ); // wavelet = new Daubechies9( ); // wavelet = new Daubechies10( ); // wavelet = new Daubechies11( ); // wavelet = new Daubechies12( ); // wavelet = new Symlet2( ); // wavelet = new Symlet3( ); // wavelet = new Symlet4( ); // wavelet = new Symlet5( ); // wavelet = new Symlet6( ); // wavelet = new Symlet7( ); // wavelet = new Symlet8( ); // wavelet = new Symlet9( ); // wavelet = new Symlet10( ); // wavelet = new Symlet11( ); // wavelet = new Symlet12( ); // wavelet = new CDF53( ); // wavelet = new CDF97( ); // wavelet = new Battle23( ); // wavelet = new DiscreteMayer( ); Algorithm algorithm = null; algorithm = new FastWaveletTransform(wavelet); // algorithm = new WaveletPacketTransform( wavelet ); // algorithm = new ShiftingWaveletTransform( wavelet ); Transform t = new Transform(algorithm); Console.WriteLine("SharpWave .. " + "doing Fast Wavelet Transform by " + wavelet.TYPE + ":"); Console.WriteLine( ); // 1-D example // double[ ] arrTime = { 1, 1, 1, 1, 1, 1, 1, 1 }; // const double[] arrTime = { 1.1, 2.2, 2.2, 2.2, 3.3, 3.3, 4.4, 4.4 }; // real Console.Write("time domain: "); for (int i = 0; i < arrTime.Length; i++) { Console.Write(arrTime[i] + " "); } Console.WriteLine( ); double[] arrHilb = t.forward(arrTime); // 1-D FWT Haar forward Console.Write("hilbert domain: "); for (int i = 0; i < arrHilb.Length; i++) { Console.Write(arrHilb[i] + " "); } Console.WriteLine( ); double[] arrReco = t.reverse(arrHilb); // 1-D FWT Haar reverse Console.Write("reconstruction: "); for (int i = 0; i < arrReco.Length; i++) { Console.Write(arrReco[i] + " "); } Console.WriteLine( ); Console.WriteLine( ); // 2-D example double[ , ] matTime = { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }; // const // double[ , ] matTime = { { 1, 1, 1, 1 }, // { 1, 1, 1, 1 }, // { 1, 1, 2, 2 }, // { 1, 1, 2, 2 } }; // real Console.WriteLine("time domain: "); for (int i = 0; i < matTime.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matTime.GetUpperBound(1) + 1; j++) { Console.Write(matTime[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); double[ , ] matHilb = t.forward(matTime); // 2-D FWT Haar forward Console.WriteLine("hilbert domain: "); for (int i = 0; i < matHilb.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matHilb.GetUpperBound(1) + 1; j++) { Console.Write(matHilb[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); double[ , ] matReco = t.reverse(matHilb); // 1-D FWT Haar reverse Console.WriteLine("reconstruction: "); for (int i = 0; i < matReco.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matReco.GetUpperBound(1) + 1; j++) { Console.Write(matReco[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); // try the wavelet packet transform t = new Transform( new WaveletPacketTransform( new Haar1( ))); // 1-D example // double[ ] arrTime = { 1, 1, 1, 1, 1, 1, 1, 1 }; Console.Write("time domain: "); for (int i = 0; i < arrTime.Length; i++) { Console.Write(arrTime[i] + " "); } Console.WriteLine( ); arrHilb = t.forward(arrTime); // 1-D FWT Haar forward Console.Write("hilbert domain: "); for (int i = 0; i < arrHilb.Length; i++) { Console.Write(arrHilb[i] + " "); } Console.WriteLine( ); arrReco = t.reverse(arrHilb); // 1-D FWT Haar reverse Console.Write("reconstruction: "); for (int i = 0; i < arrReco.Length; i++) { Console.Write(arrReco[i] + " "); } Console.WriteLine( ); Console.WriteLine( ); // 2-D example // double[ , ] matTime = { { 1, 1, 1, 1 }, // { 1, 1, 1, 1 }, // { 1, 1, 1, 1 }, // { 1, 1, 1, 1 } }; Console.WriteLine("time domain: "); for (int i = 0; i < matTime.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matTime.GetUpperBound(1) + 1; j++) { Console.Write(matTime[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); matHilb = t.forward(matTime); // 2-D FWT Haar forward Console.WriteLine("hilbert domain: "); for (int i = 0; i < matHilb.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matHilb.GetUpperBound(1) + 1; j++) { Console.Write(matHilb[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); matReco = t.reverse(matHilb); // 1-D FWT Haar reverse Console.WriteLine("reconstruction: "); for (int i = 0; i < matReco.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matReco.GetUpperBound(1) + 1; j++) { Console.Write(matReco[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); // try the shifting wavelet transform t = new Transform( new ShiftingWaveletTransform( new Haar1( ))); // 1-D example // double[ ] arrTime = { 1, 1, 1, 1, 1, 1, 1, 1 }; Console.Write("time domain: "); for (int i = 0; i < arrTime.Length; i++) { Console.Write(arrTime[i] + " "); } Console.WriteLine( ); arrHilb = t.forward(arrTime); // 1-D FWT Haar forward Console.Write("hilbert domain: "); for (int i = 0; i < arrHilb.Length; i++) { Console.Write(arrHilb[i] + " "); } Console.WriteLine( ); arrReco = t.reverse(arrHilb); // 1-D FWT Haar reverse Console.Write("reconstruction: "); for (int i = 0; i < arrReco.Length; i++) { Console.Write(arrReco[i] + " "); } Console.WriteLine( ); Console.WriteLine( ); // 2-D example // double[ , ] matTime = { { 1, 1, 1, 1 }, // { 1, 1, 1, 1 }, // { 1, 1, 1, 1 }, // { 1, 1, 1, 1 } }; Console.WriteLine("time domain: "); for (int i = 0; i < matTime.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matTime.GetUpperBound(1) + 1; j++) { Console.Write(matTime[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); matHilb = t.forward(matTime); // 2-D FWT Haar forward Console.WriteLine("hilbert domain: "); for (int i = 0; i < matHilb.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matHilb.GetUpperBound(1) + 1; j++) { Console.Write(matHilb[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); matReco = t.reverse(matHilb); // 1-D FWT Haar reverse Console.WriteLine("reconstruction: "); for (int i = 0; i < matReco.GetUpperBound(0) + 1; i++) { for (int j = 0; j < matReco.GetUpperBound(1) + 1; j++) { Console.Write(matReco[i, j] + " "); } // loop Console.WriteLine( ); } // loop Console.WriteLine( ); } catch (Exception e) { Console.WriteLine(); Console.WriteLine(e.StackTrace); Console.WriteLine(e.Message); } // try } // method
// Use this for initialization void Start() { wl = new Wavelet(); }
///<summary> /// Constructor receiving a Wavelet object and setting identifier of /// transform. ///</summary> ///<remarks> /// Christian ([email protected]) 23.02.2010 13:44:05 ///</remarks> public WaveletPacketTransform(Wavelet wavelet) : base("Wavelet Packet Transform", wavelet) { } // method
///<summary> /// Constructor receiving a Wavelet object and setting identifier of /// transform. ///</summary> ///<remarks> /// Christian ([email protected]) 10.02.2010 08:10:42 ///</remarks> public FastWaveletTransform(Wavelet wavelet) : base("Fast Wavelet Transform", wavelet) { } // FastWaveletTransform