## 5 Result and Error Analysis  
The algorithm proposed in the paper is applied to the acquired ultrasonic underwater images to calculate the underwater two-dimensional flow field to verify the effectiveness of the algorithm. The original ultrasound particle image of \(640\times 480\) pixels is downsampled by 2:1 to obtain the image of the next layer. The bilinear interpolation method is used between adjacent layers to make the transition smoother. The obtained image sequence of the pyramid structure is shown in Figure 10.  
Figure 10: Pyramidal images of high concentration ultrasound images (3 layers). Figure 9: Comparison of optical images and ultrasound images. (**a**) Optical image of volume concentration of 3%; (**b**) Optical image of volume concentration of 10%; (**c**) Ultrasound image of volume concentration of 3%; (**d**) Optical image of volume concentration of 10%. The experimental results are measured by average angle error (AAE) and standard angle error (SAD). The average angle error is calculated as:  
\[\text{AAE}=\frac{1}{N}\sum_{i=1}^{N}\phi_{e}(i) \tag{31}\]  
where:  
\[\phi_{e}(i)=\arccos\left[\frac{u_{i}^{e}u_{i}^{e}+v_{i}^{e}v_{i}^{e}+k^{2}}{ \sqrt{\left(u_{i}^{e}\right)^{2}+\left(v_{i}^{e}\right)^{2}+k^{2}}\cdot\sqrt{ \left(u_{i}^{e}\right)^{2}+\left(v_{i}^{e}\right)^{2}+k^{2}}}\right] \tag{32}\]  
where \(N\) denotes the total number of pixels in a frame of ultrasound particle image, \((u_{i}^{e},v_{i}^{e})\) denotes the ground truth value of the velocity of the \(i\)th pixel, i.e., standard optical flow value, \((u_{i}^{e},v_{i}^{e})\) denotes the optical flow vector value of the \(i\)th pixel, and \(k\) denotes the number of frame intervals between images. \(\phi_{i}(i)\) denotes the angular error of the \(i\)th pixel, and AAE denotes the average angular error of the entire optical flow field. The average angular error reflects the deviation of the optical flow vector field calculated using the optical flow algorithm from the standard vector field. In the experiments, the frame interval \(k\) is set as 1, and the velocity measured by a high precision acoustic doppler velocimetry (ADV) is used as the standard optical flow value \(u_{i}^{e},v_{i}^{e}\), to evaluate the depth average flow velocity of the flow field obtained by the algorithm in the paper. Since the real underwater flow field is difficult to acquire, this verification is only used as a consistency verification. The standard angle error can be expressed as:  
\[\text{SAD}=\sqrt{\frac{1}{n}\sum_{i=1}^{n}(\phi_{e}(i)-\text{AAE})^{2}} \tag{33}\]  
The standard angular error reflects the fluctuation of AAE in the calculated optical flow vector field. The performance of Pyramid L-K optical flow and the traditional algorithm, Cross-Correlation algorithm, are compared horizontally to further validate the performance of the proposed algorithm. The experiments choose a high concentration ultrasonic particle image sequence of 50 consecutive frames of ultrasonic particle images with a volume concentration of 10% and a flow rate of 25 cm/s for experimental analysis, as shown in Figure 11, to acquire a time-averaged flow field. The experiments are conducted with typical templates with sizes of 32 \(\times\) 32, 48 \(\times\) 48, and 64 \(\times\) 64 pixels are selected for matching in the template matching-based mutual correlation algorithm with window deformation technique [4]. The number of stratifications of 0, 1, and 2 are selected for comparative analysis in the Pyramid L-K optical flow-based algorithm, as shown in Table 1. Figure 12(a1,b1) shows the velocity field obtained using the Pyramid L-K optical flow, Cross-Correlation algorithm, and Figure 12(a2,b2) shows the velocity cloud maps corresponding to the velocity fields.