2017 2nd International Conference on Information Technology and Industrial Automation (ICITIA 2017) ISBN: 978-1-60595-469-1

Inspection for Grapefruit’s Shape Based on

Image Processing Technology

Dongtao Yang, Jiexian Huang, Yueming Hu and Tiansheng Hong

ABSTRACT

Grapefruit’s shape is a most important characteristic which effects Grapefruit’s classification directly. In order to realize inspection for Grapefruit’s shape, the algorithm of Sobel is firstly implemented in extracting Grapefruit’s contour. And then calculate directional angle of all the pixel on contour. On the basis of that, the function of Grapefruit’s shape difference is established to quantize shape’s difference between Grapefruits. The ineligible Grapefruit’s shape is distinguished through setting shape’s difference threshold. The final experiment prove its effectiveness, Grapefruit’s shape inspecting accuracy rate reach 92.24%. The algorithm not only has advantage of practicality, generality and convenience but also is significant for academic research.

INTRODUCTION

Grapefruit is rich in organic acids, vitamins and calcium, phosphorus, magnesium, sodium and other essential elements of the human body. It is also sweet, delicious, nutritious and easy for storage, which is also called natural canned

______Dongtao Yang, a senior experimentalist in School of Electronic Information Engineering, Jiaying University, , , China. She is currently visiting scholar in School of Automation Science and engineering, South China University of Technology, , China. Jiexian Huang, corresponding author, is currently a lecturer in School of Electronic Information Engineering, Jiaying University, Meizhou, Guangdong, China. This research is funded by Guangdong provincial organization department, Guangdong province 2014 sail plan support, postdoctor support program and Meizhou industrial technology research and development fund with grant number 201415.

34 fruit. Meizhou is a most important production base. In 2013, grapefruit planting area is more than 29,000 acres in Meizhou, and production reached 600,000 tons that is worth 2 billion yuan. The shape is one of most important quality index for Grapefruit, which affects grapefruit's classification [1-3]. So inspecting grapefruit's shape is necessary and very important work. The technology of machine vision is always applied to fruit shape inspection, such as apple, grape, orange, tomato inspecting device [4-7]. The inspecting method has advantage of high efficiency, accuracy and harmless damage to surface. It is very fit for production lines. As the above inspecting method is used for grapefruit's inspection, the inspecting result is unpleasant. The reason is that shape's inspection is realized by matching circularity of target. However, the grapefruit is not circular object, is similar to gourd. That brings difficulty to inspection. The information of grapefruit can be achieved by means of measuring horizontal and vertical diameter. Only horizontal and vertical diameters are not adequate to describe grapefruit's shape. And grapefruit should be arranged by guiding device firstly before inspection. The technology of binocular vision is applied to achieving three dimensional information of grapefruit. Although three dimensional data is comprehensive and complete, which can describe grapefruit's surface and shape delicately [8-10], the inspecting method costs large computation and consumes mass calculating resource. That affects inspecting efficiency seriously. So the processing object in my research is still two dimensional image, which ensure real-time performance. In this paper a new inspecting algorithm is developed, the detailed inspecting content includes such several work, grapefruit contour is extracted firstly, and pixel's directional angle on contour is calculated in succession. On the basis of the above work, the shape similar function is established, which is used to quantify difference between standard grapefruit and inspecting one. The unqualified grapefruit can be detected by mean of setting threshold according to similar function. The final experiment prove effectiveness of the inspecting algorithm.

FEATURE EXTRACTION BASED ON TEXTURE GRADIENT

The grapefruit image is shown in figure 1(a). The contour is extracted by algorithm of sobel [11]. The expression of sobel is defined by expression (2).

G f( x  1, y  1)  2 f ( x , y  1)  f ( x  1, y  1)  Y    f( x 1, y  1)  2 f ( x , y  1)  f ( x  1, y  1) G[ f ( x  1, y  1)  2 f ( x  1, y )  f ( x  1, y  1)]  X (1) [f ( x 1, y  1)  2 f ( x  1, y )  f ( x  1, y  1)]

22 C(,) u v GXY G (2)

35

(a) grapefruit (b) contour (c) 3-D distribution of gradient Figure 1. Grapefruit’s contour feature extraction.

Apply expression (2) to grapefruit image. And the image gradient can be obtained. The distribution of gradient in three dimensional space is shown in figure 1(c).The gradient around contour is obviously greater than other region. So set gradient threshold, and all contour can be segmented which is shown in figure1 (b).

ACHIEVEMENT OF GRAPEFRUIT CONTOUR PIXEL DIRECTIONAL ANGLE

Although contour is located, the only position information is not enough for shape inspection. More information is requested. The directional angle of all contour pixel is calculated through expression (3).

G   tan 1 Y G , X  (0  90  ) (3)

Take circular object for example, using the above method, directional angle of contour pixel is achieved. If pixel lies in the bottom or top region, the angle is nearly 90°. And angle is nearly 0°as pixel lies in left and right region. The figure 2(c) is distribution of circle contour pixel directional angle in three dimensional space. In figure2(c), X-axis, Y-axis are horizontal and longitudinal ordinates respectively. Z- axis indicates directional angle [12].

36

(a) circle (b) directional angle (c) 3-D exibition on directional angle Figure 2. Directional angle on circular target’s contour.

The three dimensional distribution of grapefruit contour pixel directional angle can also be achieved through above way, which is shown in figure 3.

Figure 3. Directional angle of Grapefruit’s contour in three dimensional space.

ANALYSIS ON GRAPEFRUIT CONTOUR SIMILARITY

Select a standard grapefruit that is shown in figure 4(a), locate the grapefruit's left and right contour respectively, and archive their pixel directional angle in order from top to bottom. Describe shape through drawing directional angle curve, which is shown in figure 4(b) and figure 4(d).

37

Figure 4. Analysis on referent Grapefruit’s contour. Figure 5. Grapefruit’s contour analysis 1.

Select three grapefruit samples, one is eligible, the other two are ineligible, draw their directional angle curve, which is shown in figures 5-7.

Figure 6. Grapefruit’s contour analysis 2. Figure 7. Grapefruit’s contour analysis 3.

To quantify difference between referent shape and inspecting shape, the function is defined by expression (4). The bigger the value is, the greater the shape difference is.

N 2 ()RMii Dif  i1 (4) N

38 The qualifying result of grapefruit shape's difference is as follow. The eligible sample, in figure 5, shape difference value on left and right contour is 5.62, 6.00 respectively. One ineligible sample, in figure 6, the shape difference value on left and right contour is 9.85, 10.82. Another ineligible sample is 12.40, 10.60. The quantifying result is pleasant. In order to prove effectiveness of above the method, select 30 grapefruit sample, 10 of them are eligible, the others are ineligible. 30 groups of data, 60 data in all are achieved. The distribution is shown in figure 8, In figure 8, X-axis is sample ID, Y-axis is shape difference value, the flag ‘o’ indicate eligible sample, the flag ‘*’ indicate ineligible sample.

Figure 8. The distribution on Grapefruit’s contour.

EXPERIMENT OF GRAPEFRUIT SHAPE INSPECTION

During grapefruit shape inspecting experiment, there are several key performance indicators. The first is accuracy rate, which means ratio of accurate inspecting result. The second is error rate, which means mistaking eligible to ineligible. The third is missed rate, which means mistaking ineligible to eligible [13]. There are 232 grapefruit sample in total for test.50 of them are ineligible sample. The flow char of inspecting program is shown as Figure 9. The inspecting result is shown as TABLE I.

39

Figure 8. The distribution on Grapefruit’s contour.

TABLE I. EXPERIMENTAL. Total Ineligible Error Missed Accurate Error Missing sample sample detection detection rate Rate Rate (%) (%) (%) 232 50 18 0 92.4

As shown in the TABLE I, all ineligible grapefruit are detected, the accuracy rate can reach 92.24%. The inspecting result is pleasant.

CONCLUSION AND ANALYSIS

In this paper, an inspecting method for grapefruit shape is proposed. Grapefruit contour is extracted, its pixel directional angle is achieved, and shape inspection is

40 realized by comparing angle with reference. And the final experimental result proves its effectiveness. Through further analysis, the proposed inspecting algorithm has also advantage of generality and ease of use. The inspecting method is not only applicable for grapefruit but also for other fruit. Besides, the inspecting method is very easy to operate, only achieving standard grapefruit contour pixel directional angle is enough to start inspecting work without tedious operation. As shown in TABLE I, all ineligible grapefruit are detected, the accuracy can reach 92.24%. The inspecting result is pleasant.

REFERENCES

1. Zhang Jun-xiong, Xun Yi, Li Wei, et a1. Double-channel on-line automatic fruit grading system based on computer vision[C]//27th International Congress on High-speed Photography and Photonics, Proc. of SPIE Vo1.6279, Xi’an, China, 2006:17-22. 2. Bai Fei, Meng Chaoying. Research progress and commercialization of the automatic classification technology [J]. Food Science, 2005, 26(Supp.): 145-148. 3. Zheng Guan-nan, Tan Yu-zhi, Zhang Jun-xiong, et a1. Automatic detecting and grading method of potatoes with computer vision [J]. Transactions of the Chinese Society. 4. Luo Guo-guang. Historic task for China's viticulture: transformation from quantity focused pattern to quality oriented one[J]. Journal of Fruit Science, 2010, 27(3): 431-435. 5. Lu Wei-qi, Guo Yong-hong. A nondestructive detection method to distinguish different kinds of grapes[J]. Journal of China University of Metrology, 2012, 23(1):20-24. 6. Hu Fa-huan, Dong Zeng-wen, Kuang Yi-shun. Online navel orange grading detection system based on machine vision [J]. Journal of China Agricultural University, 2016,21(3):112-118. 7. Li Li, Yin Guo-Fu, Liu Ke-qi. Design and Experiments of Vision Sensor for Harvest Robots in Field[J]. Transactions of The Chinese Society of Agricultural Machinery, 2010,41(5):152-157. 8. Li C, Gao H Y, Yuan C. Research on apple grading method based on computer [J]. Computer simulation. 2012, 29(9):293-296. 9. Yun Shuang, Zhang Qiu-ju. A Method of Recognizing the Grapefruit Axial Orientation by Binocular Vision[J]. Journal of Jiangnan University (Natural Science Edition). 2012,11(1):33-37. 10. Zhou Jun, Liu Rui, Zhang Gao-yang. Design of Fruit Harvesting Robot Based on Stereo Vision [J]. Transactions of the Chinese Society of Agricultural Machinery, 2010, 41(6):158-162. 11. Vesna Z K, Pavel P. Automatic object classification and image retrieval by sobel edge detection and latent sematic methods [J]. Social and Telecommunications Engineer, 2012, 79(3):204-205. 12. Feng Ye, Di Li, Jiexian Huang, et al. Flaw detection on FPC solder surface [J]. Circuit World, 2012, 38 (3):142-152. 13. DM Tsai, BT Lin. Defect Detection of Gold-Plated Surfaces on PCBs Using Entropy Measures[J].The International Journal of Advanced Manufacturing Technology, 2002, 20(6):420-428.

41