Tomato Sorting System Based on Machine Vision
Abstract
:1. Introduction
2. Overall Scheme of the System
2.1. System Process
2.2. Tomato Grading Standards
- The tomato grading standard of this system refers to the “NY/T 940-2006 Tomato Grade Specification” [19], which divides tomatoes into special grade, first grade, and second grade according to their size, maturity, and defect degree.
- Special grade: the fruit is large, round, and fully ripe, with a uniform and bright color and smooth skin without any defects;
- First grade: the fruit is also full but slightly deformed, with bright and uniform color and slightly defective skin;
- Second grade: the fruit is medium-sized, slightly underripe, and has some blemishes on the skin.
3. Materials and Methods
3.1. Materials
3.1.1. PC
3.1.2. USB Camera
3.1.3. Raspberry PI
3.1.4. Arduino CNC Shield V3.0
3.1.5. Mechanical Arm
3.1.6. Conveyor Belt
3.2. Method
3.2.1. Detect Defects in Tomatoes
- (1)
- YOLOv8
- (2)
- Dataset preparation and training
- (3)
- Analysis of training results
3.2.2. Detect the Size of Tomatoes
- (1)
- The calculation of the perimeter
- (2)
- Specific steps of perimeter calculation
- The 8-connected edge image of the tomato is obtained by the bottom processing of the image;
- The edge of the image is detected to extract the edge pixels in the image, and the total number of edge pixels (E) is calculated;
- The number of 4-connected points (X) in horizontal direction and vertical direction is calculated, respectively (whether the difference between horizontal coordinate and vertical coordinate is 1 is judged);
- The number of points (Y) in diagonal connections is obtained by subtracting the number of 4-connected points from the total pixel value:
- Finally, we obtain
- (3)
- Tomato size grading experiment
3.2.3. Detect the Maturity of the Tomatoes
3.2.4. The Working Method of the Robotic Arm
- , , : The angles of the 1st, 2nd, and 3rd joints of the robotic arm.
- x, y: The position coordinate of the tool coordinate system with respect to the base coordinate system.
- : Intermediate variables calculated by , and joint Angle .
- : The sine and cosine values of .
- : Cosine and sine of theta 1.
- : The length of the two connecting rods of the robot arm.
- : The rotation Angle of the tool coordinate system with respect to the base coordinate system.
- (): The inverse tangent function is used to find the Angle.
4. Implementation of Software Interactive Interface
4.1. Communication Implementation
4.2. Setting of User Interaction Interface
5. Experimental Data and Discussion
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Rao, A.V.; Rao, L.G. Carotenoids and human health. Pharmacol. Res. 2007, 55, 207–216. [Google Scholar] [CrossRef] [PubMed]
- Olaniyi, J.O.; Akanbi, W.B.; Adejumo, T.A.; Akande, O.G. Growth, fruit yield and nutritional quality of tomato varieties. Afr. J. Food Sci. 2010, 4, 398–402. [Google Scholar]
- Burton-Freeman, B.; Reimers, K. Tomato consumption and health: Emerging benefits. Am. J. Lifestyle Med. 2011, 5, 182–191. [Google Scholar] [CrossRef]
- Jangid, K.K.; Dwivedi, P. Physiological responses of drought stress in tomato: A review. Int. J. Agric. Environ. Biotechnol. 2016, 9, 53–61. [Google Scholar] [CrossRef]
- Butelli, E.; Titta, L.; Giorgio, M.; Mock, H.-P.; Matros, A.; Peterek, S.; Schijlen, E.G.W.M.; Hall, R.D.; Bovy, A.G.; Luo, J.; et al. Enrichment of tomato fruit with health-promoting anthocyanins by expression of select transcription factors. Nat. Biotechnol. 2008, 26, 1301–1308. [Google Scholar] [CrossRef] [PubMed]
- Tieman, D.; Zhu, G.; Resende, M.F., Jr.; Lin, T.; Nguyen, C.; Bies, D.; Rambla, J.L.; Beltran, K.S.O.; Taylor, M.; Zhang, B.; et al. A chemical genetic roadmap to improved tomato flavor. Science 2017, 355, 391–394. [Google Scholar] [CrossRef] [PubMed]
- Kumar, R.; Paul, V.; Pandey, R.; Sahoo, R.N.; Gupta, V.K. Reflectance based non-destructive determination of colour and ripeness of tomato fruits. Physiol. Mol. Biol. Plants 2022, 28, 275–288. [Google Scholar] [CrossRef] [PubMed]
- Ye, X.; Izawa, T.; Zhang, S. Rapid determination of lycopene content and fruit grading in tomatoes using a smart device camera. Cogent Eng. 2018, 5, 1504499. [Google Scholar] [CrossRef]
- Chen, Y.R.; Chao, K.; Kim, M.S. Machine vision technology for agricultural applications. Comput. Electron. Agric. 2002, 36, 173–191. [Google Scholar] [CrossRef]
- Zhang, Y.; Yin, X.; Xu, T.; Zhao, J. On-line sorting maturity of cherry tomato by machine vision. In Proceedings of the International Conference on Computer and Computing Technologies in Agriculture, Berlin/Heidelberg, Germany, 1 January 2009. [Google Scholar] [CrossRef]
- Haggag, M.; Abdelhay, S.; Mecheter, A.; Gowid, S.; Musharavati, F.; Ghani, S. An intelligent hybrid experimental-based deep learning algorithm for tomato-sorting controllers. IEEE Access 2019, 7, 106890–106898. [Google Scholar] [CrossRef]
- Opeña, H.J.G.; Yusiong, J.P.T. Automated tomato maturity grading using ABC-trained artificial neural networks. Malays. J. Comput. Sci. 2017, 30, 12–26. [Google Scholar] [CrossRef]
- Fojlaley, M.; Moghadam, P.A.; Nia, S.A. Tomato classification and sorting with machine vision using SVM, MLP, and LVQ. Int. J. Agric. Crop Sci. 2012, 4, 1083–1088. [Google Scholar]
- Arjenaki, O.O.; Moghaddam, P.A.; Motlagh, A.M. Online tomato sorting based on shape, maturity, size, and surface defects using machine vision. Turk. J. Agric. For. 2013, 37, 62–68. [Google Scholar] [CrossRef]
- Ghael, H.D.; Solanki, L.; Sahu, G. A review paper on raspberry pi and its applications. Int. J. Adv. Eng. Manag. 2020, 2, 225–227. [Google Scholar]
- Tran, T.K.; Huynh, K.T.; Le, D.N.; Arif, M.; Dinh, H.M. A Deep Trash Classification Model on Raspberry Pi 4. Intell. Autom. Soft Comput. 2023, 35, 2479–2491. [Google Scholar] [CrossRef]
- Kondaveeti, H.K.; Bandi, D.; Mathe, S.E.; Vappangi, S.; Subramanian, M. A review of image processing applications based on Raspberry-Pi. In Proceedings of the 2022 8th International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 25–26 March 2022. [Google Scholar] [CrossRef]
- Villaseñor-Aguilar, M.-J.; Padilla-Medina, J.-A.; Prado-Olivarez, J.; Botello-Álvarez, J.-E.; Bravo-Sánchez, M.-G.; Barranco-Gutiérrez, A.-I. Low-Cost Sensor for Lycopene Content Measurement in Tomato Based on Raspberry Pi 4. Plants 2023, 12, 2683. [Google Scholar] [CrossRef]
- NY/T 940-2006; The grades and specifications of tomatoes. Ministry of Agriculture: Beijing, China, 2006.
- Afolabi, A.; Abubakar, M.; Oriolowo, O.T. Selected anthropometric study and energy required for grading tomatoes by farmers using hoes in Zaria. AMA Agric. Mech. Asia Afr. Lat. Am. 2016, 47, 41–46. [Google Scholar]
- Nyalala, I.; Okinda, C.; Qi, C.; Mecha, P.; Korohou, T.; Yi, Z.; Nyalala, S.; Zhang, J.; Liu, C.; Chen, K. Weight and volume estimation of single and occluded tomatoes using machine vision. Int. J. Food Prop. 2021, 24, 818–832. [Google Scholar] [CrossRef]
- Joice, A.; Rajkumar, P.; Deepa, J.; Arulmari, R. Colour discernment of tomatoes using machine vision system with OpenCV Python and Raspberry Pi. Indian J. Eng. Mater. Sci. 2022, 29, 502–508. [Google Scholar] [CrossRef]
- Rajkumar, P.; Abinaya, K.; Deepa, J.; Pandiselvam, R.; Rani, C.I.; Parveen, S. Development of a farmer-friendly portable color sorter cum grader for tomatoes. J. Food Process Eng. 2022, 45, e13894. [Google Scholar] [CrossRef]
Size | Maturity | Defect Area | Grade |
---|---|---|---|
≥70 mm | ≥90% | 0 cm2 | Premium Grade |
50–70 mm | 80–90% | 0–1 cm2 | Grade I |
≤50 mm | ≤80% | 0–1 cm2 | Grade II |
No Defect | Minor Defect | Serious Defect | |
---|---|---|---|
Defect area | 0 (cm2) | 0–1 (cm2) | >1 (cm2) |
Epochs | Class | Image | Labels | p | R | map@0.5 | map@0.5:0.95 |
---|---|---|---|---|---|---|---|
30 | All | 50 | 50 | 0.981 | 0.963 | 0.981 | 0.790 |
60 | All | 50 | 50 | 0.938 | 0.964 | 0.983 | 0.856 |
100 | All | 50 | 50 | 0.974 | 0.933 | 0.986 | 0.877 |
200 | All | 50 | 50 | 0.958 | 0.963 | 0.982 | 0.881 |
300 | All | 50 | 50 | 0.967 | 0.947 | 0.991 | 0.873 |
400 | All | 50 | 50 | 0.965 | 0.967 | 0.98 | 0.873 |
Large | Middle | Small | |
---|---|---|---|
Diameter | >7 (cm) | 5 to 7 (cm) | <5 (cm) |
Pixels | >250.34 | 200.52–250.34 | <200.52 |
Ripe | Medium | Unripe | |
---|---|---|---|
Red area | 90% or higher | 80–90% | 80% or less |
Tomato Picture | Detection Effect | Tomato Size | Tomato Ripeness | Tomato Defect Detection | Tomato Grade Determination |
---|---|---|---|---|---|
7.52 cm | ripe | No defect | Premium Grade | ||
5.98 cm | ripe | No defect | Primary fruit | ||
4.79 cm | ripe | No defect | Secondary fruit | ||
4.91 cm | medium | No defect | Secondary fruit | ||
5.96 cm | medium | Minor defect | Not recommended for sale | ||
6.54 cm | ripe | Minor defect | Not recommended for sale | ||
3.64 cm | unripe | No defect | Not recommended for sale | ||
4.23 cm | ripe | Serious defect | Not recommended for sale | ||
4.67 cm | unripe | Minor defect | Not recommended for sale | ||
3.94 cm | unripe | Serious defect | Not recommended for sale |
Group 1 | Group 2 | Group 3 | Group 4 | Group 5 | |
The number of tomatoes | 22 | 23 | 22 | 22 | 21 |
Group 6 | Group 7 | Group 8 | Group 9 | Group 10 | |
The number of tomatoes | 22 | 23 | 24 | 23 | 23 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Hou, L.; Liu, Z.; You, J.; Liu, Y.; Xiang, J.; Zhou, J.; Pan, Y. Tomato Sorting System Based on Machine Vision. Electronics 2024, 13, 2114. https://doi.org/10.3390/electronics13112114
Hou L, Liu Z, You J, Liu Y, Xiang J, Zhou J, Pan Y. Tomato Sorting System Based on Machine Vision. Electronics. 2024; 13(11):2114. https://doi.org/10.3390/electronics13112114
Chicago/Turabian StyleHou, Lixin, Zeye Liu, Jixuan You, Yandong Liu, Jingxuan Xiang, Jing Zhou, and Yu Pan. 2024. "Tomato Sorting System Based on Machine Vision" Electronics 13, no. 11: 2114. https://doi.org/10.3390/electronics13112114
APA StyleHou, L., Liu, Z., You, J., Liu, Y., Xiang, J., Zhou, J., & Pan, Y. (2024). Tomato Sorting System Based on Machine Vision. Electronics, 13(11), 2114. https://doi.org/10.3390/electronics13112114