Blueberry sorting method, system and equipment and storage medium
Through blueberry image segmentation and multi-dimensional data analysis, combined with size, color and reflectance spectrum information for sorting, the problem of poor consistency in blueberry sorting was solved, and refined sorting and efficient and accurate sorting results were achieved.
Patent Information
- Application Number
- CN202510768263.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-09-12
AI Technical Summary
Existing blueberry sorting technology relies on manual sorting with poor consistency, and mechanical sorting is rough, making it difficult to achieve refined sorting. In addition, existing technology is difficult to combine multi-dimensional factors for accurate sorting.
By acquiring blueberry images, performing image segmentation and data analysis, and combining size, color, and reflectance spectrum information for multi-dimensional sorting, accurate sorting results are generated.
It achieves refined sorting of blueberries, reduces the subjectivity and inconsistency of manual sorting, improves sorting efficiency and accuracy, and meets the market's diverse demand for blueberries of different qualities.
Smart Images

Figure CN120618882A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blueberry production, and in particular to a blueberry sorting method, system, equipment and storage medium. Background Art
[0002] In recent years, my country's blueberry production has steadily increased, and the public's demand for blueberry quality has also become increasingly demanding. Blueberry quality, to a certain extent, depends on grading and sorting. Currently, blueberry sorting relies primarily on manual and mechanical sorting. Manual sorting relies on visual factors, resulting in poor overall sorting consistency and difficulty ensuring consistent results. While mechanical sorting is generally more efficient, it primarily considers the size of the berries. This method is relatively crude, with a relatively limited range of testing dimensions, making it difficult to achieve precise sorting of blueberries.
[0003] It can be seen that the existing technology still needs to be improved and enhanced. Summary of the Invention
[0004] In order to overcome the shortcomings of the existing technology, the purpose of the present invention is to provide a blueberry sorting method, system, equipment and storage medium, which combine the multi-dimensional factors of softness, color and size to sort blueberries, thereby achieving refined sorting of blueberries.
[0005] A first aspect of the present invention provides a blueberry sorting method, comprising: acquiring real-time blueberry images on a conveyor line according to a preset acquisition cycle; performing image segmentation on the real-time blueberry images to obtain blueberry image subsets; performing data analysis on each image in the blueberry image subsets to obtain appearance features of each image; and performing a primary sorting on the blueberry image subsets based on the appearance features to obtain multiple groups of blueberry image primary sorting subsets; acquiring reflectance spectrum information of each group of blueberry image sorting subsets, and performing a secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets; acquiring transmission coordinates of each image in each group of blueberry image secondary sorting subsets to obtain a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets; and generating corresponding sorting results according to each group of blueberry image secondary sorting subsets and the corresponding transmission coordinate set.
[0006] Optionally, in a first implementation method of the first aspect of the present invention, acquiring real-time blueberry images on the conveyor line according to a preset acquisition cycle includes: determining the acquisition cycle according to the sparse distribution of blueberries on the conveyor line; acquiring camera shooting field of view data, and correcting the camera shooting field of view data to obtain camera shooting field of view correction data; and continuously acquiring real-time blueberry images on the conveyor line based on the camera shooting field of view correction data and the acquisition cycle.
[0007] Optionally, in a second implementation manner of the first aspect of the present invention, the performing image segmentation on the real-time blueberry image to obtain a blueberry image subset includes: performing image preprocessing on the real-time blueberry image to obtain a pre-segmented blueberry image; performing foreground and background segmentation on the pre-segmented blueberry image based on a threshold segmentation algorithm to obtain a blueberry foreground segmented image; performing morphological processing on the blueberry foreground segmented image to obtain a blueberry foreground repaired image; performing connected domain analysis on the blueberry foreground repaired image to determine the image area of each blueberry target based on the contour information and position information of each blueberry target, and generating a blueberry image subset based on the image area of each blueberry target.
[0008] Optionally, in a third implementation of the first aspect of the present invention, data analysis is performed on each image in the blueberry image subset to obtain appearance features of each image; and the blueberry image subset is sorted once based on the appearance features to obtain multiple groups of primary sorted blueberry image subsets, including: extracting appearance features of the blueberry target in each image in the blueberry image subset to obtain appearance features of each blueberry target; the appearance features include geometric size parameters, color feature parameters and surface defect feature parameters; performing primary grading processing on the blueberry image subset based on preset blueberry standard size gradient parameters and geometric size parameters of each blueberry target to obtain multiple groups of size-graded blueberry image sets with different size dimensions; and analyzing the color feature parameters of the blueberry targets in each group of size-graded blueberry image sets. To obtain the dark purple pigment ratio and the fruit surface color mean of each blueberry target; and perform secondary grading processing on each group of size-graded blueberry image sets according to the preset standard ratio, the preset color mean, the dark purple pigment ratio of each blueberry target and the fruit surface color mean of each blueberry target to obtain multiple groups of ripeness-graded blueberry image sets; analyze the surface defect feature parameters of the blueberry targets in each group of ripeness-graded blueberry image sets to obtain the defect area ratio and texture characteristics of each blueberry target; analyze the defect area ratio and texture characteristics of each blueberry target according to the preset defect standard ratio and the preset texture entropy value to obtain a defective fruit image set; de-duplicate the corresponding ripeness-graded blueberry image set according to each group of defective fruit image sets to obtain multiple groups of blueberry image primary sorting subsets.
[0009] Optionally, in a fourth implementation of the first aspect of the present invention, the method of obtaining the reflectance spectrum information of each group of blueberry image sorting subsets and performing secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets includes: obtaining the reflectance spectrum information of each blueberry target in each group of blueberry image sorting subsets, and extracting characteristic bands from the reflectance spectrum information according to preset band information to obtain blueberry softness-related band information; performing distribution analysis on the blueberry softness-related band information to obtain moisture absorption peak wave information. The method comprises the following steps: calculating a band distribution ratio of water absorption peaks, a band distribution ratio of OH bond stretching vibration bands, and a ratio of pectinesterase activity-related bands; generating a water composition ratio according to the band distribution ratio of water absorption peaks, the band distribution ratio of OH bond stretching vibration bands, and a ratio of pectinesterase activity-related bands; wherein the water composition ratio is a ratio between bound water and free water; when the water composition ratio meets a preset standard condition, adding a passing label to the image corresponding to the blueberry target; and obtaining a blueberry image with a passing label from each group of blueberry image sorting subsets to form multiple groups of blueberry image secondary sorting subsets.
[0010] Optionally, in a fifth implementation manner of the first aspect of the present invention, obtaining the transmission coordinates of each image in each group of blueberry image secondary sorting subsets to obtain a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets includes: extracting contour information of each image in each group of blueberry image secondary sorting subsets; calculating the center of mass coordinates of the blueberry target based on the contour information, and obtaining the boundary coordinates of the blueberry target; determining the transmission coordinates of each image based on the center of mass coordinates and the boundary coordinates, and forming a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets.
[0011] Optionally, in a sixth implementation manner of the first aspect of the present invention, generating corresponding sorting results based on each group of blueberry image secondary sorting subsets and the corresponding transmission coordinate sets includes: performing channel encoding on each group of blueberry image secondary sorting subsets; associating the channel encoding with the corresponding transmission coordinate set to obtain a transmission mapping relationship; and generating the sorting results based on the transmission mapping relationship and the corresponding blueberry image secondary sorting subsets.
[0012] A second aspect of the present invention provides a blueberry sorting system, comprising: an acquisition module for acquiring real-time blueberry images on a conveyor line according to a preset acquisition cycle; a segmentation module for performing image segmentation on the real-time blueberry images to obtain blueberry image subsets; a first sorting module for performing data analysis on each image in the blueberry image subsets to obtain appearance features of each image; and performing a primary sorting on the blueberry image subsets based on the appearance features to obtain multiple groups of blueberry image primary sorting subsets; a second sorting module for acquiring reflectance spectrum information of each group of blueberry image sorting subsets, and performing a secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets; a coordinate module for acquiring the transmission coordinates of each image in each group of blueberry image secondary sorting subsets to obtain a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets; and a generation module for generating corresponding sorting results based on each group of blueberry image secondary sorting subsets and the corresponding transmission coordinate set.
[0013] A third aspect of the present invention provides a blueberry sorting device, comprising: a memory and at least one processor, wherein the memory stores instructions; at least one processor calls the instructions in the memory to enable the blueberry sorting device to perform each step of any one of the above-mentioned blueberry sorting methods.
[0014] A fourth aspect of the present invention provides a computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement the steps of any of the above-mentioned blueberry sorting methods.
[0015] In the technical solution of the present invention, by extracting features from three dimensions of size, color, and surface defects, calculating parameters such as the area, diameter, circumference, and fruit shape index of blueberries, the appearance quality of blueberries is evaluated in multiple dimensions to achieve preliminary refined grading; providing basic grading for further processing or sales, thereby increasing product added value; reducing the subjectivity and inconsistency of manual sorting, and improving sorting efficiency and accuracy; and simultaneously combining reflectance spectrum information to detect the internal quality of blueberries, achieving more accurate grading; and meeting the market's diverse demands for blueberry quality, such as the different requirements for softness, hardness, and sugar content for fresh consumption and processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flow chart of a blueberry sorting method provided in an embodiment of the present invention;
[0017] Figure 2 A schematic structural diagram of a blueberry sorting system provided in an embodiment of the present invention;
[0018] Figure 3 This is a schematic structural diagram of a blueberry sorting device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0019] The present invention provides a blueberry sorting method, system, equipment, and storage medium. By analyzing the size, color, and surface defects of blueberries and calculating parameters such as their area, diameter, circumference, and fruit shape index, the method enables multi-dimensional assessment and preliminary grading of appearance quality. This provides a foundation for further processing or sales, increasing product value, reducing the subjectivity and inconsistency of manual sorting, and improving sorting efficiency and accuracy. Incorporating reflectance spectral information can also detect the internal quality of blueberries, enabling more accurate grading to meet market demand for different qualities of blueberries, such as varying requirements for firmness and sugar content for fresh consumption and processing.
[0020] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0021] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the blueberry sorting method in the embodiment of the present invention includes:
[0022] 101. Acquire real-time images of blueberries on the conveyor line according to a preset acquisition cycle;
[0023] In this embodiment, an industrial camera, such as the Basler acA2500-14gm, is installed directly above the blueberry conveyor line. It features a frame rate of up to 14 fps and a resolution of 2592 × 1944, enabling clear capture of blueberry images. A ring-shaped, high-brightness LED light source ensures uniform illumination, preventing reflections and shadows from affecting image quality. Blueberry images of the conveyor line are acquired at a specific acquisition cycle, providing basic data for subsequent processing and ensuring consistent and reliable data acquisition. The acquisition cycle can be flexibly adjusted to meet varying production speed and accuracy requirements. Real-time monitoring ensures the stability of the acquisition process and reduces data loss or errors.
[0024] 102. Perform image segmentation on the real-time blueberry image to obtain a blueberry image subset;
[0025] In this embodiment, an image segmentation algorithm (such as the Otsu algorithm) is used to automatically calculate the optimal threshold value, divide the image into foreground (blueberries) and background, accurately separate the blueberry targets, remove background interference, and provide a pure image for appearance feature analysis; effectively repair image defects to make the analysis results more accurate; and improve the accuracy and completeness of blueberry recognition to avoid missed detection or false detection.
[0026] 103. Perform data analysis on each image in the blueberry image subset to obtain appearance features of each image; and perform a sorting on the blueberry image subset based on the appearance features to obtain multiple groups of primary sorted blueberry image subsets;
[0027] In this example, features are extracted from three dimensions: size, color, and surface defects. For size, the blueberry area, diameter, circumference, and fruit shape index are calculated. For color, the image is converted to HSV or Lab space to extract parameters such as hue, saturation, and brightness. Surface defects are detected using algorithms such as threshold segmentation, edge detection, and texture analysis. Furthermore, weights are set for each feature to establish grading standards, such as first-grade fruit diameter ≥18mm, dark purple pixel proportion ≥90%, and defect area proportion ≤2%. A weighted scoring model is used to divide the blueberry image subset into multiple groups of primary sorting subsets. The appearance quality of the blueberries is assessed using multiple dimensions to achieve preliminary and refined grading. This provides a basic grading basis for subsequent processing or sales, increasing product added value. This reduces the subjectivity and inconsistency of manual sorting, improving sorting efficiency and accuracy.
[0028] 104. Obtaining reflectance spectrum information of each group of blueberry image sorting subsets, and performing secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets;
[0029] In this embodiment, reflectance spectrum information is preprocessed using Savitzky-Golay filtering and multivariate scattering correction; features are extracted using methods such as PCA and PLS-DA; quality prediction models are established based on a large number of samples, such as predicting softness; secondary sorting is performed on the primary sorting subset according to grading criteria such as soluble solids content and sugar-acid ratio; the internal quality of blueberries is tested to achieve more accurate grading, and the diverse quality requirements of blueberries in different markets are met, such as the different requirements for softness, hardness, and sugar content for fresh consumption and processed products.
[0030] 105. Acquire the transmission coordinates of each image in each group of blueberry image secondary sorting subsets to obtain a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets;
[0031] 106. Generate corresponding sorting results according to the secondary sorting subsets of each group of blueberry images and the corresponding transmission coordinate sets.
[0032] In this embodiment, the secondary sorting subset images are preprocessed again, and the pixel coordinates of the blueberries in the image are obtained through contour detection and centroid calculation. Boundary coordinates are obtained using a circumscribed rectangle or ellipse fitting. The pixel coordinates are converted to actual physical coordinates through camera calibration and scale calibration. A world coordinate system is established, and the coordinates are dynamically compensated based on the conveyor belt speed. The coordinates are converted into a format recognizable by the transmission equipment. Precise positioning information is provided to the blueberry sorting actuator to ensure that the blueberries are accurately sorted to the corresponding channel. This improves the accuracy and efficiency of automated sorting and reduces manual intervention. Sorting errors caused by inaccurate coordinates are reduced, and the accuracy and consistency of product sorting are improved. Simultaneously, a data structure is established to associate the secondary sorting subset information with the transmission coordinate set. Sorting rules are formulated, and executable sorting instructions containing the target channel, coordinates, and action type are generated based on the coordinate information.
[0033] In an embodiment of the present invention, features are extracted from three dimensions: size, color, and surface defects. Parameters such as the area, diameter, circumference, and fruit shape index of blueberries are calculated. Multi-dimensional evaluation of the appearance quality of blueberries is used to achieve preliminary refined grading. This provides basic grading for further processing or sales, thereby increasing product added value. This reduces the subjectivity and inconsistency of manual sorting, improving sorting efficiency and accuracy. Furthermore, reflectance spectrum information is combined with the detection of the internal quality of blueberries to achieve more accurate grading. This meets the market's diverse demands for blueberry quality, such as the different requirements for softness, hardness, and sugar content for fresh consumption and processing.
[0034] A second embodiment of the blueberry sorting method according to the present invention includes:
[0035] 201. Determine the collection cycle based on the sparseness of blueberry distribution on the conveyor line;
[0036] In this embodiment, the distribution sparsity of blueberries on the conveyor line can be measured in two ways. The first way is to install an infrared pair tube or a laser sensor array at the initial section of the conveyor line, and calculate the real-time distribution density of blueberries (such as the number of fruits per meter of the conveyor belt) by the number of occlusions per unit time. The second way is to adopt a machine vision solution, and the arrangement rule of blueberries during the transmission process can be analyzed through historical images. For example, the average spacing D and standard deviation σ between adjacent blueberries are statistically calculated to judge the sparsity level (such as sparse D>20 cm, medium 10 cm<D≤20 cm, dense D≤10 cm). Moreover, a mapping relationship between the sparsity and the acquisition period is established: sparse scenario (such as obvious single-fruit interval): extend the acquisition period (such as T = 500 ms) to avoid repeated shooting of the same fruit and reduce data redundancy. Dense scenario (such as fruits stacked or closely arranged): shorten the acquisition period (such as T = 100 ms) to ensure that each fruit is photographed at least once and avoid missing detections. Avoid problems such as "over-shooting in sparse scenarios" or "missing shots in dense scenarios" caused by a fixed period. For example, in sparse scenarios, more than 50% of invalid images can be reduced, saving storage resources and computing costs. Ensure that each blueberry is covered by at least one image frame, without missing tiny fruits or edge fruits, and improve the integrity of subsequent sorting.
[0037] 202. Obtain the camera shooting field of view data, and correct the camera shooting field of view data to obtain the corrected camera shooting field of view data;
[0038] 203. Continuously obtain real-time blueberry images on the conveyor line based on the corrected camera shooting field of view data and the acquisition period.
[0039] In this embodiment, a standard checkerboard calibration board (such as a 10×10 black and white checkerboard) is placed within the camera's field of view, multiple groups of images at different angles are taken, the corner coordinates (u, v) (i.e., pixel coordinate system) are extracted, and at the same time, the coordinates (X, Y, Z) of the calibration board in the world coordinate system are recorded. The image is converted from the pixel coordinate system to the world coordinate system through a homography matrix to achieve geometric correction of the field of view range, ensuring that the size and shape of blueberries in the image are consistent with the actual physical size (such as 1 pixel corresponding to 0.1 mm). By correcting the camera shooting field of view data, the phenomenon of "stretching" or "compressing" of edge blueberries caused by lens distortion is eliminated. For example, the diameter measurement error of edge fruits is reduced from ±(15%) to ±(2%) after correction, ensuring the accuracy of appearance features (such as fruit diameter, defect area). Moreover, the corrected image coordinates correspond one-to-one with the actual physical positions, providing a basis for subsequent transmission coordinate calculation (such as the centroid pixel coordinates of blueberries can be directly converted into the positions on the conveyor belt, avoiding sorting position deviation caused by perspective distortion.
[0040] The third embodiment of the blueberry sorting method in the embodiment of the present invention includes:
[0041] 301. Perform image preprocessing on the real-time blueberry image to obtain a pre-segmented blueberry image;
[0042] In this embodiment, image preprocessing includes grayscale conversion, noise removal and illumination correction; grayscale conversion is to convert the color blueberry image from the RGB color space into a grayscale image, reduce the image data dimension, and reduce the subsequent processing calculation amount; noise removal is to use the median filtering algorithm to traverse the image through a sliding window, replace the median value of the pixel value in the window center with the median value of the pixel value in the window, and effectively remove salt and pepper noise; or use Gaussian filtering to construct a filter kernel based on the Gaussian distribution function, perform a convolution operation on the image, smooth the image, and suppress Gaussian noise; illumination correction is to use the histogram equalization method to redistribute the image grayscale values, expand the grayscale range, and enhance the image contrast; for non-uniform illumination, homomorphic filtering is used to separate the illumination component and the reflection component of the image, suppress low-frequency illumination changes, enhance high-frequency details, and make the image brightness more uniform.
[0043] 302. Perform foreground and background segmentation on the pre-segmented blueberry image based on a threshold segmentation algorithm to obtain a blueberry foreground segmented image;
[0044] In this embodiment, a global threshold segmentation algorithm is used to calculate the grayscale histogram of the pre-segmented blueberry image, traverse all possible grayscale thresholds, and divide the image pixels into two groups: foreground and background. By calculating the inter-class variance, the threshold that maximizes the inter-class variance is selected as the optimal segmentation threshold, and the image is converted into a binary image. Pixels greater than the threshold are set as the foreground (blueberries), and pixels less than the threshold are set as the background. When the image illumination is uneven, a local threshold segmentation algorithm is used to divide the image into multiple sub-regions, and a threshold is calculated for each sub-region. The threshold is determined based on the grayscale distribution characteristics of the pixels in the sub-region to complete the foreground and background segmentation, avoiding erroneous segmentation caused by the global threshold when the illumination is uneven. In this way, the blueberries are quickly and effectively separated from the background, and a preliminary blueberry foreground region is obtained.
[0045] 303. Perform morphological processing on the blueberry foreground segmented image to obtain a blueberry foreground repaired image;
[0046] In this embodiment, morphological processing includes erosion, dilation, opening, and closing operations. The erosion operation defines a structural element (such as a 3×3 or 5×5 rectangular or circular structural element), which is used to traverse the blueberry foreground segmentation image. If all pixels within the area covered by the structural element are foreground pixels, the center pixel is retained as the foreground; otherwise, it is set to the background, thereby eliminating isolated pixels and small burrs at the edge of the foreground area. The dilation operation also uses the structural element. If there are foreground pixels within the area covered by the structural element, the center pixel is set as the foreground, expanding the foreground area, connecting adjacent blueberry targets, and filling small holes in the foreground area. The opening operation first erodes and then dilates to remove small noise blocks remaining in the background. The closing operation first dilates and then erodes to repair the broken outline of the blueberry foreground area, making the blueberry target edge smoother and the shape more complete. Morphological processing effectively removes noise and redundant parts in the image, repairs incomplete parts of the blueberry foreground area, and makes the blueberry target outline clearer and the shape more accurate. Adjacent blueberries are connected to avoid misjudging a single blueberry as multiple targets.
[0047] 304. Perform connected component analysis on the blueberry foreground restoration image to determine the image region of each blueberry object according to the contour information and position information of each blueberry object, and generate a blueberry image subset according to the image region of each blueberry object.
[0048] In this embodiment, a blueberry foreground restoration image is traversed, and a four-neighborhood or eight-neighborhood search method is used to mark interconnected foreground pixels with the same label, thereby marking each independent blueberry target and recording the pixel coordinates of each connected area. A contour detection algorithm (such as the findContours function in OpenCV) is used to extract the contour of each blueberry target based on the marked connected areas, and geometric features such as the perimeter, area, and centroid coordinates of the contour are calculated. Finally, based on the extracted contour information and position information, the circumscribed rectangle or minimum enclosing circle of each blueberry target is determined to delineate its area in the image. The image area corresponding to each blueberry target is cropped to form a blueberry image subset, which facilitates subsequent independent analysis of individual blueberries. This accurately separates each blueberry target in the image and obtains its detailed contour and position information. The generated blueberry image subset can be used for subsequent appearance feature analysis, quality testing, etc., to achieve refined processing and evaluation of individual blueberries, avoid interference between multiple blueberries, and improve the accuracy and efficiency of analysis.
[0049] A fourth embodiment of the blueberry sorting method according to the present invention includes:
[0050] 401. Perform appearance feature extraction on the blueberry object in each image in the blueberry image subset to obtain appearance features of each blueberry object; the appearance features include geometric size parameters, color feature parameters, and surface defect feature parameters;
[0051] 402. Performing a first-level grading process on the blueberry image subset based on preset blueberry standard size gradient parameters and geometric size parameters of each blueberry target to obtain a plurality of size-graded blueberry image sets of different size dimensions;
[0052] In this embodiment, the contour detection function (such as findContours) in the image processing library such as OpenCV is used to obtain the contour information of the blueberry target. The area (number of pixels within the contour), perimeter (total length of contour pixels), major axis and minor axis length (major and minor axes of the fitted ellipse) of the blueberry are calculated through the contour, and then the fruit shape index (major axis / minor axis) is calculated. According to market demand and industry standards, different blueberry standard size gradient parameters are preset, such as dividing the fruit diameter into three levels: "large (≥18mm)", "medium (14-18mm)", and "small (<14mm)". The geometric size parameters (such as the fruit diameter) of each blueberry target are compared with the preset standard size gradient parameters, and the blueberry images are assigned to the corresponding size-graded blueberry image set according to their size. This realizes the preliminary size grading of blueberries and meets the market demand for blueberries of different sizes.
[0053] 403. Analyze the color characteristic parameters of the blueberry targets in each set of size-graded blueberry image collections to obtain the dark purple pigment ratio and the fruit surface color mean of each blueberry target; and perform secondary grading processing on each set of size-graded blueberry image collections based on a preset standard ratio, a preset color mean, the dark purple pigment ratio of each blueberry target, and the fruit surface color mean of each blueberry target to obtain multiple sets of ripeness-graded blueberry image collections.
[0054] In this embodiment, the image is converted from the RGB color space to the HSV or Lab color space. In the HSV space, it is easier to extract the hue, saturation and lightness of the color; in the Lab space, the brightness, red and green channels, and yellow and blue channels can be obtained; in the HSV space, the hue, saturation and lightness range corresponding to dark purple are set (such as H∈[240,300], S∈[100,255], V∈[20,150]), and the proportion of the number of pixels that meet the conditions to the total number of pixels is counted to obtain the proportion of dark purple pigment; the mean of the color values of all pixels on the fruit surface is calculated to obtain the mean color of the fruit surface; the calculated dark purple pigment proportion and the mean color of the fruit surface are compared with the preset standard proportion and standard color mean. For example, blueberries with a dark purple pigment proportion ≥ 90% and a color mean within a specific range are set as "ripe", those with a proportion between 70% and 90% are set as "relatively ripe", and those below 70% are set as "unripe". Based on this, blueberries in the same size grade are further divided into blueberry image sets with different ripeness grades. On the basis of size grading, blueberries are graded for ripeness according to color characteristics, further refining the blueberry quality classification and meeting the market demand for blueberries of different ripeness.
[0055] 404. Analyze surface defect characteristic parameters of blueberry objects in each set of ripeness-graded blueberry image sets to obtain defect area ratios and texture characteristics of each blueberry object.
[0056] 405. Analyze the defect area ratio and texture characteristics of each blueberry target according to a preset defect standard ratio and a preset texture entropy value to obtain a defect fruit image set;
[0057] 406. Deduplication processing is performed on the corresponding ripeness graded blueberry image sets according to each group of defective fruit image sets to obtain multiple groups of primary sorted blueberry image subsets.
[0058] In this embodiment, defect areas such as disease spots and insect holes on the surface of blueberries are identified by threshold segmentation and edge detection (such as the Canny operator). The ratio of the area of the defect area to the total area of the blueberry is calculated to obtain the defect area ratio; the gray level co-occurrence matrix (GLCM) is used to calculate the contrast, entropy, correlation and other characteristics of the blueberry surface texture, and the texture entropy value is used to characterize the complexity of the texture; the defect standard ratio (such as the defect area ratio>5%) and the texture entropy value threshold (such as the texture entropy value>specific value, indicating that the texture is too complex and there may be defects) are set. The defect area ratio and texture entropy value of each blueberry target are compared with the preset standard, and blueberries with a defect area ratio exceeding the standard or a texture entropy value higher than the threshold are screened out to form a defective fruit image set; finally, the blueberry image sets of each maturity grade are traversed, and the blueberry images that are the same as those in the defective fruit image set are removed, and the blueberry images without defects are retained to form multiple groups of blueberry image primary sorting subsets.
[0059] A fifth embodiment of the blueberry sorting method according to the present invention includes:
[0060] 501. Obtaining reflectance spectrum information of each blueberry target in each group of blueberry image sorting subsets, and extracting characteristic bands from the reflectance spectrum information according to preset band information to obtain blueberry softness-related band information;
[0061] In this embodiment, a spectral acquisition device (such as a near-infrared spectrometer) performs a spectral scan on each blueberry target in each blueberry image sorting subset, acquiring reflectance data at different wavelengths (typically covering the visible to near-infrared band, such as 400-1000nm). Based on pre-set band information (based on research on the correlation between blueberry internal quality and spectral characteristics), specific bands highly correlated with blueberry softness (such as maturity, moisture content, and internal damage) are screened. For example, near-infrared bands (such as 970nm and 1450nm) are sensitive to water absorption and can reflect fruit moisture content; mid-infrared bands (such as 1740cm) are associated with pectinesterase activity and can indirectly reflect fruit maturity and texture firmness.
[0062] 502. Perform distribution analysis on blueberry softness-related wavelength information to obtain a water absorption peak wavelength distribution ratio, an OH bond stretching vibration wavelength distribution ratio, and a pectinesterase activity-related wavelength ratio;
[0063] 503. Generate a water content ratio according to the water absorption peak band distribution ratio, the OH bond stretching vibration band distribution ratio, and the pectinesterase activity-related band ratio; the water content ratio is the ratio of bound water to free water;
[0064] In this embodiment, the water absorption peak band distribution ratio: the ratio of the reflectivity of the moisture-sensitive band (such as 970nm) to the reference band (such as 550nm) is calculated to reflect the free water content of the fruit. The higher the ratio, the greater the proportion of free water may be, and the softer the fruit may be. The OH bond stretching vibration band distribution ratio: the vibration intensity of the OH bond in the near-infrared band (such as 1400nm) is related to the bound water content. By calculating the ratio of this band to the baseline band, the proportional relationship between bound water and free water is evaluated. Pectinesterase activity-related band ratio: pectinesterase activity affects the degradation of fruit cell walls. The absorbance change ratio of a specific band (such as 1740cm) is used to quantify the enzyme activity intensity and indirectly judge the degree of fruit softening. The three band distribution ratios are fused through a weighted algorithm (such as principal component analysis to determine the weights) to calculate the "water component ratio", which can be expressed as follows:
[0065] Water content ratio = α × R 水分 +β×R O-H +γ×R 果胶
[0066] Among them, α, β and γ are weight coefficients, which are determined by historical data training; R 水分 、R O-H and R 果胶The water content ratio reflects the ratio of bound water to free water in blueberries. Fruits with a high bound water content (low ratio) have a firmer texture and are more durable in storage and transportation. Fruits with a high free water content (high ratio) may be overripe or softened and require priority sorting.
[0067] 504. When the water content ratio meets the preset standard condition, a passing label is added to the image corresponding to the blueberry target; and blueberry images with passing labels are obtained from each group of blueberry image sorting subsets to form multiple groups of blueberry image secondary sorting subsets.
[0068] In this embodiment, based on the characteristics of blueberry varieties and market demand, a qualified threshold value of the water content ratio is preset (e.g., 0.3-0.5 is the qualified interval for hard fruit). When the water content ratio of a certain blueberry target falls within this interval, a "pass label" is added, otherwise it is marked as "soft fruit" or "overripe fruit". Images with "pass labels" are screened out from each group of blueberry image sorting subsets to form a secondary blueberry image sorting subset. Soft fruits or overripe fruits that fail the test are eliminated or grouped separately; softness screening is achieved at the single fruit level, avoiding the problems of mistaken killing or missed detection in traditional batch grading, and improving the utilization rate of high-quality fruits.
[0069] A sixth embodiment of the blueberry sorting method according to the present invention includes:
[0070] 601. Extracting contour information of each image in the secondary sorting subset of each group of blueberry images;
[0071] 602. Calculate the centroid coordinates of the blueberry target based on the contour information, and obtain the boundary coordinates of the blueberry target;
[0072] 603. Determine the transmission coordinates of each image based on the centroid coordinates and the boundary coordinates, and form a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets.
[0073] In this embodiment, the edge pixels of the blueberry target are identified by image processing algorithms (such as Canny edge detection, Sobel operator, etc.) to form a closed contour curve; based on the contour information, the center of mass (center of gravity) coordinates are calculated by geometric moments. i ,y i ), centroid coordinates (C x , C y ), the calculation formula is:
[0074]
[0075] Among them, m 00 is the zero-order moment (i.e., the total number of pixels within the contour);
[0076] Extract the extreme points (such as the upper left and lower right vertices) or the coordinates of all edge points in the contour to form a boundary coordinate set; convert the center of mass coordinates and boundary coordinates in the image coordinate system into coordinates in the actual physical coordinate system of the conveyor line (this needs to be combined with camera calibration parameters, such as the conversion ratio of pixels to millimeters). Transmission coordinates usually include lateral position (X-axis), longitudinal position (Y-axis) and movement direction (such as the direction of conveyor line speed), which are used to drive the sorting actuator (such as pneumatic push rods, robotic arms) to move. Summarize the target coordinates of all blueberries in the same sorting subset and store them as a coordinate list or matrix by group for real-time call by the sorting system.
[0077] A seventh embodiment of the blueberry sorting method according to the present invention includes:
[0078] 701. Perform channel coding on the secondary sorted subsets of each group of blueberry images;
[0079] 702. Associating the channel code with the corresponding transmission coordinate set to obtain a transmission mapping relationship;
[0080] 703. Generate a sorting result according to the transmission mapping relationship and the corresponding blueberry image secondary sorting subset.
[0081] In this embodiment, channel coding rules are formulated based on the secondary sorting standards and actual sorting requirements of blueberries. For example, "1" is set to represent the first-level hard fruit channel, "2" to represent the first-level soft fruit channel, "3" to represent the second-level hard fruit channel, and so on; or a combination of letters and numbers is used, such as "A1" represents the special fruit channel for high-end fresh fruit sales, and "B2" represents the second-level fruit channel for juice processing. Traverse each group of blueberry image secondary sorting subsets, and assign a corresponding channel code to each subset based on its grading attributes (such as size, ripeness, softness and hardness, etc.). For example, after the second sorting, the blueberry image secondary sorting subset that meets the first-level hard fruit standard is marked as "1" code, and the subset that meets the second-level soft fruit standard is marked as "4" code; each channel code is associated with the transmission coordinate set of its corresponding blueberry image secondary sorting subset in a one-to-one correspondence. Ensure that each code uniquely corresponds to a set of transmission coordinates to ensure the accuracy and integrity of the information. For example, the code "1" corresponds to the secondary sorting subset of blueberry images for the first-level hard fruit. The transmission coordinate set of this subset is bound to the code "1." Based on the transmission mapping relationship, a specific sorting instruction is generated for each blueberry target in the secondary sorting subset of blueberry images. The instruction content may include the target channel code (determining the sorting destination), transmission coordinates (determining the sorting location), and the action type (such as air blowing sorting, robotic arm grasping, etc.). For example, for the first-level hard fruit set coded "1," the instruction "sort the blueberry at coordinates (100, 200) to channel 1 using air blowing" is generated.
[0082] The above describes the blueberry sorting method in the embodiment of the present invention. The following describes the blueberry sorting system in the embodiment of the present invention. Figure 2 In one embodiment of the present invention, a blueberry sorting system includes:
[0083] The acquisition module 801 is used to acquire real-time images of blueberries on the conveyor line according to a preset acquisition cycle;
[0084] a segmentation module 802 for performing image segmentation on the real-time blueberry image to obtain a blueberry image subset;
[0085] The first sorting module 803 is configured to perform data analysis on each image in the blueberry image subset to obtain appearance features of each image; and to sort the blueberry image subset based on the appearance features to obtain multiple groups of primary sorted blueberry image subsets;
[0086] The second sorting module 804 is configured to obtain the reflectance spectrum information of each group of blueberry image sorting subsets, and perform secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets;
[0087] The coordinate module 805 is used to obtain the transmission coordinates of each image in each group of blueberry image secondary sorting subsets to obtain the transmission coordinate sets corresponding to each group of blueberry image secondary sorting subsets;
[0088] The generating module 806 is configured to generate corresponding sorting results according to the secondary sorting subsets of each group of blueberry images and the corresponding transmission coordinate sets.
[0089] above Figure 2 The blueberry sorting system in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The blueberry sorting device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0090] Figure 3is a schematic diagram of the structure of a blueberry sorting device provided in an embodiment of the present invention. The blueberry sorting device 900 may vary significantly due to different configurations or performance, and may include one or more processors (central processing units, CPUs) 910 (e.g., one or more processors) and memory 920, and one or more storage media 930 (e.g., one or more mass storage devices) storing application programs 933 or data 932. The memory 920 and storage medium 930 may be either transient or persistent storage. The program stored in the storage medium 930 may include one or more modules (not shown), each of which may include a series of instruction operations on the blueberry sorting device 900. Furthermore, the processor 910 may be configured to communicate with the storage medium 930, executing the series of instruction operations in the storage medium 930 on the blueberry sorting device 900 to implement the steps of the blueberry sorting method provided in the above-mentioned method embodiments.
[0091] The blueberry sorting device 900 may further include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input and output interfaces 960, and / or one or more operating systems 931, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 3 The structure of the blueberry sorting equipment shown does not constitute a limitation on the blueberry sorting equipment, and the equipment may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0092] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, cause the computer to execute the steps of the blueberry sorting method.
[0093] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system or system or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0094] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program code.
[0095] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art will be able to modify the technical solutions described in the aforementioned embodiments or substitute equivalents for some of the technical features. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.
Claims
1. A blueberry sorting method, characterized in that: include: Acquire real-time blueberry images on the conveyor line according to the preset acquisition cycle; Perform image segmentation on the real-time blueberry image to obtain a blueberry image subset; Perform data analysis on each image in the blueberry image subset to obtain the appearance features of each image; and performing a sorting on the blueberry image subsets based on the appearance features to obtain multiple groups of primary sorted blueberry image subsets; Obtaining reflectance spectrum information of each group of blueberry image sorting subsets, and performing secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets; Obtaining the transmission coordinates of each image in each group of blueberry image secondary sorting subsets to obtain a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets; The corresponding sorting results are generated according to the secondary sorting subsets of each group of blueberry images and the corresponding transmission coordinate sets.
2. The blueberry sorting method according to claim 1, characterized in that: The method of acquiring a real-time blueberry image on the conveyor line according to a preset acquisition cycle includes: Determine the collection cycle based on the sparse distribution of blueberries on the conveyor line; Acquire camera field of view data, and correct the camera field of view data to obtain camera field of view correction data; Real-time blueberry images on the conveyor line are continuously acquired based on the camera's field of view correction data and acquisition cycle.
3. The blueberry sorting method according to claim 1, characterized in that: The performing image segmentation on the real-time blueberry image to obtain a blueberry image subset includes: performing image preprocessing on the real-time blueberry image to obtain a pre-segmented blueberry image; The pre-segmented blueberry image is segmented into foreground and background based on the threshold segmentation algorithm to obtain a blueberry foreground segmentation image; Perform morphological processing on the blueberry foreground segmentation image to obtain the blueberry foreground repaired image; Connected component analysis is performed on the blueberry foreground restoration image to determine the image area of each blueberry target according to the contour information and position information of each blueberry target, and a blueberry image subset is generated according to the image area of each blueberry target.
4. The blueberry sorting method according to claim 1, characterized in that: performing data analysis on each image in the blueberry image subset to obtain appearance features of each image; The blueberry image subsets are sorted based on appearance features to obtain multiple sets of primary sorted blueberry image subsets, including: Performing appearance feature extraction on the blueberry target in each image in the blueberry image subset to obtain appearance features of each blueberry target; the appearance features include geometric size parameters, color feature parameters, and surface defect feature parameters; Based on the preset blueberry standard size gradient parameters and the geometric size parameters of each blueberry target, the blueberry image subset is subjected to a first-level classification process to obtain a plurality of sets of size-graded blueberry image sets with different size dimensions; The color characteristic parameters of the blueberry targets in each set of size-graded blueberry image collections are analyzed to obtain the dark purple pigment ratio and the fruit surface color mean of each blueberry target; and each set of size-graded blueberry image collections is subjected to secondary grading processing based on a preset standard ratio, a preset color mean, the dark purple pigment ratio of each blueberry target, and the fruit surface color mean of each blueberry target to obtain multiple sets of ripeness-graded blueberry image collections; Analyze the surface defect characteristic parameters of blueberry targets in each set of ripeness-graded blueberry image collections to obtain the defect area ratio and texture characteristics of each blueberry target; The defect area ratio and texture characteristics of each blueberry target are analyzed according to the preset defect standard ratio and the preset texture entropy value to obtain a set of defective fruit images; According to each group of defective fruit image sets, the corresponding ripeness graded blueberry image sets are deduplicated to obtain multiple groups of blueberry image primary sorting subsets.
5. The blueberry sorting method according to claim 1, characterized in that: The step of obtaining the reflectance spectrum information of each group of blueberry image sorting subsets and performing secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets includes: Obtaining the reflectance spectrum information of each blueberry target in each group of blueberry image sorting subsets, and extracting characteristic bands from the reflectance spectrum information according to preset band information to obtain blueberry softness-related band information; The distribution of blueberry softness-related wavelength information was analyzed to obtain the ratio of water absorption peak wavelength distribution, OH bond stretching vibration wavelength distribution, and pectinesterase activity-related wavelength distribution. Generate a water content ratio according to the water absorption peak band distribution ratio, the OH bond stretching vibration band distribution ratio, and the pectinesterase activity-related band ratio; the water content ratio is the ratio between bound water and free water; When the water content ratio meets the preset standard conditions, a passing label is added to the image corresponding to the blueberry target; and blueberry images with passing labels are obtained from each group of blueberry image sorting subsets to form multiple groups of blueberry image secondary sorting subsets.
6. The blueberry sorting method according to claim 1, characterized in that: The step of obtaining the transmission coordinates of each image in each group of the secondary sorted subsets of blueberry images to obtain a transmission coordinate set corresponding to each group of the secondary sorted subsets of blueberry images includes: Extract the contour information of each image in the secondary sorting subset of each group of blueberry images; Calculate the centroid coordinates of the blueberry target based on the contour information and obtain the boundary coordinates of the blueberry target; The transmission coordinates of each image are determined based on the centroid coordinates and the boundary coordinates, and a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets is formed.
7. The blueberry sorting method according to claim 1, characterized in that: Generating corresponding sorting results according to the secondary sorting subsets of each group of blueberry images and the corresponding transmission coordinate sets includes: Channel coding is performed on the secondary sorted subsets of each group of blueberry images; Associating the channel coding with the corresponding transmission coordinate set to obtain a transmission mapping relationship; The sorting results are generated based on the transmission mapping relationship and the corresponding blueberry image secondary sorting subset.
8. A blueberry sorting system, characterized in that: include: An acquisition module is used to acquire real-time images of blueberries on the conveyor line according to a preset acquisition cycle; a segmentation module, configured to perform image segmentation on the real-time blueberry image to obtain a blueberry image subset; a first sorting module, configured to perform data analysis on each image in the blueberry image subset to obtain appearance features of each image; and performing a sorting on the blueberry image subsets based on the appearance features to obtain multiple groups of primary sorted blueberry image subsets; a second sorting module, configured to obtain reflectance spectrum information of each group of blueberry image sorting subsets, and perform secondary sorting on the corresponding blueberry image sorting subsets based on the reflectance spectrum information to obtain multiple groups of blueberry image secondary sorting subsets; A coordinate module is used to obtain the transmission coordinates of each image in each group of blueberry image secondary sorting subsets to obtain a transmission coordinate set corresponding to each group of blueberry image secondary sorting subsets; The generation module is used to generate corresponding sorting results according to the secondary sorting subsets of each group of blueberry images and the corresponding transmission coordinate sets.
9. A blueberry sorting device, characterized in that: The blueberry sorting device includes: a memory and at least one processor, wherein the memory stores instructions; At least one of the processors calls the instructions in the memory to enable the blueberry sorting device to perform each step of the blueberry sorting method according to any one of claims 1 to 7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by a processor, each step of the blueberry sorting method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Security check article automatic sorting system and method
CN120861460A
Blueberry fruit detection method and system based on image recognition
CN121236749A
Blueberry fruit detection method and system based on image recognition
CN121236749B
Method and system for generating sorting task based on image recognition and related equipment
CN121304045A