# Security Protection of 3D Models of Oblique Photography by Digital Watermarking and Data Encryption
## 4 The Proposed Scheme
### Digital Watermarking Algorithm of Vertex Coordinates  
#### 4.1.1 Watermark Embedding  
The embedding process of the vertex coordinate watermark is shown in Figure 2.  
This section first extracts the vertex coordinates of the oblique photography 3D model, then performs clustering algorithm processing on the vertex coordinate data, divides it into several clustering clusters, extracts the feature points in the clustering clusters, and establishes the mapping relationship between the feature points and the watermark data, thus completing the embedding of the watermark. The process of embedding the vertex coordinates watermark is shown in Figure 2, which can be summarized as follows:  
Step 1. Preprocess the oblique photography 3D model data, extract the vertex coordinates in the oblique photography 3D model, and obtain the data of the point cloud set \(P=\{P_{1},\ P_{2},\ P_{3},\ \ldots,\ P_{n}\}\), where \(P_{i}(X_{i},\ Y_{i},\ Z_{i})\) is the vertex coordinate data, and \(i\in[1,\ N]\), \(N\) is the number of vertices. Step 2. The cluster obtained after processing by the clustering algorithm is represented as \(C=\{C_{1},\ C_{2},\ C_{3},\ \ldots C_{n}\}\). The disordered point cloud in the cluster is processed by establishing a KD tree (K Dimension Tree) to obtain the K-neighborhood of the target point, thus improving the efficiency of point cloud data retrieval. Then, the point cloud density is calculated, and the point cloud is downsampled according to the density information to obtain a subset of point clouds, thus completing the extraction of the corresponding feature points \(P^{\prime}_{n}=\{P^{\prime}_{1}.P^{\prime}_{2}.P^{\prime}_{3},\ \ldots P^{\prime}_{j}\}\) in the cluster. Figure 2: Flow chart of embedding the vertex coordinate watermark. Step 3. Taking a single cluster as an example, calculate the virtual centroid coordinates \(\left(\overline{X},\ \overline{Y},\ \overline{Z}\right)\) in the \(P_{n}^{\prime}\) cluster based on the feature points, as calculated in Equation (1):  
\[ \begin{cases}\overline{X}=\frac{\sum_{i}^{n}x_{i}}{\overline{Y}=\frac{\sum_{i}^{ n}y_{i}}{\overline{Z}=\frac{\sum_{i}^{n}z_{i}}{n}}}\\ \end{cases}  \tag{1}\]  
calculate the distance between the feature points \(P_{n}^{\prime}=\{P_{1}^{\prime}.P_{2}^{\prime}.P_{3}^{\prime},\ \ldots P_{i}^{ \prime}\}\) and the virtual centroid coordinates to obtain \(D=\{D_{1},\ D_{2},\ D_{3},\ \ldots D_{i}\}\), where \(i\) is the number of feature points. Step 4. Establish a mapping relationship between the watermark data \(w=\{w_{(i,j)},\ 0\leq i\leq h-1,\ 0\leq j\leq h-1\}\) and the distance \(D\) between the feature point and the virtual centroid. For the \(m\)-th feature point \(P_{m}^{\prime}\), use Equation (2) to calculate the row and column numbers \(r,\ 1\) of its corresponding watermark value \(w\):  
\[ \begin{cases}D_{m}=\sqrt{\left(X_{m}^{\prime}-\overline{X}\right)^{2}+\left( Y_{m}^{\prime}-\overline{Y}\right)^{2}+\left(Z_{m}^{\prime}-\overline{Z} \right)^{2}}\\ d_{m}=trunc(D_{m},p)\\ d_{m}^{\prime}=Int\big{(}D_{m}*10^{6}\big{)}\\ r,l=divmod\left(Hash(d_{m}),\ h^{2}\right)\end{cases}  \tag{2}\]  
In Equation (2), \(trunc(a,b)\) means to retain \(b\) digits after the decimal point for \(a\) (choosing to retain four digits after the decimal point and calculating the mapping relationship through the hash value), \(Int(*)\) represents taking the integer part of a decimal number, \(Hash(*)\) represents a function that converts an input of any length into a fixed length output, \(divmod(a,b)\) represents the quotient and remainder, where \(a\) is the divisor and \(b\) is the dividend and \(d_{m}\) represents the distance between the feature point with the number of digits retained after the decimal point and the virtual centroid coordinate point. For \(D_{m}\), the selection of the number of retained digits directly affects the robustness and imperceptibility of the watermark; the smaller the number of retained digits, the higher the watermark strength, but the weaker the imperceptibility.