Corn variety testing is a process to pick and cultivate a high yield, disease resistant and outstandingly adaptive variety from thousands of corn hybrid varieties. In this process, we have to do a large number of comparative tests, observation and measurement. The workload of this measurement is very huge, for the large number of varieties under test. The grain numbers of maize ear is an important parameter to the corn variety testing. At present, the grain counting is mostly done by manpower. In this way, both the deviation and workload is unacceptable. In this paper, an automatic counting method of maize ear grain is established basing on image processing. Image segmentation is the basis and classic difficult part of image processing. This paper presents an image pre-processing method, which is based on the characteristics of maize ear image. This method includes median filter to eliminate random noise, wallis filter to sharpen the image boundary and histogram enhancement. It also mainly introduces an in-depth study of Otsu algorithms. To overcome the problems of Otsu algorithm that background information being erroneously divided when object size is small. A new method based on traditional Otsu method is proposed, which combines the multi-threshold segmentation and RBGM gradient descent. The implementation of RBGM gradient descent leads to a remarkable improvement on the efficiency of multi-threshold segmentation which is generally an extremely time-consuming task. Our experimental evaluations on 25 sets of maize ear image datasets show that the proposed method can produce more competitive results on effectiveness and speed in comparison to the manpower. The grain counting accuracy of ear volume can reach to 96.8%.