4.3 Execution time for the Algorithm Table 4-5 shows the average execution time of ten executions for each image-processing step. Conversion from RGB to HSI color space took a maj or segment of the execution time (65.9 %), since the algorithm needed to compute 640 x 480 pixels for an image. Binarization was carried out using software that consisted of checking hue, saturation, and luminance gray levels of each pixel value with the threshold and classifying accordingly. Table 4-5. Execution time for each image processing tp Image processing step Avg. Execution time (ms) Percent of total time (%) Conversion from RGB to HSI 78.8 65.9 Binarization 28.4 23.8 Remove noise 6.3 5.3 Fill gaps 3.8 3.2 Extract features and count fruits 2.1 1.8 Total time 119.5 100.0 The execution time for binarization could be reduced considerably, if it was carried out in hardware. The time for initialization was also measured and it was 80 ms. Average execution time including all steps was 119.5 ms. During real time Hield-testing, image acquisition time needs to be added. 4.4 Encoder Calibration The encoder was calibrated in the grove before the Hield-testing of the algorithm. The truck was driven for predefined distances three times and the average of the number of pulses generated by the encoder was used as the reference number of pulses for each distance. Data for the encoder calibration is shown in Table 4-6. A regression analysis was conducted over the pulses generated by the encoder for different trials, Figure 4-12. The R2 Value for the regression analysis was 0.99.