## 4 Proposed Scheme for Self-Embedding
### Watermark Generation, Localization and Authentication
The algorithm of watermark localization is as follows:  
```
0: Two watermark bitmaps, \(\mathbb{M}_{1}\) and \(\mathbb{M}_{2}\) in Algorithm 1, Key \(\xi\)
0: Mapped (scrambled) bitmaps \(\mathbb{M}_{1}\), and \(\mathbb{M



### Watermark Embedding Procedure

In Section 4.1, we introduced obtaining bitmaps \(\mathbb{M}_{1}\) and \(\mathbb{M}_{2}\) for the restoration of marked images using Algorithm 1. However, if one block of the marked image has tampered with, \(\mathbb{M}_{1}\) and \(\mathbb{M}_{2}\) of the block have tampered with, so localization is required. Algorithm 2 introduced obtaining localized maps \(\mathbb{M}_{1}\) and \(\mathbb{M}_{2}\). Section 3.2 introduces the procedure of hiding the two maps and the authentication bits in the cover image. Here, the three LSB layers of the cover image are replaced with watermark bits and authentication bits. The watermark embedding procedure is as follows:
```
0: cover image \(\mathbb{C}\)
0: marked image \(\mathbb{K}\)
0: Divide the cover image \(\mathbb{C}\) and two maps (\(\mathbb{M}_{1}\) and \(\mathbb{M}_{2}\)) in Algorithm 2 into non-overlapping blocks sized \(m\times m\), where \(m=4\). 0: Read three blocks from the cover image \(\mathbb{C}\), two maps \(\mathbb{M}_{1}\) and \(\mathbb{M}_{2}\), respectively, then these blocks are assigned to \(\mathcal{P}_{n}\), \(\mathcal{M}_{1}\), and \(\mathcal{M}_{2}\), where \(n\in\{1\leq n\leq(N\times N)/(m\times m)\}\) and \(n\) is a block index number. 0: Obtain 1 LSB (\(b_{i}^{1}\)), 2 LSB (\(b_{i}^{2}\)), and 3 LSB (\(b_{i}^{3}\)) using Equation (9), where \(n\) is the index, and \(i\) is the pixel index. After that, OPAP is applied according to the rule of Equation (10), and \(\mathcal{M}_{1}^{n}\) is hidden in the 3 LSB of \(\hat{\mathcal{P}}\). That is, \(\hat{\mathcal{P}}_{n}^{\prime}=\sum_{i=1}^{m\times m}f(\hat{\mathcal{P}}_{n,i},\mathcal{M}_{1}^{n,i})\), here, \(f\) is a function representing the logic of Equation (10). \[\left\{\begin{array}{l}\hat{\mathcal{P}}_{n,i}\xleftarrow{ \text{removed}}\  
**Step 5**: For image authentication, we compute a checksum for each block and hide it in a block. First, we choose a large number \(\mathcal{G}\) that will be used for calculating the checksums (Equation (12)). For each block, every pixel (\(\mathcal{V}_{n,i}\)) is generated by a key (\(\xi\)) with a pseudo-random number. Here, \(g(\mathcal{V}_{n,i})\) is the gray level of the pixel \(\mathcal{V}_{n,i}\). We also generate \(m\times m\) integers \(c_{1},c_{2},\ldots,c_{m\times m}\) comparable in size to \(\mathcal{G}\). The checksum \(K_{sum}\) is calculated as  
\[\left\{ \begin{array}{l}\mathcal{V}_{sum}=\sum_{i=1}^{m\times m}c_{i}g( \mathcal{V}_{n}(i))\bmod\mathcal{G}\\ k_{i,t}=\left|\frac{\mathcal{V}_{sum}}{2^{t}}\right|\bmod 2,t=0,1,\ldots,m \times m.\end{array} \right. \tag{12}\]  
Finally, the transformed bits \(k_{i}\) from checksum \(K_{sum}\) are acquired. **Step 6**: Embed \(k_{i}\) into the LSBs of \(\mathcal{P}_{n,i}\) using the logic of Equation (13). That is, \(\mathcal{P}^{\prime}_{n}=\sum_{i=1}^{m\times m}f(\mathcal{P}_{n,i},k_{i,t})\), where \(f\) is the function representing the rule. \[\mathcal{P}_{n}(i)^{\prime}=\left\{ \begin{array}{l}\text{no operation, \ if $k_{i}=b_{i}^{1}$}\\ \mathcal{P}_{n}(i)+1,\ \text{if $(k_{i}\
eq b_{i}^{1})$ and $b_{i}^{1}=0$},\\ \mathcal{P}_{n}(i)-1,\ \text{if $(k_{i}\
eq b_{i}^{1})$ and $b_{i}^{1}=1$},\end{array} \right. \tag{13}\]