# Hyperspectral Data: Efficient and Secure Transmission
## 2 An Efficient and Secure Transmission Framework
### An Effective Implementation of the Proposed Framework
#### 2.1.1 Reversible Invisible Watermarking Scheme for Hyperspectral Images
The algorithm considers each substring \(w_{i}\) and performs the following steps until all the bits composing \(w_{i}\) are embedded into \(\textit{HI}_{(i)}\): four pixels (we denote them as \(x_{(0)}\), \(x_{(1)}\), \(x_{(2)}\), and \(x_{(3)}\)) are randomly selected by using the PRNG \(G\) to compose a set \(S_{P}\). Subsequently, the estimation \(S_{P}^{E}\) (composed by four estimated pixels, that we denote as \(x_{(0)}^{E}\), \(x_{(1)}^{E}\), \(x_{(2)}^{E}\), and \(x_{(3)}^{E}\)) of \(S_{P}\) is calculated. This estimation is computed by a linear combination of the pixels of \(S_{P}\), as it is shown in the _estimate_ procedure of Algorithm 2. In order to classify the set \(S_{P}\), the difference \(D\), in absolute value, between \(x_{(0)}\) and \(x_{(0)}^{E}\) is computed. In the case \(D\) is less than 1, then the set \(S_{P}\) is classified as a carrier set and, therefore, the \"embedWatermarkBit\" procedure (Algorithm 1) is performed in order to embed \(b_{w}\) into \(S_{P}\). Thus, the processing of bit \(b_{w}\) is complete. The coordinates of the pixels \(x_{(0)}\), \(x_{(1)}\), \(x_{(2)}\), and \(x_{(3)}\) will be no longer selectable and the algorithm proceeds by embedding the next bit of \(w_{i}\). ```
procedure estimate (\(S_{P}\))
1. \(x_{(0)}^{\text{E}}=\frac{2\times x_{(0)}+x_{(1)}+x_{(2)}}{4}\);
2. \(x_{(1)}^{\text{E}}=\frac{2\times x_{(1)}+x_{(0)}+x_{(3)}}{4}\);
3. \(x_{(2)}^{\text{E}}=\frac{2\times x_{(2)}+x_{(0)}}{4}\);
4. \(x_{(3)}^{\text{E}}=\frac{2\times x_{(3)}+x_{(1)}+x_{(2)}}{4}\);
5. \(S_{P}^{\text{E}}=\{x_{(0)}^{\text{E}},\ x_{(1)}^{\text{E}},\ x_{(2)}^{\text{E}},\ x_{(3)}^{\text{E}}\}\);
6. return\(S_{P}^{\text{E}}\); endprocedure
```  
**Algorithm 2** The \"estimate\" procedure (pseudo-code from [13])  
In case \(S_{p}\) is classified, instead, as a non-carrier set, then the value of the pixels of \(S_{p}\) are modelled in order to increase the difference, \(D\). In this manner, the extraction algorithm is able to correctly understand that \(S_{p}\) is a non-carrier set. As a consequence, the bit, \(b_{w}\), cannot be embedded into the set \(S_{p}\) and other four pixels (different from the ones previously selected) will be selected to compose a new set \(S_{p}\), to try the embedding again. ```
procedure embed (\(H1\), \(w\), \(K\))
1. Let \(G\) be a \(PRNG\);
2. \(N=lengthOf(w)\);
3. Subdivide \(w\) into \(\{w_{1},\ w_{2},\ \ldots,\ w_{M}\}\);
4. for\(i=1\)to\(M\)do
5. \(idx=1\);
6. \(N_{i}=lengthOf(w_{i})\)
7. repeat
8. \(b_{w}=w_{i}[idx]\);
9. By using \(G\) along with \(K\), selects \(x_{(0)}\), \(x_{(1)}\), \(x_{(2)}\), \(x_{(3)}\) from \(HI_{(i)}\);
10. \(S_{P}=\{x_{(0)},\ x_{(1)},\ x_{(2)},\ x_{(3)}\}\);
11. \(S_{P}^{\text{E}}=estimate(S_{P})\);
12. \(D=|x_{(0)}-x_{(0)}^{\text{E}}|\);
13. if\(D<1\)then
14. \(S_{P}^{\text{E}}=embedWatermarkBit(S_{P},\ b_{w})\);
15. \(idx++\);
16. else
17. Modifying of \(S_{P}\), by using \(S_{P}=embedWatermarkBit(S_{P},0)\) or \(S_{P}=embedWatermarkBit(S_{P},1)\), in order to increase the value of \(D\);
18. endif
19. Setting of the coordinates of \(x_{(0)}\), \(x_{(1)}\), \(x_{(2)}\) and \(x_{(3)}\) no longer selectable;
20. until\(idx\leq N_{i}\);
21. endfor
22. Copying of all modified and unmodified pixels to \(HI^{W}\);
23. return\(HI^{W}\); endprocedure
```  
**Algorithm 3** The \"embed\" procedure (pseudo-code from [13])  
In case \(S_{p}\) is classified, instead, as a non-carrier set, then the value of the pixels of \(S_{p}\) are modelled in order to increase the difference, \(D\). In this manner, the extraction algorithm is able to correctly understand that \(S_{p}\) is a non-carrier set. As a consequence, the bit, \(b_{w}\), cannot be embedded into the set \(S_{p}\) and other four pixels (different from the ones previously selected) will be selected to compose a new set \(S_{p}\), to try the embedding again. ``` procedure embed (\(H1\), \(w\), \(K\))
1. Let \(G\) be a \(PRNG\);
2. \(N=lengthOf(w)\);
3. Subdivide \(w\) into \(\{w_{1},\ w_{2},\ \ldots,\ w_{M}\}\);
4. for\(i=1\)to\(M\)do
5. \(idx=1\);
6.