## 5 Results
### Grape Cluster Size Segmentation Results
The next bloc of rows show the results obtained with the LCM segmentation, which provides better cluster size estimations results in the RGB color space (20.07% error) rather than the HSV (62.59% error), although the application of a sequence of morphological operators greatly reduces the cluster size estimation error up to 10.99% and 14.78%, respectively. The optimal sequence of morphological operators applied was: five dilations (5D), five erosions (5E) and a hole filling (HF) in the RGB color space; and three dilations (3D), four erosions (4E) and a hole filling (HF) in the HSV color space. The LCM segmentation method was originally proposed to model color relationships in the RGB color space, and it is expected to have the best segmentation performances in this color space. The drawback of the LCM method is the accurate manual selection of several representative templates during the tuning stage in order to describe the color variability of grapes and the other objects considered as part of the background. Finally, the histogram segmentation (Hist. Segm. in Table 1) technique generates similar segmentation results and similar cluster size estimations in the RGB color space (18.80%, improved up to 13.37% when applying morphological operators) and in the HSV color space (17.81%, improved up to 12.27%). In both cases, the resulting three-dimensional histogram was computed with 128 histogram bins per layer, dilated with a solid sphere with a radius, r, of six bins in the RGB color space and nine bins in the case of the HSV color space. These radii were obtained by a trial and error procedure during the tuning stage. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & & & & & **Average Grape Cluster Area Error** \\  & & & & & **(40 Images/97 Clusters of Grapes)** \\ \hline \multirow{3}{*}{**Method**} & **Color** & \multirow{3}{*}{**Parameters**} & **Clusters** & \multirow{3}{*}{**Segm.**} & **Segm. + Morph.** & **Morphological** \\  & **Space** & & **Detected** & & **Filter** & **Filter** * \\ \hline \multirow{6}{*}{**Method**} & R & R \(>\) 0.35294 & 100\% & 59.67\% & 62.54\% & 6E + 4D + HF \\ \cline{2-7}  & G & G \(>\) 0.29412 & 100\% & 87.87\% & 95.61\% & 8E + 2D + HF \\ \cline{2-7}  & B & B \(>\) 0.29804 & 100\% & 57.00\% & 55.00\% & 4E + 6D + HF \\ \cline{2-7}  & Gray & I \(>\) 0.30588 & 100\% & 74.06\% & 80.00\% & 7E + 3D + HF \\ \cline{2-7}  & H & H \(>\) 0.54902 & 100\% & **13.55\%** & **10.01\%** & HF + 4E + 4D \\ \hline \multirow{6}{*}{**Method**} & RGB & - & 100\% & 17.36\% & 13.29\% & 4E + 4D + HF \\ \cline{2-7}  & HSV & - & 100\% & 16.05\% & 10.50\% & 3E + 3D + HF \\ \cline{2-7}  & RGB & 43.36\%/56.64\% & 100\% & 19.29\% & 13.24\% & 5D + 5E + HF \\ \cline{2-7}  & HSV & 43.36\%/56.64\% & 100\% & 17.97\% & 10.29\% & 3D + 4E + HF \\ \hline \multirow{6}{*}{**Method**} & RGB & - & 100\% & 20.07\% & 10.99\% & 5D + 5E + HF \\ \cline{2-7}  & HSV & - & 100\% & 62.59\% & 14.78\% & 3D + 4E + HF \\ \cline{2-7}  & RGB & \(r=\) 6 & 100\% & 18.80\% & 13.37\% & 3E + 3D + HF \\ \cline{2-7}  & HSV & \(r=\) 9 & 100\% & 17.81\% & 12.27\% & 3E + 3D + HF \\ \hline \hline \end{tabular}
* Morphological operators: E, erosion; D, dilation; HF, hole filling.  
\end{table} 
Table 1: Grape cluster size segmentation results obtained in the case of no occlusion. In general, small differences in the numerical errors obtained with the methods compared have a large impact on the accuracy of the segmentation, because the large size of the images analyzed smoothes the differences in the perimeter of the cluster of grapes. The lowest difference between the areas of the cluster of grapes (automatic segmentation compared to manual labeling) was 13.55% in the case of applying a threshold level to the \(\mathrm{H}\) color layer, and this error was improved up to 10.01% when applying an optimal sequence of morphological operators.