Beispiel #1
0
        private void ApplyHaarTransform(bool forward, bool safe, int iterations, Bitmap bmp)
        {
            var maxScale = WaveletTransform.GetMaxScale(bmp.Width, bmp.Height);

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

            var time = Environment.TickCount;

            var channels = ColorChannels.CreateColorChannels(safe, bmp.Width, bmp.Height);

            var transform = WaveletTransform.CreateTransform(forward, iterations);

            var imageProcessor = new ImageProcessor(channels, transform);

            imageProcessor.ApplyTransform(bmp);

            if (forward)
            {
                this.TransformedImage = new Bitmap(bmp);
            }

            this.pictureBox1.Image     = bmp;
            this.lblDirection.Text     = forward ? "Forward" : "Inverse";
            this.lblTransformTime.Text = string.Format("{0} milis.", Environment.TickCount - time);
        }
Beispiel #2
0
 public ImageProcessor(ColorChannels channels, WaveletTransform transform)
 {
     this.channels  = channels;
     this.transform = transform;
 }