# Automatic System for the Detection of Defects on Olive Fruits in an Oil Mill
## 1 Introduction  
The production of Virgin Olive Oil (VOO) is a food transformation activity that encompasses the extraction of the oil out of the raw incoming olives using exclusively mechanical means. The ripeness and sanitary state of these olives is a key factor in the final quality of the VOO obtained [1, 2], as the technological variables of the process have only limited authority to influence the final features of the produced VOO, and can only preserve the potential quality offered by the fruit. Therefore, from a practical point of view, the properties of the incoming olives set an upper bound on the VOO quality, as the process cannot compensate for poor olive conditions. Under these circumstances, a proper characterization of the incoming olives emerges as a key step when the objective is to produce a consistent quality level of the final product. There is well known trade-off between quality and extraction yield [3, 4], so it is important to only employ a high quality configuration of the process for those olives that could actually provide such quality, since using that configuration for other types of olives would simply result in a diminished extraction yield without the desired higher quality. Separating the olives according to whether they were collected from the tree canopy or from the ground is a widespread practice in the VOO production industry. When this classification is carried out, olive growers are typically paid according to this factor, with olives coming from the tree receiving a higher remuneration. The classification of the batches between olives coming from the trees or from the ground is usually carried out by operators of the reception area of the factory. Consequently, these assessments can be affected by the subjectivity and the fatigue of the operators. Another important drawback of the manual inspection of the batches is the fact that the operator typically needs to perform some other actions in the reception area, so the inspection is carried out only on a subset of the received olives. The different remuneration for the olives coming from the tree canopy and coming from the ground provides an economic motivation for growers to try to present ground olives as canopy olives, or to mix small amounts of ground olives in a batch of canopy olives. Sometimes, a preliminary cleaning process is carried out in the orchards in order to complicate the classification of ground olives as such. Besides these considerations, canopy olives may have different quality levels, depending on whether they have suffered plagues or hail. The detection of these olives is of great interest, since even a small number of these may significantly impact the final quality of the produced VOO. Different aspects of the determination of the quality level of olives using computer vision have been addressed in previous scientific publications. The first contributions were focused on the detection of bruises on table olives and the classification of these into different classes according to the presence of these defects [5; 6]. These works reported that the best results were obtained using artificial neural networks (ANN). A posterior work [7] introduced the use of the Lab and HSV color spaces, and showed their applicability for the classification of table olives into different classes according to the type of defect present in them. In turn, [8] proposed using a ANN for the prediction of the ripeness of olives bound for the production of virgin olive oil (VOO). All of these contributions employ images that were taken in structured environments that avoided the superposition of olives and enhanced the difference between the olives and the background. The first contributions that try to segment olives in unstructured conditions were [9; 10]. These works, which are very similar, tackle the segmentation of olives from the olive branch, using the correlation of the image with an olive prototype and the application of the Chan-Vese algorithm in the surrounding area of the seeds detected by the correlation algorithm.