Online Tomato Sorting Based On Shape Maturity Size and Surface
Online Tomato Sorting Based On Shape Maturity Size and Surface
1-1-2013
Recommended Citation
ARJENAKI, OMID OMIDI; MOGHADDAM, PARVIZ AHMADI; and MOTLAGH, ASAD MODDARES (2013)
"Online tomato sorting based on shape, maturity, size, and surface defects using machine vision," Turkish
Journal of Agriculture and Forestry: Vol. 37: No. 1, Article 7. https://doi.org/10.3906/tar-1201-10
Available at: https://journals.tubitak.gov.tr/agriculture/vol37/iss1/7
This Article is brought to you for free and open access by TÜBİTAK Academic Journals. It has been accepted for
inclusion in Turkish Journal of Agriculture and Forestry by an authorized editor of TÜBİTAK Academic Journals. For
more information, please contact [email protected].
Turkish Journal of Agriculture and Forestry Turk J Agric For
(2013) 37: 62-68
http://journals.tubitak.gov.tr/agriculture/
© TÜBİTAK
Research Article doi:10.3906/tar-1201-10
Online tomato sorting based on shape, maturity, size, and surface defects using machine
vision
Omid Omidi ARJENAKI, Parviz Ahmadi MOGHADDAM*, Asad Moddares MOTLAGH
Department of Agricultural Machinery Engineering, Faculty of Agriculture, Urmia University, Urmia, Iran
Abstract: Online sorting of tomatoes according to their features is an important postharvest procedure. The purpose of this research
was to develop an efficient machine vision-based experimental sorting system for tomatoes. Relevant sorting parameters included
shape (oblong and circular), size (small and large), maturity (color), and defects. The variables defining shape, maturity, and size of
the tomatoes were eccentricity, average of color components, and 2-D pixel area, respectively. Tomato defects include color disorders,
growth cracks, sunscald, and early blight. The sorting system involved the use of a CCD camera, a microcontroller, sensors, and a
computer. Images were analyzed with an algorithm that was developed using Visual Basic 2008. In order to evaluate the accuracy of the
algorithms and system performance, 210 tomato samples were used. Each detection algorithm was applied to all images. Data about the
type of each sample image, including healthy or defective, elongated or rounded, small or large, and color, were extracted. Results show
that defect detection, shape and size algorithm, and overall system accuracies were 84.4%, 90.9%, 94.5%, and 90%, respectively. System
sorting performance was estimated at 2517 tomatoes h–1 with 1 line.
surface area) was 0.89. Blasco et al. (2009) developed a with 2 receivers for sorted tomatoes. The conveyor speed
machine for singulating, inspecting, and sorting satsuma was 105 mm s–1, and conveyor speed could be increased
mandarin (Citrus unshiu) segments using morphological using industrial cameras. The conveyor was driven by a
features. Their system automatically identified pieces of 1.49-kW, 3-phase electric motor that was adjusted by an
skin and other raw material, separated whole segments inverter (LG Inverter SV-iG5). On the left side of the belt
from broken ones, and was able to correctly classify 93.2% (Figure 1) was a box with a CCD camera (Sony, Japan). It
of sound segments on conveyor belts at 600 mm s–1. A was equipped with a circular polarizing filter and mounted
practical application was demonstrated by Zhang et al. on top of the conveyor. There were 4 LED lamps of 220
(2009) in a study that developed a machine vision system V (500–700 nm wavelength) with 4 polarizing films on
to automatically sort cherry tomato according to maturity. the right and left sides (45° from horizontal) and above
Nine features were extracted from each image. Tomatoes (perpendicular to the surface) the box to provide uniform
were classified into 3 categories (unripe, half-ripe, and light intensity with minimum shadow and light reflection.
ripe). Images were captured in the RGB color space. The The camera, with a focal length of 40.6–406 mm, was
principle component analysis (PCA) results showed that mounted 53 cm above the belt and provided a resolution
ripe tomatoes were distinguished from immature and half- of 2M pixels (spatial resolution: 640 × 480). In this study,
ripe tomatoes. The machine was able to correctly classify tomatoes were classified into 2 categories (desirable and
93.2% of tomato samples. undesirable) based on maturity, defects, shape, and size
In industry today tomatoes are sorted manually, as (2-D area) (Table 1).
are satsuma, limes, pomegranate, and other fruits. The
objective of this research was to develop an efficient
automated sorting system for tomatoes based on the image Table 1. Minimum thresholds of expectation.
processing techniques that were effectively used with
Type of sorting Threshold
limes, pomegranate, and other products.
Defect 72
2. Materials and methods
Shape 0.722
2.1. Hardware and software design
Size 35,696 (11 ± 0.2 cm2)
The hardware included a conveyor, power drive with
inverter, light source, CCD camera, mechanical segregator, Maturity R = 45–104, G = 23–50, B = 26–46
control unit, and computer. The software consisted of
separate algorithms for shape, size, maturity, and defect
detection. The electric control unit (Figure 2) comprised a
2.2. Hardware and operation microcontroller (ATmega8) and an IR sensor (made in the
Figure 1 shows the experimental tomato sorting system. It Urmia University Agricultural Machinery Engineering
featured a black conveyor belt 25 cm wide and 500 cm long Department workhouse) with wavelength of 840 nm. A
computer (CPU speed: 2.8 MHz, dual core) was used for
CCD Camera signal processing and capturing/processing images. While
LED Lamp
Lighting
Box
Segregator
Control CCD
Unit IR Camera
Sensor
Computer Control Unit
BAD
Microcontroller Computer
Processing Unit
Conveyor
Belt
Segregator
Power Drive GOOD
63
MOGHADDAM et al. / Turk J Agric For
a. b. c.
d. e. f.
Figure 3. Image processing steps: a) original image, b) green component, c) red component, d) G-R
component, e) thresholded image, f) final image.
64
MOGHADDAM et al. / Turk J Agric For
65
MOGHADDAM et al. / Turk J Agric For
Defect 68 32 85 15 85.00%
Shape 40 15 50 5 90.90%
Size 28 27 52 3 94.54%
Maturity 37 13 46 4 92.00%
red component was higher. However, in the absence of a 4.2. Color analysis in maturity sorting
polarizing filter, at certain points in the distance the gray Results (Table 2) showed that the average of R was the
level of color components was close together or equal maximum among all averages. The average of B was less
(Figure 4). As a result, these points were blacked and were than the others. The average values of all components in
identified as defects. The use of polarizing filters to remove defective samples were greater than in healthy samples
the effects of light reflection from the tomatoes was (57.8 for defective samples; 53.55 for healthy samples).
effective and necessary. It was very important, especially Two profiles of gray level in defective and healthy tomatoes
when the defects were on bright spots. Polarizing filters are shown in Figure 6.
were used in 3 different modes: 1) filter used only on In order to separate the tomato from the background,
camera, 2) filter used only on light sources, and 3) filter the G component of the image was subtracted from
used on both camera and light sources. Use of the filter in the R component. Because the difference between R
the third mode provided the best results. and G in the tomato was 30 times greater than in the
The results obtained from gray-level profiles indicated background and defects, as a result of subtracted images,
that along with sampling distance, gray levels of green (G) the tomato appeared more significant and specific than the
and black (B) were affected by light intensity (Figure 5). background. Therefore, the background was removed and
As the intensity of light became greater, the gray levels the defects were effectively identified.
of G and B became greater and moved closer to red (R). 4.3. Sorting system performance
Under these conditions, B variations were greater than The average of sorting accuracy was 90.61% (Table
those of G on the conveyor. The difference between R and 3). Zhang et al. (2009) reported 94.9% accuracy of
G for tomato separation from the background was almost identification of ripe tomatoes from immature and half-
constant under both light conditions on the conveyor. ripe tomatoes. Those authors sorted tomatoes based only
As a result, use of the difference between R and G for on maturity. The current study simultaneously considered
segmentation was more appropriate. maturity, defects, shape, and size in one algorithm as
250
a 140 b
200
120
150 100
Intensity
Intensity
80
100 60
Red 40
50 Green
20 Red
Blue Green
0 Blue
0
0 20 40 60 80 100 0 50 100
Number of pixels Number of pixels
Figure 4. Image profile of captured tomato: a) without polarized filter, b) with polarized filter.
66
MOGHADDAM et al. / Turk J Agric For
200
300
b
a
250
150
200
Intensity
Intensity
150 100
0 0
0 50 100 0 50 100
Number of pixels Number of pixels
Figure 5. Image profile of captured tomato: a) in bright region, b) in dark region.
200
250 b
a
200 150
Intensity
Intensity
150
100
100
50 Red
50 Red Green
Green Blue
0 Blue 0
0 50 100 0 20 40 60 80 100
Number of pixels Number of pixels
sorting factors. For this reason, the accuracy obtained in values, the carrying time on the conveyor belt for 1 tomato
this study is slightly lower than that reported by Zhang et to be sorted was 1.43 s. As a result, the throughput capacity
al. (2009). of the system was 2517 tomatoes h–1.
Accuracy for size sorting was higher than overall In this study, an image processing technique was
accuracy and the accuracies for maturity, shape, and defect developed to sort tomatoes according to 4 quality criteria:
sorting. The reasons for this difference are manifold. One maturity, defects, shape, and size. The software developed
reason could be that immature tomatoes were assumed to in this study evaluated tomato shape by its eccentricity,
have defects. In this case, 4 thresholding methods were tomato size by its 2-D image area, tomato maturity by its
used. The Otsu method gave optimum values for healthy mean color, and tomato defect by its fullness parameter.
tomatoes; however, the SIS method and a value of 16 for An experimental sorting system equipped with machine
threshold resulted in immature and defective tomatoes vision was constructed to test the ability of the software
in thresholding, respectively. Only the Otsu method was to sort tomatoes under 3 operational conditions: belt
chosen for sorting defects. The second reason could be conveyor speed, tomato spacing, and light intensity. After
incorrect identification of tomatoes by shape and color optimum operating conditions were defined, the sorting
by experts. The third reason could be that there were only machine was used to separate tomato samples according
2 classes to be sorted in all types of sorting, while more to their shape, color, size, and defects. The evaluation of
classes were sorted in combined sorting, which suggests experimental data indicated that sorting accuracy changed
that less contamination was likely to occur during size with the quality criteria considered, but overall accuracy
sorting. Based on optimum belt speed and tomato spacing was remarkably high (90.61%).
67
MOGHADDAM et al. / Turk J Agric For
References
Blasco J, Aleixos N, Cubero S, Gómez SJ, Moltó E (2009) Automatic Velioglu SY, Mazza G, Gao L, Omah BD (1998) Antioxidant activity
sorting of Satsuma (Citrus unshiu) segments using computer and total phenolics in selected fruits, vegetables, and grain
vision and morphological features. Comput Electron Agr 66: products. J Agr Food Chem 46: 4113–4117.
1–8. Weisstein E (2011) Eccentricity. A Wolfram Web Resource.
Gonzalez RC, Woods RE (2002) Digital Image Processing, 2nd ed. MathWorld, Wolfram Research Inc., available online at http://
Prentice Hall, Inc., New Jersey. mathworld.wolfram.com/Eccentricity.html.
Jarimopas B, Jaisin N (2008) An experimental machine vision system Yud RC, Kuanglin C, Moon KS (2002) Machine vision technology for
for sorting sweet tamarind. J Food Eng 89: 291–297. agricultural applications. Comput Electron Agr 28: 173–191.
Lino LAC, Sanches J, Dal FMI (2008) Image processing techniques Zhang Y, Yin X, Zou X, Zhao J (2009) On-line sorting maturity of
for lemons and tomatoes classification. Bragantia Campinas cherry tomato by machine vision. IFIP AICT 295: 2223–2229.
67: 785–789.
van Assen HC, Egmont PM, Reiber JC (2002) Accurate object
localization in gray level images using the center of gravity
measure: accuracy versus precision. IEEE T Image Process 11:
1379–1384.
68