Overlapping is a major problem for machine vision applications in agriculture. We present a robust marker-controlled watershed transform algorithm to automatically perform the accurate segmentation of overlapping plant fruits. The marker-controlled watershed algorithm mainly involves image preprocessing, marker extraction, and watershed transform. Marker extraction is the most important and difficult step of the whole process. Using K-means clustering, cut point decision making, spline interpolating, and morphological processing, markers can be detected automatically. Due to the good localization performance of detected markers, the accurate contour of separated fruits can be extracted by the watershed transform based on detected markers. The face validity of the segmentation algorithm is tested with a set of grape images, and segmentation results are overlaid onto original images for visual inspection. The algorithm is further evaluated by comparing segmentation results with a "gold standard" established by professional agronomists. Quantitative comparison shows that the segmentation algorithm can obtain very good spatial segmentation results. (c) 2009 Society of Photo-Optical Instrumentation Engineers. [DOI: 10.1117/1.3076212]