CanvasPartition.WaveletSegmentation.GetReconstructedVector C# (CSharp) Méthode

GetReconstructedVector() private static méthode

Reconstructs a vector from its top-down Unbalanced Haar decomposition stored in an object returned by best.unbal.haar or hard.thresh
private static GetReconstructedVector ( List tree, double smooth ) : double[]
tree List
smooth double
Résultat double[]
        private static double[] GetReconstructedVector(List<List<double>> tree, double smooth)
        {
            int J = tree.Count();

            int n = (int)tree[0][5 - 1];
            double[] rec = new double[n];
            for (int i = 0; i < n; i++)
            {
                rec[i] = 1.0 / Math.Sqrt(n) * smooth;
            }

            for (int j = 0; j < J; j++)
            {
                int K = (int)Math.Floor((double)tree[j].Count() / 5);
                for (int k = 0; k < K; k++)
                {
                    int skip = k * 5 + 3 - 1;
                    int take = k * 5 + 5 - skip;
                    double[] branch = new double[take];
                    for (int i = 0; i < take; i++)
                        branch[i] = tree[j][skip + i];
                    List<double> unbal_haar_vector = GetUnbalHaarVector(branch);

                    // for (unsigned i=3; i<=5;i++)
                    for (int i = (int)tree[j][3 - 1 + k * 5] - 1; i < tree[j][5 - 1 + k * 5]; i++)
                    {
                        rec[i] = rec[i] + unbal_haar_vector[i - (int)tree[j][3 - 1 + k * 5] + 1] * tree[j][k * 5 + 2 - 1];
                    }
                }
            }
            return rec;
        }