## 2 Improvement of DPIV Algorithm
### Improved WIDIM Algorithm  
#### 2.2.1 ICP Algorithm  
In the WIDIM algorithm, typically, mismatched pixels exist in the large interrogation window in the initial iteration. Moreover, the vertical upward oil-water two-phase immiscible flow DPIV image contains more abundant gray information compared with single-phase flow images, including noise that results from uneven illumination. Hence, the displacement calculated by cross-correlation in the iteration tends to produce a large number of errors, especially in the initial iteration. These errors may be amplified many times in the subsequent iteration process, thereby affecting the deformation of the interrogation window and resulting in the reduction of the image matching rate. Therefore, it is necessary to take measures to improve the accuracy of the displacement field in the iteration. ICP is a type of point cloud data registration method that can achieve the accurate registration of large amounts of data [36]. The three-dimensional (3D) ICP is applied to 2D DPIV image registration simply by projecting the 2D gray image into 3D space, as shown in Figure 4. Compared with cross-correlation matching, ICP is less affected by noise [37]. Moreover, the plane rotation of oil droplets is taken into account in the registration process. Table 1 shows the comparison between ICP and cross-correlation algorithm applied on the 117 pixel \(\times\) 179 pixel image. Figure 3: Window deformation iterative multigrid (WIDIM) algorithm flow chart. The registration precision means the accuracy degree of the position of the first image's object in the second image obtained by algorithms, and that of ICP is higher than that of cross-correlation. Although its run-time is longer than cross-correlation's run-time due to the complicacy and expensive computation of ICP, we still use ICP in the subsequent PIV passes. Because the proposed approach is not meant to be used for real-time measurements. The ICP algorithm searches for the optimal transformation \(\mathbf{R}\), \(\mathbf{T}\) according to the nearest neighbor principle and minimizes the objective function repeatedly, thus conducting spatial matching for the two point sets. Given target point set \(p\), where the coordinate is \(\{p_{i}|p_{i}\in\mathbb{R}^{3}\), \(i=1,\,2,\,\ldots\,,\,N_{p}\}\). Given reference point set \(q\), where the coordinate is \(\{q_{i}|q_{i}\in\mathbb{R}^{3}\), \(i=1,\,2,\,\ldots\,,\,N_{q}\}\). The transform and target function [38], respectively, are  
\[\mathbf{q}_{i}^{\prime}=\mathbf{R}\mathbf{p}_{i}+\mathbf{T}, \tag{1}\]  
\[\theta=\sum_{i=1}^{N_{p}}\|\mathbf{q}_{i}-\mathbf{q}_{i}^{\prime}\|^{2}, \tag{2}\]  
where, \(\mathbf{R}\) and \(\mathbf{T}\) are the rotation matrix and translation vector, respectively. Singular value decomposition (SVD) is adopted to solve rotation matrix \(\mathbf{R}\) and translation vector \(\mathbf{T}\), and the point set \(p\) and \(q\) are transformed as follows  
\[\mathbf{P}_{i}=\mathbf{p}_{i}-\frac{1}{N_{p}}\sum_{j}^{N_{p}}\mathbf{p}_{j}, \tag{3}\]  
\[\mathbf{Q}_{i}=\mathbf{q}_{i}-\frac{1}{N_{p}}\sum_{j=1}^{N_{p}}\mathbf{q}_{j}. \tag{4}\]  
Then  
\[\mathbf{H}=\sum_{i=1}^{N_{p}}\mathbf{Q}_{i}\mathbf{P}_{i}^{\mathrm{T}}. \tag{5}\]  
SVD is performed for \(\mathbf{H}\):  
\[\mathbf{H}=\mathbf{\Phi}\mathbf{\Lambda}\mathbf{\Psi}^{\mathrm{T}}, \tag{6}\]  
where \(\mathbf{\Phi}\) and \(\mathbf{\Psi}\) are all unitary matrixes that contain left singular vector and right singular vector, respectively; \(\mathbf{\Lambda}\) is the singular matrix. Then the calculation formula of \(\mathbf{R}\) and \(\mathbf{T}\) are as follows  
\[\mathbf{R}=\mathbf{\Phi}\mathbf{\Psi}^{\mathrm{T}}, \tag{7}\] \begin{table}
\begin{tabular}{c c c} \hline \hline
**Algorithm** & **Run-Time** & **Registration Precision** \\ \hline ICP & 0.3315 s & 90.3\% \\ Cross-correlation & 0.1010 s & 84.2\% \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The comparison between ICP and normalized cross-correlation. Figure 4: A three-dimensional projection of a two-dimensional grayscale image.