2.1. Apple Samples and Fruit Measurement
Fresh apples are divided into three commercial grades on the basis of a set of quality indicators: the highest grade, the first grade, and the second grade. Apples are also classified into four groups on the basis of the color of all or part of the surface: Group A—red; B—heterogeneous red; C—pinkish or striped with red; E—no color requirements [
1]. For example, the surface of highest grade apples (Group A) must be at least 3/4 red, and the surface of first-grade apples should be at least 1/2 red. The proportion of the color area is not normalized for second-grade apples. In addition to color, for each apple variety, there are requirements regarding skin defects, the degree of maturity, fruit condition, smell, taste, the presence or absence of a peduncle and numerous other indicators. The above indicators, as well as skin browning, pulp condition, presence of weed admixture, presence of agricultural pests, damage by agricultural pests, rotting, rotting with signs of wilting, overripening with pulp browning, and spoiling, are evaluated organoleptically. The organoleptic method has numerous significant disadvantages, including subjectivity, low accuracy and low productivity.
The weight or size of an apple is important for determining its commercial grade. In accordance with standard requirements, apples are calibrated on the basis of their largest transverse diameter or weight. The largest transverse diameter should be at least 60 mm. and the weight should be at least 90 g. Moreover, for apples calibrated by diameter, the difference in diameter in the same package should not exceed 5 mm for the highest, first and second grades. The weight ranges for commercial varieties are as follows: 70.0–90.0 g, 90.0–135.0 g, 135.0–200.0 g, and 200.0–300.0 g. The permissible weight deviations range from 15 to 50 g, depending on the weight category. To measure the mass and diameter, the following measuring instruments are used: a static weighing scale of average accuracy class, with a maximum weight limit of 25 kg and a calibration increment of 50 g; a scale of average accuracy class, with a minimum weight of 3 kg and a calibration increment is 2 g; a stainless steel tape measure of second-class accuracy, with a nominal length of 1 m and a measurement error of ±0.1 mm; a caliper of first-class accuracy, with a measurement error of 0.05 mm; a caliper of second-class accuracy, with a measurement error of 1 mm; a laboratory press; a juicer; a refractometer; and other auxiliary materials and measuring instruments. These instruments require manual operation. With the increase in apple production and shortage of skilled workers, improving the efficiency of apple quality assessment has become an urgent problem.
Objective quantitative methods for assessing the quality of vegetables and fruits have physical and chemical characteristics and can be categorized as follows: mechanical measurements of mass, size, volume, and density; physical measurements of thermal conductivity, acoustics, electrical conductivity, and permittivity; chemical measurements; electromagnetic measurements; and optical measurements of transmission and reflection coefficients in the visible and infrared regions. Optical measurement methods provide high measurement accuracy and meet the requirements for various crop quality evaluations [
2,
3]. Apples with surface defects can be classified relatively simply and safely via well-known sorting technologies [
4,
5]. Internal defects are "invisible", requiring new approaches and methods that provide information about the internal state of the fruits. In addition to internal defects caused by diseases and structural disorders, maturity, including the amounts of solids, proteins, vitamins and other components, is also evaluated. Known methods for determining internal qualities are based mainly on the optical permeability of products in different regions of the electromagnetic radiation spectrum.
In recent decades, technical vision systems (TVSs) have been widely used to determine the quantitative indicators of various objects. The advent of photoelectric transformation into object images, high spatial resolution, sufficient sensitivity, color video cameras and flexible digital image processing algorithms has facilitated the use of information about objects and their surrounding background. A classic example of such an approach for assessing the quality of fruits is the simultaneous measurement of fruit vegetable diameter, height, area, shape and color, followed by the calculation of quantitative parameters, defect classification and product category determination [
6,
7]. Kazakh National Agrarian Research University has some experience in developing TVS-based systems [
8,
9]. To obtain quantitative information about the size, shape, and color of apples, additional research is needed to substantiate informative quantitative signs that correspond to the verbal descriptions of various indicators.
The scientific novelty of this work lies in two aspects: the development of a digital method and computer program for assessing the quality indicators of apples and the results obtained from an experimental study involving apples from five varieties commonly found in the Republic of Kazakhstan.
On the basis of recommendations from pomological garden breeders, five apple varieties from the 2023 Kazakh harvest were chosen for research: Aport Alexander, Ainur, Sinap Almatynski, Nursat, and Kazakhski Yubileinyi. Fruit samples of these varieties were collected from the pomological garden at the Talgar regional branch of the Kazakh Research Institute of Fruit and Vegetable Growing in the second decade of September.
Figure 1 shows a section of a pomological garden with apple trees of the Sinap Almatynski variety.
The fruits of the Sinap Almatynski variety are large and have an elongated-conical shape, with a dark red blurred blush covering the fruit. The flesh is white with a creamy tint, dense, juicy, sweet and sour and has a pleasant dessert taste. These fruits are transportable and can be stored for a long time (until May). The fruits of the Aport variety are large (280 g), attractive, and have a strong aroma. The flesh is white, grainy and juicy. These fruits ripen in September and are stored until February or March. The fruits of the Ainur variety are 170–200 g in size, round-conical, golden yellow with a slight blush, sweet and sour, and have a strong aroma. The flesh is creamy, juicy, dense and tender. These fruits ripen in mid-September and stored in a refrigerator until March. The fruits of the Nursat variety are large, with an average weight of 180 g and a maximum weight of 250 g. The main color is golden yellow. The flesh is greenish, has a medium density, and juicy. The taste is sweet and sour, with a moderate aroma. The fruits of the Kazakhski Yubileinyi variety are large and round-conical in shape with a strong waxy coating. They have a dark red, blurred, and striped blush with numerous large, bright subcutaneous spots. The flesh is white, medium density, juicy, crispy, fine-grained, aromatic, and has a good sweet and sour taste. For this study, 30 fruits of each variety were collected. The study was conducted in the research laboratory of the Department of Energy Saving and Automation of Kazakh National Agrarian Research University. The workstation for determining the apple parameters is shown in
Figure 2.
The selected apple varieties include the main types of apple fruits on the basis of color, size (weight) and shape. The weight of each apple was determined on a DX1200 electronic scale with an accuracy of 0.01 g. The procedure for determining the weight of the fruit of the Aport Alexander variety is shown in
Figure 3a.
An electronic caliper was used to measure the linear dimensions (diameters (D) and (d) in two perpendicular planes and height (h)) of each apple). The average time for measuring and recording these dimensions was 26 seconds. The measurement of the linear dimensions of an apple of the Ainur variety is shown in
Figure 3b.
In addition to the standard parameters, the density of each fruit (ρ) was determined to identify the presence of possible defects and diseases. The density (ρ) was calculated as the ratio of the mass (m) to the volume (V) of the apple. The volume of the apple (V) was determined by measuring the volume of displaced water. The time for determining the density value was approximately 90 seconds. The procedure used for volume determination is shown in
Figure 3c.
2.2. Algorithm for Assessing the Quality of Apple Fruits via a Digital Method
The digital method for estimating the apple quality indicators in this study is based on analyzing apple images captures in the visible range of optical radiation and determining the geometric determination of the fruit from these images. The data processing algorithm is developed and is shown in
Figure 4.
First, an apple image must be captured via a digital camera or a similar device capable of capturing images. The image must be clear and well illuminated for more accurate analysis. In this study, a Varifocus camera, with a resolution of 1080 P, a focal length range of 5–50 mm, a complementary metal–oxide–semiconductor (CMOS) OV2710 sensor, and the ability to capture video in the MJPEG format at frame rates of 30 fps, 60 fps, and 120 fps, is used. The obtained images are in the RGB color space and have a resolution of 960 × 1280 pixels. Images of the variety Sinap Almatynski are shown in
Figure 5.
Before an image is analyzed, preprocessing must be carried out. Preprocessing includes converting each image to the hue, saturation, value (HSV) color space for more accurate color analysis, as well as applying filters to reduce noise and improve contrast. To implement the digital method, an experimental setup and a computer program in Python have been developed [
10,
11]. The experimental software test results are shown in
Figure 6.
The image captured by the camera is preprocessed via specialized algorithms and computer vision programs. Preprocessing includes outlining, segmenting the object, and analyzing the color information. Characteristics such as apple size, area, percentage of red, and shape are determined via the standard function in Python for image object analysis. By using the OpenCV library in the Python programming language, the main features of an apple, such as contour, shape and color, are identified. Edge extraction is performed via the Canny algorithm. After the apple contour features are extracted, the shape of the apple is analyzed via geometric analysis methods, such as finding the contour length, area, and aspect ratio. This process allows the size and shape of the apple to be determined. The duration of parameter evaluation for one apple is eight seconds.
Feature selection is based on the following algorithms: minimum redundancy maximum relevance (mRMR), F test and ReliefF. MATLAB software is used for feature ranking [
12]. The mRMR algorithm sequentially ranks the features by minimizing redundancy and maximizing relevance. The F test algorithm is based on the informativeness of each trait, which is analyzed separately via an F test. The traits are then ranked using the p values of the F test statistic. Each F test tests the hypothesis that the response values grouped by values of the predictor variable are drawn from populations with the same mean against the alternative hypothesis that the population means are not the same. The results correspond to –log(p). The ReliefF algorithm penalizes the feature points that give different values to neighbors of the same class, and rewards the feature points that give different values to neighbors of different classes. This algorithm estimates the significance of features on the basis of an estimate of the distance between two pairs of measurements. The results here also correspond to "–log(p)".
The prediction of the main apple quality parameters, i.e., weight and volume, is based on the following main models in the Regression Learner App in MATLAB: trees–fine, medium and coarse; regression–linear, interactions linear, robust linear and stepwise linear; SVM–linear, quadratic, cubic, fine Gaussian, medium Gaussian and coarse Gaussian; ensemble–boosted trees and bagged trees; Gaussian process–Matern, exponential and rational; neural network–narrow, wide, bilayered and trilayered; and kernel–SVM and LSR.