Пример #1
0
        /// <summary>
        /// Generate one level of inverse of MallatDecomposition
        /// </summary>
        /// <param name="currentSize">Size of area</param>
        /// <param name="predecessors">4 predecessors</param>
        /// <returns></returns>
        private Node <T> GenerateLevel(Size currentSize, params Node <T>[] predecessors)
        {
            var flipper11 = new ImageDiagonalFlipper <T>(currentSize, predecessors[0]);
            var flipper12 = new ImageDiagonalFlipper <T>(currentSize, predecessors[1]);
            var flipper13 = new ImageDiagonalFlipper <T>(currentSize, predecessors[2]);
            var flipper14 = new ImageDiagonalFlipper <T>(currentSize, predecessors[3]);
            var wavelet11 = instancer.New(flipper11, flipper12);
            var wavelet12 = instancer.New(flipper13, flipper14);

            currentSize.Width *= 2;
            var flipper21 = new ImageDiagonalFlipper <T>(currentSize, wavelet11);
            var flipper22 = new ImageDiagonalFlipper <T>(currentSize, wavelet12);
            var wavelet21 = instancer.New(flipper21, flipper22);

            return(wavelet21);
        }
Пример #2
0
        /// <summary>
        /// Build new level of decomposition
        /// </summary>
        /// <param name="currentSize">Curent size of image</param>
        /// <param name="predecesor">Input node</param>
        /// <returns>List of output nodes</returns>
        private Node <T>[] GenerateLevel(Size currentSize, Node <T> predecesor)
        {
            var wavelet11 = instancer.New(predecesor);

            currentSize.Width /= 2;
            var flipper11 = new ImageDiagonalFlipper <T>(currentSize, wavelet11[0]);
            var flipper12 = new ImageDiagonalFlipper <T>(currentSize, wavelet11[1]);
            var wavelet21 = instancer.New(flipper11);
            var wavelet22 = instancer.New(flipper12);

            currentSize.Height /= 2;
            var flipper21 = new ImageDiagonalFlipper <T>(currentSize, wavelet21[0]);
            var flipper22 = new ImageDiagonalFlipper <T>(currentSize, wavelet21[1]);
            var flipper23 = new ImageDiagonalFlipper <T>(currentSize, wavelet22[0]);
            var flipper24 = new ImageDiagonalFlipper <T>(currentSize, wavelet22[1]);

            return(new[] { flipper21, flipper22, flipper23, flipper24 });
        }