Exemple #1
0
        private static void applyAdaptiveDeadzone(float[,] array, int numCoeffs)
        {
            int width  = array.GetLength(0);
            int height = array.GetLength(1);
            Biorthogonal53Wavelet2D wavelet53    = new Biorthogonal53Wavelet2D(width, height);
            OrderWavelet2D          waveletOrder = new OrderWavelet2D(width, height);

            wavelet53.EnableCaching    = true;
            waveletOrder.EnableCaching = true;
            wavelet53.TransformIsotropic2D(array);
            //Reverse the ordering of the coefficients
            waveletOrder.BacktransformIsotropic2D(array);
            //Use numCoeffs cofficient out of 64 (8x8) -> for e.g. numCoeffs = 5 this
            //means a compression to 7,8% of the original size
            waveletOrder.CropCoefficients(array, 7, 8);
            waveletOrder.TransformIsotropic2D(array);
            wavelet53.BacktransformIsotropic2D(array);
        }
Exemple #2
0
        private static void applyAdaptiveShapening(float[,] array, float position)
        {
            int width  = array.GetLength(0);
            int height = array.GetLength(1);
            Biorthogonal53Wavelet2D wavelet53    = new Biorthogonal53Wavelet2D(width, height);
            OrderWavelet2D          waveletOrder = new OrderWavelet2D(width, height);

            wavelet53.EnableCaching    = true;
            waveletOrder.EnableCaching = true;
            wavelet53.TransformIsotropic2D(array);
            //Reverse the ordering of the coefficients
            waveletOrder.BacktransformIsotropic2D(array);
            float[] scale = new float[8 * 8];

            for (int x = 0; x < 8 * 8; x++)
            {
                scale [x] = 1.0f + 2.0f / ((position - x) * (position - x) + 1.0f);
            }
            waveletOrder.ScaleCoefficients(array, scale, 8);
            waveletOrder.TransformIsotropic2D(array);
            wavelet53.BacktransformIsotropic2D(array);
        }