Browse Source

Changes to Filter

Rafael Arce Nazario 8 years ago
parent
commit
593302c81e
1 changed files with 1 additions and 56 deletions
  1. 1
    56
      Filter.cpp

+ 1
- 56
Filter.cpp View File

@@ -34,62 +34,7 @@ void ImageScrambler::cropSwap(QImage &img, int x0, int y0, int x1, int y1, int w
34 34
 // ScrambleFilter(I, 2, 0, 0, 100, 100); 
35 35
 
36 36
 QImage ImageScrambler::ScrambleFilter(QImage image, int level, int sx, int sy, int width, int height){
37
-
38
-    // Compute half the width and half the height to obtain the sub images
39
-    // Computa la mitad del ancho y la mitad de la altura para obtener la sub imagen.
40
-    int w = width  / 2;
41
-    int h = height / 2;
42
-
43
-    // Condition to stop the recursion
44
-    // Condicion para parar la recursion
45
-    if ( level > 0 ) {
46
-
47
-        if ( level % 2 ) {
48
-
49
-            // Assume an image with the following quadrants:
50
-            //     1  2
51
-            //     3  4
52
-            // When N is odd, we will divide the image in
53
-            // four quadrants and swap quadrants 1 <-> 4, and 3 <-> 2.
54
-            //     1  2     =>   4 3
55
-            //     3  4          2 1
56
-            //
57
-            // Asume una imagen con los siguentes cuadrantes:
58
-            //     1  2
59
-            //     3  4
60
-            // Cuando N es impar, divide la imagen en
61
-            // cuatro cuadrantes e intercambia los cuadrantes 1 <-> 4, and 3 <-> 2.
62
-            //     1  2     =>   4 3
63
-            //     3  4          2 1
64
-            cropSwap(image, sx,      sy, sx + w, sy + h, w, h);
65
-            cropSwap(image, sx + w , sy, sx    , sy + h, w, h);
66
-        }
67
-        else
68
-            // Assume an image with the following quadrants:
69
-            //     1  2
70
-            // When N is even, we will divide the image in
71
-            // two quadrants and swap quadrants 1 <-> 2.
72
-            //     1  2     =>   2  1
73
-            // Note that in this case the given width is half the width
74
-            // and the full height is given to the cropSwap function.
75
-            //
76
-            // Asume una imagen con los siguientes cuadrantes:
77
-            //     1  2
78
-            // Cuando N es par, dividiremos la imagen en
79
-            // dos cuadrantes e intercambiar cuadrantes 1 <-> 2.
80
-            //     1  2     =>   2  1
81
-            // Note que en este caso el ancho dado es la mitad del ancho
82
-            // y la altura dada es la altura completa en la funcion cropSwap.
83
-            cropSwap(image, sx,      sy, sx + w, sy,     w, height);
84
-
85
-        // Call the function recursively dividing the imagen on 4 quadrants
86
-        // Invoca la funcion recursivamente dividiendo la imagen en 4 cuadrantes
87
-
88
-        image = ScrambleFilter(image, level-1, sx,     sy    , w, h); //upper left / arriba izq
89
-        image = ScrambleFilter(image, level-1, sx + w, sy    , w, h); //upper right / arriba derecha
90
-        image = ScrambleFilter(image, level-1, sx    , sy + h, w, h); //lower left / abajo izq
91
-        image = ScrambleFilter(image, level-1, sx + w, sy + h, w, h); //lower right / abajo derecha
92
-    }
37
+    
93 38
     return image;
94 39
 }
95 40