# Estimation of Wind Turbine Blade Icing Volume Based on Binocular Vision
## 2 Principle and Method
### Volume Calculation  
To accurately assess the volume of the object, we employed a systematic approach that encompasses outlier detection and removal, interpolation to construct a 3D surface, and the final volume calculation. Firstly, to enhance data quality and analytical accuracy, we utilized an outlier detection method based on \(k\)-Nearest Neighbors (\(k\)-NN). For each data point \((x_{i},y_{i})\), it is necessary to determine its nearest neighbors in the plane. For the \(i\)-th point, we find its \(k\) nearest neighbors (excluding itself) in the plane, denoted as:  
\[\text{Neighbors}(i)=\{j\mid j\in\text{KNN}(i)\} \tag{15}\]  
where \(\text{KNN}(i)\) represents the indices of the \(k\) nearest neighbors of the \(i\)-th point. Neighbors\((i)\) is the set of neighbor point indices for the \(i\)-th point. Let \(z_{j}^{\prime}\) be the height value of neighbor point \(j\). To determine whether the current point is an outlier, we set athreshold \(\theta=2\). If the following condition is satisfied, the point is considered an outlier and is removed:  
\[|z_{i}^{\prime}-z_{\text{neighbors}}|>\theta\cdot\sigma_{\text{neighbors}} \tag{16}\]  
After data preprocessing, the next step is to construct the 3D surface. For this purpose, we applied a linear two-dimensional interpolation method to map the discrete point cloud data onto a regular grid. Firstly, we set \(N_{x}\) equally spaced nodes in the \(x\)-direction and \(N_{y}\) equally spaced nodes in the \(y\)-direction. The process of generating grid nodes includes determining the grid range, calculating step sizes, and generating grid nodes. Based on the \(x\) and \(y\) coordinate ranges of the point cloud data, we determine the minimum and maximum values of the interpolation grid and then calculate the step sizes \(\Delta x\) and \(\Delta y\) in the \(x\) and \(y\) directions:  
\[\Delta x=\frac{x_{\text{max}}-x_{\text{min}}}{N_{x}-1} \tag{17}\]  
\[\Delta y=\frac{y_{\text{max}}-y_{\text{min}}}{N_{y}-1} \tag{18}\]  
Equally spaced nodes are then generated in the \(x\) and \(y\) directions:  
\[x_{\text{grid}}=\{x_{\text{min}},\ x_{\text{min}}+\Delta x,\ \dots,\ x_{\text{ max}}\} \tag{19}\]  
\[y_{\text{grid}}=\{y_{\text{min}},\ y_{\text{min}}+\Delta y,\ \dots,\ y_{\text{ max}}\} \tag{20}\]  
Using the generated regular grid, we compute the height values \(Z\) at each node through linear interpolation. This process smoothly maps the discrete point cloud data onto the regular grid, constructing a continuous 3D surface model. After obtaining the 3D surface model, the next step is to calculate the object's volume. To improve the accuracy of the volume calculation, we employed numerical integration methods. By performing double integration over the region beneath the surface, we can capture subtle variations in the surface more accurately. The calculation formula is as follows:  
\[V=\iint\limits_{\Omega}Z(x,y)\,dx\,dy \tag{21}\]  
where \(\Omega\) is the projection area of the surface, and \(Z(x,y)\) is the height value of the interpolated surface at coordinate \((x,y)\). There are two specific implementation methods:  
1. Sum of Heights and Unit Area Method First, calculate the area of each grid cell \(S\): \[S=\Delta x\times\Delta y\] (22) Then, sum the height values \(Z_{i,j}\) of all grid points to obtain the total height \(H\): \[H=\sum\limits_{i=1}^{N_{x}}\sum\limits_{j=1}^{N_{y}}Z_{i,j}\] (23) Finally, the volume \(V\) is calculated as: \[V=H\times S\] (24)  
This method is simple to compute but may lead to larger errors when the grid density is low or the surface varies significantly. Trapezoidal Integration Method  
Using the trapz function for more accurate numerical integration. The calculation formula is:  
\[|z_{i}^{\prime}-z_{\text{neighbors}}|>\theta\cdot\sigma_{\text{neighbors}} \tag{16}\]0  
First, perform trapezoidal integration in the \(x\)-direction for each row to obtain the integration results of each row; then, perform trapezoidal integration in the \(y\)-direction on these results to obtain the total volume \(V\).