## 3 Materials and Methods
### WAI Reconstruction Algorithm Based on Finite Difference
#### 3.2.1 Sampling of WAI Normals  
The algorithm first takes advantage of the position information of the feature points of the structured light pattern to perform the quasi-periodic sampling of the wave surface to be measured. Figure 5 shows a simulation example of WAI sampling via structured light projection. Figure 5 is the preset structured light pattern, and Figure 5 is the projection on the water-air interface when the water surface is flat (note: in the daytime or moonlit night, no projection is formed on the water-air interface; a virtual image is introduced for the convenience of analysis). Given the system parameters, the location distribution of the WAI sampling points can be obtained using perspective projection transformation [32; 33; 34], as shown in Figure 5.  
Figure 4: Geometry of the image restoration model via structured light projection, comprising a structured light projection system \(S\) and an observing system \(V\), where component \(S\) includes a projector, diffuser plane and camera. The structured light pattern of blue-green stripes projected by the projector is reflected by the water surface, forming a distorted structured light image on the diffuser plane. This section solves the sampled normals of the WAI according to the relationship between the incident ray, the reflected ray and the normal vector. As shown in Figure 6, the global coordinate system is established with the projected center \(\mathbf{o}^{\text{pro}}\) as the origin, and the \(z\) axis denotes the height above the projector. \(\mathbf{p}_{k}\) is the 3D location of the arbitrary feature point on the structured light pattern to be projected, and the corresponding projected ray is reflected by the WAI, at 3D location \(\mathbf{q}_{k}\), and then the reflected ray irradiates a spot on the diffuser \(\prod^{\text{diffuser}}\), at 3D location. \(\hat{\mathbf{N}}_{k}\) is the corresponding WAI normal, and \(\mathbf{s}^{\prime}_{k}\) is the corresponding spot when the WAI is flat. The unit vector of projected ray \(\hat{\psi}_{k}^{\text{P}}\) is always known, given the preset structured light pattern. As shown in Figure 5c, the set \(\{\mathbf{q}_{k}\}\) represented as \(\left\{\mathbf{q}^{{}^{\prime}}_{k}\right\}\) is periodic when the WAI is still. Meanwhile, \(\{\mathbf{q}_{k}\}\) is quasi-periodic, having a perturbation to periodicity, when the WAI is wavy. Considering that the variations in the height of the water surface are small compared to the work depth of the system (\(\Delta h\ll h_{0}\)), we have  
\[\mathbf{q}_{k}\approx\left(q_{x},q_{y},h_{\,0}\right)=\mathbf{p}_{k}+(h_{\,0} /c_{k}^{\text{P}})\cdot\hat{\psi}_{k}^{\text{P}}, \tag{3}\]  
Figure 5: Examples of WAI sampling via structured light projection: (**a**) structured light pattern on the display element of the projector; (**b**) the virtual image formed on the water surface via structured light projection when the WAI is flat; (**c**) sampling point distribution of the WAI for flat water surface. Figure 6: The principle of sampling of WAI normals. where \(h_{0}\) is the system height, which is the average underwater depth of the projector. The value can be determined in the field, using a pressure-based depth gauge. \(c_{k}^{\mathrm{P}}\) is the propagation length of \(\hat{\mathbf{v}}_{k}^{\mathrm{P}}\) at the \(z\)-axis. Moreover, the 3D location of the spot \(\mathbf{s}_{k}\) can be extracted from the distorted structured light image. We adopt the corner detection algorithm of Reference [35] for feature extraction and matching. Therefore, the vector of reflected ray \(\hat{\mathbf{v}}_{k}\) is \(\hat{\mathbf{v}}_{k}=\mathbf{s}_{k}-\mathbf{q}_{k}/\|\mathbf{s}_{k}-\mathbf{ q}_{k}\|\). Using the vector form of the law of reflection at the water interface,  
\[\hat{\mathbf{v}}_{k}\times\hat{\mathbf{N}}_{k}=\hat{\mathbf{v}}_{k}^{\mathrm{ P}}\times\hat{\mathbf{N}}_{k}\Rightarrow\left(\hat{\mathbf{v}}_{k}^{\mathrm{P}}- \hat{\mathbf{v}}_{k}\right)\times\hat{\mathbf{N}}_{k}=0. \tag{4}\]  
Here, \(\times\) is the cross product.