## 3 Watermarking in Tensor Domain
### Procedures of Watermark Embedding  
This part mainly introduces the specific process of embedding. Figure 7 shows a flowchart of watermark embedding. The embedding process of watermark information is as follows.  
Figure 6: Distribution of three imaginary components. (**a**) The \(C^{\prime}s\) value distribution of the image block \(I_{r}\) size is \(16\times 16\). (**b**) The \(D^{\prime}s\) value distribution of the image block size \(I_{r}\) is \(16\times 16\). (**c**) The \(E^{\prime}s\) value distribution of the image block size \(I_{r}\) is \(16\times 16\).  
**Step1** : Obtain a color-image \(I_{o}\) with dimensions of \(X\times Y\times 3\), and divide the \(I_{o}\) into non-overlapping blocks of size \(8\times 8\times 3\). The numbers of the blocks are \(\frac{X\times Y}{8\times 8}\).  
**Step2** : Construct a pure quaternion Fourier \(f(x,y)=R(x,y)i+G(x,y)j+B(x,y)k\) using RGB channels of the color image block size of \(8\times 8\times 3\), and perform QDFT on the each block to obtain \(A(\lambda,v)\), \(C(\lambda,v)\), \(D(\lambda,v)\), and  
**Step3** : Use the three Fourier frequency components \(C(\lambda,v)\), \(D(\lambda,v)\), and \(E(\lambda,v)\) of each block to construct a third-order tensor \(T\).  
**Step4** : Operate Tucker decomposition on each tensor \(T\) to obtain core tensor \(K\), and the numbers of \(K\) are \(\frac{X\times Y}{X\times K}\).  
**Step5** : Perform logistic mapping on all the core tensor \(K\) blocks, a bit of the watermark \(w_{o}\) is embedded in \(K(1,1,1)\) of each core tensor, and the odd-even quantization embedding technique is defined as follows:  
if \(K(1,1,1)>0\), \(\eta=round(K(1,1,1)/Q)\)  
\[K(1,1,1)=\begin{cases}K(1,1,1)&if\quad w\
eq\mod(\eta,2),\\ \eta\times Q+0.6\times Q&if\quad w=\mod(\eta,2).\end{cases} \tag{24}\]  
else \(K(1,1,1)=-1\times K(1,1,1)\), \(\eta=round(K(1,1,1)/Q)\)  
\[K(1,1,1)=\begin{cases}-K(1,1,1)&if\quad w\
eq\mod(\eta,2),\\ -(\eta\times Q-0.6\times Q)if&w=\mod(\eta,2).\end{cases} \tag{25}\]  
where \(Q\) is the quantization step, that is, the watermark embedding strength, \(round(*)\) is the rounding operation, and \(mod(*)\) is the modulo operation.  
The value of \(K(1,1,1)\) is made up of positive and negative numbers. If the traditional odd-even quantization watermarking rule is used, the error rate is relatively high. When \(K(1,1,1)<0\), the traditional rule is \(K(1,1,1)=-1\times(\eta\times Q-0.5\times Q)\), an error occurs when extracting the watermark. For example, \(K(1,1,1)=-1000\), \(Q=23\), \(w=1\), \(\mod(1000/23)=43\), and \(K^{\prime}(1,1,1)=-1\times(43\times 23-0.5\times 23)=-977.5\). When extracting the watermark, \(\eta=43\), \(mod(\eta,2)=1\), and \(w=0\). This result is inconsistent with \(w=1\) when embedding. Hence, the paper replaces 0.5 with 0.6 to avoid this error.  
**Step6** : Perform inverse logistic mapping on all the core tensor \(K^{\prime}\) blocks with the watermark, and then obtain tensor \(T^{\prime}\) using Equation (1).  
**Step7** : Obtain the three imaginary components \(C^{{}^{\prime}}(\lambda,v)\), \(D^{{}^{\prime}}(\lambda,v)\), and \(E^{{}^{\prime}}(\lambda,v)\) from \(T^{\prime}\) using frontal slice way in Figure 7, and then construct \(F^{{}^{\prime}}(\lambda,v)=A(\lambda,v)+C^{{}^{\prime}}(\lambda,v)i+D^{{}^{ \prime}}(\lambda,v)j+E^{{}^{\prime}}(\lambda,v)k\).  
**Step8** : Perform inverse QDFT transformation on \(F^{{}^{\prime}}(\lambda,v)\) by using Equation (7) to obtain \(f^{{}^{\prime}}(x,y)=R^{{}^{\prime}}(x,y)i+G^{{}^{\prime}}(x,y)j+B^{{}^{ \prime}}(x,y)k\). Finally, construct a watermarked color image using \(R^{{}^{\prime}}(x,y)\), \(G^{{}^{\prime}}(x,y)\), and \(B^{{}^{\prime}}(x,y)\), that is, the three RGB channels with the watermark.