A strawberry ripeness real-time detection and grading method based on color-texture-shape multi-feature fusion
The strawberry maturity detection method, which integrates color, texture, and shape features, solves the problems of poor robustness, coarse grading, and difficulty in balancing real-time performance and accuracy in existing technologies, and achieves high-accuracy four-level grading and real-time detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAANXI SCI TECH UNIV
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-05
AI Technical Summary
Existing methods for detecting strawberry maturity suffer from problems such as poor robustness of single features, coarse grading granularity, lack of handling of defect interference, and difficulty in balancing real-time performance and accuracy.
A detection method based on color-texture-shape multi-feature fusion is adopted, including image preprocessing, defect region detection, feature extraction and fusion, support vector machine classifier for maturity level discrimination, and principal component analysis for feature dimensionality reduction.
It improves the robustness of detection and the accuracy of classification, realizes four-level fine-grained classification, meets real-time requirements, reduces computational complexity, and is suitable for online classification.
Smart Images

Figure CN122156136A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of non-destructive testing of agricultural products and computer vision technology, specifically involving a method for real-time detection and grading of strawberry maturity based on the fusion of multiple features of color, texture and shape. Background Technology
[0002] Strawberries are a high-value berry fruit widely cultivated globally. my country ranks first in the world in both strawberry planting area and output, and the industry is transitioning from scale expansion to quality improvement. However, the thin skin, juiciness, and vigorous post-harvest physiological activity of strawberry fruits mean that outdated testing and grading methods have become a key bottleneck restricting the industry's upgrading.
[0003] Maturity is the core indicator for evaluating the quality of strawberries, directly affecting their taste, nutritional value, and shelf life. Currently, the main methods for detecting strawberry maturity include: (1) manual sensory evaluation, which relies on the visual judgment of skilled workers and has problems such as strong subjectivity, low efficiency, and poor consistency; (2) physicochemical index detection, such as soluble solids content and titratable acidity analysis, which, although highly accurate, has a slow detection speed and is difficult to adapt to the needs of online real-time grading; (3) bioimpedance detection, which uses the differences in the electrical properties of strawberry tissues at different maturity levels for discrimination, but problems such as electrode contact consistency and temperature influence still need to be solved; (4) machine vision detection, which has become a research hotspot due to its advantages of being non-contact, fast, and rich in information.
[0004] Existing machine vision grading methods suffer from the following technical shortcomings: First, the problem of feature singularity exists, with most methods relying solely on color features for maturity determination, using the area of red coloration as the primary criterion, resulting in insufficient robustness under conditions such as changes in light intensity and varietal differences. Second, the granularity of maturity grading is coarse, with existing studies often dividing it into 2-3 grades, which is insufficient to meet the demands of high-quality products. Third, the balance between real-time performance and accuracy is inadequate, as complex deep learning models involve large computational demands, making them difficult to deploy on low-cost embedded platforms. Fourth, defect interference is not effectively addressed, as common strawberry defects such as deformed fruit, mechanical damage, and lesions can interfere with the accuracy of maturity determination. Summary of the Invention
[0005] The technical problem to be solved by the present invention
[0006] To address the aforementioned shortcomings in existing technologies, this invention provides a real-time strawberry maturity detection and grading method based on the fusion of multiple features including color, texture, and shape. This method aims to solve the technical problems of poor robustness of single features, coarse grading granularity, defect interference, and the difficulty in balancing real-time performance and accuracy.
[0007] Technical solution
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A method for real-time detection and grading of strawberry maturity based on multi-feature fusion of color, texture, and shape, characterized by the following steps:
[0010] Step 1: Acquire strawberry images and preprocess them to obtain a binary mask of the strawberry fruit region;
[0011] Step 2: Detect the defective areas on the strawberry surface and generate a defect mask;
[0012] Step 3: Extract color features, texture features, and shape features from the fruit region after removing the defect mask;
[0013] Step 4: Fuse color features, texture features, and shape features to form the original feature vector, and then perform feature dimensionality reduction;
[0014] Step 5: Input the dimensionality-reduced feature vector into the pre-trained classification model and output the ripeness level of the strawberry;
[0015] Step 6: Based on the maturity level results, drive the actuators to be classified.
[0016] Preferably, the preprocessing in step 1 includes: denoising the image using median filtering, correcting the illumination using white balance adjustment, and segmenting the background using an Otsu threshold-based segmentation algorithm.
[0017] The mathematical expression for median filtering is shown in formula (1):
[0018] (1)
[0019] in, For the original image, This is the filtered image. It is a 3×3 neighborhood window.
[0020] The Otsu thresholding algorithm determines the optimal threshold by maximizing the inter-class variance, and its calculation method is shown in formulas (2) and (3):
[0021] (2)
[0022] (3)
[0023] in, , These represent the ratios of background and target pixels, respectively. , These are the average gray levels of the background and the target, respectively. The grayscale level is denoted by .
[0024] Preferably, the defect area detection in step 2 includes the following sub-steps:
[0025] Step 2.1: Detection of hue and saturation anomalies based on HSV color space. Convert the image from RGB space to HSV space using the following conversion formulas (4) to (6):
[0026] (4)
[0027] (5)
[0028] (6)
[0029] Set the threshold for color anomalies or saturation abnormal threshold Generate an initial defect mask The determination logic is shown in formula (7):
[0030] (7)
[0031] Step 2.2: Texture anomaly detection based on Local Binary Patterns (LBP). The LBP operator is defined as shown in equations (8) and (9):
[0032] (8)
[0033] (9)
[0034] in, The grayscale value of the center pixel. For radius On the circular neighborhood The gray values of the neighboring points are used in this method. , The circular LBP operator.
[0035] Using a 32×32 pixel sliding window, the chi-square distance between the LBP histogram within the window and the normal region template is calculated as shown in formula (10):
[0036] (10)
[0037] in, and These are the LBP histograms for the window to be detected and the normal template, respectively. To avoid small constants that divide by zero. Distance exceeds a threshold. The time markers are used as candidate defect regions to generate texture anomaly masks. .
[0038] Step 2.3: Combine the color anomaly detection results and the texture anomaly detection results, as shown in formula (11):
[0039] (11)
[0040] in, This represents the logical "OR" operation. This represents the morphological closing operation. It is a 5×5 circular structural element. The definition of the closing operation is shown in formula (12):
[0041] (12)
[0042] in, This indicates an expansion operation. This indicates the erosion operation. Finally, isolated noise points with an area smaller than 100 pixels are removed to generate the final defect mask. .
[0043] Preferably, the color feature extraction in step 3 includes the following sub-steps:
[0044] Step 3.1.1: Statistical characteristics of the RGB color space. Calculate the mean (first moment), standard deviation (second moment), skewness (third moment), and kurtosis (fourth moment) of the R, G, and B channels. The definitions of each statistic are shown in formulas (13) to (16):
[0045] Mean: (13)
[0046] Standard deviation: (14)
[0047] Skewness: (15)
[0048] Kuroshi: (16)
[0049] Step 3.1.2: The formula for calculating the proportion of red component is shown in (17):
[0050] (17)
[0051] Step 3.1.3: Colored area ratio, defined as the proportion of pixels that meet the red criterion to the total number of pixels in the fruit area, as shown in formula (18):
[0052] (18)
[0053] Step 3.1.4: Statistical characteristics of HSV color space. Calculate the mean and standard deviation of the three channels H, S, and V, using the same method as formulas (13) and (14).
[0054] Step 3.1.5: Histogram of 18-interval distribution of hue H. Quantize the H channel to 18 intervals, each interval being 20°, as shown in formula (19):
[0055] (19)
[0056] Preferably, the texture feature extraction in step 3 includes the following sub-steps:
[0057] Step 3.2.1: Feature extraction based on Gray-Level Co-occurrence Matrix (GLCM). Convert the image to grayscale, quantize to 16 gray levels, and calculate the displacement. ,direction Gray co-occurrence matrix .
[0058] The following five statistics are extracted from GLCM, and the mean values in four directions are taken. The formulas for contrast, correlation, energy, homogeneity, and entropy are shown in (20) to (24), respectively:
[0059] Contrast: (20)
[0060] Correlation: (twenty one)
[0061] in, This is the mean of the rows and columns. The standard deviation is denoted as .
[0062] Energy: (twenty two)
[0063] Homogeneity: (twenty three)
[0064] Entropy: (twenty four)
[0065] Step 3.2.2: Feature extraction based on Local Binary Pattern (LBP). The circular LBP operator is used ( The LBP spectrum was calculated using a uniform pattern encoding, resulting in 59 possible LBP values (58 uniform patterns + 1 non-uniform pattern). The histogram of the LBP spectrum was then compiled. .
[0066] Four global statistics of the histogram are extracted: mean, variance, energy, and entropy, which are defined as shown in formulas (13), (14), (22), and (24), respectively.
[0067] Preferably, the shape feature extraction in step 3 includes the following sub-steps:
[0068] Step 3.3.1: Geometric Features. Based on a binary mask of the fruit region. Extract the following geometric features:
[0069] area: (25)
[0070] Perimeter: The boundary length is calculated using 8-neighbor chain codes.
[0071] Major axis length and minor axis length : Calculate the lengths of the major and minor axes of an ellipse that has the same standard second-order central moments as the region.
[0072] Aspect Ratio: (26)
[0073] Sphericity: (27)
[0074] in The sphericity range is defined as the perimeter. The closer it is to 1, the closer it is to a circle.
[0075] Circularity: (28)
[0076] in It is the minimum circumcircle radius.
[0077] Step 3.3.2: Contour Features. The contour shape is described using Fourier descriptors. The sequence of contour points is represented in complex form, as shown in formula (29):
[0078] (29)
[0079] right Perform the discrete Fourier transform, as shown in equation (30):
[0080] (30)
[0081] The first 10 normalized amplitude coefficients are taken as shape features, as shown in formula (31):
[0082] (31)
[0083] Step 3.3.3: Symmetry Characteristics. Calculate the symmetry index of the region about its major axis. and symmetry index about the minor axis As shown in formula (32):
[0084] (32)
[0085] in express The mirror region about the specified axis.
[0086] Preferably, the feature fusion and dimensionality reduction in step 4 employs Principal Component Analysis (PCA). Color features (38 dimensions), texture features (9 dimensions), and shape features (19 dimensions) are concatenated to form a 66-dimensional original feature vector. .
[0087] First, the original features are normalized using Z-score, as shown in formula (33):
[0088] (33)
[0089] in and The first The mean and standard deviation of the dimensional features.
[0090] The covariance matrix is calculated as shown in formula (34):
[0091] (34)
[0092] Solving the eigenvalue problem is shown in formula (35):
[0093] (35)
[0094] Before choosing Each principal component contributes to the cumulative variance. The cumulative variance contribution rate is shown in formula (36):
[0095] (36)
[0096] In this method The cumulative variance contribution rate reached 96.8%. The eigenvectors after dimensionality reduction are shown in formula (37):
[0097] (37)
[0098] in For the front The projection matrix consisting of eigenvectors.
[0099] Preferably, the classification model in step 5 is a Support Vector Machine (SVM). For a binary classification problem, the SVM searches for the optimal classifying hyperplane, and its decision function is shown in formula (38):
[0100] (38)
[0101] in For kernel function mapping, For weight vectors, For bias.
[0102] Solving the optimization problem is shown in equations (39) and (40):
[0103] (39)
[0104] (40)
[0105] in As a penalty factor, These are slack variables.
[0106] The radial basis function (RBF) is used, as shown in equation (41):
[0107] (41)
[0108] in These are the parameters for the kernel function.
[0109] For four-class classification problems, a "one-against-one" strategy is adopted to construct... A binary SVM is used to determine the final category through a voting mechanism, as shown in formula (42):
[0110] (42)
[0111] in For category and A binary classifier, This is an indicator function.
[0112] Parameters were optimized using a combination of grid search and five-fold cross-validation. and The objective function is shown in formula (43):
[0113] (43)
[0114] Search scope: , .
[0115] Preferably, the maturity level is divided into four levels:
[0116] Grade I immature: >70% of the fruit is green or greenish-white, with a rough surface texture, weak luster, and relatively firm fruit;
[0117] Grade II semi-ripe: 30%-70% of the fruit is red-colored, with residual green at the base, medium gloss, and medium plumpness.
[0118] Grade III Maturity: Red coloring area >70%, bright color, smooth surface, strong luster, and plump fruit;
[0119] Grade IV Overripe: Deep red or dark red, with possible localized browning, reduced luster, possible wrinkled texture, and softened fruit.
[0120] Beneficial effects
[0121] Compared with the prior art, the present invention has the following beneficial effects:
[0122] (1) This invention adopts a strategy of integrating three complementary features: color, texture, and shape, which overcomes the limitations of a single color feature under changes in light and varietal differences. Color features reflect pigment accumulation, texture features reflect changes in surface tissue structure, and shape features reflect the degree of fruit development. The three features depict the ripening process from different dimensions, improving the comprehensiveness and robustness of the criteria, and achieving a grading accuracy rate of 96.7%.
[0123] (2) The present invention introduces a defect area detection and masking mechanism to eliminate the interference of defect areas before feature extraction, ensuring that the extracted features reflect the maturity state of normal fruit pulp tissue, and avoiding the problem of misjudgment of maturity caused by defects such as mechanical damage and lesions.
[0124] (3) The present invention divides maturity into four levels: immature, semi-mature, mature and overripe. Compared with the traditional two- or three-classification method, the grading granularity is finer. The establishment of the semi-mature level provides technical support for e-commerce logistics. The mature level is suitable for ready-to-eat sales and is more in line with the market's differentiated needs for maturity.
[0125] (4) The present invention uses PCA to reduce the dimension of multi-dimensional features and fuse them. While retaining the complementary information of the three types of features, the feature dimension is reduced from 66 dimensions to 15 dimensions, which reduces the computational complexity of the classifier. The processing time for a single image is 37ms, which meets the real-time requirements of online classification.
[0126] (5) This invention uses an SVM classifier combined with an RBF kernel function and optimizes the parameters through grid search. The F1-score for the four maturity levels is above 0.96, which shows good generalization ability. Attached Figure Description
[0127] Figure 1 This is an overall flowchart of the method of the present invention.
[0128] Figure 2 This is a schematic diagram of the image acquisition system of the present invention.
[0129] Figure 3 This is a schematic diagram of defect region detection and mask generation according to the present invention.
[0130] Figure 4 This is a schematic diagram of color feature extraction according to the present invention.
[0131] Figure 5 This is a schematic diagram of texture feature extraction according to the present invention.
[0132] Figure 6 This is a schematic diagram of shape feature extraction according to the present invention.
[0133] Figure 7 This is a diagram showing the dimensionality reduction effect of principal component analysis features in this invention.
[0134] Figure 8 This is a schematic diagram of the SVM classifier structure of the present invention.
[0135] Figure 9 This is a physical diagram and working interface of the hierarchical system of the present invention.
[0136] Figure 10 These are representative sample images of strawberries at different maturity levels according to the present invention. Detailed Implementation
[0137] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, but the scope of protection of the present invention is not limited thereto.
[0138] Example 1: System Setup and Image Acquisition
[0139] This embodiment provides a specific implementation method for real-time detection and grading of strawberry maturity based on the fusion of multiple features including color, texture, and shape.
[0140] 1. Image Acquisition System Setup
[0141] Construct an image acquisition system consisting of an industrial camera, a ring LED light source, a conveyor belt, photoelectric sensors, and a control unit, such as... Figure 2As shown. The industrial camera uses a Baslerac A1300-30gc CMOS color camera with a resolution of 1296×966 pixels, a frame rate of 30fps, and an 8mm focal length lens. A ring-shaped LED white light source with a color temperature of 5500K and a color rendering index ≥90 is installed around the camera lens to provide uniform and stable illumination. The conveyor belt speed is adjustable, ranging from 0.1-0.5m / s. The photoelectric sensor uses an Omron E3Z-L61 through-beam photoelectric switch, which triggers the camera to capture an image when the strawberry moves to the shooting position with the conveyor belt.
[0142] 2. Image Preprocessing
[0143] Preprocess the acquired raw RGB color images:
[0144] (1) Use 3×3 neighborhood median filtering to remove salt-and-pepper noise;
[0145] (2) White balance correction is performed based on the gray world hypothesis to eliminate the influence of light source color temperature changes;
[0146] (3) Convert the image from RGB to Lab color space, and use the a channel to perform Otsu thresholding to obtain a binary mask for the fruit region. .
[0147] 3. Defect region detection and mask generation
[0148] Detection of surface defects in strawberries, such as Figure 3 As shown:
[0149] (1) Color anomaly detection: Convert the image to HSV space and calculate the H, S, and V values of each pixel according to formulas (4) to (6). Set a color anomaly threshold. or saturation abnormal threshold The initial defect mask is generated according to formula (7). The result is as follows Figure 3 As shown in (b).
[0150] (2) Texture anomaly detection: Calculate the LBP map according to formulas (8) and (9), using a 32×32 pixel sliding window, and calculate the chi-square distance between the LBP histogram within the window and the normal region template according to formula (10). If the distance exceeds the threshold, the detection is performed. The time markers are used as candidate defect regions to generate texture anomaly masks. The result is as follows Figure 3 As shown in (c).
[0151] (3) The color anomaly and texture anomaly detection results are merged according to formulas (11) and (12), and morphological closing operation is performed using a 5×5 circular structuring element to remove isolated noise points with an area of less than 100 pixels, thereby generating the final defect mask. The result is as follows Figure 3 As shown in (d).
[0152] 4. Multi-dimensional feature extraction
[0153] Fruit area after removing defect masking Feature extraction is performed in the process.
[0154] 4.1 Color Feature Extraction (38-dimensional)
[0155] Calculate the mean, standard deviation, skewness, and kurtosis of each channel in the RGB space using formulas (13) to (16) (12-dimensional); calculate the proportion of the red component using formula (17) (1-dimensional); calculate the tinting area ratio using formula (18) (1-dimensional); calculate the mean and standard deviation of each channel in the HSV space using formulas (13) and (14) (6-dimensional); calculate the 18-interval histogram of hue H using formula (19) (18-dimensional), as follows. Figure 4 As shown.
[0156] 4.2 Texture Feature Extraction (9-dimensional)
[0157] The contrast, correlation, energy, homogeneity, and entropy of GLCM are calculated according to formulas (20) to (24), and the average values in four directions (5 dimensions) are taken. Figure 5 As shown in (d); calculate the mean, variance, energy, and entropy (4-dimensional) of the LBP spectrum histogram according to formulas (13), (14), (22), and (24), as follows. Figure 5 As shown in (b)(c).
[0158] 4.3 Shape Feature Extraction (19 Dimensions)
[0159] Calculate the geometric features according to formulas (25) to (28): area, perimeter, major axis length, minor axis length, aspect ratio, sphericity, and circularity (7 dimensions); perform a Fourier transform on the contour point sequence according to formulas (29) to (31), and take the first 10 normalized coefficients (10 dimensions), such as... Figure 6 (c) shows; the symmetry index (2D) about the major and minor axes is calculated according to formula (32), as shown. Figure 6 As shown in (d).
[0160] 5. Feature fusion and dimensionality reduction
[0161] The 66-dimensional original feature vector Z-score normalization is performed according to the formula to obtain... The covariance matrix is calculated according to formula (34). Solving eigenvalue problems Select the previous one according to formula (36). The principal components, with a cumulative variance contribution rate of 96.8%, such as Figure 7 As shown. The 15-dimensional feature vector after dimensionality reduction is calculated according to formula (37). .
[0162] 6. Classification Model Construction and Training
[0163] 6.1 Dataset Construction
[0164] 2,500 samples of the "Hongyan" strawberry variety were collected and labeled by five professional graders according to industry standards into four maturity levels: 520 immature, 680 semi-ripe, 750 ripe, and 550 overripe. The samples were then randomly divided into a training set of 1,750 and a test set of 750 at a ratio of 7:3.
[0165] 6.2 Model Training
[0166] Support Vector Machine (SVM) is used as the classifier, and Radial Basis Function (RBF) is selected, as shown in Equation (41). A one-to-one strategy is used to achieve four-class classification, as shown in Equation (42). Parameters are optimized by combining grid search with five-fold cross-validation, as shown in Equation (43). Search range: The optimal parameters are .
[0167] 7. Experimental Results
[0168] 7.1 Grading accuracy
[0169] Performance was evaluated on the test set, with an overall accuracy of 96.7%. Recall rates for each category were: immature 96.2%, semi-mature 96.1%, mature 97.3%, and overripe 97.5%, with precision rates of 96.8%, 95.1%, 96.5%, and 98.8%, respectively. The F1-score for each category was above 0.96.
[0170] 7.2 Ablation Experiment
[0171] To verify the contributions of the three types of features, feature ablation experiments were conducted:
[0172] Table 1. Accuracy of different feature combinations
[0173] Feature combination accuracy Compared to the decline in complete features Color + Texture + Shape (Complete) 96.7% - Color features only 89.5% 7.2% Texture features only 76.3% 20.4% Shape features only 71.8% 24.9% Color + Texture 93.1% 3.6% Color + Shape 92.4% 4.3% Texture + Shape 84.7% 12.0%
[0174] The results show that color features contribute the most, while texture and shape features provide complementary information, and the fusion of the three can achieve the best performance.
[0175] 7.3 Real-time testing
[0176] The processing time of each stage was tested on an industrial PC platform (Intel i7-8700, 16GB RAM):
[0177] Table 2 Average processing time for each stage
[0178] Processing steps Time elapsed (ms) Image acquisition and transmission 8 Preprocessing and Defect Detection 12 Feature extraction 14 Feature dimensionality reduction and classification 3 total 37
[0179] The average processing time for a single image is 37ms, corresponding to a processing speed of approximately 27 images per second. This can match the throughput of strawberries at a 100mm interval under a conveyor belt speed of 0.3m / s, meeting the real-time requirements for online grading.
[0180] 7.4 Comparison with other methods
[0181] To verify the technical effectiveness of this invention, a comparative experiment was conducted with existing typical methods:
[0182] Table 3 Comparison of grading performance of different methods
[0183] method Feature type Classifier accuracy Processing time (ms / frame) Option 1 Color + Size + Shape Entropy weight method 96.3% 42 Option 2 Color characteristics YOLOv8+ 91.9% 45 Option 3 Color + Texture SVM 93.5% 40 Method of the present invention Color + Texture + Shape (PCA Fusion) SVM 96.7% 37
[0184] The method of this invention outperforms the comparative methods in terms of accuracy and has the shortest processing time, demonstrating the effectiveness of multi-feature fusion and PCA dimensionality reduction.
[0185] Example 2: Hierarchical System Integration and Operation
[0186] This embodiment provides a real-time strawberry maturity detection and grading system to implement the method described in Embodiment 1, including:
[0187] (1) Image acquisition unit: including industrial camera, ring LED light source, conveyor belt and photoelectric sensor, used to acquire strawberry images;
[0188] (2) Image processing unit: including an industrial control computer, which runs the computer program of the method described in Example 1 to realize image preprocessing, defect detection, feature extraction, feature dimensionality reduction and maturity classification;
[0189] (3) Control and execution unit: including PLC controller and pneumatic nozzles, which drive 4 sets of pneumatic nozzles according to the classification results to send strawberries into the collection channel of the corresponding maturity level;
[0190] (4) Collection unit: contains 4 collection channels, corresponding to the four levels of immature, semi-mature, mature and overripe.
[0191] The system operated continuously for 2 hours at a conveyor belt speed of 0.3 m / s, processing approximately 6,000 strawberries. The system ran stably without any jams or crashes. The grading success rate (the ratio of correctly graded strawberries by the system to those graded manually) reached 95.3%.
[0192] Example 3: Adaptability verification of different varieties
[0193] To verify the adaptability of the method of this invention to different strawberry varieties, 500 samples each of the three varieties "Zhang Ji", "Sweet Charlie", and "Feng Xiang" were collected for testing. The results showed that the method of this invention had a grading accuracy of 96.2% for "Zhang Ji", 95.8% for "Sweet Charlie", and 96.5% for "Feng Xiang", with an average accuracy of 96.2%, indicating that the method has good variety adaptability.
[0194] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for real-time detection and grading of strawberry maturity based on multi-feature fusion of color, texture, and shape, characterized in that, Includes the following steps: Step 1: Acquire strawberry images and preprocess them to obtain a binary mask of the strawberry fruit region; Step 2: Detect the defective areas on the strawberry surface and generate a defect mask; Step 3: Extract color features, texture features, and shape features from the fruit region after removing the defect mask; Step 4: Fuse color features, texture features, and shape features to form the original feature vector, and then perform feature dimensionality reduction; Step 5: Input the dimensionality-reduced feature vector into the pre-trained classification model and output the ripeness level of the strawberry; Step 6: Based on the maturity level results, drive the actuators to be classified.
2. The method according to claim 1, characterized in that, The defect area detection in step 2 includes: Step 2.1: Detect hue and saturation anomalies based on the HSV color space, and set a hue anomaly threshold. or saturation abnormal threshold Generate an initial defect mask ; Step 2.2: Texture anomaly detection based on Local Binary Pattern (LBP). A sliding window is used to calculate the chi-square distance between the LBP histogram within the window and the normal region template. When the distance exceeds a threshold, it is marked as a candidate defect region, and a texture anomaly mask is generated. ; Step 2.3: Merge the color anomaly detection results and the texture anomaly detection results into... The final defect mask is generated through morphological processing.
3. The method according to claim 1, characterized in that, The color features mentioned in step 3 include: The average value of the R, G, and B channels in the RGB color space Standard deviation skewness kurtosis ; Red component percentage ; Colored area ratio ; The average value of the H, S, and V channels in the HSV color space and standard deviation ; Histogram of 18 intervals for hue H .
4. The method according to claim 1, characterized in that, The texture features mentioned in step 3 include: Contrast extraction based on gray-level co-occurrence matrix (GLCM) Correlation ,energy Homogeneity ,entropy Take the average of the four directions; Histogram mean extracted based on LBP ,variance ,energy ,entropy .
5. The method according to claim 1, characterized in that, The shape features mentioned in step 3 include: Geometric features: area ,perimeter Major axis length minor axis length Aspect Ratio sphericity Circularity ; Contour Features: Fourier Descriptors ; Symmetry characteristics: Symmetry indices about the major and minor axes .
6. The method according to claim 1, characterized in that, In step 4, the feature fusion and dimensionality reduction are performed using Principal Component Analysis (PCA), which concatenates color features, texture features, and shape features to form the original feature vector. After normalization, the covariance matrix is calculated. Solving eigenvalue problems Before choosing Each principal component contributes to the cumulative variance. Obtain the dimensionality-reduced feature vectors .
7. The method according to claim 1, characterized in that, The classification model described in step 5 is a Support Vector Machine (SVM), which uses a radial basis function kernel. A "one-to-one" strategy is used to achieve four-class classification, the final category is determined through a voting mechanism, and the penalty factor is optimized through grid search. and kernel function parameters .
8. The method according to claim 1, characterized in that, The maturity level is divided into four levels: Level I: Unripe, Level II: Semi-ripe, Level III: Ripe, and Level IV: Overripe.
9. The method according to claim 8, characterized in that, The Grade II semi-ripe strawberry is defined as strawberry with 30%-70% red coloring area, suitable for short- and medium-distance logistics transportation; the Grade III ripe strawberry is defined as strawberry with >70% red coloring area, suitable for ready-to-eat sales.
10. A real-time strawberry ripeness detection and grading system, used to implement the method described in any one of claims 1-9, characterized in that... include: Image acquisition unit: includes an industrial camera, light source, conveyor belt and photoelectric sensor, used to acquire images of strawberries; Image processing unit: A computer program that runs the method according to any one of claims 1-9; Control execution unit: Drives the hierarchical execution mechanism according to the classification results; Collection Unit: Contains multiple collection channels, corresponding to different maturity levels.