A new image analysis algorithm based on mathematical morphology and pixel classification for grapevine berry counting is presented in this paper. First, a set of berry candidates represented by connected components was extracted. Then, six descriptors were calculated using key features of these components, and were employed for false positive (FP) discrimination using a supervised approach. More specifically, the set of descriptors modelled the grapes' distinctive shape, light reflection pattern and colour. Two classifiers were tested, a three-layer neural network and an optimised support vector machine. A dataset of 152 images was acquired with a low-cost smart phone camera. Images came from seven grapevine varieties, 18 per variety, at the two phenological stages in the Baggiolini scale between berry set (named stage K; 94 images) and cluster-closure (named stage L; 32 images). 126 of these images were kept for external validation and the remaining 26 were used for training (12 at stage L and 14 at K). From these training images, 5438 true/false positive samples were generated and labelled in terms of the six descriptors. The neural network performed better than the support vector machine, yielding consistent Recall and Precision average values of 0.9572 and 0.8705, respectively. The presented algorithm, implemented as a smartphone application, can constitute a useful diagnosis tool for the in-the-field and non-destructive yield prediction and berry set assessing for the grape and wine industry. (C) 2017 IAgrE. Published by Elsevier Ltd. All rights reserved.