Design and development of a machine vision system to determine the apparent apple imperfections

Document Type : Research Article


1 MSc student, Mechanics of Biosystems Engineering Department, Faculty of Agricultural Engineering and Rural Development, Khuzestan Agricultural Sciences and Natural Resources of University.

2 Assistant professor of Mechanics of Biosystems Engineering Department, Faculty of Agricultural Engineering and Rural Development, Khuzestan Agricultural Sciences and Natural Resources University

3 Graduated MSc, Mechanics of Biosystems Engineering Department, Faculty of Agricultural Engineering and Rural Development, Khuzestan Agricultural Sciences and Natural Resources University.


The machine vision system is one of the newest systems for identifying the quality of agricultural products. Apple is one of the fruits whose apparent quality used by customer to select this product at the market. Automatic detection of faulty apples through the machine's visual system is difficult due to the non-uniform of distribution of on the surface and the similarity between actual defects with the color changes of the fruit peel. For this purpose, in this study, a new method for detecting apparent defects of apple using a machine vision system with a combination of auto-correction of light was presented. In order to classify the samples, the histogram of the taken images was corrected based on the RGB method, then three-color and 11 textural features were extracted. Based on the results of the feature selection, the best features for the highest accuracy in the classification were respectively entropy, energy, correlation and local smooth. Finally, for categorization of data, two classifiers namely relevance vector machine (RVM) and support vector machine (SVM) were used. Based on the classification results, the accuracy of the RVM classification was 95% in the sound group, 82% in the unsound group and 88.5% in for total accuracy; but the accuracy of the SVM classification was 100% in the sound group, 94.23% in the unsound group and 97.11% for total accuracy. Therefore, in order to detect sound samples from unsound ones the SVM classification is more suitable than the RVM, due to the greater accuracy and less error.

Graphical Abstract

Design and development of a machine vision system  to determine the apparent apple imperfections


  • Image processing was used to detect the appearance defective of apples.
  • The histogram of the images was corrected based on a suggested linear combination of RGB color space.
  • To classify the data, RVM and SVM were used and 88.5% and 97.11% accuracy were obtained, respectively.


Main Subjects

[1]     Zhang, B., Huang, W., Li, J., Zhao, C., Fan, S., Wu, J., Liu, C. (2014a). Principles, developments and applications of computer vision for external quality inspection of fruits and vegetables: a review. Food Res. Int. 62, 326–343.
[2]     Xiao-bo, Z., Jie-wen, Z., Yanxiao, L., Holmes, M. (2010). In-line detection of apple defects using three color cameras system. Comput. Electron. Agric. 70, 129–134.
[3]     Pathare, P.B., Opara, U.L., Al-Said, F.A.-J. (2013). Colour measurement and analysis in fresh and processed foods: a review. Food Bioprocess Technol. 6, 36–60.
[4]     Qin, J., Burks, T.F., Zhao, X., Niphadkar, N., Ritenour, M.A. (2012). Development of a two-band spectral imaging system for real-time citrus canker detection. J. Food Eng. 108, 87–93.
[5]     Patel, K.K., Kar, A., Jha, S., Khan, M. (2012). Machine vision system: a tool for quality inspection of food and agricultural products. J. Food Sci. Technol. 49, 123–141.
[6]     Zhang, B.H., Huang, W.Q., Li, J.B., Zhao, C.J., Liu, C.L., Huang, D.F. (2013). Detection of bruises and early decay in apples using hyperspectral imaging and PCA. Infrared Laser Eng. 42, 5.
[7]    نداف زاده، مریم. آبدانان مهدی زاده، سامان. (1395) تعیین زمان بهینه پخت سبزیجات با کمک پردازش تصاویر دیجیتالی و اندازه گیری مختصات رنگی. فناوری‌های نوین غذایی، جلد 3، شماره 11، ص 49-57.
[8]    حسینی، سید مهدی. جعفری، عبدالعباس. حمزه زرقانی، حبیب الله. تاتار، احسان. (1392) تشخیص بیماری لکه موجی در گوجه­فرنگی با استفاده از ماشین بینایی جهت اعمال سمپاشی نقطه­ای. هشتمین کنگره ملی مهندسی ماشین­های کشاورزی (بیوسیستم) و مکانیزاسیون دانشگاه فردوسی مشهد. ص 981-970.
[9]     Cubero, S., Aleixos, N., Molto, E., Gomez-Sanchis, J., Blasco, J. (2011). Advances in machine vision applications for automatic inspection and quality evaluation of fruits and vegetables. Food Bioprocess Technol. 4, 487–504.
[10] Kleynen, O., Leemans, V., Destain, M.-F. (2005). Development of a multi-spectral vision system for the detection of defects on apples. J. Food Eng. 69, 41–49.
[11]  اورک, هادی, آبدانان مهدی زاده, سامان. (1396) تشخیص و جداسازی گره و میانگره در ساقه‌های نیشکر به صورت برخط با کمک بینایی ماشین. مهندسی بیوسیستم ایران، جلد 48، شماره 2، ص 263-272.
[12] Unay, D., Gosselin, B., Kleynen, O., Leemans, V., Destain, M.-F., Debeir, O. (2011). Automatic grading of bi-colored apples by multispectral machine vision. Comput. Electron. Agric. 75, 204–212.
[13] Li, J., Rao, X., Wang, F., Wu, W., Ying, Y. (2013). Automatic detection of common surface defects on oranges using combined lighting transform and image ratio methods. Postharvest Biol. Technol. 82, 59–69.
[14] Bennedsen, B., Peterson, D. (2005). Performance of a system for apple surface defect identification in near-infrared images. Biosyst. Eng. 90, 419–431.
[15] Gomez-Sanchis, J., Molto, E., Camps-Valls, G., Gomez-Chova, L., Aleixos, N., Blasco, J. (2008). Automatic correction of the effects of the light source on spherical objects. An application to the analysis of hyperspectral images of citrus fruits. J. Food Eng. 85, 191–200.
[16] Huang, W., Li, J., Zhang, C., Li, B., Chen, L., Zhang, B. (2012). Detection of surface defects on fruits using spherical intensity transformation. Nongye Jixie Xuebao (Trans. Chinese Soc. Agric. Mach.) 43, 187–191.
[17] Aleixos, N., Blasco, J., Navarron, F., Molto, E. (2002). Multispectral inspection of citrus in real-time using machine vision and digital signal processors. Comput. Electron. Agric. 33, 121–137.
[18] Papadakis, K.S.E., Abdul-Malek, S., Kamdem, R.E., Yam, K.L. (2000). A versatile and inexpensive technique for measuring color of foods. Food Technol. 54, 48–51.
[19] Blasco, J., Molto, E. (2002). Identification of defects in citrus using multispectral imaging. In: International Conference on Agricultural Engineering. AgEng 02, Budapest, Hungary: EurAgEng Paper No. 02-AE-031.
[20] آبدانان مهدی­زاده، سامان. سلطانی کاظمی، مریم. (1396) ساخت، توسعه و ارزیابی سامانه جداکننده‏ توت فرنگی با استفاده از تکنولوژی بینایی ماشین. پژوهش­های مکانیک ماشین­های کشاورزی، جلد 6، شماره 1، ص31-44.
[21] Robnik-Sikonja, M., Kononenko, I. (2003). Theoretical and empirical analysis of ReliefF and RReliefF. Machine learning. 53, 23-69.
[22] Zheng, Y., Zhu, Q., Huang, M., Guo, Y., Qin, J. (2015). Maize and weed classification using color indices with support vector data description in outdoor fields. Computers and Electronics in Agriculture, 141, 215-222.
[23] Aghnabati, A. (2004). Geology of Iran. Geological Survey of Iran, Tehran. 586.
[24] Adankon, M.M., Cheriet, M. (2009).  Model selection for the LS-SVM application to handwriting recognition. Pattern Recognition. 42, 3264–3270.
[25] Karimi, Y., Prasher, S. O., Patel, R. M., Kim, S. H. (2006). Application of support vector machine technology for weed and nitrogen stress detection in corn. Computers and Electronics in Agriculture. 51, 99–109.
[26]  آبدانان مهدی­زاده، سامان. (1395) تشخیص ترک در پوسته تخم مرغ با استفاده از PCA و SVM. مجله علوم و صنایع غذایی، جلد 56، شماره  13، ص 143-153.
[27] Lin, Y. L., Wei, G. (2005). Speech emotion recognition based on HMM and SVM. In Machine Learning and Cybernetics, 2005. Proceedings of 2005 International Conference on (Vol. 8, pp. 4898-4901). IEEE.‏
[28] Demir, B., Erturk, S. (2007). Hyperspectral image classification using relevance vector machines. IEEE Geoscience and Remote Sensing Letters, 4, 586-590.‏