|
|
|
|
4
|
![main2.png](images/main2.png)
|
4
|
![main2.png](images/main2.png)
|
5
|
![main3.png](images/main3.png)
|
5
|
![main3.png](images/main3.png)
|
6
|
|
6
|
|
|
|
7
|
+[Verano 2016 - Ive]
|
|
|
8
|
+
|
7
|
One of the advantages of using computer programs is that we can easily implement repetitive tasks. Structures such as the `for`, `while`, and `do-while` allow us to repeat a block of instructions as many times as needed. These structures are also referred to as *repetition structures*. In today's laboratory experience you will complete a steganography application to practice the use of nested loops and the manipulation of bidimensional arrays.
|
9
|
One of the advantages of using computer programs is that we can easily implement repetitive tasks. Structures such as the `for`, `while`, and `do-while` allow us to repeat a block of instructions as many times as needed. These structures are also referred to as *repetition structures*. In today's laboratory experience you will complete a steganography application to practice the use of nested loops and the manipulation of bidimensional arrays.
|
8
|
|
10
|
|
9
|
##Objectives:
|
11
|
##Objectives:
|
|
|
|
|
15
|
3. Use the binary representation of characters.
|
17
|
3. Use the binary representation of characters.
|
16
|
|
18
|
|
17
|
|
19
|
|
18
|
-##Pre-Lab:
|
|
|
|
|
20
|
+## Pre-Lab:
|
19
|
|
21
|
|
20
|
Before coming to the laboratory session you should have:
|
22
|
Before coming to the laboratory session you should have:
|
21
|
|
23
|
|
|
|
|
|
29
|
|
31
|
|
30
|
5. Studied the concepts and instructions related to the laboratory session.
|
32
|
5. Studied the concepts and instructions related to the laboratory session.
|
31
|
|
33
|
|
32
|
-6. Taken the Pre-Lab quiz available through the course’s Moodle portal.
|
|
|
|
|
34
|
+6. Taken the Pre-Lab quiz available in Moodle.
|
33
|
|
35
|
|
34
|
---
|
36
|
---
|
35
|
|
37
|
|
36
|
---
|
38
|
---
|
37
|
|
39
|
|
38
|
|
40
|
|
39
|
-##Steganography
|
|
|
|
|
41
|
+## Steganography
|
40
|
|
42
|
|
41
|
Steganography is the science of camouflaging the presence of hidden messages in legitimate carriers (seemingly harmless files). This science has been used by cybercriminals to inflict damage to computer systems and by (old style) terrorists to encode hidden messages transmitted through the internet. There is claim that Al-Qaeda may have used steganography to encode messages into images, and then transport them via e-mail, and possibly via USENET, to prepare and execute the September 11, 2001 terrorist attack.
|
43
|
Steganography is the science of camouflaging the presence of hidden messages in legitimate carriers (seemingly harmless files). This science has been used by cybercriminals to inflict damage to computer systems and by (old style) terrorists to encode hidden messages transmitted through the internet. There is claim that Al-Qaeda may have used steganography to encode messages into images, and then transport them via e-mail, and possibly via USENET, to prepare and execute the September 11, 2001 terrorist attack.
|
42
|
|
44
|
|
|
|
|
|
49
|
|
51
|
|
50
|
---
|
52
|
---
|
51
|
|
53
|
|
52
|
-##Image Editing
|
|
|
|
|
54
|
+## Image Editing
|
53
|
|
55
|
|
54
|
In this laboratory experience, you will recover secret messages that have been hidden in an image. To be able to carry out your task, you should understand some concepts related to images, be familiar with the methods of the `QImage` class in `Qt`, and with functions to work with data of the `QRgb` type.
|
56
|
In this laboratory experience, you will recover secret messages that have been hidden in an image. To be able to carry out your task, you should understand some concepts related to images, be familiar with the methods of the `QImage` class in `Qt`, and with functions to work with data of the `QRgb` type.
|
55
|
|
57
|
|
56
|
-###Pixels
|
|
|
|
|
58
|
+### Pixels
|
57
|
|
59
|
|
58
|
The smallest element in an image is called a *pixel*. This unit consists of a single color. Since each color is a combination of tones for the primary red, green and blue colors, it is coded as an unsigned integer whose bytes represent the tones of red, green and blue of the pixel (Figure 1). This combination is called the color's *RGB* which is an acronym for "Red-Green-Blue". For example, a pure red pixel has an RGB representation of `0x00ff0000`, while a white pixel has an RGB representation of `0x00FFFFFF` (since the color white is a combination of tones of red, green and blue in all of their intensity).
|
60
|
The smallest element in an image is called a *pixel*. This unit consists of a single color. Since each color is a combination of tones for the primary red, green and blue colors, it is coded as an unsigned integer whose bytes represent the tones of red, green and blue of the pixel (Figure 1). This combination is called the color's *RGB* which is an acronym for "Red-Green-Blue". For example, a pure red pixel has an RGB representation of `0x00ff0000`, while a white pixel has an RGB representation of `0x00FFFFFF` (since the color white is a combination of tones of red, green and blue in all of their intensity).
|
59
|
|
61
|
|
|
|
|
|
67
|
|
69
|
|
68
|
`Qt` uses the `QRgb` type to represent `RGB` values. Using the functions that are described below we can perform important operations to analyze images, such as obtaining the RGB of each pixel in an image, and to obtain the red, green and blue components of the `QRgb` value of the pixel.
|
70
|
`Qt` uses the `QRgb` type to represent `RGB` values. Using the functions that are described below we can perform important operations to analyze images, such as obtaining the RGB of each pixel in an image, and to obtain the red, green and blue components of the `QRgb` value of the pixel.
|
69
|
|
71
|
|
70
|
-###Library
|
|
|
|
|
72
|
+### Library
|
71
|
|
73
|
|
72
|
In today's laboratory experience you will use the `QImage` class. This class allows you to access the data in the pixels of an image to manipulate it. The documentation for the `QImage` class can be found in http://doc.qt.io/qt-4.8/qimage.html.
|
74
|
In today's laboratory experience you will use the `QImage` class. This class allows you to access the data in the pixels of an image to manipulate it. The documentation for the `QImage` class can be found in http://doc.qt.io/qt-4.8/qimage.html.
|
73
|
|
75
|
|
|
|
|
|
91
|
|
93
|
|
92
|
|
94
|
|
93
|
|
95
|
|
94
|
-####Examples:
|
|
|
|
|
96
|
+#### Examples:
|
95
|
|
97
|
|
96
|
1. If the following `4 x 4` image of pixels represents the object `origImage`,
|
98
|
1. If the following `4 x 4` image of pixels represents the object `origImage`,
|
97
|
|
99
|
|
98
|
![ejemplo.png](images/ejemplo.png)
|
100
|
![ejemplo.png](images/ejemplo.png)
|
99
|
|
101
|
|
100
|
-then `origImage.pixel(2,1)` returns the `rgb` value that represents the color blue ( `0x0000ff`).
|
|
|
|
|
102
|
+ then `origImage.pixel(2,1)` returns the `rgb` value that represents the color blue ( `0x0000ff`).
|
101
|
|
103
|
|
102
|
2. The following instruction assigns to `greenContent` the value of the green tone that is contained in the pixel `(1,1)` of `origImage`:
|
104
|
2. The following instruction assigns to `greenContent` the value of the green tone that is contained in the pixel `(1,1)` of `origImage`:
|
103
|
|
105
|
|
|
|
|
|
105
|
|
107
|
|
106
|
3. The following program creates an object of class `QImage` and prints the red, green and blue components of the pixel in the center of the image. The image used is the one specified within the parenthesis during the creation of the object, that is, the file `chuck.png`.
|
108
|
3. The following program creates an object of class `QImage` and prints the red, green and blue components of the pixel in the center of the image. The image used is the one specified within the parenthesis during the creation of the object, that is, the file `chuck.png`.
|
107
|
|
109
|
|
108
|
----
|
|
|
|
|
110
|
+ ---
|
109
|
|
111
|
|
110
|
-```cpp
|
|
|
111
|
-#include <QImage>
|
|
|
112
|
-#include <iostream>
|
|
|
|
|
112
|
+ ```cpp
|
|
|
113
|
+ #include <QImage>
|
|
|
114
|
+ #include <iostream>
|
113
|
|
115
|
|
114
|
-using namespace std;
|
|
|
115
|
-int main() {
|
|
|
116
|
- QImage myImage(“/Users/rarce/Downloads/chuck.png”);
|
|
|
117
|
- QRgb centralPixel;
|
|
|
|
|
116
|
+ using namespace std;
|
|
|
117
|
+ int main() {
|
|
|
118
|
+ QImage myImage(“/Users/rarce/Downloads/chuck.png”);
|
|
|
119
|
+ QRgb centralPixel;
|
118
|
|
120
|
|
119
|
- centralPixel = myImage.pixel(myImage.width() / 2, myImage.height() / 2);
|
|
|
|
|
121
|
+ centralPixel = myImage.pixel(myImage.width() / 2, myImage.height() / 2);
|
120
|
|
122
|
|
121
|
- cout << hex;
|
|
|
|
|
123
|
+ cout << hex;
|
122
|
|
124
|
|
123
|
- cout << “The red, green and blue components of the middle pixel are: “
|
|
|
124
|
- << qRed(centralPixel) << “, “
|
|
|
125
|
- << qGreen(centralPixel) << “, “
|
|
|
126
|
- << qBlue(centralPixel) << endl;
|
|
|
127
|
- return 0;
|
|
|
128
|
-}
|
|
|
129
|
-```
|
|
|
|
|
125
|
+ cout << “The red, green and blue components of the middle pixel are: “
|
|
|
126
|
+ << qRed(centralPixel) << “, “
|
|
|
127
|
+ << qGreen(centralPixel) << “, “
|
|
|
128
|
+ << qBlue(centralPixel) << endl;
|
|
|
129
|
+ return 0;
|
|
|
130
|
+ }
|
|
|
131
|
+ ```
|
130
|
|
132
|
|
131
|
----
|
|
|
|
|
133
|
+ ---
|
132
|
|
134
|
|
133
|
|
135
|
|
134
|
-###Embedding a message into an image
|
|
|
|
|
136
|
+### Embedding a message into an image
|
135
|
|
137
|
|
136
|
One of the simplest methods of *hidding* a message in an image is by encoding the message into the least significant bits of the image pixel's colors. This method effectively hides the message in the image because changing the least significant bit of a 8-bit color is barely noticeable by the human observer.
|
138
|
One of the simplest methods of *hidding* a message in an image is by encoding the message into the least significant bits of the image pixel's colors. This method effectively hides the message in the image because changing the least significant bit of a 8-bit color is barely noticeable by the human observer.
|
137
|
|
139
|
|
|
|
|
|
239
|
|
241
|
|
240
|
---
|
242
|
---
|
241
|
|
243
|
|
242
|
-!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-01.html"
|
|
|
|
|
244
|
+!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-01.html"
|
243
|
<br>
|
245
|
<br>
|
244
|
|
246
|
|
245
|
-!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-02.html"
|
|
|
|
|
247
|
+!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-02.html"
|
246
|
<br>
|
248
|
<br>
|
247
|
|
249
|
|
248
|
-!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-03.html"
|
|
|
|
|
250
|
+!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-03.html"
|
249
|
<br>
|
251
|
<br>
|
250
|
|
252
|
|
251
|
-!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-04.html"
|
|
|
|
|
253
|
+!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-04.html"
|
252
|
<br>
|
254
|
<br>
|
253
|
|
255
|
|
254
|
-!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-05.html"
|
|
|
|
|
256
|
+!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-05.html"
|
255
|
<br>
|
257
|
<br>
|
256
|
|
258
|
|
257
|
-!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-06.html"
|
|
|
|
|
259
|
+!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-06.html"
|
258
|
<br>
|
260
|
<br>
|
259
|
|
261
|
|
260
|
-!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-07.html"
|
|
|
|
|
262
|
+!INCLUDE "../../eip-diagnostic/steganography/en/diag-steganography-07.html"
|
261
|
<br>
|
263
|
<br>
|
262
|
|
264
|
|
263
|
---
|
265
|
---
|