# Detection and Localization of Overlapped Fruits Application in an Apple Harvesting Robot
## 5 Experiments
### Discussion  
This paper presents a localization method of overlapped apples based on maxima. First, convert the color space to Lab color space, and then perform K-means segmentation. Second, apple contours were obtained after some morphological processing. Third, a fast algorithm to calculate distance between two points was used to find the center. Finally, the corresponding radii were obtained by rotating vectors. Such positioning can be achieved. The experimental results show that this method can accurately and quickly locate apples. Therefore, it has certain practicality for the sorting robot system.  
Under the Lab color space, the overlapped apple targets can be effectively segmented by K-means clustering. After performing a series of morphological processing on the obtained divided overlapping apples, the extracted overlapping apple contours are completed. In this study, there was a large difference between apple fruit, leaves, sky, so \(K\) can be determined. The selection of and the initial clustering center will influence the segmentation results. However, in the practical application, \(K\) is difficult to estimate. If an inappropriate initial clustering center is selected, the results will be difficult to achieve. K-means clustering segmentation algorithm updates the clustering center by iterative operations, when it encounters big data, the calculation cost will be very large.  
When the overlapping round shadows are moderate and the edges are relatively complete, the process effect of maximum method is good, and it is superior to the Hough transform and the corrosion method in terms of accuracy and time consumption. So, the maximum method can satisfy the accuracy and real-time requirements of the harvesting robot. Although maximum method has obvious advantages, there are some defects. In the case of incomplete apple edges or large holes in the  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Image** & **Area Relative Errors** & **Center Errors** & **Runtime** \\ \hline Hough Transform & 35.267\% & 23.296 & 10.035 \\ Corrosion Method & 26.833\% & 27.185 & 1.619 \\ Maximum Method & 17.671\% & 18.767 & 0.806 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison of repeated tests  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Image** & **Hough Transform** & **Corrosion Method** & **Maximum Method** \\ \hline Experiment I & 11.123106 & 15.4404 & 7.4142 \\ Experiment II & 7.90361 & 71.7062 & 23.20526 \\ Experiment III & 18.2132 & 16.08319 & 14.375872 \\ Experiment IV & 18.0237 & 20.9736 & 18.2693 \\ Experiment V & 24.9359 & 27.5083 & 20.4479 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Apple’s center errors.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Image** & **Hough Transform** & **Corrosion Method** & **Maximum Method** \\ \hline Experiment I & 2.468 & 0.952 & 0.352 \\ Experiment II & 3.694 & 1.187 & 0.419 \\ Experiment III & 16.994 & 1.613 & 0.991 \\ Experiment IV & 28.733 & 1.844 & 1.425 \\ Experiment V & 8.18 & 1.243 & 0.702 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Runtime of the three methods.  
apple, it may lead to large errors and deviations, which may affect the incorrect positioning. Therefore, the image needs to be repaired and preprocessed, and then fitted.