Using machine vision to accurately identify apple number on the tree is becoming the key supporting technology for orchard precision production management.For adapting to the complexity of the field environment in various detection situations,such as illumination changes,color variation,fruit overlap,and branches and leaves shading,a robust algorithm for detecting and counting apples based on their color and shape modes was proposed.Firstly,BP(back propagation)neural network was used to train apple color identification model.Accordingly the irrelevant background was removed by using the trained neural network model and the image only containing the apple color pixels was acquired.Then apple edge detection was carried out after morphological operations on the obtained image.Finally,the image was processed by using circle Hough transform algorithm,and apples were located with the help of calculating the center coordinates of each apple edge circle.The validation experimental results showed that the correlation coefficient of R2 between the proposed approaches based counting and manually counting reached 0.985.It illustrated that the proposed algorithm could be used to detect and count apples from apple trees’images taken in field environment with a high precision and strong anti-jamming feature.