## 2 Materials and Methods
### Data Processing
#### 2.3.4 Image Segmentation  
Based on our previous research, we opted to utilize MxEG for image segmentation [35]. For thresholding in the image segmentation process, we chose to employ [PERSON]'s thresholding method. [PERSON]'s algorithm is unaffected by image brightness and contrast and is computationally simple, making it one of the best choices for threshold selection in image segmentation [29]. The Otsu algorithm determines the optimal threshold value based on the grayscale characteristics of an image, maximizing the between-class variance between the target and background regions.  
The Otsu threshold is calculated by first stretching the image to a range of 0-255. The parameter \(p_{i}\) represents the probability of occurrence of pixel value \(i\) occurring. Suppose there exists a threshold \(k\) that divides the image into two classes \(C_{0}\) and \(C_{1}\), maximizing the inter-class variance \(\sigma^{2}\). \(C_{0}\) consists of pixels with levels [0,..., \(k\)], and \(C_{1}\) consists of pixels with levels [\(k+1\),..., 255]. Let \(p_{0}(k)\), \(p_{1}(k)\) represent the probabilities of \(C_{0}\) and \(C_{1}\), respectively. Similarly, let \(u_{0}(k)\), \(u_{1}(k)\) denote the means of \(C_{0}\) and \(C_{1}\).  
These values are given by:  
\[p_{0}(k)=\sum_{i=0}^{k}p_{i} \tag{9}\]  
\[p_{1}(k)=\sum_{i=k+1}^{255}p_{i}=1-p_{0}(k) \tag{10}\]  
\[u_{0}(k)=\sum_{i=0}^{k}\frac{ip_{i}}{p_{0}(k)} \tag{11}\]  
\[u_{1}(k)=\sum_{i=k+1}^{255}\frac{ip_{i}}{p_{1}(k)} \tag{12}\]  
The between-class variance \(\sigma^{2}(k)\) is given by:  
\[\sigma^{2}(k)=p_{0}(k){u_{0}}^{2}(k)+p_{1}(k){u_{1}}^{2}(k) \tag{13}\]  
When \(\sigma^{2}(k)\) reaches its maximum, \(k\) is the optimal threshold value:  
\[k=arg\max_{0<k\leq 255}\sigma^{2}(k) \tag{14}\]  
\begin{table}
\begin{tabular}{c c c c} \hline
**Index** & **Name** & **Definition** & **Reference** \\ \hline C9 & Color intensity index (INT) & (R + G + B)/3 & [34] \\ C10 & L* component of CIE L*a*b* color spaces & L* & \\ C11 & Modified excess green index (MExG) & 1.262G - 0.884R - 0.311B & [40] \\ C12 & Modified green-red vegetation index (MGRVI) & (G\({}^{2}-{\rm B}^{2}\))/(G\({}^{2}+{\rm B}^{2}\)) & [41] \\ C13 & Normalized blueness intensity (NBI) & B/(R + G + B) & [34] \\ C14 & Normalized difference index (NDI) & 128((G - R)/(G + R) + 1) & [42] \\ C15 & Normalized difference L*b* index (NDLIBI) & (L* - b*)/(L* + b*) & [43] \\ C16 & Normalized green-blue difference index (NGBDI) & (G - B)/(G + B) & [44] \\ C17 & Normalized greenness intensity (NGI) & G/(R + G + B) & [34] \\ C18 & Normalized redness intensity (NRI) & R/(R + G + B) & [34] \\ C19 & Red–green–blue vegetation index (RGBVI) & (G\({}^{2}-{\rm RB}\))/(G\({}^{2}+{\rm RB}\)) & [41] \\ C20 & Saturation (S) & S & \\ C21 & Value refers to the brightness of the color & V & \\ C22 & Visible atmosprically resistant index (VARI) & (G - R)/(G + R - B) & [45] \\ C23 & Vegetative index (VEG) & G/(R*B(1 - a)) & [46] \\ C24 & a* component of CIE L*a*b* color spaces & a* & \\ C25 & b* component of CIE L*a*b* color spaces & b* & \\ \hline \end{tabular}
\end{table}
Table 2: _Cont._The steps involved in this image segmentation are as follows.  
Step 1. MxEG values are used to replace the original image gray values. The new gray value histogram relative to the original image histogram has a more bimodal distribution and is suitable for the Otsu method.  
Step 2. The Otsu method is used to find the optimal segmentation threshold value.  
Step 3. UAV images are then divided into rice and background regions by the optimal threshold value.