Classification of hawthorn fruit based on ripeness level by machine vision

Document Type : Research Article


1 Department of biosystem engineering, agriculture faculty, university of tehran,

2 Associated professor of illam university

3 Department of Mechanical Engineering of Agriculture Machinery, Samangan Faculty of Agriculture, Technical and Vocational University (TVU), North-Khorasan, Iran


Marketability of the produced products largely depends on their appearance. Therefore, the aim of the present study was to develop the required algorithms to extract, select, and classify the images’ features of hawthorn samples in order to classify different fruit classes based on the ripeness stages. Six hundred of hawthorn fruit samples were prepared. Afterward, a lighting box was designed and constructed to capture images from hawthorn specimens under controlled lighting conditions. After imaging and saving the images of hawthorn samples, image processing operation in MATLAB Software was done. In this step after image preprocessing, color and texture features were extracted. Through all extracted features, some features were selected as efficient ones by sequential selection method with quadratic base in MATLAB Software. Linear and quadratic discriminant analysis methods were used to classify the efficient features. The obtained results indicated that the methods were able to classify the images of hawthorn samples with same accuracies (98.67 %). Furthermore, accuracy, precision, sensitivity, and specificity parameters were calculated for the classifier models. The results indicated that the accuracy of hawthorn samples by classifier models based on linear and quadratic discriminant analysis models were 98.67 and 99.33 %, respectively in the train step and they were same as 98.67 % in the test step. Also based on the results of the determined parameters, the quadratic discriminant analysis model hade better performance than the linear discriminant analysis model.

Graphical Abstract

Classification of hawthorn fruit based on ripeness level by machine vision


  • A machine vision system with machine learning algorithm was used to evaluate the hawthorn maturity.
  • The proposed method was completely non-destructive and performed the classification with high accuracy and speed.
  • QDA and LDA algorithms classified hawthorn fruit with high accuracy.
  • The proposed method can be used to classify the products accurately.


Main Subjects

[1] Özcan, M., Hacıseferoğulları, H., Marakoğlu, T. & Arslan, D. (2005). Hawthorn (Crataegus spp.) fruit: some physical and chemical properties. J Food Eng69(4), 409-413.
[2] Erfani Moghadam1*, J. & Kheiralipour, K. (2015). Physical and nutritional properties of hawthorn fruit (Crataeguspontica L.). AgricEngInt: CIGR J, 17(1), 232-237.
[3] Kao, E. S., Wang, C. J., Lin, W. L., Yin, Y. F., Wang, C. P. & Tseng, T. H. (2005). Anti-inflammatory potential of flavonoid contents from dried fruit of Crataegus pinnatifida in vitro and in vivo. J Agric Food Chem , 53(2), 430-436.
[4] Chang, W. T., Dao, J. & Shao, Z. H. (2005). Hawthorn: potential roles in cardiovascular disease. The Am. J. Chin. Med, 33(01), 1-10.
[5] Pittler, M. H., Schmidt, K. & Ernst, E. (2003). Hawthorn extract for treating chronic heart failure: meta-analysis of randomized trials. The Am. J. Chin. Med114(8), 665-674.
 [6] Jahanbakhshi, A. & Kheiralipour, K. )2019(. Carrot Sorting Based on Shape using Image Processing, Artificial Neural Network, and Support Vector Machine. J AGR Machine, 9(2): 295-307. (In Persain).
[7] Teimouri, N., Omid, M., Mollazade, K., Mousazadeh, H., Alimardani, R., & Karstoft, H. (2018). On-line separation and sorting of chicken portions using a robust vision-based intelligent modelling approach. Biosyst Eng167, 8-20.
[8] Kheiralipour, K., Ahmadi, H., Rajabipour, A. & Rafiee, S. (2018). Thermal Imaging, Principles, Methods and Applications. Ilam Uni Pub. Ilam, Iran. (In Persian).
[9] Kheiralipour, K. & Kazemi, A. 2020. A new method to determine morphological properties of fruits and vegetables by image processing technique and nonlinear multivariate modeling. Int J Food Prop, 23(1), 368-374.
[10] Farokhzad, S., Motlagh, A.M., Moghadam, P.A., Honarmand, S.J. & Kheiralipour, K. (2020). Application of infrared thermal imaging technique and discriminant analysis methods for non-destructive identification of fungal infection of potato tubers. J Food Measure Charac, 14 (1), 88-94.
[11] Wang, A., Zhang, W., & Wei, X. (2019). A review on weed detection using ground-based machine vision and image processing techniques. Comput Electron Agric158, 226-240.
[12] Liming, X. & Yanchao, Z. (2010). Automated strawberry grading system based on image processing Author links open overlay panel. Comput Electron Agric, 71, S32-S39.
[13] Seng, W. C., & Mirisaee, S. H. (2009, August). A new method for fruits recognition system. In 2009 Int Con Elec ENG (Vol. 1, pp. 130-134). IEEE.
[14] Sofu, M. M., Er, O., Kayacan, M. C., & Cetişli, B. (2016). Design of an automatic apple sorting system using machine vision. Comput Electron Agric127, 395-405.
[15] Mizushima, A. & Lu, R. (2013). An image segmentation method for apple sorting and grading using support vector machine and Otsu’s method. Comput Electron Agric94, 29-37.
[16] Zandi, M., Ganjloo, A. & Bimakr. M. (2020). Development of quality grading system based on image processing for hawthorn classification during various storage condition (cold, refrigerator and room). J Food Res, 30(1): 195-210.
[17] Sonka, M., Hlavac, V. & Boyle, R. (2014). Image process anal mach visi. (4th ed) Cengage Learning. Boston, Massachusetts, US: Springer.
[18] Mohammadi, V., Kheiralipour, K. & Ghasemi-Varnamkhasti, M. (2015). Detecting maturity of persimmon fruit based on image processing technique. Sci Hortic, 184, 123-128.
[19] Kheiralipour, K. & Pormah, A. 2017. Introducing new shape features for classification of cucumber fruit based on image processing technique and artificial neural networks. J Food Process Eng, 40(6), 12558.
[20] Khazaee, Y., Kheiralipour, K., Hosainpour, A. & Javadikia, H. (2019). Development of an algorithm based on image processing technique and sport vector machine to distinct potato from clod and stone. J Res Mech Agri, 8(1), 1-11. (In Persian).
[21] Gonzalez, R. C., & Woods, R. E. (2002). Digit Image Process (2nd ed). New Jersey: Prentice Hall Inc.
[22] Kheiralipour, K. (2012). Implementation and construction of a system for detecting fungal infection of pistachio kernel based on thermal imaging (TI) and image processing technology. Ph.D. Dissertation. Karaj, Iran: Uni Tehran. [In Persian].
[23] Mollazade, K., Omid, M., Tab, F. A., Kalaj, Y. R., Mohtasebi, S. S., & Zude, M. (2013). Analysis of texture-based features for predicting mechanical properties of horticultural products by laser light backscattering imaging. Comput Electron Agric98, 34-45.
[24] Salam, S. & Kheiralipour, K. (2021). Development and evaluation of chickpea classification system based on visible image processing technology and artificial neural network. Innov Food Tech, 9(2), 181-193.
[25] Kheiralipour, K., & Marzbani, F. (2016). Pomegranate quality sorting by image processing and artificial neural network. 10th  Iranian National Congress on AGR Machi Eng (Biosystems) and Mechanizasion. 30-31 August, Mashhad, Iran. [In Persian].
[26] Azadnia, R, & Kheiralipour, K. (2021). Recognition of leaves of different medicinal plant species using a robust image processing algorithm and artificial neural networks classifier. J Appl Res Med Aromat Plants, 100327.
 [27] Chandrashekar, G. & Sahin, F. (2014). A survey on feature selection methods. Comput Electron Agric40(1), 16-28.
[28] Dixon, S. J., Heinrich, N., Holmboe, M., Schaefer, M. L., Reed, R. R., Trevejo, J. & Brereton, R. G. (2009). Application of classification methods when group sizes are unequal by incorporation of prior probabilities to three common approaches: Application to simulations and mouse urinary chemosignals. Chemometrics and Intelligent Laboratory Systems99(2), 111-120.
[29] Wu, W., Mallet, Y., Walczak, B., Penninckx, W., Massart, D. L., Heuerding, S. & Erni, F. (1996). Comparison of regularized discriminant analysis linear discriminant analysis and quadratic discriminant analysis applied to NIR data. Anal Chim Acta329(3), 257-265.
[30] Aggarwal, N. & Agrawal, R. K. (2012). First and second order statistics features for classification of magnetic resonance brain images. J Signal Process Syst, 3, 146-153.
[31] El-Bendary, N., El Hariri, E., Hassanien, A. E. & Badr, A. (2015). Using machine learning techniques for evaluating tomato ripeness. Expert Syst Appl42(4), 1892-1905.
[32] Nasiri, A., Taheri-Garavand, A., & Zhang, Y. D. (2019). Image-based deep learning automated sorting of date fruit. Postharvest Biol Technol153, 133-141.
[33] Saranya, N., Srinivasan, K. & Kumar, S. P. (2021). Banana ripeness stage identification: a deep learning approach. J Ambient Intell Humaniz Comput.