Computer vision-based dimension measurement system for olive identification

Olive tree is an important portion of the human history of Mediterranean nations. On the other hand, local varieties are important for each producer regions and even countries. So, olive cultivars are important for agricultural production for these people. The traditional pomological identifiers of the olive trees based on fruits and leaves, also morphometric analysis of size, additionally shape elliptic analysis of endocarp. Because of this reason, in this study, for the ‘Picual’ olive cultivar identification, a fast and easy method was presented. For this aim, ‘Picual’ olive leaf, fruit, and stone dimension measurement values obtained from real-time video images. ‘Picual’ olive fruit, stone, leaf samples evaluated by using real-time computer vision measurements. Regression analysis was applied to the data which was obtained from real-time video and caliper measurements. According to the regression coefficient results, the regression between caliper length measurement (OLLM) and computer vision video length measurement (OLLCV) found as 98.9%, also the regression between caliper width measurement (OLWM) and computer vision video width measurement (OLWCV) found as 97.9% at ‘Picual’ leaves, additionally, the regression between caliper length measurement (OFLM) and computer vision video length measurement (OFLCV) found as 98.5% the regression between caliper width measurement (OFWM) and computer vision video width measurement (OFWCV) found as 98.1 % at ‘Picual’ fruits, at last, the regression between caliper length measurement (OSLM) and computer vision video length measurement (OSLCV) found as 86.2%, the regression between caliper width measurement (OSWM) and computer vision video width measurement (OSWCV) found as 75.3% at ‘Picual’ stones.


Introduction
Today, agricultural production without new technologies and industrial applications is not possible, because the farmers and olive industry will not get good quality products on the contrary. Also, all olive producer countries are selling lots of olive products like table olive, olive oil, olive cologne, olive oil soap, olive oil hand cream, olive leaf tea, pellets of refined olive pomace for heating, etc. They have to follow new technologies because if they do not do that, as a result of this condition, they will not get better incomes. It means that everything is changing with the new technologies which are developed by people. It is also affecting agricultural production and its quality in countries like Spain, Turkey, etc. as olive producer countries. Between these countries, Spain produced 1.4 million tonnes of olives only for olive oil production in the 2017 year. It means that Spain is a vital country for olive production and the olive industry, and researchers are working on olive identification, olive classification, precision farming techniques on olive production, pesticide applications on olive fruit and olive trees, harvest machines, post-harvest olive processing techniques, and its automation systems, etc. (Bari et al., 2002;Diaz et al. ,2004;Riquelme et al., 2008;Arnan et al., 2012;Guzmán et al., 2013;Anonymous, 2020).
Before all these technologies and applications in the orchards and olive oil production factories, as the biological material mainly the olive and its quality are essential. There are a lot of olive cultivars in the world. All of them have different biological characteristics. For example, some of them have cold resistance and some of them have some disease resistance. Additionally, the chemical compounds of olives have significant effects on human health. So, these properties show us that scientists have to know and research about these features of olives and all olive products. For this aim, some countries have their gene banks in their olive tree collections like at Izmir in Turkey and Cordoba in Spain. In addition to this condition, the olives are living biological materials that can change their properties according to different environmental conditions in years. So cultivated products in a period, becoming wild products, also some hybrid ones and synonyms are produced by Olive Research Institutes, and they are getting new properties their inside. Because of this reason, there is a lot of research in the literature, and they are continuing (van Hintum et al., 2000;Navero, 2000;Muzzalupo, 2012;Anonymous, 2015).
Biological material properties are important for the agricultural applications and design of the automation system, also improve the quality and quantity of the agricultural product and product quality control stages. There is a lot of literature about the biomolecular analysis of leaves or oil, the chemical analysis of the various constituents of oil, and the spectral analysis (NIR, MIR, NMR, Raman) of leaves, olives or oils, but some of these methods were not always easy to apply for the identification of main cultivars in an old orchard (Vanloot et al., 2014;Trujillo et al., 2014). About this issue, Hannachi et al. (2008) studied on comparison of cultivars and oleasters from North Tunisia to determine their relationships based on morphological traits, oil composition, and SSR genotyping. They used those parameters to examine 32 cultivar trees from 17 denominations and 70 oleaster trees sampled. They did the multivariate analysis, enabling to retain the best variables, to establish relationships among trees based on morphological and pomological parameters. Also, Toplu et al. (2009) stress that olive (Olea europaea L.) is one of the oldest cultivated species in the Mediterranean basin and it is widespread throughout the Mediterranean region. In their study, they determined several phenological, morphological, and pomological characteristics of some olive cultivars when grown in Hatay province in the eastern Mediterranean region of Turkey. The 21 cultivars examined in their study, which originated from Italy, Spain, Tunisia, and Turkey. Additionally, Ismaili et al. (2011) analysed the 'Kaninjot' olive cultivar for the characterization of intervarietal variability (pomological and technological) in 2007-2009 years, in three geographical cultivation areas at a distance 420 km (North-South): (1) Lukove (2) Jonufer, (3) Oblike. They implied that this cultivar has expressed the variations of its genetic potential, intervarietal vary, affected by the environment of the growing areas. Additionally, Hegazi (2012) looked at the performance of 12 olive cvs. introduced to Egypt in 1984 ('Thrombolia', 'Strogylia', 'Villalonga', 'Cerasicola', 'Dermlali', 'Leccio Dela Corna', 'Roseciola', 'Boutellian', 'Ouslati', 'Mouslati', 'Enduri', and 'Tansh') included vegetative characteristics, floral biology, fruit set, fruit characteristics and oil percentage of these cvs. were investigated under Egyptian conditions, ('Giza Governorate'). Guzmán et al. (2013) studied visible images which allows a fast, automatic, and objective prediction of olive maturity index based on artificial vision. Additionally, they have applied the method for the aim of automatic estimation of the size and weight of olive fruits. Ismaili (2014) worked on olive vestige in Mediterranean geography and climate where proves up to 46 thousand years of olive cultivation. He said that Albanian generations had connected their life with olives, have maintained, protected, and inherited centuries-old trees, olive biodiversity. He also stresses that olive has not yet shown all his secrets to them. So, there has always been some issues in researching to know its characteristics in general, and for testing and quality of olive oil in particular. In his study, he evaluated the pomology characteristics of the main olive cultivars. Also, Petruccelli et al. (2014) studied olive trees which are thousands of years (Olea europaea L.) and they have been presented a significant symbol in the Garden of Gethsemane, a place located at near the Mount of Olives, Jerusalem. In their investigation, they compared firstly morphological and genetic characterization of eight olive trees in the Garden of Gethsemane. Pomological traits, morphometric, and ultrastructural observations, as well as SSR (Simple Sequence Repeat) analysis, were performed to identify the olive trees by them (Trujillo et al., 2014). Vanloot et al. (2014) studied on artificial vision and chemometrics analyses of olive stones for varietal identification of five French cultivars. They measured area, perimeter, length, width, circularity, elongation, the eccentricity of the five olive varieties as size and shape features used for olive stone characterization. Prashanth et al. (2015) worked on the object's dimension identification to sort exact material with LabVIEW software using machine vision techniques. O'neal et al. (2002) and Yang et al. (2015) worked on the software which can measure leaf dimension and extract the leaf shape, leaf height, leaf width. and leaf area. They stated that their simulation result showed success to measure the length and width of the object and it is displayed on the front panel of LabVIEW software. Piras et al. (2016) studied the two forms of olives namely the wild and the cultivated ones. The purpose of their work is to determine different Sardinia wild olive populations, as ancient olive trees and olive varieties, and they used endocarps for image analysis measurements to conduct research. A total of 137 morphometric, colorimetric, and textural characters were measured in each of 2842 studied on endocarps.

Çetin et al. (2016) worked on the project named 'Variety Development by Hybridization in Olives' is being
carried out at the Olive Research Institute in Turkey to develop new alternatives to the current oil and table olive cultivars. They studied on 'Memecik' cultivar which is one of Turkeys' important oil cultivar and also 'Uslu' which is a table cultivar, has been hybridized within their project. They harvest the olives in the winter season, at 'Memecik' due to its late maturity. They stressed that the quality is decreasing in these cultivars with environmental conditions, and this condition results in economic losses. For this reason, 'Memecik' has been hybridized with 'Uslu' in their project, in which ripening is much earlier. In their study; oil quantity percentile, fruit maturation, fruit flesh firmness, seed-flesh separation grade, fruit weight, fruit width, and fruit length have been determined in 90 genotypes within 'Memecik' x 'Uslu' hybrid combination. Beyaz and Ozturk (2016) have been studied in olive varieties using image processing techniques. For this purpose, olive images were captured at 2896 x 1944 pixels at 300 dpi resolution using a DSLR camera, and the evaluation of pixels was used taking into account the size measurements. For this purpose, MATLAB v2012 and Image j software were used. In the light of the obtained data, variance analysis and Duncan's test were used to characterize the olive varieties. As a result, all observed olive varieties are defined at the level of significance of P <0.05. They emphasize that only 'Erkence' variety is not defined. Yildirim et al. (2017) in their study determined the physical characteristics of three olive cultivars' fruits at three different harvest time (skin green with pink spots, pulp white-skin black, skin black and pulp purple) growing in the Mediterranean region of Turkey in Isparta/Sütçüler at the same garden and growing conditions. They imply that 'Ayvalik' and 'Memecik' olive cultivars are grown in large areas of Turkey, and 'Topakaşi' cultivar is a local cultivar and is cultivated limitedly in the research area by them. Thus, in their study, the differences between the varieties adapted to the region's ecology and the varieties brought from different regions were investigated by them. Beyaz et al. (2017) tried to identify various Spanish olive varieties using image processing techniques. 'Lechin De Granada', 'Arbequina', 'Picual', 'Verdial De V-M', 'Picudo', 'Hojiblanca', and 'Empeltre' olive varieties were defined by them. The photos of olives were captured by using a DSLR camera at 300 dpi with 2896 × 1944-pixel resolution. LabVIEW Vision Assistant v2013 (NI) and Image j (NIH) software were used for image analysis procedures. Artificial Neural Network analysis was applied to the data obtained from the image analysis results of the photos of fruit and olive stones. With Artificial Neural Network analysis, varieties are 90% classified according to their sizes. Blazakis et al. (2017), express that the morphological analysis from olive leaves, fruits, and endocarps is an effective method for the characterization and discrimination of cultivars and showing the relationships between them. Also, they imply that olive cultivars, with their great variability, are easily detectable from the morphological parameters like fruit, leaf, and endocarp shape and size. Piras et al. (2016) express that there are two forms of the olive tree (Olea europaea L.) namely the wild and the cultivated ones. So, it is essential to the determination of these forms by using a fast and accurate system. In the last years, a critical increase in image analysis applications has been related to plant biology research to identify the biological diversity in wild and cultivated plant species Smykalova et al., 2013;Pinna et al., 2014;Lo Bianco et al., 2015;Santo et al., 2015;). Because of this reason, in this research; tree, leaf, fruit, and stone dimensions were measured as morphological parameters for the identification of cultivars which is based on the description of twenty-seven morphological parameters of Word Catalogue of Olive Varieties by using LabVIEW based video measurement software to accurate and comparison as an advanced method (Navero, 2000). Descriptors widely use for the identification of olive cultivars' approach, but there is a lack of a methodology for the development in this field (Belaj et al., 2016). Because of this reason, the morphological analysis of olive leaves, fruits, and stones by using video analysis considered an essential method for this field study in with their numerical findings. Nowadays, old methods such as screw gauge or caliper, gridded paper, etc. are using for the morphological analysis of olives by experts as manual techniques (Al-Ruqaie et al., 2016). This olive research base on the 'Picual' olive cultivar measurement methods which is produced in Jaen in Spain and the comparison of each method with the other one as an application of dimension measurement from the olive leaf, fruit, and stone. These methods are selected as caliper measurement (as primary measurement method), and real-time video analysis. Additionally, the research focused on the identification of the 'Picual' olive cultivar morphologically. In this methodology, in addition to the identification of olive leaves, fruits and stones were analysed by providing some basic morphological features such as height and perimeter. This study aims to develop a useful methodology for getting reliable numerical values in a fast way from morphological measurements of olive leaves, fruits, and stones. In the study, a realtime video analysis method used and its efficiency was tested for 'Picual' olive cultivar dimension measurements. For this purpose, olive fruit, stone, leaf samples were placed under a webcam (Logitech C930e). A software was developed on the LabVIEW platform used for real-time measurements. Video measurements were not influenced by the parameters like product surface, color, and ambient light changes in general, because of these reasons environmental conditions optimized for the real-time video measurements. For controlling the result accuracy of the measurement system, the obtained data were compared with the caliper measurements manually.
The structure of this paper is organized as follows. First of all, the 'Picual' olive variety was introduced which was focused on this research. Then, the measurement steps of the application were explained. Under this sub-section developed video analysis software introduced and the measurement process of this application was explained as a leaf, fruit, and stone dimension measurement. Results were presented as dimensional measurements. Also, results were discussed in this section. The research has reached a conclusion based on the results found from experiments.

Materials and Methods
Olive leaf, fruit and stone samples 'Picual' variety was selected for experiments because this cultivar is widely produced in Jaen. So, it has great economic importance because of their production amounts in Jaen, also in Spain. 50 fruit samples were collected from five trees of the cultivar. Also, they were collected from rotation around the tree at approximately 1.5 m from the ground level. They were collected randomly from chosen fruiting branches. All the samples were collected in winter, with fruits at fully ripened, according to colour in dark purple, and the stones at the complete morphologic and colorimetric development. 50 olive stone stones were manually removed, and accurately cleaned, washed, and dried ( Figure 1). Also, 50 mature, normally developed leaves were collected from the trees at the shoulder level as samples obtained from the trees randomly to characterize the olive population. 150 samples were analysed from olive cultivar. Selected cultivar fruit, stone, and leaf samples of the olive cultivar can be seen in (Figure 2). For the leaf, fruit, and olive stone dimension measurements, a measurement unit was set up with Kaiser RS1 camera stand and Logitech C930e USB webcam. Also, a led light chamber added to the unit which has 64 mW power and 400 -700 nm wavelength.
LabVIEW supports different cameras that have a variety of computer connections. Some are wireless, some have wire connections. In this exemplary application, a USB 3.0 interface unit webcam (Logitech C930e) capable of capturing video up to 30 frames per second is used with a 1920x1080 pixel resolution with the original driver of the webcam. But the webcam resolution is set at 2304x1536 pixels and 0.35 frames per second for the software to get the most valuable results by using the external driver-based video transfer method. Specifications of the Logitech C930e USB webcam can be seen in Table 1. Preventing from perspective errors which come from calibration plate two different colour calibration object was printed on the white measurement surface as black and yellow 15 mm circles. Calibration objects selected as circular objects because dimension errors are low at the circular shapes. Also, two different colour calibration objects were printed because the yellow one was used for stone evaluations from HSL colour space and the black one was used for fruits and leaf measurements from the Green and Blue channels of the video acquisition, respectively (Figure 3). Length and width measurements of leaf, fruit, and stones had been executed for the morphological classification of olive cultivates by using LabVIEW software. Collected data from the digital images of fruit, leaves, and olive stones can be seen in (Figure 4). LabVIEW is a software, which is developed for different aims with the various sub-modules for the goal of scientific use. Among the various development platforms, LabVIEW offers visual and easier software development techniques. Also, it has a vast programming library with engineering modules. The software development process has been done by using LabVIEW visual program interface tools. For this purpose, LabVIEW and its vision submodules have been used for video processing and motion detection. At vision submodule Vision Acquisition Software (VAS) was used for video acquisition functions. LabVIEW programming has two steps of visual programming. These are front panel vision and block diagram icon programming. The front panel is an interactive software part where the user can insert visual and graphical objects in software like indicators and graphics ( Figure 5).

Figure 5. Software interface which is developed for video measurement
By the visual elements placed in this field, the interface of needed software can be created in a short time. The block diagram is the place where the LabVIEW environment programming was done ( Figure 6). Each icon has its source codes run in this location. The connections of the symbols with their codes, which work in the background of the program, create the software, which we need. Software outputs can be seen from the front panel according to the entry and output parts of the software.  In the block diagram, first NI Vision Acquisition Express VI used for selecting the video source and video properties. Webcam resolution was set to 2304x1536 pixels and 0.35 frames per second for the software to get the best precious results by using the external driver-based video transfer method. Then IMAQ Extract Single Color Plane VI was used for detaching the destination image (Image Dst), colour plane (Color Plane), and image search (Image Src). Color Plane defines the colour plane to extract. Image Src is the reference to a color image that has one of its color planes extracted. If Image Dst is not connected, the source image is converted to an image that contains the extracted plane. Image Dst is a reference to the destination image. Additionally, Vision Assistant Express was used to create, edit, and run vision applications like clamp measurements from video acquisition. Then, with the help of Bundle Function clusters were assembled from individual elements. Also, this function can use to change the values of individual elements in an existing cluster without having to specify new values for all elements. After that, using IMAQ Overlay Text VI the texts on an image were overlaid. Overlay function is non-destructive, which means that they do not overwrite the underlying pixel values. With the help of this function, overlay information can save with an image by using the IMAQ Read Image and Vision Info VI. Also, it is possible to replace the underlying pixel values with the overlay values with the use of IMAQ Merge Overlay VI. At last, with the help of the Image Out function results were monitored on the front panel as the captured image (National Instruments, 2018).
In this application, a colour printed calibration object (15 mm size) was used for agricultural product dimension measurements. In this way, agricultural product dimensions were determined by using the developed software (Figure 8). First of all, for the calibration of measurement 5 product was measured, then according to the measurement error calibration object size was changed from the software calibration value input panel to get close measurement values. In this way, the measurement errors which come from the camera lens, perspective errors were decreased. Additionally, for length and width of calibration plate measurement directions were changed for making each measurement direction the same. Camera measurements have been performed from different distances (6 cm for stone measurements, 7 cm for fruit measurements, 7 cm for leaf measurements) for getting close measurements. In this way, a real dimension that combines with per pixel was optimized for close measurement. Additionally, camera framing was optimized for the objects which have different dimensions. Vanloot et al. (2014) emphasize that the definition of traditionally variant origin from the olive stone examination is based on the determination of ten visually accessible characters which can be measured with a caliper. So, the manual measurements were done with a 0.1 mm precision caliper for detaching the accuracy of computer vision video measurements. Additionally, for the determination of the maximum width diameter at fruit and stones turned around their centre point between caliper surfaces, so the maximum diameter was found in this way. Using this method, measurement errors were mostly eliminated. The difference between the results was analysed statistically. As a statistical compare test, regression analysis has been applied to the data which is obtained from real-time video and caliper measurements. Compare results of the test were used for explaining the effectiveness of the methods for olive tree and its product dimension measurements also cultivar classification process morphologically.

Results and Discussion
The graphics which contain the prediction equation and the regression value of video and caliper measurements of olive cultivars width and length can be seen in Figures 9-14. According to the regression coefficient results, the regression between caliper length measurement (OLLM) and computer vision video length measurement (OLLCV) found as 98.9%, also the regression between caliper width measurement (OLWM) and computer vision video width measurement (OLWCV) found as 97.9% at 'Picual' leaves, additionally, the regression between caliper length measurement (OFLM) and computer vision video length measurement (OFLCV) found as 98.5% the regression between caliper width measurement (OFWM) and computer vision video width measurement (OFWCV) found as 98.1 % at Also, in the literature about this issue, Vanloot et al. (2014) worked on an artificial vision approach for the olive variety identification from stones at five main French cultivars. They expressed that the best results were obtained from the data of front and profile images with 100% of classification success. Beyaz and Ozturk (2016) focused on olive cultivars identification with the help of image processing techniques. They used variance and Duncan's test to characterize the olive cultivars. As a result, all olive cultivars were identified successfully at the P < 0.05 significance level. Additionally, Beyaz et al. (2017) studied to identify some Spanish olive cultivars using image processing techniques. They imply that the cultivars were identified 90% from dimensions with artificial neural networks. Blazakis et al. (2017) focused on sets of images from fruits, leaves, and endocarps of Greek olive cultivars. They expressed that they described olive morphologies efficiently and robustly in a semi-automated way. On the contrary of Blazakis et al. (2017), in this research, all measurements were done by using a video measurement-based fully automatic measurement system successfully. Sabliov et al. (2002) worked on the image processing method to determine surface area and volume of axisymmetric agricultural products. They imply that the surface area of axisymmetric objects by using the image processing method gave results within 5%, lower than the tape method.

Conclusions
In this research, digital video processing, and caliper measurement techniques have been excused. At first, essentials around the video processing and measurement technique were discussed for understanding the video analysis and acquisition system of LabVIEW. Then an olive cultivar dimension measurement application has been made. The efficiency of video analysis of development application has been presented. The results of the video measurements show that the computer and electronic-based systems and technique is useful for determinations of olive properties. These systems promise a future as a solution to the problems. About this issue in the literature, Ozdemir et al. (2016) explained that the fruit, and seed dimensional characteristics (width and length), fruit weight and flesh to seed ratio are being used as descriptive fruit characters and thus are required for the new cultivar registration procedure for olive cultivar candidates in breeding studies.
Additionally, Ennouri et al. (2017) implied that the morphological markers are a preliminary tool to characterize olive oil accessions. In conclusion, we can develop a more efficient machine and tools with getting morphological characteristics and digital information of olives for agricultural applications such as fertilization, pesticide applications, crop separation, and classification at olive trees.