# Enhanced Joint and Separable Reversible Data Hiding in Encrypted Images with High Payload
## 3 The Proposed Joint Data Hiding System
### An Example of the Proposed Joint Data Hiding System  
To illustrate our proposed joint data hiding system, a simple example is considered. Let \(I\) be the original image of size \(4\times 6\), as shown in Figure 5a. First, \(I\) is encrypted by using the encryption key and encrypted image \(I^{\prime}\) is obtained, as demonstrated in Figure 5b. Then, the information bits are embedded into \(I^{\prime}\). It is assumed that \(t=4\). We consider \(Q=4\), the four bits to be embedded are 1001 and after permutation the permuted bits, \(A=0101\). Here, \(Q_{\rm B}=2\) and \(Q_{\rm W}=2\). Let \(G=2\)  
Figure 4: Four cases of two adjacent pixels.  
i.e., two pixels are required to embed one bit. \(I^{\prime}\) is divided into four sets \(B_{1}\), \(B_{2}\), \(W_{1}\), and \(W_{2}\). Border pixels can be the elements of \(B_{2}\) or \(W_{2}\) but cannot be the elements of \(B_{1}\) or \(W_{1}\). Let the first chosen pixel be 186 at position (2, 2) where \(i=2\) and \(j=2\). Since \((2+2)\) mod 2 = 0, this pixel will belong to set \(B_{1}\) and neighboring pixels [186,183,160,183] will be the elements in set \(W_{2}\). The second pixel, 189 at (3, 3), will belong to set \(B_{1}\) as \((3+3)\) mod 2 = 0, and as top and left pixels [183,160] are already in set \(W_{2}\), only bottom and right pixels [189,160] will be the elements in set \(W_{2}\). The third pixel, 183 at position (3, 2), will belong to set \(W_{1}\) as \((3+2)\) mod 2 = 1, and neighboring pixels [183,186,189,186] will be elements in \(B_{2}\). The process is continued until number of pixels in \(B_{1}\) and \(W_{1}\) exceeds 4. Let \(B_{1}\) and \(W_{1}\) be \(B_{1}\) = [186,189,160,183] and \(W_{1}\) = [183,160,189,186],respectively.Therefore, \(C\) is determined as \(C\) = [186,189,160,183,183,160,189,186]. These pixels are divided into four groups and each group contains two pixels. If it is assumed that the first group is [186,189] and first bit to be embedded is 0, the pixels in this group will be the same. If the second group is [160,183] and bit to be embedded is 1, then \(t\) th bit of all pixels in this group is flipped. Thus, after embedding all the bits, embedded encrypted image is shown in Figure 5c.  
For joint data extraction and image restoration, the embedded encrypted image has to be decrypted using the same encryption key. In this example, the decrypted embedded image is given in Figure 5d. The decrypted image is divided into four sets which are the same with the sets in the data embedding process and the selected pixels are [8,15,26,13,5,18,7,0]. Then, the pixels are divided into groups and for each group another flipped group is obtained by flipping the \(t\) th bit. For example, {0,7} is the flipped group of [8,15] where the fourth bit of each pixel in group [8,15] is flipped. Fluctuation of [8,15] and {0,7} are calculated by using (10) and (11), respectively. Let \(f_{0}\) = 40 and \(f_{1}\) = 60. As \(f_{0}\) <\(f_{1}\), [8,15] is the original group and the extracted bit is 0. The last group is {7,0} and its flipped group is {15,8}. Let \(f_{0}\) = 96 and \(f_{1}\) = 42. As \(f_{1}\) <\(f_{0}\), {15,8} is the original group and the extracted bit is 1. After extracting all information bits, a recovered image is shown in Figure 5e.  
Figure 5: Example of the proposed joint data hiding system. (**a**) Original image; (**b**) encrypted image; (**c**) encrypted image containing information bits; (**d**) decrypted image containing information bits; and (**e**) recovered image.