## 2 Materials and Methods
### Image Data Preprocessing  
To remove noise from the datasets, a preprocessing method was applied to the images to provide image segmentation, as shown in Figure 2. Image segmentation is a pivotal task in most computer vision applications, with significant improvements when integrated with deep learning. This process was performed to isolate the region of interest in the image, providing separation of the citrus leaf from the background. Since the ultimate goal of the proposed algorithm is to analyze images acquired in field conditions, it is highly relevant to reduce the prevalence of miscellaneous objects in the background that may cause false positives by increasing background noise. For this reason, a foundational open-source segmentation model, the Segment Anything Model (SAM) [44], was applied for image preprocessing. This SAM is a state-of-the-art instance segmentation model developed by Meta Platforms Inc.'s Fundamental AI Research (FAIR) lab, aiming to become a foundational model in the area of computer vision segmentation tasks upon which future segmentation models are developed. The model itself displays unrivaled precision in performing complex image segmentation tasks and has become the basis for newer segmentation models that aim to provide higher quality segmentation masks [45], provide nearly identical segmentation masks at a much lower computational cost [14; 46], with significantly smaller datasets [47]. In contrast, other models such as U-Net were considered for segmentation during the image preprocessing step. This model is widely used in the biomedical sector for image segmentation with effective pixel-level classification; however, it also requires significantly larger amounts of annotated datasets for model training. Furthermore, the U-Net model is known to have limitations under field conditions due to the unstructured environment; this may lead to major setbacks in future stages of the software development for end-user (growers) applicability. Therefore, based on this project's aims and the constraint of a limited number of datasets, a SAM proved to be  
Figure 1: Blueprint of the sample compartment design constructed using Onshape.  
a better alternative, achieving the desired segmentation and isolation of the region of interest during the preprocessing stage. SAMs provided high-quality segmentation at lower computational cost with smaller annotated datasets, which is particularly valuable to later stages with real-world images.  
Briefly, the preprocessing stage consisted of the applied model generation of multiple segmentation masks sorted by the prominence of the region of interest (Figure 2). Subsequently, the three most prominent masks were selected for further analysis. This model provided higher quality segmentation masks and nearly identical segmentation masks at a much lower computational cost. It is worth noting that the preliminary testing of the SAM on our dataset resulting in high-accuracy segmentation masks, considering the limited annotated data available. The model was deemed suitable for applications with no required additional fine-tuning, and thus suitable for integration into the algorithm with no further modification. Later image processing will be performed with a convolutional neural network (CNN) to provide a functional and competitive algorithm with the use of much lower computing resources.