## 2 Materials and Methods
### System's Software Programming and Workflow
#### 2.2.3 Plant Finding  
A series of procedures must be conducted to identify the plants (see also the flowchart in Figure 10):  
1. The initial step in the process is crucial as it involves determining the starting position of the carriage. To achieve this, the carriage is moved automatically to the far-right edge of the beam until the right end switch is activated. This position is then labeled as \"position zero\" (home position). 2. Subsequently, the user must have indicated the number of plants for identification. A plant counter is then established and employed to ascertain the number of procedural iterations that will be carried out. In instances where the number of plants remains constant (as is typically the case in practical scenarios, where a specific number of plants exist in a row), this step is omitted, and the number of plants remains unchanged. 3. The RGB camera that is utilized for plant recognition is then initialized. An image of \(W\times H:\ 1920\times 1080\) pixels is captured for further processing. 4. Since the RGB camera has a wide field of view (\(95^{\circ}\) diagonal), it is necessary to crop the image to ensure that only one plant (and potentially small segments of other plants) is present. This operation results in a square frame (cropped image) that features the same center as the original image. This not only helps in better focusing on a single plant, but also reduces the image processing time for the smaller image; the amount of cropping in pixels (a border with the same number for left and right sides as well as the up and down sides) can be determined by the user through dedicated buttons in the GUI (left side in Figure 9a). If \(CF_{w}\) denotes the amount of pixels for cropping the image on the left and right sides (width dimension), and similarly, if \(CF_{H}\) denotes the amount of pixels for the top and bottom sides (height dimension), the following relationship holds: \(CF_{w}-CF_{H}=420\). For example, to result in \(888\times 888\) pixel cropped images, \(CF_{w}=516\) and \(CF_{H}=96\) pixels, respectively. (In this study, the experiments were conducted using cropped images of dimensions \(360\times 360\) pixels and \(888\times 888\) pixels). 5. To filter out any high-frequency noise that may exist, a Gaussian blur (with \(11\times 11\) kernel size) is applied to the image. 6. The image is converted to HSV color space. 7. The automatic identification of the plant primarily relies on analyzing its color. To achieve this, users are required to predefine specific thresholds for the Hue (H), Saturation (S), and Value (V). These thresholds determine the range of colors that will be considered as the plant's color. In this process, the undesired colors are masked out, resulting in a black color in the empty space of the image. To facilitate this procedure, a dedicated menu called \"Color Picker\" has been incorporated into the graphical user interface (GUI). By pressing the \"Tweak Parameters\" button, the user can access the \"Color Picker\" window, where they can adjust the sliders to carefully select the appropriate upper and lower thresholds for the Hue, Saturation, and Value. This ensures that only the colors of the plant are retained, while all other colors are filtered out, leaving a black background. Through an empirical analysis, specific lower and upper thresholds were determined for the examination of lettuce. The chosen thresholds, which proved to be effective and remained unchanged for all the experiments in this study, are as follows: \(H\in[23,\ 84]\), Saturation \(S\in[30,\ 255]\), and \(V\in[70,\ 255]\). Another crucial setting is the exposure value, which can range from 0 to 255. The appropriate value should be selected based on the lighting conditions. In the current application, a value of 200 was chosen during the experiments, which remained unchanged too (the installed LEDs used for illumination proved to be sufficient during all experiments).