Automatic estimation of the size and weight of

Automatic estimation of the size and weight of grapevine berries by
image analysis
J. Tardaguila1, M.P. Diago1, J. Blasco2, B. Millán1, S. Cubero1,2, O.L. GarcíaNavarrete2,3, N. Aleixos4*
1
Instituto de Ciencias de la Vid y del Vino (University of La Rioja, CSIC, Gobierno de La
Rioja). 26006 Logroño. Spain.
2
Centro de Agroingeniería. Instituto Valenciano de Investigaciones Agrarias (IVIA). Cra.
Moncada-Náquera km 5, 46113 Moncada (Valencia), Spain.
3
Departamento de Ingeniería Civil y Agrícola. Universidad Nacional de Colombia - Sede
Bogotá. Carrera 30 Nº. 45-03, Edificio 214, Oficina 206. Bogotá, Colombia
4
Instituto Interuniversitario de Investigación en Bioingeniería y Tecnología Orientada al Ser
Humano. Universitat Politècnica de València. Camino de Vera s/n, 46022 Valencia, Spain.
Email: [email protected]
Abstract
Berry size of winegrapes has often been considered to influence wine composition and
quality. The measurement of the size and weight of grapevine berries may provide important
information to assess differences in ripening stage, pulp/skin ratio and phenolic content. This
task is usually done by hand, so that it becomes slow, tedious and inaccurate. This paper
focuses on three main objectives aimed at automating this process: 1) to determine the size
of the berry (length and width) and the length of the pedicel using automated methods based
on image analysis, and 2) to assess the possibility of estimating the weight of the berry from
image analysis.
Some tests were carried out with 100 berries from two cultivars and data from manual
analysis and vision system analysis were extracted and compared. Results obtained proved
the efficiency and accurateness of the developed laboratory vision based tool.
1. Introduction
Machine vision systems are being used to automate inspection tasks in agriculture and food
processing (Cubero et al. 2011, Lorente et al. 2012). Among other characteristics like defect
detection or colour estimation, shape and size analysis are features for which image analysis
provides an objective and reliable tool.
In viticulture, grapevine berry size and weight are two key parameters, which not only impact
the cluster architecture and compactness (leading to looser or tighter clusters), but are also
considered as indicators of grape and wine quality (Matthews and Nuzzo, 2007). As a matter
of fact, berry weight and size, and their implication in grape and wine quality, have been
extensively studied worldwide (Roby et al. 2004; Walker et al. 2005) and recently reviewed
by Matthews and Nuzzo (2007). The rationale behind the link between berry size and quality
is based on the skin to pulp ratio, essentially higher in smaller berries, which therefore, are
widely considered to yield better wines (Barbagallo et al. 2011), and are highly aimed by
winemakers.
Grape yield estimation is a topic of utmost technical and economical interest in viticulture, not
only to produce grapes and wines of improved quality, but also to optimize the vineyard
management and meet yield regulations in many wine regions worldwide (Wolpert and Vilas
1992; Clingeleffer, 2001; Dunn and Martin, 2004). Several strategies have been adopted to
estimate and forecast the yield of a given vineyard, such as bud dissection to assess its
fertility (Wisdom et al. 2004), assessment of the number of branches of the inflorescence
(Dunn and Martin, 2007), and harvesting some vines at veraison (Tardaguila et al. 2007).
1
However, all these methods are destructive, labour-demanding and time-consuming and
often a representative and sufficient number of measurements cannot be made to get an
accurate estimation of the final yield.
This work presents a method based on computer vision to automatically determine the size
and weight of grapevine berries. The berries in the images included the pedicel, therefore
being necessary to detect the insertion point between the berry and the pedicel to obtain
accurate measurements of both. Two algorithms based on the radius signature (Kunttu and
Lepisto, 2007) and arclength versus turning angle graph (Wolfson, 1990) of the contour have
been developed to detect the points in the contour of the objects found in the images.
2. Materials and methods
A total of 100 berries of different size and colour (given by the degree of ripening), belonging
to two grapevine (Vitis vinifera L.) cultivars were used for the analysis (50 berries of cv
‘Grenache’ and 50 berries of cv ‘Tempranillo’). The berries were placed on a white
background and imaged using a still camera (Canon EOS 550D) to obtain images with a size
of 2592 x 1944 pixels and a resolution of 9 pixels/mm (Figure 1).
2.1. Measurement of berry weight and size
Imaged grape berries were individually labelled and weighed, and their size was manually
measured using a digital calliper in the axe stem-end-calyx and in the equatorial diameter.
Also their pedicels were manually measured to obtain their lengths.
2.2. Image analysis
The images were analysed using an image processing application developed at IVIA for this
purpose. The segmentation process was done by thresholding in the blue channel because
all the berries exhibited lower values of blue in the RGB (red, green, blue) colour model
provided by the images, therefore showed increased contrast against the background
configured in white. Due to this high contrast, any threshold value in the range 100-150 was
found to be suitable for discriminating purposes without altering the segmentation quality.
The value of 125 was chosen since it was the middle between the peaks corresponding to
the background and berry in the histogram. Next to image segmentation, an algorithm
extracted the eight-connected contour by means of the chain code described by Freeman
(1961).
FIGURE 1. Colour image with 50 berries of cv ‘Tempranillo’.
2
The steps of the algorithm for feature extraction for each berry in the image are the following:
1. Firstly, the centroid of the objects was calculated using boundary information.
2. Second, the radius signature of the berry contour was calculated (Rubine, 1991). This
is represented in Figure 2, where Figure 2a contains three samples of berries with
different orientations and their centroid positions in red colour. Figure 2b shows the
radius signature in red colour that represents the distance of all contour points to the
berry centroid. It can be seen the maximum value of the radius signature for the end
of the pedicel (1) and the two contact points of the pedicel with the berry (2)(3), which
are sited at the two local minima of the radius signature.
3. Third, a displacement was done to centre the maximum value of the radius signature
in the array. This was done to avoid the maximum value at the beginning when the
berry is oriented with the pedicel on the top part in the image (Figure 2 top).
4. Fourth, the algorithm scanned for the maximum value in the radius signature (1), in
order to find the maximum point of the contour which represents the end of the
pedicel.
5. Fifth, the two local minima were found around the end of the pedicel in the radius
signature (2)(3).
(1)
(2)
(3)
Centroid position
a)
b)
FIGURE 2. a) Contour of three samples of berries with different orientations and b) their corresponding radius
signature
6. Later, the stroke of the contour corresponding to the pedicel was removed from the
array and the centroid of the berry was recalculated.
7. The next step consisted of finding the point of the contour that accomplishes the line
equation that passes through the base of the pedicel (calculated as the midpoint
between the points (2)(3) of contact of the pedicel with the berry) and the new
centroid of the berry. The length of this axis was the polar diameter.
3
8. The equatorial axis was calculated as the line oriented 90º on the polar axis that
crossed the centroid. The two points of the contour that accomplished the equation
were the ends of the equatorial axis. The equatorial diameter was then calculated as
the length of the equatorial axis.
Figure 3 top shows the segmented berries of the first five berries of the first row in image
of Figure 1. Figure 3 bottom shows the extracted contours of these berries. The end and
base of the pedicel are represented in green colour, the end of the polar axis in green
colour, the connections of the pedicel with the berry in black colour and the ends of the
equatorial axis in cyan colour.
FIGURE 3. Segmented image (top) and contour extraction (bottom) of the berries of the first row in Figure 1
3. Results
In order to assess the goodness of the imaging system developed predicting the size
(diameter) of the berries, a regression model was built on a training set of 66 out of the 100
berries. The 34 berries were used for validation. Table 1 presents the regression model and
the ANOVA table for the cv. ‘Grenache’. The adjusted R2 value obtained (0,978) confirmed
the goodness of the regression and the two coefficients were found to be statistically
significant (Table 1).
TABLE 1. Regression and ANOVA analyses for the estimation of size of Grenache berries
Parameter
CONSTANT
Diameter
Estimation
1.04361
0.904493
Standard error
0.273590
0.0197651
T Statistic
3.8145
45.762
P-Value
0.0004
0.0000
For the ‘Tempranillo’ berries, Table 2 presents the corresponding regression model table.
Also in this case, the adjusted R2 achieved was very high (0.968) demonstrating the reliability
of the developed algorithms.
TABLE 2. Regression and ANOVA analyses for the estimation of size of Tempranillo berries
Parameter
CONSTANT
Diameter
Estimation
0.815612
0.908564
Standard error
0.335005
0.0237072
T Statistic
2.43463
38.3244
P-Value
0.0188
0.0000
In order to properly validate the models, the next step was to use the regression models to
predict the size values of the validation set. Figure 4 presents the validation results for both
varieties. The validated R2 values remained almost the same (a little bit lower, as expected
for very high R2 values), which finally assessed for a reliable predictive model. This result
indicates that the vision system developed for the estimation of the size of grape berries with
4
pedicel was completely reliable and could be used as a useful laboratory tool replacing
current and very slow and tedious manual methods.
18
17
16
15
14
13
12
11
10
17
16
15
14
13
R² = 0,9715
12
11
11
13
15
17
R² = 0,9626
10
12
a)
14
16
18
b)
FIGURE 4. Adjustment to the linear model (predicted vs observed) for the polar diameter (in mm) of the berries
from a) ‘Grenache’ and b) ‘Tempranillo’.
Similar analyses were done to assess the goodness of the system predicting the size of
individual berries. The linear model was also calculated to estimate the weight and the
following correlation was obtained: 0,984 and R2=0.969 for cv ‘Grenache’ (Table 3) and
0,981 and R2=0.976 for the cv ‘Tempranillo’ (Table 4) with P-value<0.05 for both cultivars.
TABLE 3. Regression analyses for the estimation of weight of ‘Grenache’ berries
Parameter
CONSTANT
Weight-Area
Estimation
-0.673729
0.0147663
Standard error
0.056554
0.00037978
T Statistic
-11.9131
38.8813
P-Value
0.0000
0.0000
TABLE 4. Regression analyses for the estimation of weight of ‘Tempranillo’ berries
Parameter
CONSTANT
Weight-Area
Estimation
-0.659291
0.0148569
Standard error
0.052372
0.00033449
T Statistic
-12.5887
44.4165
P-Value
0.0000
0.0000
To validate the models, the regression models were used to predict the weigh values of the
validation set. Figure 4 presents the validation results for both varieties. This result indicated
that the vision system developed was also reliable for estimating de weight of grape berries.
220
190
200
170
180
160
150
140
130
R² = 0,9795
120
110
100
R² = 0,9613
90
0,5
1
1,5
2
2,5
3
0,5
1
1,5
2
2,5
a)
b)
2
FIGURE 5. Adjust to the linear model to estimate the weight (in grams) of berries from the area (in mm ), a)
‘Grenache’, and b) ‘Tempranillo’.
These results show that the algorithms developed were capable of correctly estimate the size
and weight of grapevine berries even if they presented pedicel, which can speed up some
tedious and repetitive analysis task normally performed in laboratories. The accurate and
robust method for detecting the pedicel could be probably applied to detect the stem of other
fruits like apples, oranges or cherries with few changes.
5
4. Conclusions
Results obtained prove that machine vision systems are powerful laboratory tools that can
shorten times of tedious task and perform them accurately. Size and weight estimation by
image analysis could avoid the repetitive and tedious task of manual measurement of wine
grape berries, since strong correlations between manual and image-derived automatic
methods were obtained.
Reference list
Barbagallo, M.G., Guidoni, S., & Hunter, J.J. (2011). Berry size and qualitative characteristics
of Vitis vinifera L. cv. Syrah. South African Journal of Enology and viticulture, 32, 129-136.
Clingeleffer, P.R. (2001) Final Report for Project CSH 96/1. Crop development, crop
estimation and crop control to secure quality and production of major wine grape varieties: a
national approach.
Cubero, S., Aleixos, N., Moltó, E., Gómez-Sanchis, J., & Blasco, J. (2011). Advances in
machine vision applications for automatic inspection and quality evaluation of fruits and
vegetables. Food and Bioprocess Technology, 4(4), 487-504.
Dunn, G.M., & Martin. S.R. (2004). Yield prediction from digital image analysis: A technique
with potential for vineyard assessments prior to harvest. Australian Journal Grape Wine
Research, 10, 196-198.
Dunn, G.M., & Martin, S.R. (2007) A functional association in L. cv. Cabernet Sauvignon
between the extent of primary branching and the number of flowers formed per
inflorescence. Australian Journal of Grape and Wine Research, 13, 95-100.
Freeman, H. (1961). On the encoding of arbitrary geometric configurations.IRE Transactions
of Electronic Computers. EC-10, 260–268.
Kunttu, I., & Lepisto, L. (2007). Shape-based retrieval of industrial surface defects using
angular radius Fourier descriptor. IET Image Processing, 1(2), 231–236.
Lorente, D., Aleixos, N., Gómez-Sanchis, J., Cubero, S., García-Navarrete, O.L., & Blasco, J.
(2012). Recent advances and applications of hyperspectral imaging for fruit and vegetable
quality assessment. Food and Bioprocess Technology, 5(4), 1121-1142.
Matthews, M.A. & Nuzzo, V. (2007). Berry size and yield paradigms on grapes and wine
quality. Acta Horticulturae, 754, 423-436.
Roby, G., Harbertson, J.F., Adams, D.A., & Matthews, M.A. (2004). Berry size and vine water
deficits as factors in winegrape composition: Anthocyanins and tannins. Australian Journal of
Grape and Wine Research, 10, 100-107.
Rubine, D. (1991). Specifying Gestures by Example. Computer Graphics 25 (4), 329-337.
Tardáguila, J., & Martinez de Toda, F. (2007) Assessment of Tempranillo grapes quality in
the vineyard by Vitur score-sheet. Acta Horticulturae, 754, 213-220.
Walker, R.R., Blackmore, D.H., Clingeleffer, P.R., Kerridge, G.H., Ruhl, E.H., & Nicholas,
P.R. (2005). Shiraz berry size in relation to seed number and implications for juice and wine
composition. Australian Journal of Grape and Wine Research, 11, 2-8.
Wisdom, T., Bennett, J., & Clark, N. (2004). Bud dissections: Crop estimation and achieving
target yields in the Margaret River wine region. Australian and New Zealand Grapegrower
and Winemaker, 485a, 60-62.
Wolfson, H.J. (1990). On curve matching, IEEE Transactions on Pattern Analysis and
Machine Intelligence, 12(5), 483-489.
Wolpert, J.A., & Vilas, E.P. (1992). Estimating Vineyard Yields: Introduction to a Simple,
Two-Step Method. American Journal of Enology and Viticulture, 43, 384-388.
6