Image Analysis Implementation for Evaluation of External Potato Damage

The aim of this work was the implementation of an identification and evaluation methodology for external potato damage detection. A system for automatic image recognition was used and a methodology validation, by comparison with human visual selection, was performed. The potato surface image was acquired with a monochromatic video camera that operated in the visible spectrum and in the near infrared. This device was connected to a frame grabber card, interfaced to a PC, for image acquisition and elaboration. The software for the image elaboration has enabled the definition of algorithms for the automatic recognition and measurement of the damaged area. The obtained data were compared with the human visual evaluation demonstrating an adequate level of reliability of the applied methodology.


Introduction
Potato tubers are very sensitive to mechanical damage during harvesting, transport and handling.The mechanical impacts can cause damage to the surface of the tuber an adaptive boosting algorithm to automatically select the best features and discriminate potato blemishes achieving more than 89% of accuracy.Razmjooy et al. [19] proposed a potatoes classification of both size and external defect, using machine vision system based on classification algorithm.The system obtained high accuracy in both size sorting and classification.This paper describes a methodology that applies a vision system for the automatic detection of the external defects of the tubers using a monochromatic video camera.Such a system should be able to identify and quantify the surface defects through recognition of the damaged surface compared to that of the intact tuber, allowing the quality of the potato to be evaluated, maintaining accuracy while eliminating the subjectivity of manual inspections and reducing the time and cost of the operation.

Materials and methods
Primura cultivar was used in the investigation, the only Italian variety that can be marketed with the trademark Patata Tipica di Bologna® and utilized with the European PDO recognition.The research was split into the following phases: (1) sample preparation, (2) image acquisition, (3) image elaboration, (4) visual evaluation of the damage, (5) verification of the automatic acquisition system.

Sample preparation
A sample of 100 tubers was taken immediately after harvesting.Sample preparation involved cleaning the tubers under running water to eliminate any soil particles adhering to the skin, as happens in the potato grading line in which the product is mechanically washed prior to grading.The mass and diameters in the three directions were then measured.

Image acquisition
The image acquisition station was composed of a camera Jai (JAI AS, Copenhagen, Denmark) model CV-M50IR equipped with a monochromatic sensor charge-coupled device CCD with spectral response 400 ÷ 900 nm (visible spectrum and NIR) and Rodenstock lens (Rodenstock USA Inc, Columbus, OH, USA) with focal length 25 mm and spectral range 400 ÷ 900 nm.The video camera was fixed to a photographic stand on which the lighting system was mounted, composed of two 400 Lumen incandescent lamps.The lamps were set at a height of 0.5 m above the tubers and arranged laterally at 0.25 m with respect to the vertical axis of the video camera, and the whole system was placed inside a closed box.The elaboration system was composed of a PC with a National PCI/PXI-1409 frame grabber card and National IMAQ Vision Builder Ver.6.1 software (National Instruments Corporation, Austin, Texas, U.S.) for the image elaboration.
The tests were conducted in static conditions with the tubers placed on a dark surface to clearly differentiate the potato from the background.Four pictures were taken of every tuber, rotating it by 90° each time, so a total of 400 images were acquired.The combination of the four images allowed the entire surface of the tuber to be reproduced.This method simulates the traditional screening process, where the tubers rotate on roller systems that allow the grader to see the whole surface and remove any damaged ones.The lens diaphragm was set at 11 to obtain a better depth of field, so that, maintaining the fixed focus, the system was able to correctly acquire images of tubers of different sizes.
The exposure was controlled by the frame grabber card setting the automatic exposure mode, which allowed any variations in the lighting conditions to be controlled.Representation of the levels of grey was encoded with 8 bits (256 shades of grey).

Image elaboration
Most of the damage and external defects on tubers differ from the rest of the normal skin by a darker colour, so a script was implemented that adopts automatic procedures of image acquisition and elaboration that allow the dark parts to be extracted.
The programme was organized according to the flow diagram in Fig. 1.The first phase of the process consists in image acquisition operations to convert the image into digital form.In this phase, the control and regulation of the video camera is managed directly by the software.The second phase involves the definition of a threshold of separation of the values of grey for the transformation of the image from 256 grey-levels to a binary image; in this way just two values are represented, white and black, which distinguish the investigated areas.The procedure involves the automatic definition of the threshold value with the methodology "Auto Threshold Entropy", aimed at the identification and accentuation of objects, such as damaged areas, present in a limited percentage in the image [18].The probability of the shade of grey i, in an image, is given by equation ( 1): where N represents the number of the grey-levels (256 for the representation at 8 bits utilized) and i is the individual level of grey.Indicating the threshold level with k, equation (2) gives the value of the entropy (Hb) associated to the black pixels in the elaborated image, and equation ( 3) the value of the entropy (Hw) associated to the white pixels: The optimal threshold value is the shade of grey that maximizes, in the elaborated image, the value of entropy expressed by equation 4: Afterwards the following operations are performed: binary inversion, removal of small objects (the check is done around each individual pixel), erosion and removal of objects on the border of the main image.
The final result is obtained with operations of dilation and filling, followed by the removal, through filtering, of objects smaller than 9 mm 2 (threshold set to discriminate between a damaged product and a marketable one).
Once the image is segmented into discrete objects of interest, the particle analysis is conducted to measure the size of objects picked out and not removed by the filter and, lastly the classification operation that allows the objects to be identified by classifying them into different groups.

Visual evaluation of the damage
The visual analysis of the potatoes damage was done by the same operator on all the sampled tubers in order to reduce the variability to a minimum.On each tuber the number of defects larger than 9 mm 2 were counted and the two major axes d1 and d2 of the individual defects were measured.The area of each defect was estimated approximating it to both a rectangular shape (Area = d1• d2) and an elliptical shape (Area = π•4 -1 •d1•d2) (Fig. 2).

Comparison between computer vision with human inspection
The results obtained from human inspection and by automatic image acquisition were analyzed to reveal any correlation between the areas calculated with the image acquisition and those measured by direct observation, and a linear model of correlation was evaluated.

Results and discussions
The phases of image acquisition and elaboration are shown in Fig. 3, which displays, for a generic tuber, the image acquired by the PC via the video camera (Fig. 3a), and the images obtained with the elaboration procedures summarized in Fig. 1.It can be seen that after the filtering operations the areas corresponding to the two main defects, which were recognizable in the original image of the potato (Fig. 3a), are highlighted (Fig. 3f).The inner area of one of the two defects is similar to that of the intact potato as the lesion has undergone a partial healing process with newly formed skin, which explains the elaboration and automatic recognition of just the circular area around the lesion (Fig. 3 b, c, d).
From the sample of 400 images, 84 images were selected of tubers with defects identified by both human inspection and the computer vision analysis.There was 100% correspondence in the identification of the number of damaged areas by human inspection and computer vision.Fig. 4 summarizes the results of image processing for some tubers.The data were analyzed statistically to identify any correlation between the areas calculated with the image acquisition and those measured by direct observation, and a linear model of correlation was evaluated (Fig. 5 and Fig. 6).The regression lines are expressed by the following equations: Where Areacv is the area acquired by computer vision; Areahi is the area of defect measured by human inspection, approximated to a rectangle (eq.5) and an ellipse (eq.6).From the two equations it can be seen that the area of damage evaluated with the automatic image acquisition is included within that calculated hypothesizing the defect as a rectangle and that calculated considering it an ellipse, which, given the usually irregular shape of a defect, is an approximation compatible with the objectives of the research.

Conclusions
The results show that the automatic vision system can measure, with a good level of reliability compared to human vision and even for small defects, the mechanical damage and insect and fungi attacks that cause surface damage.In particular: there is complete correlation between the identification of the number of damaged areas by the grader and that obtained through computer image analysis; -with reference to the sizes of the damage, the area evaluated with the automatic acquisition is included within those visually evaluated by an observer approximating the lesion to a rectangle and to an ellipse; -with reference to the damage size classes, the automatic acquisition procedure, with respect to visual evaluation, overestimates the defects in the smallest size class and underestimates them in the intermediate size class.The system of computer vision may confuse the damage with the tuber surface when there has been a healing process of the skin with the formation of new tissue of a similar colour to that of the potato.In these cases the peripheral area of the defect is still recognizable and, through the procedure of automatic elaboration, it is possible to estimate the actual size of the damage.The results obtained are the starting point for the development of a system integ-rated to a quality control and grading line for the automatic recognition of external damage to tubers in post harvest.This technology may represent a system usable on the processing line to establish the quality parameters of the product associated to external anomalies, both from the perspective of checking the harvested material, aimed at its valorisation, and from that of product grading.In this latter case the image processing technique will be combined with mechanical and instrumental devices to replace human handling.Computer vision applied to potatoes can provide an alternative method for economical and non-destructive product selection and allows the introduction of automatic selection procedures to integrate the manual grading practices.

Figure 1 .
Figure 1.System block diagram of image processing configuration.

Figure 2 .
Figure 2. Figures of approximation in the visual evaluation of the damage (the dimensions are measured directly on the tuber by an operator).

Figure 3 .
Figure 3. Image acquisition and elaboration phases; (a) image acquired by the video camera; (b) binary image obtained with the automatic determination of the threshold level; (c) inversion of the binary image; (d) image obtained after the processes of dilation and removal of the borders; (e) elaboration of the image with the filling technique; (f) final image elaborated with the application of filters.

Figure 4 .
Figure 4. Image processing for four tubers; first row: image acquired; second row: binary image obtained with the automatic determination of the threshold level; third row: image obtained after the processes of dilation and removal of the borders; fourth row: final image elaborated with the application of filters.

Figure 5 .
Figure 5. Linear regression line relating the damaged area evaluated with the automatic image acquisition to the area measured directly by an operator and approximated to a rectangle.

Figure 6 .
Figure 6.Linear regression line relating the damaged area evaluated with the automatic image acquisition to the area measured directly by an operator and approximated to an ellipse.
The coefficients R 2 (R 2 = 0.71) reveal the correlation between damaged area acquired with computer vision technology and that measured directly by the grader.Another consideration can be made from dividing the defects into 3 damage classes identified according to the different percentages of the tuber surface damaged: 4038 Claudio Caprara and Roberta Martelli I. 0% ÷ 3%; II.3% ÷ 6%; III.> 6%.The analysis of the damage distribution, in relation to the damage classes, shows that the automatic acquisition procedure by video camera can identify small defects and that, in the smallest size class (damage class I) it overestimates the defects, in the intermediate size class (damage class II) it underestimates the defects, and in the largest size class (damage class III) it differs slightly from the human visual evaluations (Fig.6).

Figure 6 .
Figure 6.Distribution of the damage classes; A, automatic acquisition, B visual detection; I, II, III, level damage classes