Segmentation is one of the main steps in image processing, as it influences the accuracy of other processes such as feature selection and classification. In this study, an effective method based on a combined image processing and machine learning was presented and evaluated for segmenting almond images with different classes such as normal almond, broken and split almond, shell of almond, wrinkled almond and doubles or twins almond. One of the major difficulties encountered in segmenting almonds was the existence of shadow on the background of the acquired images. Another difficulty was separating almonds with various shapes and colors from input images. To implement an effective algorithm, initially a suitable set of color features was extracted from the images. Then, sensitivity analysis was used to select the best features. Finally, artificial neural networks (ANNs) were adopted to classify the images into three categories, namely, object, shadow and background. The optimum ANN classifier had a 8-5-3 structure, i.e., it was consisted of an input layer with eight input variables, one hidden layer with five neurons and three neurons as output. To evaluate the performance of the proposed method, the results of our optimum ANN model were compared with Otsu, dynamic thresholding and watershed methods. The mean values of sensitivity, specificity and accuracy for object class (detected almonds from images) achieved by using the proposed method were 96.88, 99.21 and 98.82, respectively . It gave a better accuracy than the mentioned methods. In addition, the proposed method was able to separate the almonds from the background and shadows more efficiently. The processing time of the proposed method was 1.35 s which makes it possible for real time applications.