# Security Protection of 3D Models of Oblique Photography by Digital Watermarking and Data Encryption
## 4 The Proposed Scheme
### Digital Watermarking Algorithm of Texture Coordinates  
#### 4.2.1 Watermark Embedding  
The watermark embedding algorithm process is illustrated in Figure 4.  
This section extracts the texture coordinates of the oblique photography 3D model and embeds the watermark by modifying the texture coordinates. The process of embedding the watermark is shown in Figure 4 and can be summarized as follows:  
Step 1. First, the texture coordinate data needs to be preprocessed. The texture coordinate data extracted from the 3D model data is represented as \(T=\{T_{1},\ T_{2},\ T_{3},\ \ldots T_{n}\}\), where \(T_{i}(U_{i},\ V_{i})\) is the texture coordinate, \(i\in[1,\ N]\), and \(N\) is the number of texture coordinates. The texture coordinate values are usually between [0, 1], indicating the position on the texture image.  
Figure 3: The vertex coordinates of the watermark extraction flow chart.  
Step 2. Calculate the distance between each texture coordinate and the origin of the texture coordinates [0, 0], resulting in \(D_{T}=\{D_{T1},\ D_{T2},\ C_{T3},\ \ldots D_{T1}\}\), where \(i\) is the number of texture coordinates.  
Step 3. The watermark data \(w\) is a binary matrix of \(h*h\) dimensions. A mapping relationship is established between the watermark data = \(\left\{w_{(i,j)},\ 0\leq i\leq h-1,\ 0\leq j\leq h-1\right\}\) and the distance \(D\) between the feature point and the virtual centroid. For the \(m\)-th texture coordinate \(T_{m}(U_{m},V_{m})\), the corresponding row and column numbers \(r,l\) in the watermark w are calculated according to Equation (6).  
\[\left\{\begin{array}{c}D_{Tm}=\sqrt{\left(U_{m}\right)^{2}+\left(V_{m} \right)^{2}}\\ d_{Tm}=trunc\left(D_{Tm}*10^{2},\ \ p\right)\\ d_{Tm}^{\prime}=Int\left(D_{Tm}*10^{6}\right)\\ r,l=divmod\left(Hash(d_{Tm}),\ \ h^{2}\right)\end{array}\right. \tag{6}\]  
In Equation (6), \(trunc(a,b)\) represents the truncation of \(a\) to \(b\) digits after the decimal point, \(Int(*)\) represents the integer part of a decimal number, \(Hash(*)\) represents a function that converts an input of arbitrary length into a fixed length output, \(divmod(a,b)\) represents the quotient and remainder, where \(a\) is the divisor and \(b\) is the dividend, \(d_{m}\) represents the number of digits to retain after the decimal point for the distance \(D_{Tm}\) from the texture coordinate to the origin of the texture coordinate, and \(mod\) represents the remainder calculation.  
Step 4. According to the corresponding position of \(r,l\) in \(w\), obtain the watermark value \(w_{[r,l]}\) corresponding to the feature point. The watermark value \(w_{[r,l]}\) and \(D_{m}\) are modified according to Equations (7)-(9) on the original feature point coordinates, thus completing the watermark embedding.  
\[g(x)=\left\{\begin{array}{c}1,\ \ x\ mod2\ \
eq 0\\ 0,\ \ x\ mod2=0\end{array}\right. \tag{7}\]  
\[dis=\left\{\begin{array}{c}10^{-6},\ \ g\left(d_{Tm}^{\prime}\right)\ \
eq w_{[r,l]}\\ 0,\ \ g\left(d_{Tm}^{\prime}\right)=w_{[r,l]}\end{array}\right. \tag{8}\]  
\[\left\{\begin{array}{c}u^{\prime}=u+\left(\frac{u}{\sqrt{\left(u\right)^{2 }+\sqrt{\left(v\right)^{2}}}}\right)*dis\\ v^{\prime}=v+\left(\frac{v}{\sqrt{\left(u\right)^{2}+\sqrt{\left(v\right)^{2 }}}}\right)*dis\end{array}\right. \tag{9}\]