Exemple #1
0
        public void ApplyHaarTransform(bool Forward, bool Safe, int iterations)
        {
            decimal[][,] temp = Forward ? OriginalImage.DeepClone() : TransformedImage.DeepClone();

            //int Iterations = 0;
            //int.TryParse(sIterations, out Iterations);
            decimal[,] Red   = temp[0];
            decimal[,] Green = temp[1];
            decimal[,] Blue  = temp[2];

            int maxScale = (int)(Math.Log(Red.GetLength(0) < Red.GetLength(1) ? Red.GetLength(0) : Red.GetLength(1)) / Math.Log(2));

            if (iterations < 1 || iterations > maxScale)
            {
                MessageBox.Show("Iteration must be Integer from 1 to " + maxScale);
                return;
            }

            int time = Environment.TickCount;


            if (Forward)
            {
                DwtF(Red, iterations);
                DwtF(Green, iterations);
                DwtF(Blue, iterations);
            }
            else
            {
                IDwtF(Red, iterations);
                IDwtF(Green, iterations);
                IDwtF(Blue, iterations);
            }

            if (Forward)
            {
                TransformedImage = temp.DeepClone();
            }
            else
            {
                OriginalImage = temp.DeepClone();
            }

            string transformationTime = ((int)(Environment.TickCount - time)).ToString() + " milis.";
        }