|
|
|
|
30
|
|
30
|
|
31
|
---
|
31
|
---
|
32
|
|
32
|
|
33
|
-## Scrambling images digitally
|
|
|
34
|
|
33
|
|
35
|
-When scrambling images digitally we reorder the pixels of the image to break the relation between adjacent pixels, making the original image incomprehensible. This technique is used frequently to cypher images and hide data. [1]
|
|
|
|
|
34
|
+## Scrambling Images Digitally
|
|
|
35
|
+
|
|
|
36
|
+When scrambling images digitally, we reorder the pixels of the image to break the relation between adjacent pixels, making the original image incomprehensible. This technique is frequently used to cypher images and hide data. [1]
|
36
|
|
37
|
|
37
|
---
|
38
|
---
|
38
|
|
39
|
|
|
|
|
|
44
|
|
45
|
|
45
|
There are many methods that have been proposed to scramble images. In this laboratory experience, you will use a simple method that has a natural implementation with recursive functions.
|
46
|
There are many methods that have been proposed to scramble images. In this laboratory experience, you will use a simple method that has a natural implementation with recursive functions.
|
46
|
|
47
|
|
47
|
-### Scramble it!
|
|
|
|
|
48
|
+### Scramble It!
|
48
|
|
49
|
|
49
|
The method you will use to scramble the image works by exchanging rectangles of an image a certain number of times, which is established by the *level*. Figure 2 illustrates a *level 1* scramble: the diagonal quadrants are exchanged. Observe Figure 6 as well.
|
50
|
The method you will use to scramble the image works by exchanging rectangles of an image a certain number of times, which is established by the *level*. Figure 2 illustrates a *level 1* scramble: the diagonal quadrants are exchanged. Observe Figure 6 as well.
|
50
|
|
51
|
|
|
|
|
|
52
|
|
53
|
|
53
|
![figure2.png](images/figure2.png)
|
54
|
![figure2.png](images/figure2.png)
|
54
|
|
55
|
|
55
|
-**Figure 2.** Level 1 scramble: (a) is the original image divided in quadrants, (b) is the image after scrambling it the first level by exchanging diagonal quadrants.
|
|
|
|
|
56
|
+**Figure 2.** Level 1 scramble: (a) is the original image divided in quadrants, (b) is the image after scrambling it with the first level by exchanging diagonal quadrants.
|
56
|
|
57
|
|
57
|
---
|
58
|
---
|
58
|
|
59
|
|
|
|
|
|
127
|
---
|
128
|
---
|
128
|
|
129
|
|
129
|
|
130
|
|
130
|
-## Additional functions provided in the project
|
|
|
|
|
131
|
+## Additional Functions Provided in the Project
|
131
|
|
132
|
|
132
|
-The project which you will be working on today contains the `cropSwap` function that implements the functionality of exchanging the pixels contains in two congruent rectangles within an image. Its prototype is:
|
|
|
|
|
133
|
+The project which you will be working on today contains the `cropSwap` function that implements the functionality of exchanging the pixels contained in two congruent rectangles within an image. Its prototype is:
|
133
|
|
134
|
|
134
|
`void ImageScrambler::cropSwap(QImage &img, int x0, int y0, int x1, int y1, int width, int height );`
|
135
|
`void ImageScrambler::cropSwap(QImage &img, int x0, int y0, int x1, int y1, int width, int height );`
|
135
|
|
136
|
|
|
|
|
|
153
|
The project `ImageScrambler` contains the skeleton of an application to scramble and unscramble images. In today’s laboratory experience you will work in the `Filter.cpp` file to complete the application.
|
154
|
The project `ImageScrambler` contains the skeleton of an application to scramble and unscramble images. In today’s laboratory experience you will work in the `Filter.cpp` file to complete the application.
|
154
|
|
155
|
|
155
|
|
156
|
|
156
|
-### Exercise 1: Pseudocode for the scrambling function
|
|
|
|
|
157
|
+### Exercise 1 - Pseudocode for the Scrambling Function
|
157
|
|
158
|
|
158
|
Write the pseudocode to express the scrambling algorithm described above as a recursive function.
|
159
|
Write the pseudocode to express the scrambling algorithm described above as a recursive function.
|
159
|
|
160
|
|
160
|
|
161
|
|
161
|
-### Exercise 2: Recursive function to scramble an image
|
|
|
|
|
162
|
+### Exercise 2 - Recursive Function to Scramble an Image
|
162
|
|
163
|
|
163
|
-**Instructions**
|
|
|
|
|
164
|
+#### Instructions
|
164
|
|
165
|
|
165
|
-1. Load the project `ImageScrambler` into `QtCreator`. There are two ways to do this:
|
|
|
|
|
166
|
+1. Load the project `ImageScrambler` into `QtCreator`. There are two ways to do this:
|
166
|
|
167
|
|
167
|
* Using the virtual machine: Double click the file `ImageScrambler.pro` that can be found in the folder `/home/eip/labs/recursion-imagescrambler` of your virtual machine.
|
168
|
* Using the virtual machine: Double click the file `ImageScrambler.pro` that can be found in the folder `/home/eip/labs/recursion-imagescrambler` of your virtual machine.
|
168
|
|
169
|
|
|
|
|
|
194
|
|
195
|
|
195
|
1. Use “Deliverable 1” in Moodle to upload the file with the pseudocode for the recursive function.
|
196
|
1. Use “Deliverable 1” in Moodle to upload the file with the pseudocode for the recursive function.
|
196
|
|
197
|
|
197
|
-2. Use "Deliverable 2" in Moodle to upload the `Filter.cpp` file that contains the functions you implemented in this laboratory experience. Remember to use good programming techniques, by including the names of the programmers involved, and documenting your program.
|
|
|
|
|
198
|
+2. Use "Deliverable 2" in Moodle to upload the `Filter.cpp` file that contains the functions you implemented in this laboratory experience. Remember to use good programming techniques, include the names of the programmers involved, and document your program.
|
198
|
|
199
|
|
199
|
|
200
|
|
200
|
---
|
201
|
---
|
|
|
|
|
212
|
|
213
|
|
213
|
[3] http://www.instructables.com/id/Python-Programming-recursion/
|
214
|
[3] http://www.instructables.com/id/Python-Programming-recursion/
|
214
|
|
215
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
220
|
-
|
|
|
221
|
-
|
|
|