## 4 Proposed Scheme for Self-Embedding
### Watermark Extraction and Reconstructing Ambtc
6: Read a block \(\mathcal{M}_{n}\) from \(\mathbb{M}_{2}\), where \(n\in\{1\leq n\leq(N\times N)/(m\times m)\}\). The moment values (\(Q_{1}\) and \(Q_{2}\)) are reconstructed from \(\mathcal{M}_{n}\) using Equation (16), where \(base=[2^{7},2^{6},2^{5},2^{4},2^{3},2^{2},2^{1},2^{0}]^{T}\). \[\left\{ \begin{array}{l}Q_{1}^{n}=\sum_{i=1}^{m\times m}/2(base\cdot \mathcal{M}_{n,i})\\ Q_{2}^{n}=\sum_{i=9}^{m\times m}/2(base\cdot\mathcal{M}_{n,i})\end{array} \right.\] (16)
7: Read a block \(\mathcal{M}_{n}\) from \(\mathbb{M}_{1}\). Equation (5) is applied to replace a bitmap block \(\mathcal{M}_{n}\) with a grayscale block \(G_{n}\). That is, \(G_{n,i}=\sum_{i=1}^{m\times m}f(\mathcal{M}_{n},Q_{1},Q_{2})\), where \(f\) is a function logic of Equation (5) and \(n\) is block number. A grayscale block \(G\) coding obtained by the decoding is assigned to \(\mathbb{B}\), i.e., \(\mathbb{B}(n)=G_{n}\). 8: The image derived from AMBTC is reconstructed as repeating the procedure of Step 6 as much as the number of blocks. ```

**Algorithm 4**_Cont._

Until now, we explained the restoration of a grayscale image based on AMBTC through extracting watermarks(maps) from the marked image. Next, we will explain how to restore the tampered block after finding the tampered block from the marked image. This describes the extracting checksum from the marked image and the restoration procedure of the tampered block using the checksum and the recovered trio. **Input:** A marked image \(\mathbb{K}\) and a grayscale image \(\mathbb{B}\) (output of Algorithm 4) based on AMBTC with a size of \(N\times N\), Key \(\xi\). **Output:** A reconstructed cover image \(\mathbb{R}\) with a size of \(N\times N\). **Step 1:**: Divide the images \(\mathbb{K}\) and \(\mathbb{B}\) into non-overlapping blocks sized \(m\times m\), where \(m=4\). The sized \(N\times N\) image \(\mathbb{R}\) are initialized with zeros. **Step 2:**: Read a block of the images \(\mathbb{K}\) and \(\mathbb{B}\), then this block is assigned to \(\mathcal{P}_{n}\) and \(\mathcal{B}_{n}\), where \(n\) is a block number. \(\mathcal{P}_{sum}\) embedded in the LSB of the block \(\mathcal{P}_{n}\) is recovered by using Equation (17). \[\mathcal{P}_{sum}=\sum_{i=1}^{m\times m}(\mathcal{P}_{n,i}\bmod 2)\times 2^{i} \tag{17}\]

\(\mathcal{P}_{sum}\) is an embedded checksum in the block \(\mathcal{P}_{n}\). **Step 3**: Generate checksum \(\mathcal{V}_{sum}\) using Equation (12) and then discriminate whether the block has been tampered with or not using Equation (18). That is, if \(\mathcal{V}_{sum}=\mathcal{P}_{sum}\), this block is a safe block; otherwise, it is a tampered block. If the block is safe, \(\mathcal{P}_{n}\) is assigned to \(\mathbb{R}_{n}\). Meanwhile, if it is tampered, the recovered block \(\mathcal{B}_{n}\) is assigned to \(\mathbb{R}_{n}\). \[\mathbb{R}_{n}=\left\{ \begin{array}{ll}\mathcal{P}_{n},&if\ \ (\mathcal{V}_{sum}= \mathcal{P}_{sum}),\\ \mathcal{B}_{n},&otherwise,\end{array} \right. \tag{18}\]

**Step 4**: The recovered image \(\mathbb{R}\) is made by repeating the procedure of Steps 2 and Step 3 as much as the number of blocks. ## 5 Experimental Results

In this section, the experiments and analysis are described to prove the performance of the proposed method. The computing platform used in the experiment has a Core i5-8250U processor, 1.60 GHz speed and 8 GB of RAM, and the software for the simulation is MATLAB R2019b. The standard USC-SIPI image database was used in the experiment for image restoration. Of these, some of the original \(512\times 512\) grayscale images were selected and used for the experiment. Figure 4 shows a set of test images (e.g., Lena, Pepper, Airplane, Boat, Goldhill, Couple, Baboon, and Zelda) used in the experiment. For evaluation, Structural Similarity Index Metric (SSIM) and peak signal-to-noise ratio (PSNR) were used to compare the performance of the existing and proposed methods.