Study on the Fruit Grading Recognition System Based on Machine Vision

The study proposed that the current development of fruit industry requires the fast and efficient methods to test the varieties of fruits, which can combine the image processing and computer machine vision technology together to be applied in the field of fruit varieties detection, so as to be consistent with this new trend. At present, the determination of these traits were mainly depended on visual grading and manual measurement, which existed the problems such as: slow speed, low accuracy and poor objectivity and so on.


INTRODUCTION
The annual output of fruit in China is ranked at the first place in the world, with a large number of varieties.Observing and making analysis on the morphology and size of the seeds is one of the important contents for analyzing the cultivating specificity, consistency, stability, DUS test, as well as breeding the new varieties.The commercialized processing of fruits can be included a series of skills such as cleaning after harvest, waxing, grading, packaging and other technical processing.Quality classification is the core link of the commercialized processing of fruits.
In recent years, with the development of computer image recognition and visual technologies becoming more mature, the ways of classification have developed from the weight grading and photoelectric grading to the development of computer vision grading, which means that classification can not only be classified according to the weight, but also can be according to the defects, color, shape, maturity and so on, so as to improve the processing quality and efficiency for classifying the fruits.With the development of classification technology, the international quality standard of fruits has been further improved and refined, therefore, study on the technology of computer vision, as well as its development with the accurate grading devices for classifying fruits can improve the commercial processing capacity of fruits, which is very important for Chinese fruit industry to improve the competitiveness in the international market.

The introduction of the principle of computer vision technology:
Computer vision technology is a discipline composed by optics, computer science, mathematics, image processing, pattern recognition and so on, which is a rapid non-destructive testing technology with multiple disciplines as well as the emerging of new intelligence.It is regarded as a promising evaluation method for evaluating food quality objectively.It is through the optical imaging sensor instead of the visual function of human eyes that can objectively obtain the image information of the tested food (Elster and Goodrum, 2001); then by using image processing technique to mine the information contained in the food as well as the characteristics of quality, adopting the pattern recognition algorithm, so as to establish the qualitative or quantitative detection model of quality information for food quality testing, grading, management and other information.Computer vision technology is mainly composed of two parts, namely, digital image acquisition and image processing.The digital image acquisition system is carried out by computer vision detection system, while computer vision detection system is generally composed by digital camera, lighting system, image acquisition card that is connected with the computer, as well light detection platform, etc. Lighting system includes light source and light setup platform.Common types of the light source are incandescent, fluorescent light, LEDs (Light Emitting Diodes), etc.General light setup platform mainly includes two types, namely, ring setup and scattering setup, the former is suitable for lighting the objects with the flat surfaces, while the latter is used for the objects that had surfaces with circular illumination.The light is from the light source, injecting the light to the surface of the measured food, then the result of the tested food surface as well as the information of the composition can be reflected by the reflected light into the imaging system of the digital camera, which can be converted into electrical signals afterwards.The commonly used camera sensors include Charge-Coupled Device (CCD) and Complementary Metal Oxide Semiconductor (CMOS).The electrical signals are stored in data format by using the image acquisition card with computer through converting, so as to put the information into the subsequent data analysis and image processing.The main components of image acquisition cards include signal conditioning components, A/D converter, the mapping table for pixel gray value (LUT), image buffer and the general interface of PCI, etc.If the function of digital image acquisition can be regarded as the observation function of the human eyes in artificial detection, then the digital image processing can play an important role in judging and thinking as same as human brain, which is an important part of computer vision technology.Generally speaking, computer image processing steps can include the following steps: image preprocessing, image segmentation, target detection, feature extraction and pattern recognition.
As early as, Rehkugler and Throop (1985) proposed to use black and white camera lens to have defect detection which is a kind of method based on image gray value (Goodrum and Elster, 1992).However, due to the fruit's surface is curved, the gray value of the image is decreased from the center of the fruit's surface to the edge of the fruit's surface, which is also affected by noise, size and shape and cannot use a single technique for the defect detection, moreover, it cannot be detected by pattern recognition on the quality evaluation, thus the degree of the detection accuracy is particularly low.Based on this, Yang proposed to use Snake Algorithm for closed defect separation, both of which reduced noise by the Median filter and Gauss filter and used thresholding method to deal with various defects (Jenshin et al., 2001).Although the degree of accuracy is improved greatly, it still cannot meet the commercial needs.Lee et al. (2008) and other staff use the color image detection method to detect the defect of fruit's surface: firstly, they calculated out the average value of color of the whole fruit's surface, then they calculated out the colorimetric values of each pixel as well as the variance and standard deviation of the colorimetric values of the entire surface, If the different value exceeded the limited value, the pixel is regarded to have defect; and then, by calculating the median value of the tri-color incentive value of RGB of each pixel, respectively, including the median value of all kinds of defects, compared with the median value of the fruit with good surface, making weighted deviation with the tri-color incentive value, so as to amend the above evaluation results; finally, with the help of the local color information again, it can revise the evaluation results.Tao et al. (2005) and some other staff have developed fruit defect detection system based on computer vision, which can achieve a rapid and comprehensive detection effect.In this system, firstly, the collected image data of the six fruits were separated and filtered the environment noise, then calculation on the defect of fruit's surface is carried out.In order to overcome the uneven light intensity problem caused by the fruit's curved surface, it adopted the method of transforming the detection to maximize the retention of the fruit's surface on any level, including the situation that the gray value of pixel is lower than the background (Chen et al., 2003) and then through the different to use different algorithms, so as to make effective compensation for light.

Identification process:
The identification process is to use the technology of image processing and computer vision for the identification of fruit's defect, which can be shown in Fig. 1.

Image analysis and processing:
The image format obtained from the tests is BMP, with the shadow color images 800×600 in size, in order to improve the speed of detecting the quality of fruit, which can also be conducive to the extraction of the fruit's features (Lee et al., 2008) First of all, converting the fruit's images obtained by the segmentation to the gray images; taking the starfruit as example, then using the iterative method to decide the domain value, get the threshold value is 55, then separating the fruit profile from the segmentation of the image, so as to get the binary images, smoothing the fruit image with 3×3 median filter, eliminating noise of the image; and then carrying on expansion processing, so as to get the final binary images; finally, extracting the external contour of the fruit (Fig. 2).
After the image processing and image preprocessing technology of removing the background, gray level transformation, median filter, threshold segmentation, region labeling as well as the extraction of features, etc., it can separate one defective area from the image of fruit and extract the geometric feature parameters of the defect area, so as to realization the discrimination of the defects of fruit.

Background removal:
The background of the image is black, which has great difference from the main region of the fruit in red, by means of segmentation, it can better remove the useless background (Brosnan and Sun, 2002).
The transformation of gray scale: Due to transmittance of the defective area is higher than that of the non-defective area, the acquired defective part of the original image becomes a bright line or becomes bright region in the scattering shape.In the picture of the gray scale, it is easier to distinguish between the defective part with the other regions of the fruit, thus, we convert the color images to the gray scale, which is easy to distinguish the defects, but also can improve the speed of image processing.Median filter: Because the main region of the image that is acquired from the structure of the fruit is similar with the defective region with color and shape, moreover, the background parts usually have some miscellaneous points, thus, by using median filter, it can eliminate all kinds of noisy sources and some false samples as well as edges or outlines caused by the interference.It can adopt the square 3×3 templates and carrying on the median filter two times.
Threshold segmentation: It can summarize the number of the pixels with the same gray level, then set up the gray histogram, through analysis, it can find out that the gray level on the right of the gray histogram, the gray level with the pixel accounted to 0.002 of the total number of pixels is the optimum threshold segmentation, after segmentation, the defective area is white area, while the background is black area.
Zonal marking: It can code the areas with different gray levels after segmentation, which is easy for the extraction of feature parameter of the regions (Tao et a1., 2005).The extraction of features: the feature extraction of the regional geometric parameters mainly includes five parameters, namely, the ratio of the area, area, long path, short path and the ratio between long path and short path.Through the pre-test analysis, these five parameters can comprehensively describe the defects (Blasco et al., 2003).The method for the extraction of parameter is: A: Area; the total sum of pixels; R: Ratio: R = 47tA/12, O≤R≤1, O is a straight line, 1 is a circularity, the perimeter (1) is the sum of distances between the adjacent pixels within the edge of the area; L: Long path; the long side of the outside of the smallest area within the bounding rectangle; S: Short path: the short side of the rectangular area in the smallest area within the bounding rectangle; LS: Long path/Short path.This step will mark the area and display the calculation of various parameters, due to the quality of the image will produce some noise, so this step will also extract the parameter in the noise area.

RESULTS AND DISCUSSION
The extraction and classification of the characteristic parameters of fruit's image: Based on the image processing of fruit, it can get the geometric characteristics parameters of the image in the defective area and noise areas.In the test, it collected 34 images of the defective fruits, each fruit is collected with two images, because a portion of the images do not contain the defective areas, so the total collection of the characteristics parameters is 59 groups with various defective areas, with the characteristics parameters of 396 groups in noise area.The noise area of the defective fruits and the noise area of the perfect fruits intact fruits produced are the same type, so it can be transformed into the defective areas and noise areas that can judge the images of the fruit.Through the statistical analysis, the distribution of the characteristics parameters of all noise areas and defective areas is as shown in Table 1.
From Table 1 we can see, the distribution of each individual parameter of noise area and defective area has no obvious difference, it is difficult to distinguish with the traditional methods.While the multi-layer structure of feed forward neural networks based on error back propagation can achieve arbitrary nonlinear mapping between the input and output, which is suitable for the classification of the complicated modes, with the function of generalization.

CONCLUSION
This study has a review on the development of the domestic application of computer vision technology in fruit quality inspection as well as the application of the grading system, it puts forward the model of classifying system with the high speed based on the computer image recognition.This model can detect fruits comprehensively with the external defects, color, size and shape, which can classify fruits comprehensively with high speed and precise classification, at the same time, the grading of fruits as well as the grading level can be arbitrarily adjusted according to the requirements of the users or the requirements of the market.

Fig
Fig. 1: The identification process of varieties

Table l :
Distribution of characteristic parameters for crack and noise areas