## 3 Proposed Work
### Image Restoration Phase  
The process of extracting the hidden secret information and the restoration of the cover image from the marked image \(E^{\prime}\) is detailed in this section. The receiver uses Algorithm 2 to accomplish this phase. The image \(E^{\prime}\) and the decryption key \(M\) make up the inputs to this phase. At first, we generate a pseudo-random matrix \(M^{\prime}\) of size \(X\times Y\) pixels using the key \(M\), which will hold values in the range \([0-255]\). Further, the marked image is processed as independent blocks of fixed size \(H\times H\) pixels, and each block is processed as independent \(2\times 2\)-sized blocks, similar to the data-hiding phase. The receiver employs the same local pixel-swapping process to recover the 2-bit information hidden in each block of the image \(E^{\prime}\). Each block will be transformed into four different versions by using the four local pixel-swapping operations as referred to in Equation (9). Let us consider a marked block \(V^{\prime}\) from \(E^{\prime}\). One version of \(V^{\prime}\) is generated by computing one type of local pixel-swapping operation on each \(2\times 2\)-pixel block of \(V^{\prime}\). Similarly, three other versions are also generated. If we consider \(V^{\prime}\) as a \(2\times 2\)-pixel block, then four different pixel arrangements, say \(Z^{0},Z^{1},Z^{2}\), and \(Z^{3}\), are generated as shown below. Let us assume  
\[Z= \begin{bmatrix}T_{11}&T_{12}\\ T_{21}&T_{22}\end{bmatrix} . \tag{10}\]Then, the four different pixel arrangements, \(Z^{0},Z^{1},Z^{2}\), and \(Z^{3}\) will be  
\[Z^{0}= \begin{bmatrix}T_{11}&T_{12}\\ T_{21}&T_{22}\end{bmatrix} . \tag{11}\]  
\[Z^{1}= \begin{bmatrix}T_{12}&T_{11}\\ T_{22}&T_{21}\end{bmatrix} . \tag{12}\]  
\[Z^{2}= \begin{bmatrix}T_{21}&T_{22}\\ T_{11}&T_{12}\end{bmatrix} . \tag{13}\]  
\[Z^{3}= \begin{bmatrix}T_{22}&T_{21}\\ T_{12}&T_{11}\end{bmatrix} . \tag{14}\]  
```
Input: 1. Marked image \(E^{\prime}\), 2. Decryption key \(M\) Output: 1. Recovered image \(F\), 2. Recovered secret data \(D^{\prime}\)  Generate \(M^{\prime}\) using the key \(M\) /* \(M^{\prime}\) is a pseudo-random matrix with size \(X\times Y\) pixels, whose values will be in the range {0-255} */  Let \(H\) indicate the block size;  Let \(r=1\);\(s=1\);\(i=1\);\(j=1\);\(A=1\); while\(((i\leq(X-H-1))\)do while\((j\leq(Y-H-1))\)do \(E^{\prime\prime}=E^{\prime}_{i,j}\); \(M^{\prime\prime}=M^{\prime}_{i,j}\); \(V^{0}=E^{\prime\prime}\); \(V^{1}=E^{\prime\prime}\); \(V^{2}=E^{\prime\prime}\); \(V^{3}=E^{\prime\prime}\); while\((r\leq H-1)\)do while\((s\leq H-1)\)do \(T_{11}=V_{r,s}\); \(T_{12}=V_{r,s+1}\); \(T_{21}=V_{r+1,s}\); \(T_{22}=V_{r+1,s+1}\); \(V^{1}_{r,s}=T_{12}\); \(V^{1}_{r,1}=T_{12}\); \(V^{1}_{r+1,s}=T_{22}\); \(V^{1}_{r+1,s+1}=T_{21}\); \(V^{2}_{r,s}=T_{21}\); \(V^{2}_{r+1,s}=T_{22}\); \(V^{2}_{r+1,s}=T_{11}\); \(V^{2}_{r+1,s+1}=T_{12}\); \(V^{3}_{r,s}=T_{22}\); \(V^{3}_{r,s+1}=T_{21}\); \(V^{3}_{r+1,s}=T_{12}\); \(s=s+2\); \(r=r+2\);  Generate 4 different matrices \(V^{0}_{D^{\prime}},V^{1}_{D^{\prime}},V^{2}_{D},V^{3}_{D}\) by bit-wise XOR of \(V^{0}\), \(V^{1},V^{2}\), \(V^{3}\) with \(M^{\prime\prime}\), respectively. Call the smoothness function to calculate smoothness of blocks \(V^{0}_{D^{\prime}},V^{1}_{D^{\prime}},V^{2}_{D^{\prime}},V^{3}_{D}\) and store the values in \(S^{0},S^{1},S^{2},S^{3}\), respectively. if((\(S^{0}<S^{1}\))&&\(\&\)(\(S^{0}<S^{2}\))&&\(\&\)(\(S^{0}<S^{3}\))) then \(V_{R}=V^{0}_{D^{\prime}}\); \(D^{\prime}[A]=0\); \(D^{\prime}[A+1]=0\); elseif((\(S^{1}<S^{2}\))&&\((S^{1}<S^{3}\))) then \(V_{R}=V^{1}_{D^{\prime}}\); \(D^{\prime}[A]=0\); \(D^{\prime}[A+1]=1\); elseif(\(S^{2}<S^{3}\))then \(V_{R}=V^{2}_{D^{\prime}}\); \(D^{\prime}[A]=1\); \(D^{\prime}[A+1]=0\); else\(V_{R}=V^{3}_{D}\); \(D^{\prime}[A]=1\); \(D^{\prime}[A+1]=1\); \(F_{i,j}=V_{R}\); \(A=A+2\); \(j=j+H\); \(i=i+H\); Return the recovered original image \(F\) and recovered secret data \(D^{\prime}\). ```  
**Algorithm 2**Secret data extraction and image restoration.