A method and system for detecting quality of a mushroom stick based on machine vision
By acquiring sidewall and end images of the mushroom logs using machine vision, and combining the ring features with end reference features, the problem of incomplete detection range and misjudgment in existing detection methods is solved, thus achieving completeness and accuracy in mushroom log quality detection.
Patent Information
- Application Number
- CN202611113093.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-25
- Publication Date
- 2026-11-20
AI Technical Summary
Existing methods for testing the quality of mushroom spawn rely on manual observation or single-side images, which are difficult to fully cover the circumferential surface of the spawn. The condition of the sidewalls and the end are usually judged separately, resulting in problems such as incomplete detection range, low accuracy in locating abnormalities, and local differences in lighting being easily misjudged as quality defects.
A machine vision-based method is used to acquire sidewall ring images and end images of the target mushroom log. By comparing the ring image features of the sidewall ring with the reference features of the end, ring consistency deviation objects are generated to determine the quality abnormality of the mushroom log.
This technology enables zoned detection of the quality status of the entire circumferential surface of the mushroom logs, accurately identifying the location and type of abnormalities, reducing misjudgments caused by local lighting differences, and improving the completeness and accuracy of the detection.
Smart Images

Figure CN123141302A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of edible fungi production quality testing technology, specifically to a method and system for testing the quality of mushroom sticks based on machine vision. Background Technology
[0002] The degree of mycelial coverage of the mushroom log, the degree of exposure of the substrate, the color difference on the surface, the deformation of the coating and the state of end closure will directly affect the subsequent mushroom management and the quality of the finished product.
[0003] Currently, the quality inspection of mushroom sticks mainly relies on manual observation, or by using a fixed imaging position to obtain partial side images of the mushroom sticks, and then judging whether the mushroom sticks are contaminated, have insufficient mycelium growth, or have abnormal membranes based on color, texture, or contour features.
[0004] Because the mushroom log is roughly cylindrical, a single side view cannot fully reflect its circumferential surface condition, and local anomalies located on the back or rear side are easily obscured or missed.
[0005] Meanwhile, existing detection methods typically assess the sidewalls and ends of the mushroom log separately, lacking a comparison of consistency between different circumferential positions of the sidewall and between the sidewall and the end.
[0006] When the substrate is affected by localized reflections, uneven lighting, or color differences in the culture medium itself, misjudgment can easily occur based solely on the color or coverage ratio of a single area.
[0007] Existing methods lack a unified record of the continuous range, circumferential span, and abnormality type of abnormalities along the axial direction of the substrate, making it difficult to accurately distinguish between local abnormalities, continuous abnormalities, and end-related abnormalities. Summary of the Invention
[0008] In view of the above-mentioned problems, the present invention is proposed.
[0009] Therefore, the technical problem solved by this invention is that existing mushroom stick quality detection methods mostly rely on manual observation or single side images, which are difficult to completely cover the circumferential surface of the mushroom stick. The side wall condition and the end condition are usually judged separately, resulting in incomplete detection range, low accuracy of abnormal location, and local lighting differences that are easily misjudged as quality defects. The invention also addresses how to jointly judge the differences between different circumferential positions of the mushroom stick side wall and the differences between the side wall and the end condition to determine the abnormality of the mushroom stick quality.
[0010] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a machine vision-based method for detecting the quality of mushroom sticks, comprising acquiring a sidewall ring image and an end image of the target mushroom stick, determining multiple sidewall rings arranged along the axial direction of the target mushroom stick based on the sidewall ring image, and extracting the ring image features of each sidewall ring.
[0011] Based on the end image, the end reference features of the target mycelium are determined. The ring image features of each sidewall ring are compared with the end reference features to generate the ring consistency deviation objects of each sidewall ring. The quality abnormality results of the target mycelium are determined based on the ring consistency deviation objects.
[0012] The ring band consistency deviation includes: the circumferential deviation component between different circumferential positions within the same sidewall ring band, and the end-side deviation component of the sidewall ring band relative to the end reference feature.
[0013] As a preferred embodiment of the machine vision-based mushroom stick quality inspection method of the present invention, the step of acquiring the side wall panoramic image of the target mushroom stick includes: rotating the target mushroom stick around its axis and acquiring side wall images at different rotation angles, or acquiring side wall images by multiple image acquisition units arranged around the target mushroom stick.
[0014] Depending on the acquisition angle or the position of the acquisition unit, the sidewall images are stitched together or mapped to form the sidewall panoramic image.
[0015] As a preferred embodiment of the machine vision-based mushroom stick quality inspection method of the present invention, the step of determining the multiple sidewall rings arranged along the axial direction of the target mushroom stick includes: identifying the axial boundary and circumferential boundary of the target mushroom stick in the sidewall ring image.
[0016] The sidewall circumferential image is divided into multiple axially arranged sidewall rings based on the axial boundary. Each sidewall ring contains multiple circumferential image segments at the corresponding axial position.
[0017] As a preferred embodiment of the machine vision-based mushroom stick quality detection method of the present invention, the ring image features include at least two of the following: mycelial coverage features, substrate exposure features, color difference features, and membrane deformation features.
[0018] The end reference features include at least one of the following: end hyphal coverage features, end color difference features, and end closed state features.
[0019] As a preferred embodiment of the machine vision-based mushroom stick quality detection method of the present invention, generating the circumferential deviation component includes: comparing the differences in the image features of the ring at each circumferential position within the same sidewall ring.
[0020] When image features at multiple consecutive circumferential positions deviate from the reference features of the same sidewall annulus, the deviation position, deviation span, and deviation category are written into the circumferential deviation component.
[0021] As a preferred embodiment of the machine vision-based mushroom stick quality detection method of the present invention, generating the end-side deviation component includes: comparing the consistency of the ring image features of each sidewall ring with the end reference features.
[0022] When the sidewall ring shows insufficient hyphal coverage, color difference due to contamination, or membrane deformation, and the sidewall ring does not satisfy the same direction of change relationship with the end reference feature, the corresponding axial position and deviation type are written into the end deviation component.
[0023] As a preferred embodiment of the machine vision-based mushroom stick quality detection method of the present invention, the determination of the abnormal quality result of the target mushroom stick includes: when the same sidewall ring has both circumferential deviation component and end deviation component, the sidewall ring is determined as an abnormal ring.
[0024] The quality anomaly result is determined based on the number of consecutive abnormal rings, the axial position of the abnormal rings, and the type of deviation.
[0025] As a preferred embodiment of the machine vision-based mushroom stick quality detection method of the present invention, the abnormal quality results include at least one of the following: contamination abnormality, insufficient mycelium growth abnormality, membrane abnormality, and end abnormality.
[0026] Contamination anomalies are determined by the circumferential deviation component and the end-side deviation component corresponding to the color difference characteristics, while insufficient mycelial growth anomalies are determined by the circumferential deviation component and the end-side deviation component corresponding to the hyphal coverage characteristics.
[0027] Another objective of this invention is to provide a machine vision-based mushroom log quality inspection system that can continuously process mushroom log sidewall panoramic images and end images through an image acquisition unit, a ring feature extraction unit, an end reference determination unit, a deviation object generation unit, and an anomaly determination unit. This solves the problems of existing machine vision inspection systems that can only acquire local side images of mushroom logs, where sidewall features and end features are independent of each other, and where it is difficult to jointly determine the location and type of anomalies.
[0028] As a preferred embodiment of the machine vision-based mushroom stick quality inspection system of the present invention, it includes an image acquisition unit, a ring feature extraction unit, an end reference determination unit, a deviation object generation unit, and an anomaly determination unit.
[0029] The image acquisition unit is used to acquire sidewall panoramic images and end images of the target mushroom stick.
[0030] The annular feature extraction unit is used to determine multiple sidewall annular zones based on the sidewall annular image and extract the annular image features of each sidewall annular zone.
[0031] An end reference determination unit is used to determine end reference features based on the end image.
[0032] The deviation object generation unit is used to compare the ring image features of each sidewall ring with the end reference features to generate ring consistency deviation objects.
[0033] The anomaly determination unit is used to determine the quality anomalies of the target mycelium based on deviations from the uniformity of the ring zone.
[0034] As a preferred embodiment of the machine vision-based mushroom stick quality inspection system of the present invention, the image acquisition unit further includes a side wall image acquisition mechanism and an end image acquisition mechanism.
[0035] The sidewall image acquisition mechanism is connected to the ring feature extraction unit, and the end image acquisition mechanism is connected to the end reference determination unit.
[0036] The ring feature extraction unit and the end reference determination unit are both connected to the deviation object generation unit, and the deviation object generation unit is connected to the anomaly determination unit.
[0037] The beneficial effects of this invention are as follows: The machine vision-based mushroom substrate quality inspection method provided by this invention divides the sidewall circumferential image into multiple sidewall rings arranged along the mushroom substrate axis, enabling zoned detection of the quality status of the entire circumferential surface of the mushroom substrate. By generating circumferential deviation components between different circumferential positions within the same sidewall ring, the circumferential position, deviation span, and deviation category of abnormalities can be determined. By comparing the ring image features of the sidewall rings with the end reference features and generating end-side deviation components, misjudgments caused solely by local color differences, illumination fluctuations, or isolated image noise can be reduced. By combining the circumferential and end-side deviation components to determine abnormal rings, and forming quality anomaly results based on the consecutive number, axial position, and deviation type of abnormal rings, this invention achieves better results in terms of the completeness of mushroom substrate surface detection, the accuracy of anomaly location identification, and the stability of quality anomaly judgment. Attached Figure Description
[0038] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] It should be noted that the accompanying drawings of this invention are mainly used to illustrate the technical relationships and data flow between various detection data, processing objects, judgment processes and processing results.
[0040] To maintain the simplicity and clarity of the accompanying drawings and to highlight the main technical processes, some of the textual descriptions in the drawings have adopted abbreviations of terms, generalizations of relationships, simplified descriptions of conditions, or simplified expressions of calculation processes without changing their technical meaning. The complete calculation processes, parameter conditions, judgment thresholds, and limiting relationships described in each specific implementation method are not listed one by one in the accompanying drawings.
[0041] All textual descriptions in the accompanying drawings correspond to the respective processing objects and technical processes in the specific embodiments. The complete meanings, calculation methods, judgment conditions, and parameter limitations of the relevant terms shall be based on the descriptions in the specific embodiments.
[0042] Figure 1 This is a schematic diagram of the acquisition of sidewall ring view images and the division of ring zones in a machine vision-based mushroom stick quality detection method provided in Embodiment 1 of the present invention.
[0043] Figure 2 This is a schematic diagram illustrating the ring feature extraction and deviation object generation of a machine vision-based mushroom stick quality detection method provided in Embodiment 2 of the present invention.
[0044] Figure 3 This is a schematic diagram illustrating the determination of quality anomaly results in a machine vision-based mushroom stick quality detection method provided in Embodiment 3 of the present invention.
[0045] Figure 4 This is a system structure diagram of a machine vision-based mushroom stick quality detection system provided in Embodiment 4 of the present invention. Detailed Implementation
[0046] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention. Example
[0047] Reference Figure 1 This invention provides a specific implementation method for acquiring sidewall ring images and dividing sidewall rings in a machine vision-based mushroom stick quality inspection method.
[0048] Acquire images of the sidewalls and ends of the target mushroom log, keeping the axis of the target mushroom log horizontal, and rotate the target mushroom log around its axis.
[0049] The imaging direction of the sidewall images is set to be perpendicular to the axis of the target mushroom stick. One sidewall image is acquired every 10° rotation of the target mushroom stick. After one rotation, 36 sidewall images are obtained according to the rotation angle.
[0050] Each sidewall image is associated with and saved with the corresponding rotation angle. The position when the target mushroom stick starts to rotate is taken as the 0° position, and the rotation angle corresponding to the kth sidewall image is (k−1)×10°.
[0051] Where k represents the sidewall image number, with a value ranging from 1 to 36.
[0052] Before acquiring the sidewall image, a background image that does not contain the target mycelium is collected. The corresponding pixels of the current sidewall image and the background image are converted into grayscale values, and the grayscale difference between the corresponding pixels is calculated.
[0053] When the grayscale difference is greater than 20, the corresponding pixel is determined as a candidate pixel for the mushroom stick. A 5×5 pixel closing operation is performed on the candidate pixel to fill the small area discontinuity inside the mushroom stick area. The connected region with the largest area is determined as the main body area of the mushroom stick, and background reflections and scattered noise are removed.
[0054] When the end of the target mushroom stick is facing the imaging direction, acquire the end image. The number of pixels in the end image of the mushroom stick end face area should not be less than 20% of the total number of pixels in the end image. If it is less than 20%, adjust the proportion of the end of the target mushroom stick in the image and reacquire the end image.
[0055] Furthermore, validity checks are performed on the sidewall and end images. The images are converted to grayscale, and the Laplacian response variance of the grayscale images is calculated.
[0056] When the Laplace response variance is less than 80, the corresponding image is identified as a blurred image and reacquired. If the images acquired three times in a row fail to meet the requirements, the quality judgment of the current target mushroom stick is terminated and an invalid image acquisition mark is generated to avoid mistaking imaging abnormalities for mushroom stick quality abnormalities.
[0057] Further, a sidewall ring image of the target mycelium is generated.
[0058] Lens distortion correction was performed on 36 side wall images, and the images were rotated according to the long axis of the main body area of the mushroom stick to make the axis of the mushroom stick parallel to the horizontal direction of the image.
[0059] Extract the strip region located at the center of the image from each corrected sidewall image. Each central strip corresponds to a circumferential range of 10° on the surface of the target mushroom stick, and adjust the width of each central strip to a uniform 120 pixels.
[0060] The 36 central strips were sequentially written into the sidewall unfolded image according to the rotation angle sequence from 0° to 350°.
[0061] The first center strip is written into columns 1 to 120 of the sidewall unfolded image, the second center strip is written into columns 121 to 240, and the remaining center strips are written in the same order to form a sidewall panoramic image with a width of 4320 pixels.
[0062] The horizontal direction of the sidewall panoramic image corresponds to the circumferential position of the target mushroom log, and the vertical direction corresponds to the axial position of the target mushroom log.
[0063] A 5-pixel overlap region is set between adjacent center strips. For the overlap region, the pixel participation ratio of the preceding center strip gradually decreases from 1 to 0, while the pixel participation ratio of the following center strip gradually increases from 0 to 1. The pixel values calculated by the two center strips according to the corresponding ratios are used as the pixel values of the overlap region to reduce the brightness abrupt changes at the strip connection points.
[0064] When a valid sidewall image is missing at any of the 36 rotation angles, the sidewall image for the corresponding rotation angle is reacquired without using interpolation from adjacent sidewall images to avoid the interpolation process covering local contamination or capsule deformation.
[0065] As another acquisition method, sidewall images can be acquired from multiple imaging positions set around the target mushroom stick, and then sidewall circumferential images can be generated according to the circumferential angles corresponding to each imaging position and the above-mentioned central strip extraction and sequential writing rules.
[0066] Furthermore, the axial and circumferential boundaries of the target mushroom logs are determined.
[0067] The axial boundary is determined based on the minimum and maximum axial coordinates of the main area of the mushroom stick in the sidewall panoramic image.
[0068] The first column of the sidewall circumferential view image is defined as the 0° circumferential boundary, the fourth, third, and second columns are defined as the 360° circumferential boundary, and the fourth, third, and second columns are set to be circumferentially adjacent to the first column.
[0069] The main body area of the mushroom stick between the axial boundaries was adjusted to 1200 pixels along the axial direction, and bilinear interpolation was used in the adjustment process.
[0070] The adjusted main body area of the mushroom stick is divided into 12 sidewall rings, each 100 pixels long, along the axial direction, and numbered 1 to 12 in sequence from the end being photographed to the other end.
[0071] Furthermore, each sidewall ring is divided into 12 circumferential image segments along the circumference, with each circumferential image segment corresponding to a 30° circumferential range.
[0072] Each sidewall ring contains 12 circumferential image segments at the same axial position.
[0073] For each circumferential image segment, calculate the ratio of the number of valid mycelium stick pixels to the total number of pixels in the segment. When this ratio is below 80%, the corresponding circumferential image segment is determined to be an invalid segment.
[0074] If there are two or more invalid segments in the same sidewall ring, the sidewall image corresponding to the rotation angle is reacquired and the sidewall ring image is regenerated.
[0075] This yields sidewall ring images, end images, 12 sidewall rings arranged along the axial direction of the target mycelium, and 12 circumferential image segments corresponding to each sidewall ring. These results are then used for the extraction of ring image features and end reference features.
[0076] Example 2 Reference Figure 2 This invention provides a specific implementation method for extracting ring image features and generating ring consistency deviation objects in a machine vision-based mushroom stick quality inspection method.
[0077] The end reference features are determined based on the end image. The closed area with the largest area is extracted from the end image and identified as the end face area of the mushroom stick.
[0078] The outer boundary of the mushroom stick end face area is recessed inward by 10% of the equivalent radius of the end face to form an effective end area, thereby reducing the influence of membrane folding and background pixels on the end features.
[0079] Convert the RGB color values of the effective area at the end to HSV color values.
[0080] For an 8-bit image, pixels with a saturation of no more than 70 and a brightness of no less than 110 are defined as mycelial-covered pixels.
[0081] The end coverage ratio is obtained by dividing the number of pixels covered by hyphae in the effective area at the end by the total number of effective pixels, and is used as the end hyphae coverage feature.
[0082] Furthermore, the effective region at the end is converted to the CIELAB color space, and the effective pixels within the effective region at the end are calculated respectively. L Component median, Component median and The median of the components forms the reference color value for the end.
[0083] A preferred method for calculating the color difference between the current pixel and the end reference color value is as follows:
[0084] In the formula, This represents the color difference between the current pixel and the end reference color value. This represents the luminance component of the current pixel. This represents the red and green components of the current pixel. This represents the yellow and blue components of the current pixel. Indicates the effective pixels within the effective region at the end. Component median, Indicates the effective pixels within the effective region at the end. Component median, Indicates the effective pixels within the effective region at the end. Median portion size.
[0085] The conversion from RGB color space to CIELAB color space uses D65 standard light source parameters.
[0086] When a pixel within the effective region of the end When the value is greater than 18, the pixel is identified as an end color difference pixel.
[0087] The end color difference ratio is obtained by dividing the number of end color difference pixels by the total number of effective pixels in the end effective area, and is used as the end color difference feature.
[0088] Furthermore, 360 boundary detection positions are determined at equal intervals along the outer boundary of the mushroom stick end face region. When there are no mushroom stick foreground pixels within a certain boundary detection position and its three adjacent pixels, the position is determined as a boundary missing position.
[0089] Divide the number of missing boundary positions by 360 to obtain the proportion of missing end closures, which is used as the end closure status feature.
[0090] The end reference feature consists of the end coverage ratio, the end reference color value, the end color difference ratio, and the end closure missing ratio.
[0091] When the proportion of overexposed pixels in the effective area of the end exceeds 5%, the proportion of effective pixels is less than 80%, or a closed end face area cannot be obtained, the current end image is not used to generate the end reference feature, and the end image is re-acquired.
[0092] Furthermore, the annular image features of each sidewall annulus are extracted.
[0093] Regarding the first The first sidewall annulus From the circumferential image segments, mycelial coverage features, color difference features, and membrane deformation features were extracted respectively.
[0094] in, This indicates the sidewall annular band number, with values ranging from 1 to 12. This indicates the circumferential image segment number, with values ranging from 1 to 12.
[0095] For mycelial coverage features, the same HSV color range as the end image is used to determine the mycelial coverage pixels, and the sidewall coverage ratio is obtained by dividing the number of mycelial coverage pixels by the number of effective mycelial stick pixels in the corresponding circumferential image segment.
[0096] For color difference features, following the aforementioned color difference calculation method, the color difference between each effective pixel within the circumferential image segment and the end reference color value is calculated respectively. .
[0097] Will Pixels with a value greater than 18 are identified as sidewall color difference pixels. The sidewall color difference ratio is obtained by dividing the number of sidewall color difference pixels by the number of effective mushroom stick pixels.
[0098] For the capsule deformation features, the upper and lower contours of the main body region of the mushroom stick are extracted from the original sidewall image corresponding to the current circumferential image segment, and the local diameter between the upper and lower contours is calculated every 10 pixels along the mushroom stick axis.
[0099] The median of the local diameters within the corresponding axial range of the current circumferential image segment is determined as the segment diameter, and the median of the diameters of the 12 segments within the same sidewall annulus is determined as the reference diameter of the annulus.
[0100] Calculate the absolute value of the difference between the segment diameter and the reference diameter of the annulus, and then divide the absolute value by the reference diameter of the annulus to obtain the membrane deformation ratio.
[0101] The sidewall coverage ratio, sidewall chromatic difference ratio, and capsule deformation ratio of 12 circumferential image segments within the same sidewall annulus together constitute the annular image features of that sidewall annulus.
[0102] Furthermore, the reference characteristics of the ring zone were determined.
[0103] Before conducting quality testing of the mushroom sticks, select no fewer than 30 mushroom sticks that have been manually confirmed to be of qualified quality and of the same specifications, and extract the ring image features of each axial ring under the same imaging conditions.
[0104] The median coverage ratio, median color difference ratio, and median membrane deformation ratio of qualified mushroom sticks at each axial position were calculated respectively, and used as the reference characteristics of the ring zone at the corresponding axial position.
[0105] After calibration, the median coverage ratio was set at 0.82, the median color difference ratio at 0.03, and the median coating deformation ratio at 0.02.
[0106] When the specifications of the mushroom logs, the color of the culture medium, or the imaging light changes, a new qualified mushroom log of the same specification is selected to determine the reference characteristics of the ring zone, instead of directly using the original reference value.
[0107] Furthermore, a circumferential deviation component is generated.
[0108] The image features of the annulus at different circumferential positions within the same sidewall annulus are compared to distinguish the differences, and the image features of the annulus at each circumferential position are compared with the reference features of the annulus at the corresponding axial position.
[0109] When the sidewall coverage ratio decreases by at least 0.12 relative to the median coverage ratio, the corresponding circumferential position is determined as the mycelial coverage deviation position, and the trigger boundary for the sidewall coverage ratio under this condition is 0.70.
[0110] When the sidewall color difference ratio increases by at least 0.07 relative to the median color difference ratio, the corresponding circumferential position is determined as the color difference deviation position, and the trigger boundary for the sidewall color difference ratio under this condition is 0.10.
[0111] When the membrane deformation ratio increases by at least 0.06 relative to the median membrane deformation ratio, the corresponding circumferential position is determined as the membrane deformation deviation position, and the membrane deformation ratio trigger boundary corresponding to this condition is 0.08.
[0112] The trigger boundary is determined based on the upper limit of the fluctuation of the corresponding characteristics of qualified mushroom sticks. Lowering the trigger boundary will improve the response to small-area anomalies, but will increase the false judgment caused by light fluctuations or contour jitter; raising the trigger boundary will reduce false judgment, but may miss minor anomalies.
[0113] The 12th circumferential image segment and the 1st circumferential image segment are set as circumferentially adjacent positions. When two or more consecutive circumferential positions show the same type of deviation, the corresponding circumferential deviation component is generated.
[0114] The circumferential deviation components include: deviation position, deviation span, and deviation category.
[0115] The deviation position is represented by the starting and ending angles of the consecutive deviation positions, and the deviation span is obtained by multiplying the number of consecutive circumferential image segments by 30°.
[0116] Deviation categories include: mycelial coverage deviation, color difference deviation, and membrane deformation deviation.
[0117] When the same type of deviation occurs in all 12 circumferential positions, the deviation span is defined as 360°, which is used to indicate insufficient hyphal coverage, abnormal color difference, or deformation of the entire periphery.
[0118] When only one circumferential position deviates and none of the adjacent positions deviate, the circumferential deviation component is not directly generated. Instead, the circumferential position is determined as the position to be verified in order to eliminate isolated reflective points or image noise.
[0119] Furthermore, an end-side offset component is generated.
[0120] For the sidewall ring band that has generated circumferential deviation components, calculate the average value of the corresponding features within the continuous deviation positions, and compare the consistency of the average value with the end reference features.
[0121] When the average sidewall coverage ratio of continuously deviating positions is less than 0.70, and the difference between the end coverage ratio and this average value is not less than 0.15, it indicates that the sidewall shows insufficient mycelial coverage, while the end still maintains a high mycelial coverage state, and the two do not satisfy the same direction of change relationship.
[0122] At this point, the corresponding axial position, mycelial coverage insufficiency type, and coverage ratio difference are written into the end-side deviation component.
[0123] When the average color difference ratio of the sidewalls with continuous deviations is higher than 0.10, and the increase of this average value relative to the color difference ratio of the end is not less than 0.10, it indicates that there is a contamination color difference on the sidewalls, while the end does not show the same degree of color difference change.
[0124] At this point, the corresponding axial position, contamination color difference type, and color difference ratio difference are written into the end-side deviation component.
[0125] When the average proportion of membrane deformation due to continuous deviation from the position is higher than 0.08, and the proportion of end closure defects is not greater than 0.05, it indicates that the sidewall membrane has deformed, while the end remains closed.
[0126] At this point, the corresponding axial position, membrane deformation type, and membrane deformation ratio are written into the end-side deviation component.
[0127] When the proportion of end closure defects is higher than 0.05, and the proportion of membrane deformation of the first sidewall ring adjacent to the photographed end is not higher than 0.08, the axial position and end closure anomaly type of the first sidewall ring are written into the end side deviation component.
[0128] A unidirectional change relationship means that the lateral wall features and the corresponding end features are both within the normal range, or both change towards the same abnormal category.
[0129] If one side meets the abnormal triggering condition while the other side does not meet the corresponding triggering condition, it is determined that the same-direction change relationship is not satisfied.
[0130] When the end reference feature is invalid, the preset value is not used to replace the end reference feature, but the end image is reacquired.
[0131] If a valid end-side baseline feature cannot be formed after reacquisition, an invalid end-side comparison flag is generated, and the quality anomaly judgment of the current target spawn is stopped.
[0132] Obtain the annular consistency deviation object for each sidewall annular band. The annular consistency deviation object includes: circumferential deviation component and end side deviation component.
[0133] Example 3 Reference Figure 3 This is one embodiment of the present invention, which provides a specific implementation method for determining quality abnormality results in a machine vision-based mushroom stick quality detection method.
[0134] First, identify the abnormal rings of the target mycelium. According to the axial arrangement of the sidewall rings, read the ring consistency deviations of the 1st to 12th sidewall rings in sequence.
[0135] When both the circumferential deviation component and the end deviation component of the same sidewall ring are not empty, the sidewall ring is identified as an abnormal ring.
[0136] The same deviation category in the circumferential deviation component and the end-side deviation component is identified as the main anomaly category of the corresponding anomaly zone.
[0137] When the same sidewall ring has both circumferential deviation components and end-side deviation components, but the deviation categories of the two deviation components are inconsistent, the corresponding sidewall ring is identified as a composite ring to be confirmed, and it is not directly classified into contamination anomaly, insufficient bacterial growth anomaly, or membrane anomaly, so as to avoid erroneously merging image changes from different sources.
[0138] When the sidewall ring only has a circumferential deviation component, it is identified as a local ring to be checked. When the sidewall ring only has an end-side deviation component, it is identified as an end-side difference ring. Neither the local ring to be checked nor the end-side difference ring is considered as a deterministic anomalous ring on its own.
[0139] Furthermore, continuous abnormal regions are formed. Adjacent relationships are checked according to the axial numbering of the abnormal rings. Abnormal rings with consecutive axial numbers and the same main abnormality category are merged into a continuous abnormal region. The starting ring number, ending ring number, number of consecutive rings, and main abnormality category of the continuous abnormal region are recorded.
[0140] The 4th, 5th and 6th sidewall rings all have circumferential deviation components and end deviation components of color difference type. The 4th to 6th sidewall rings are merged into a continuous pollution anomaly area, and the number of continuous rings is determined to be 3.
[0141] Adjacent anomalous rings with different anomalous categories are not merged; multiple discontinuous anomalous regions are saved separately, retaining the axial position of each anomalous region.
[0142] When all 12 sidewall rings meet the abnormal ring condition, the abnormal axial range is defined as the entire length of the target mycelium, and the number of consecutive abnormal rings is defined as 12.
[0143] Furthermore, determine the type of quality anomaly.
[0144] When an abnormal ring band has both circumferential deviation components and end-side deviation components of color difference type, the corresponding quality abnormality type is identified as a contamination abnormality.
[0145] When an abnormal ring has both a circumferential deviation component and an end-lateral deviation component of mycelial coverage, the corresponding quality abnormality type is identified as insufficient mycelial growth abnormality.
[0146] When an abnormal ring has both circumferential deviation components and end-side deviation components of the membrane deformation type, the corresponding quality anomaly type is identified as a membrane anomaly.
[0147] When the proportion of missing end closure is higher than 0.05, and there is an end-side deviation component of the end closure abnormality type in the first sidewall ring adjacent to the end being photographed, the corresponding quality abnormality type is determined to be end abnormality.
[0148] When the same target mycelium simultaneously meets the determination conditions of multiple anomaly types, all anomaly types are retained and a composite anomaly result is generated, without using a single anomaly type to cover other established anomaly types.
[0149] Furthermore, the anomaly level is determined based on the number of consecutive abnormal rings, the axial position of the abnormal rings, and the type of deviation.
[0150] When the number of consecutive abnormal rings is 1, and the corresponding abnormal ring is not located in the adjacent area of the end being photographed, the corresponding abnormal area is identified as a level 1 abnormality.
[0151] When the number of consecutive abnormal rings is 2 to 3, or when the abnormal area includes the first or second sidewall ring adjacent to the end being photographed, the corresponding abnormal area is identified as a level 2 abnormality.
[0152] When the number of consecutive abnormal rings is not less than 4, the abnormal area covers the entire length of the target mycelium, or there are two or more abnormal types in the same consecutive abnormal area, the corresponding abnormal area is identified as a level 3 abnormality.
[0153] The final quality anomaly results include: identification information of the target mycelium, anomaly type, anomaly ring number, anomaly axial range, anomaly circumferential range, and anomaly level.
[0154] When there is no sidewall ring with both circumferential and end-side deviation components, and the sidewall ring image, end image, and end-side comparison results are all valid, a result indicating no quality anomaly is generated.
[0155] When image acquisition is invalid, end reference features are invalid, or there are two or more invalid circumferential image segments in the same sidewall ring, no undetected quality abnormality result is generated, and a re-detection mark is generated to prevent data loss from being mistakenly judged as normal quality of the mushroom stick.
[0156] Example 4 Reference Figure 4 As an embodiment of the present invention, a machine vision-based mushroom stick quality inspection system is provided.
[0157] A machine vision-based mushroom stick quality inspection system includes: an image acquisition unit E1, a ring feature extraction unit E2, an end reference determination unit E3, a deviation object generation unit E4, and an anomaly determination unit E5.
[0158] The image acquisition unit E1 includes a side wall image acquisition mechanism E11 and an end image acquisition mechanism E12.
[0159] First, the side wall image acquisition mechanism E11 includes: a side wall industrial camera, a fixed focal length lens, a diffuse light source, a mushroom stick rotating support, and an angle encoder.
[0160] The mushroom stick rotating support is used to drive the target mushroom stick to rotate around its axis. Every time the angle encoder detects that the target mushroom stick has rotated by 10°, it triggers the side wall industrial camera to acquire a side wall image and saves the rotation angle with the side wall image.
[0161] After completing the image acquisition of the target mycelium stick around the perimeter, the sidewall image acquisition mechanism E11 generates 36 sidewall images with rotation angle markings and sends the sidewall images to the ring feature extraction unit E2.
[0162] Furthermore, the end image acquisition mechanism E12 includes an end industrial camera and an end diffuse light source arranged along the axial direction of the target mushroom stick, used to acquire end images of the target mushroom stick and send the end images to the end reference determination unit E3.
[0163] The side wall industrial camera and the end industrial camera use the same color correction parameters. The side wall image acquisition mechanism E11 is connected to the ring feature extraction unit E2, and the end image acquisition mechanism E12 is connected to the end reference determination unit E3.
[0164] Furthermore, the annular feature extraction unit E2 extracts the central strip based on the rotation angle corresponding to each sidewall image, and maps the central strip to the sidewall annular image according to the rotation angle order.
[0165] The annular feature extraction unit E2 divides the sidewall annular image into 12 sidewall annular zones based on the axial and circumferential boundaries in the sidewall annular image, and further divides each sidewall annular zone into 12 circumferential image segments.
[0166] The ring feature extraction unit E2 generates the sidewall coverage ratio, sidewall color difference ratio, and membrane deformation ratio according to the HSV color range of the mycelium-covered pixels, the color difference between the sidewall pixels and the end reference color value, and the local diameter change of the mycelium outline, and associates the features with the corresponding ring number and circumferential position number.
[0167] Furthermore, the end reference determination unit E3 extracts the end face region of the mycelium from the end image, and generates the end coverage ratio, end reference color value, end color difference ratio, and end closure missing ratio based on the mycelium coverage pixels, CIELAB color components, color difference pixels, and end boundary missing positions within the effective end area.
[0168] Both the ring feature extraction unit E2 and the end reference determination unit E3 are connected to the deviation object generation unit E4.
[0169] The annular feature extraction unit E2 sends the annular image features with the annular number and circumferential position number to the deviation object generation unit E4, and the end reference determination unit E3 sends the end reference features to the deviation object generation unit E4.
[0170] Furthermore, the offset object generation unit E4 compares the annular image features at each circumferential position with the corresponding annular reference features at the axial position.
[0171] When two or more consecutive circumferential positions meet the same type of deviation condition, a circumferential deviation component is generated.
[0172] The deviation object generation unit E4 calculates the average value of the corresponding features within the continuous deviation positions and compares the average value with the end reference feature.
[0173] When the sidewall ring and the end reference feature do not satisfy the same direction of change, an end side deviation component is generated.
[0174] The deviation object generated by the deviation object generation unit E4 includes: the identification information of the target mycelium, the ring number, the deviation position, the deviation span, the deviation category, and the deviation amount.
[0175] Furthermore, the deviation object generation unit E4 is connected to the anomaly determination unit E5, and sends the ring consistency deviation objects of each side wall ring to the anomaly determination unit E5.
[0176] The anomaly determination unit E5 identifies the sidewall rings that simultaneously exhibit circumferential and end-side deviation components as abnormal rings, and generates contamination anomalies, insufficient bacterial growth anomalies, membrane anomalies, or end anomalies based on the number of consecutive abnormal rings, axial position, and deviation category.
[0177] When the image acquisition unit E1 detects that the sidewall image is missing, the image is blurry, or the end region is incomplete, it reacquires the corresponding image.
[0178] If the validity condition is not met after three consecutive acquisitions, the image acquisition unit E1 sends an invalid acquisition status to the ring feature extraction unit E2, the end reference determination unit E3, and the anomaly determination unit E5.
[0179] After receiving an invalid acquisition status, the anomaly determination unit E5 stops the quality judgment of the current target mushroom stick and generates a re-detection identifier to avoid outputting abnormal mushroom stick quality results when the input image is incomplete.
[0180] Thus, the image acquisition unit E1, the ring feature extraction unit E2, the end reference determination unit E3, the deviation object generation unit E4, and the anomaly determination unit E5 sequentially form a continuous execution relationship of image acquisition, ring feature extraction and end reference determination, deviation object generation, and quality anomaly result determination.
[0181] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0182] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A machine vision-based method for detecting the quality of mushroom substrate, characterized in that, include: Acquire sidewall ring images and end images of the target mycelium, determine multiple sidewall rings arranged along the axial direction of the target mycelium based on the sidewall ring images, and extract the ring image features of each sidewall ring. Based on the end image, the end reference features of the target mushroom stick are determined. The ring image features of each sidewall ring are compared with the end reference features to generate the ring consistency deviation objects of each sidewall ring. The quality abnormality results of the target mushroom stick are determined based on the ring consistency deviation objects. The ring band consistency deviation objects include: The circumferential deviation component between different circumferential positions within the same sidewall ring, and the end-side deviation component of the sidewall ring relative to the end reference feature.
2. The machine vision-based mushroom stick quality inspection method as described in claim 1, characterized in that: The process of obtaining the sidewall circumferential image of the target mushroom stick includes: The target mushroom stick is rotated around its axis and sidewall images are acquired at different rotation angles, or sidewall images are acquired by multiple image acquisition units arranged around the target mushroom stick; Depending on the acquisition angle or the position of the acquisition unit, the sidewall images are stitched together or mapped to form the sidewall panoramic image.
3. The machine vision-based mushroom stick quality inspection method as described in claim 1 or 2, characterized in that: The determination of the multiple sidewall rings arranged along the axial direction of the target mycelium includes: Identify the axial and circumferential boundaries of the target mycelium in the sidewall annular image; The sidewall annular image is divided into multiple sidewall annular bands arranged along the axial direction based on the axial boundary. Each sidewall ring contains multiple circumferential image segments at the corresponding axial position.
4. The machine vision-based mushroom stick quality inspection method as described in claim 3, characterized in that: The annular image features include: At least two of the following characteristics: mycelial coverage, substrate exposure, color difference, and membrane deformation; The end reference features include at least one of the following: end hyphal coverage features, end color difference features, and end closed state features.
5. The machine vision-based method for detecting the quality of mushroom substrate as described in claim 1, 2, or 4, characterized in that: Generating the circumferential deviation component includes: Within the same sidewall annulus, the differences in the annular image features at each circumferential position are compared; When image features at multiple consecutive circumferential positions deviate from the reference features of the same sidewall annulus, the deviation position, deviation span, and deviation category are written into the circumferential deviation component.
6. The machine vision-based mushroom stick quality inspection method as described in claim 5, characterized in that: Generating the end-side offset component includes: The image features of each sidewall ring are compared with the end reference features for consistency. When the sidewall ring shows insufficient hyphal coverage, color difference due to contamination, or membrane deformation, and the sidewall ring does not satisfy the same direction of change relationship with the end reference feature, the corresponding axial position and deviation type are written into the end deviation component.
7. The machine vision-based method for detecting the quality of mushroom substrate as described in claim 1, 2, 4, or 6, characterized in that: The results of determining the quality abnormalities of the target mycelium include: When the same sidewall ring has both circumferential deviation component and end deviation component, the sidewall ring is identified as an abnormal ring. The quality anomaly result is determined based on the number of consecutive abnormal rings, the axial position of the abnormal rings, and the type of deviation.
8. The machine vision-based mushroom stick quality inspection method as described in claim 7, characterized in that: The quality anomaly results include: At least one of the following: abnormal contamination, insufficient bacterial growth, abnormal capsule, and abnormal tip; Contamination anomalies are determined by the circumferential deviation component and the end-side deviation component corresponding to the color difference characteristics, while insufficient mycelial growth anomalies are determined by the circumferential deviation component and the end-side deviation component corresponding to the hyphal coverage characteristics.
9. A machine vision-based mushroom substrate quality inspection system, employing the machine vision-based mushroom substrate quality inspection method as described in any one of claims 1 to 8, characterized in that: include: Image acquisition unit (E1), ring feature extraction unit (E2), end reference determination unit (E3), deviation object generation unit (E4), anomaly determination unit (E5); Image acquisition unit (E1) is used to acquire sidewall panoramic images and end images of the target mushroom stick; The annular feature extraction unit (E2) is used to determine multiple sidewall annular zones based on the sidewall annular image and extract the annular image features of each sidewall annular zone; An end reference determination unit (E3) is used to determine end reference features based on the end image; The deviation object generation unit (E4) is used to compare the ring image features of each sidewall ring with the end reference features to generate ring consistency deviation objects; The anomaly determination unit (E5) is used to determine the quality anomalies of the target mycelium based on the deviation of the ring consistency.
10. The machine vision-based mushroom substrate quality inspection system as described in claim 9, characterized in that: The image acquisition unit (E1) includes: Side wall image acquisition mechanism (E11) and end image acquisition mechanism (E12); The side wall image acquisition mechanism (E11) is connected to the ring feature extraction unit (E2), and the end image acquisition mechanism (E12) is connected to the end reference determination unit (E3). The ring feature extraction unit (E2) and the end reference determination unit (E3) are both connected to the deviation object generation unit (E4), and the deviation object generation unit (E4) is connected to the anomaly determination unit (E5).
