# Diagnosis by SAM Linked to Machine Vision Systems in Olive Fitting Machines
## 2 Materials and Methods
### MVS and DRRs  
The experiment was conducted at an olive pitting and packaging factory near Seville (Moron de la Frontera, Spain), where two CV systems [8; 9] were installed in parallel on different DRR machines, as it illustrates Figure 1. These systems were placed at a critical control point in the olive carrier chain, near the pitting area, where it is possible to detect the orientation in which the olives will be pitted [8; 9]. Previous studies have demonstrated that olive orientation is a key factor in predicting the occurrence of the boat error, which occurs when the awl meets the olive's minor axis in a parallel alignment [8].  
The CV system was installed on two different DRR pitting machines: a Sadrym Model 130 (Moron de la Frontera, Spain) short-arm pitting machine with a \(\frac{3}{4}\)-inch-wide feed chain, calibrated for Gordal olives with a nominal size of 80 olives/kg, and an OFM Model PSL51 (Moron de la Frontera, Spain) pitting machine [32], adjusted for Hojiblanca olives with a nominal size of 300 olives/kg.  
Figure 1: Schematic of the machine vision system (MVS) setup with its basic components. (Cam) optical sensor, (LS) LED system ring for illumination, (MS) magnetic sensor (synchronizes camera-LED triggering and data transmission), (TE) trigger electronics and (PC) Computer + Software (OpenCV/Qt-Creator). Sadrym 130 (Gordal) and OFM PSL51 (Hojiblanca) correspond to the DRR machines and the olive varieties being processed.  
The installation integrates a PVC adapter onto the carrier chain of each DRR machine, incorporating an optical sensor (camera) and a LED ring light positioned above for image acquisition (Figure 2). These components are triggered by an electronic pulse train generated by a magnetic sensor installed at track level, which detects the passage of each olive.  
The magnetic variation is stimulated by the movement of the transport buckets at a distance of 8 mm [9]. An electronic control unit coordinates the operation of all devices and manages data transmission, operating at 12V from a switched power supply (Figure 3) [9].  
The illumination system is arranged in a ring configuration to ensure uniform lighting, minimizing shadows, with a luminous flux of 900 lumens and a color temperature of approximately 3000 K. Both the lighting system and the camera operate at the processing speed of the machines (800-2500 olives/min), maintaining an operational threshold below their maximum capacity to prevent system failures or overheating. For instance, the lighting system functions at only 8-10% of its full capacity.  
Both installed CV systems differ only in the camera used for image acquisition, which were selected based on their ability to operate at high speed and their compact size. Additionally, either color or grayscale mode was chosen, resulting in two challenging case studies characterized by the absence of color contrast or low resolution. Oxidized black Gordal olives on a gray background are captured in color using a DFK 33 GV024 camera (The Imaging Source Europe GmbH, Bremen, Germany) [33], equipped with a 1/3'' MT9V024 CMOS sensor from ON Semiconductor Corporation, Phoenix, AZ, USA, capable of up to 100 fps, producing images with a resolution of 320 \(\times\) 240 pixels. The Hoijblanca case is handled with an SPS02 smart camera from Toshiba Teli Corporation, Hino, Tokyo, Japan [34], featuring a 1'' CMOS sensor operating in grayscale mode with a depth of 256 levels (1 byte), generating images of 176 \(\times\) 144 pixels. All images captured by both CV systems are automatically sent to a conventional PC running Windows 10.  
Figure 2: Basic schematic of the CV system installed during the process.  
Figure 4 presents examples of image capture for each variety during the pitting process.  
Figure 4: Oxidized black Gordal in color on a gray metallic background (**a**), pickled green Hojiblanca in B/W (**b**).  
Figure 3: Electronic control unit for CV system coordination and power distribution.