A visual detection method and system for vegetable seed damage
By detecting images under top and side lighting conditions, and combining grayscale texture differences and confidence coefficients, the damaged areas of vegetable seeds can be accurately identified, solving the problem of damage identification errors in existing technologies and improving detection accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2026-04-03
AI Technical Summary
Existing visual inspection methods struggle to accurately distinguish between natural spots and damage features on the surface of vegetable seeds, leading to damage identification errors and affecting inspection results.
Image detection under top and side lighting conditions was used to obtain suspected damage areas and shadow areas. Seed damage was evaluated by combining grayscale texture differences and confidence coefficients.
It improves the accuracy of visual detection of damage to vegetable seeds, reduces the interference of natural spots on damage identification, and ensures accurate identification of damaged areas.
Smart Images

Figure CN121032938B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual damage detection technology, specifically to a method and system for visually detecting damage to vegetable seeds. Background Technology
[0002] The quality of vegetable seeds is fundamental to ensuring crop yield and quality, and seed damage will affect its germination rate and growth potential. Therefore, seed damage detection is crucial. With the advancement of agricultural intelligence, machine vision technology, with its advantages of non-contact, high precision, and quantifiability, has become an important means of seed damage detection.
[0003] In the process of seed damage identification using existing visual detection methods, normal seeds have smooth and uniform textures, and damage such as wrinkles and depressions can be distinguished from smooth epidermis by different texture features, thus allowing for the screening of damaged areas. However, non-damage features such as natural spots on the seed surface are similar to real damage (such as wrinkles and depressions) and have obvious grayscale texture differences from smooth epidermis, making them difficult to distinguish. This leads to misidentification of seed damage and affects the visual detection effect of vegetable seed damage. Summary of the Invention
[0004] To address the technical problem of low accuracy in visual detection of vegetable seed damage, the present invention aims to provide a method and system for visual detection of vegetable seed damage, the specific technical solution of which is as follows:
[0005] A visual detection method for vegetable seed damage, the method comprising:
[0006] Obtain all suspected damage areas of each vegetable seed in the top light detection image under top lighting conditions, and obtain the suspected damage shadow area corresponding to each suspected damage area in the side light detection image under side lighting conditions;
[0007] Based on the uniformity of grayscale texture and the direction of the region in each suspected damage shadow region, and combined with the grayscale texture difference between it and the corresponding suspected damage region, the side bottom shadow interference parameters of each suspected damage shadow region are obtained.
[0008] Based on the grayscale texture information of each suspected damage shadow region and the side bottom shadow interference parameter, combined with the grayscale texture difference between it and the corresponding region at the same position in the top light detection image, and the boundary shape similarity between it and the corresponding suspected damage region, the confidence coefficient of each suspected damage shadow region is obtained.
[0009] For each vegetable seed, seed damage is assessed based on the complexity of the grayscale texture within each suspected damage area, the grayscale information of each suspected damage shadow area corresponding to each suspected damage area, and the confidence coefficient.
[0010] Furthermore, the method for obtaining the suspected damaged area includes:
[0011] In each vegetable seed in the top light detection image, all pixels are clustered according to the gradient magnitude, and region connectivity detection is performed on pixels in the same cluster. Suspected damaged regions are screened out from all connected regions based on the average gradient magnitude.
[0012] Furthermore, the method for obtaining the suspected damage shadow area includes:
[0013] For each suspected damage area, all adjacent connected regions corresponding to the same location in the side-lit detection image are considered as suspected damage shadow areas.
[0014] Furthermore, the method for obtaining the side-bottom shadow interference parameters includes:
[0015] In each vegetable seed, perpendicular lines are drawn from the two endpoints of the long axis of each suspected damage shadow area. Among all seed boundary segments between the two perpendicular lines, the seed boundary segment closest to the long axis is taken as the reference segment. Based on the angle and distance between the reference segment and the long axis, the first lateral shading index of the corresponding suspected damage shadow area is obtained.
[0016] The difference between the mean gradient magnitude of each pixel within a suspected damage shadow region and the mean gradient magnitude of the corresponding pixel within the suspected damage shadow region is used as a texture discrimination parameter; the negative correlation mapping result of the grayscale standard deviation of the pixels within the suspected damage shadow region is used as a shadow confidence weight; the texture discrimination parameter is weighted using the shadow confidence weight, and the weighted result is used as the second side bottom shadow index of the corresponding suspected damage shadow region;
[0017] By fusing the first and second side-bottom shadow indices, the side-bottom shadow interference parameters are obtained.
[0018] Furthermore, the method for obtaining the first side-bottom shadow index includes:
[0019] The cosine of the angle between the reference segment and the major axis is used as the orientation consistency parameter. The orientation consistency parameter is weighted using the negative correlation mapping result of the Euclidean distance between the reference segment and the major axis to obtain the first side-bottom shadow index.
[0020] Furthermore, the method for obtaining the confidence coefficient includes:
[0021] The negative correlation mapping result of the gray-scale mean of pixels in each suspected damage shadow region is used as the shadow reference weight; the difference between the gray-scale mean of pixels in each suspected damage shadow region and the corresponding region at the same position in the top light detection image is used as the shadow deviation; the shadow deviation is weighted using the shadow reference weight, and the weighted result is used as the first confidence parameter; the DTW similarity between each suspected damage shadow region and the chain code of the corresponding boundary of the suspected damage region is used as the second confidence parameter.
[0022] The negative correlation mapping result of the side-bottom shadow interference parameter of each suspected damage shadow region is used as the confidence reference weight; the first confidence parameter and the second confidence parameter are fused, and the fusion result is weighted using the confidence reference weight to obtain the confidence coefficient.
[0023] Furthermore, methods for assessing seed damage include:
[0024] For each suspected damaged area, a damaged shadow area is selected from all the suspected damaged shadow areas based on the grayscale information and the confidence coefficient of each suspected damaged shadow area. Based on the confidence parameter of the damaged shadow area and the grayscale texture complexity of the suspected damaged area, a damage feature index is obtained for each suspected damaged area. For each vegetable seed, the sum of the damage feature indices of all suspected damaged areas is normalized to obtain a damage score.
[0025] Furthermore, the method for obtaining the damaged shadow region includes:
[0026] For each suspected damage area, the suspected damage shadow area with the highest confidence coefficient is selected as a candidate area; if the gray value of all pixels in the candidate area is less than a preset threshold, it is determined to be a damage shadow area of the suspected damage area.
[0027] Furthermore, the method for obtaining the damage characteristic index includes:
[0028] The grayscale standard deviation and average gradient magnitude of pixels within the suspected damage area are fused to obtain the texture anomaly coefficient; the texture anomaly coefficient of the suspected damage area and the confidence coefficient of the corresponding damage shadow area are fused to obtain the damage feature index.
[0029] A visual detection system for vegetable seed damage includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the visual detection method for vegetable seed damage.
[0030] The present invention has the following beneficial effects:
[0031] This invention acquires all suspected damage areas of each vegetable seed in a top-lit detection image, and then acquires the corresponding suspected damage shadow area in a side-lit detection image to prepare for subsequent analysis. Furthermore, it analyzes the grayscale texture uniformity of each suspected damage shadow area by combining the low and uniform grayscale texture features of the shadow, and analyzes the region's morphological orientation to assess its similarity to the seed boundary orientation. Then, it combines the grayscale texture difference between the shadow area and its corresponding suspected damage area to obtain a side-bottom shadow interference parameter reflecting the possibility that the suspected damage shadow area is a side-bottom shadow caused by the three-dimensional structure of the vegetable seed. Further, based on the grayscale texture information and side-bottom shadow interference parameter of each suspected damage shadow area, combined with the grayscale texture difference between it and the corresponding area in the top-lit detection image, and the boundary morphological similarity between it and its corresponding suspected damage area, it obtains a confidence coefficient for each suspected damage shadow area to be a true damage shadow area. Finally, for each vegetable seed, it analyzes the complexity of the grayscale texture within each suspected damage area by combining the complex texture features caused by damage such as wrinkling and indentation, and further combines the grayscale information and confidence coefficient of each suspected damage shadow area corresponding to each suspected damage area to comprehensively evaluate seed damage. Based on the complex texture features of damage depressions and the characteristics of shadows produced under specific lighting conditions, this invention accurately identifies damaged areas in vegetable seeds, thereby improving the accuracy of visual detection of damage in vegetable seeds. Attached Figure Description
[0032] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. 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.
[0033] Figure 1 A flowchart of a visual detection method for vegetable seed damage provided in one embodiment of the present invention;
[0034] Figure 2 This is a flowchart illustrating a method for obtaining side-bottom shadow interference parameters according to an embodiment of the present invention. Detailed Implementation
[0035] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a visual detection method and system for vegetable seed damage proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0037] The following description, in conjunction with the accompanying drawings, details the specific scheme of a visual detection method and system for vegetable seed damage provided by the present invention.
[0038] Please see Figure 1 The diagram illustrates a flowchart of a visual detection method for vegetable seed damage according to an embodiment of the present invention, specifically including:
[0039] Step S1: Obtain all suspected damage areas of each vegetable seed in the top light detection image under top lighting conditions, and obtain the suspected damage shadow area corresponding to each suspected damage area in the side light detection image under side lighting conditions.
[0040] In one embodiment of the present invention, a sealed dark box is first constructed to eliminate ambient light interference, and a controllable LED light source (i.e., top lighting) is deployed above the detection platform. The detection platform is also integrated with a vibrating dispersion feeder, which feeds vegetable seeds to the detection platform for visual inspection through the coordinated feeding of a vibrating plate and a conveyor belt, ensuring that all seeds pass through the imaging area in a single layer with zero contact, thus ensuring a complete and clear image of the seed damage area; a high-precision position triggering device is used to capture the top light detection image when the seed reaches the imaging center;
[0041] After preprocessing the top-light detection image such as grayscale conversion and noise reduction, all vegetable seeds in the top-light detection image are identified. Specifically, the Otsu threshold segmentation algorithm is used to segment the vegetable seeds. The implementer can also train a segmentation model to segment all vegetable seeds in the top-light detection image. Both the Otsu threshold segmentation algorithm and the Otsu threshold segmentation algorithm are existing technologies and will not be described in detail here.
[0042] Further, all suspected damaged areas in each vegetable seed were obtained; considering that the healthy vegetable seed has a smooth and uniform gray scale, it has different characteristics from the wrinkled and sunken epidermis of the damaged seed. The damaged area has obvious gray scale texture changes relative to the healthy area, and the gradient can characterize the gray scale change characteristics.
[0043] Based on this, in a preferred embodiment of the present invention, the method for obtaining suspected damage areas includes: in each vegetable seed in the top light detection image, clustering all pixels according to the gradient magnitude, performing region connectivity detection on pixels in the same cluster, and filtering out suspected damage areas from all connected regions according to the average gradient magnitude.
[0044] Specifically, the Sobel operator is used to obtain the gradient of all pixels in each vegetable seed. Then, in each vegetable seed, the absolute value of the difference in gradient magnitude is used as the metric distance between pixels. Based on the DBSCAN clustering algorithm, all pixels are clustered. DBSCAN does not require pre-setting the number of clusters, can handle noise and outliers well, and automatically clusters pixels with similar gradient magnitudes into one cluster. Further, in each cluster, region connectivity detection is performed on all pixels to obtain all connected regions. The mean gradient magnitude of all pixels in each connected region is calculated, and all connected regions in all clusters are sorted in descending order based on the mean gradient magnitude. The difference in the mean gradient magnitude between adjacent connected regions is calculated, and the connected region is divided into two parts at the point where the difference is the largest. The first half of the connected region with the largest difference is regarded as the suspected damaged region.
[0045] In other embodiments, the implementer may further cluster all connected components into two clusters based on the K-means clustering algorithm, and take all connected components in the cluster with the largest gradient magnitude corresponding to the cluster center as suspected damage regions; its acquisition of pixel gradients by the Sobel operator and the DBSCAN clustering algorithm are existing technologies and will not be described in detail here.
[0046] Considering that healthy seeds may have natural spots (flat colored spots) on their surface, which exhibit obvious grayscale texture changes in visual inspection, similar to damage such as wrinkles and depressions, the suspected damage areas screened above may also contain natural spot areas, affecting the damage identification effect. Furthermore, considering that wrinkles and depressions will produce shadows under certain lighting conditions, while natural spots will not, when a suspected damage area has a damage shadow, it can be determined to be a real damage area, thereby reducing the interference of false identification caused by natural spots and improving the accuracy of damage detection.
[0047] Therefore, in one embodiment of the present invention, the suspected damage shadow area corresponding to each suspected damage area is obtained in the side-lit detection image under side lighting conditions; wherein the side lighting conditions are as follows: an LED light source is deployed at a 45° angle above the side of the detection platform, and the side-lit detection image of the vegetable seeds on the detection platform is acquired simultaneously, and the side-lit detection image is preprocessed such as grayscale conversion and noise reduction; the implementer may also customize the side lighting conditions, but it is necessary to ensure that the vegetable seeds produce shadows;
[0048] It should be noted that during the acquisition of side-lit and top-lit detection images, only the lighting angle is different. The vegetable seeds are stationary on the detection platform and the shooting angle is the same. This is so that the shadow of the suspected damaged area of the same vegetable seed in the top-lit detection image can be obtained in the side-lit detection image, thereby assessing the seed damage.
[0049] In one embodiment of the present invention, all suspected damage areas in the top light detection image are further mapped onto the side light detection image by projection or other means, so as to obtain the corresponding area of each suspected damage area at the same position in the side light detection image. The projected area is the suspected damage area in the side light detection image.
[0050] Preferably, in one embodiment of the present invention, considering that shadows are usually connected to objects, all adjacent connected regions corresponding to the same position in the side-lit detection image for each suspected damage area can be used as the suspected damage shadow area. It should be noted that the acquisition of connected regions is existing technology and will not be elaborated further.
[0051] Step S2: Based on the uniformity of grayscale texture and the direction of the region in each suspected damage shadow area, and combined with the grayscale texture difference between it and the corresponding suspected damage area, obtain the side bottom shadow interference parameters of each suspected damage shadow area.
[0052] Considering that under side lighting conditions, not only will the damage depressions cast shadows, but the three-dimensional structure of vegetable seeds will also cause shadows due to blocking the light source. This usually manifests as a shadow covering one side of the vegetable seed and close to the detection platform (also the bottom side of the vegetable seed), which is called the bottom side shadow of the vegetable seed.
[0053] Because the side bottom shadow and the damage shadow have similar shadow characteristics, they interfere with the subsequent screening of damage shadow areas. That is, the suspected damage shadow areas may contain side bottom shadows. Furthermore, because the texture features of the side bottom shadow are weak, the gray level is low and uniform, and it is close to the boundary of the vegetable seed, the shape and direction of the shadow are also similar to the boundary direction of the vegetable seed.
[0054] Therefore, in this embodiment of the invention, it is necessary to further obtain the side-bottom shadow interference parameter of each suspected damage shadow area based on the uniformity of grayscale texture and the direction of the area shape, combined with the grayscale texture difference between it and the corresponding suspected damage area. The side-bottom shadow interference parameter reflects the possibility that the suspected damage shadow area is a side-bottom shadow, which prepares for the subsequent evaluation of the confidence coefficient of each suspected damage shadow area.
[0055] It should be noted that when evaluating the side-bottom shadow interference parameters, in order to avoid the side-bottom shadow from obscuring the suspected damage area and further affecting the analysis and evaluation of grayscale texture differences, the suspected damage area obtained in the side-bottom shadow interference parameter analysis refers to the suspected damage area in the top light detection image.
[0056] Preferably, in one embodiment of the present invention, the method for obtaining the side-bottom shadow interference parameters includes:
[0057] Please see Figure 2 The flowchart illustrates a method for obtaining side-bottom shadow interference parameters according to an embodiment of the present invention, specifically including:
[0058] Step S201: In each vegetable seed, draw perpendicular lines through the two endpoints of the long axis of each suspected damage shadow area. Among all seed boundary segments between the two perpendicular lines, take the seed boundary segment closest to the long axis as the reference segment. Based on the angle and distance between the reference segment and the long axis, obtain the first lateral bottom shadow index of the corresponding suspected damage shadow area.
[0059] Considering that the shape and orientation of the lateral bottom shadow are similar to the boundary orientation of vegetable seeds, and that the lateral bottom shadow is close to the seed boundary, based on this feature, firstly, for each suspected damage area in each vegetable seed, the long axis of the suspected damage area can be determined, and then a reference segment can be determined in the seed boundary. This allows for the assessment of the similarity between the distance and orientation (measured by the angle) between the long axis and the reference segment, thereby assessing the first lateral bottom shadow index of the suspected damage shadow area. The first lateral bottom shadow index, based on the shape and orientation, initially reflects the possibility that the suspected damage shadow area is a lateral bottom shadow.
[0060] Specifically, for each vegetable seed and for each suspected damage area, the minimum bounding rectangle of the suspected damage area is first obtained. A line segment parallel to and equal to the long side is drawn through the center of the minimum bounding rectangle to obtain the major axis of the suspected damage shaded area. Then, perpendicular lines are drawn through the two endpoints of the major axis. Among all seed boundary segments between the two perpendicular lines (a total of two seed boundary segments, located on the seed boundary to the left of the major axis and the seed boundary to the right of the major axis, respectively), the seed boundary segment closest to the major axis is selected as the reference segment.
[0061] It should be noted that obtaining the minimum bounding rectangle and constructing the perpendicular line are existing technical methods, and will not be elaborated further.
[0062] Since the included angle can reflect the consistency of orientation, the smaller the included angle, the more consistent the orientation. Based on this, in a preferred embodiment of the present invention, the minimum included angle between the reference segment and the line containing the major axis is first obtained. The cosine value of the included angle between the reference segment and the major axis is used as the orientation consistency parameter. The smaller the included angle, the larger the cosine value, and the larger the orientation consistency parameter. Furthermore, the negative correlation mapping result of the Euclidean distance between the reference segment and the major axis is used to weight the orientation consistency parameter. For example, the Euclidean distance is mapped to the exponential function exp(-x) with the natural constant e as the base to adjust the logic. The closer the Euclidean distance, the greater the probability that it is a side-bottom shadow. Then, the exponential value is multiplied by the orientation consistency parameter to obtain the first side-bottom shadow index. The implementer may also use other negative correlation mapping methods, which will not be elaborated here.
[0063] Step S202: The difference between the average gradient magnitude of each pixel in the suspected damage shadow area and the average gradient magnitude of the corresponding pixel in the suspected damage shadow area is used as a texture discrimination parameter; the negative correlation mapping result of the gray standard deviation of the pixels in the suspected damage shadow area is used as the shadow confidence weight; the texture discrimination parameter is weighted using the shadow confidence weight, and the weighted result is used as the second side bottom shadow index of the corresponding suspected damage shadow area.
[0064] Since the grayscale of the shadow area is low and uniform and does not have obvious gradient, there is a clear texture difference between it and the suspected damage area. Based on this, the second side-bottom shadow index of each suspected damage shadow area can be obtained. The second side-bottom shadow index reflects the possibility that the suspected damage shadow area is a side-bottom shadow based on the grayscale texture features of the shadow, which prepares for the subsequent evaluation of the side-bottom shadow interference parameters in combination with the first side-bottom shadow index.
[0065] As an example, the difference is measured by the absolute value of the difference. The absolute value of the difference between the average gradient magnitude of each pixel in the suspected damage shadow region and the average gradient magnitude of the corresponding pixel in the suspected damage region is used as the texture discrimination parameter between the two regions. The larger the texture discrimination parameter, the greater the probability that the suspected damage shadow region is a shadow.
[0066] Further, based on the grayscale standard deviation, the grayscale uniformity of pixels in the suspected damage shadow area is evaluated. The grayscale standard deviation is mapped to the exponential function exp(-x) with the natural constant e as the base, and the logic is adjusted to obtain the shadow confidence weight. The smaller the grayscale standard deviation, the more uniform the grayscale, the greater the probability of it being a shadow, and the greater the shadow confidence weight. Implementers can also use other discrete metric parameters to replace the standard deviation, and can also use other negative correlation mapping methods such as taking the reciprocal, which will not be elaborated here.
[0067] Finally, the shadow confidence weight is multiplied by the texture discrimination parameter to obtain the second side bottom shadow index.
[0068] Step S203: Fuse the first side-bottom shadow index and the second side-bottom shadow index to obtain the side-bottom shadow interference parameters.
[0069] As an example, the first and second lateral bottom shadow indices are multiplied and fused to obtain the lateral bottom shadow interference parameters for the corresponding suspected damage shadow area.
[0070] Step S3: Based on the grayscale texture information and side-bottom shadow interference parameters of each suspected damage shadow region, combined with the grayscale texture difference between it and the corresponding region at the same position in the top light detection image, and the similarity of its boundary shape with the corresponding suspected damage region, obtain the confidence coefficient of each suspected damage shadow region.
[0071] In the side-lit detection image, considering that the damage shadow caused by the surface damage depression of vegetable seeds usually has a similar boundary shape to the damage area; and considering that the damage shadow also has the characteristics of low and uniform gray level, there is an obvious difference in gray level texture between it and the corresponding area at the same position in the top-lit detection image; therefore, the embodiments of the present invention can, based on the above features and combined with the gray level texture information of each suspected damage shadow area and the side bottom shadow interference parameters, evaluate the probability that each suspected damage shadow area is a real damage shadow, i.e., the confidence coefficient, so as to prepare for the subsequent evaluation of vegetable seed damage.
[0072] Considering that damaged shadows should have low grayscale texture features, the possibility of a shadow can first be preliminarily assessed based on the average grayscale value of pixels in the suspected damaged shadow area. The smaller the average grayscale value, the greater the possibility of it being a damaged shadow. Therefore, the average grayscale value is negatively correlated to obtain the shadow reference weight. At the same time, if the grayscale difference between the suspected damaged shadow area and the corresponding area at the same position in the top light detection image is large, it indicates that the shadow deviation relative to the shadow of the same position without light and shadow in the top light detection image is greater, and the possibility of it being a damaged shadow is also greater. Then, the confidence parameter of it being a damaged shadow can be preliminarily assessed by combining the shadow reference weight.
[0073] Furthermore, considering that the chain code information of the boundary can reflect the boundary changes, and the DTW algorithm can help measure the similarity between sequences of different lengths, it can assess the boundary similarity between the suspected damage shadow area and the corresponding suspected damage area and obtain the second confidence parameter.
[0074] Furthermore, considering that the larger the lateral shadow interference parameter of the suspected damage shadow area, the greater the probability of it being a lateral shadow and the smaller the probability of it being a damage shadow, it is necessary to further adjust the lateral shadow interference parameter through negative correlation mapping to obtain the confidence reference weight. Finally, by combining the first confidence parameter and the second confidence parameter, the confidence coefficient of the suspected damage shadow area being a damage shadow is comprehensively evaluated.
[0075] Based on this, in a preferred embodiment of the present invention, the method for obtaining the confidence coefficient includes:
[0076] The negative correlation mapping result of the gray-scale mean of pixels in each suspected damage shadow region is used as the shadow reference weight; the difference between the gray-scale mean of pixels in each suspected damage shadow region and the corresponding region at the same position in the top light detection image is used as the shadow deviation; the shadow deviation is weighted using the shadow reference weight, and the weighted result is used as the first confidence parameter; the DTW similarity between each suspected damage shadow region and the chain code of the corresponding boundary of the corresponding suspected damage region is used as the second confidence parameter; the negative correlation mapping result of the side-bottom shadow interference parameter of each suspected damage shadow region is used as the confidence reference weight; the first confidence parameter and the second confidence parameter are fused, and the fusion result is weighted using the confidence reference weight to obtain the confidence coefficient.
[0077] As an example, for each suspected damage area, the grayscale mean of the pixels within the suspected damage shadow area is first reciprocaled and the logic is adjusted using negative correlation mapping to obtain the shadow reference weight. The implementer can also use other negative correlation mapping methods. The shadow deviation is then measured by the absolute value of the difference, and the shadow deviation is multiplied by the shadow reference weight to obtain the first confidence parameter.
[0078] Then, an image coordinate system is constructed with the lower left corner of the side-lit detection image as the origin to obtain the coordinates of the boundary points of the suspected damage shadow area and the corresponding suspected damage area. Between the suspected damage shadow area and the corresponding suspected damage area, a boundary point with the smallest coordinates (the sum of the coordinates of the horizontal and vertical coordinates is the smallest) is selected. Then, the boundary of the area is traversed clockwise from the boundary point to obtain the boundary chain code of the suspected damage shadow area and the boundary chain code of the corresponding suspected damage area. Then, the DTW similarity between the two boundary chain codes is used as the second confidence parameter. The chain code used is an 8-chain code. Obtaining the boundary chain code and DTW similarity are well-known techniques and will not be described in detail. Implementers can also define their own chain code acquisition rules.
[0079] Then, the side-bottom shadow interference parameters of the suspected damage area are mapped to the exponential function exp(-x) with the natural constant e as the base for negative correlation mapping to obtain the confidence reference weight; finally, the first confidence parameter and the second confidence parameter are multiplied and fused, and then multiplied with the confidence reference weight to obtain the confidence coefficient.
[0080] It should be noted that the suspected damage area in the confidence coefficient acquisition method can be the suspected damage area obtained from the top light detection image or the suspected damage area obtained from the projection in the side light detection image.
[0081] Step S4: For each vegetable seed, assess seed damage based on the complexity of the grayscale texture within each suspected damage area, and the grayscale information and confidence coefficient of each suspected damage shadow area corresponding to each suspected damage area.
[0082] After obtaining each suspected damage shadow area in each suspected damage area of each vegetable seed, the suspected damage shadow area can be further evaluated based on its grayscale information and confidence coefficient to determine whether it is a real damage shadow. The more likely the suspected damage area is to be a real damage depression area, the more likely the seed damage can be evaluated by combining the complex texture of the suspected damage area.
[0083] Preferably, in one embodiment of the present invention, considering that the higher the confidence coefficient of a suspected damage shadow area, the greater the probability that it is a damage shadow area, the damage shadow area is further screened by combining the feature of low shadow gray level; the severity of damage features such as wrinkling and indentation is further evaluated by combining the complex texture within the suspected damage area to obtain a damage feature index; finally, the seed damage is evaluated by comprehensively considering the damage feature indices of all suspected damage areas in the vegetable seed; based on this, the method for evaluating seed damage includes:
[0084] For each suspected damage area, based on the grayscale information and confidence coefficient of each suspected damage shadow area, damage shadow areas are selected from all suspected damage shadow areas. Based on the confidence parameters of the damage shadow areas and the complexity of the grayscale texture of the suspected damage areas, the damage feature index of each suspected damage area is obtained. For each vegetable seed, the sum of the damage feature indices of all suspected damage areas is normalized to obtain a damage score.
[0085] In a preferred embodiment of the present invention, the method for obtaining the damage shadow region includes:
[0086] For each suspected damage area, the suspected damage shadow area with the highest confidence coefficient is selected as the candidate area; if the gray value of all pixels in the candidate area is less than the preset threshold, it is determined to be the damage shadow area of the suspected damage area.
[0087] It should be noted that, considering that the gray value of the damage shadow should be lower than the average gray level of the side-lit detection image, the preset threshold is set to the average gray value of all pixels in the side-lit detection image; when the gray value of the candidate region corresponding to the maximum confidence coefficient is lower than the average gray value of all pixels in the side-lit detection image, the candidate region is regarded as the real damage shadow region; otherwise, it is determined that there is no shadow damage region; the suspected damage region with damage shadow region is the real damage region.
[0088] In a preferred embodiment of the present invention, considering that the standard deviation of grayscale can reflect the grayscale dispersion to a certain extent, and the larger the gradient, the more it reflects the rate of grayscale change, and indirectly reflects the complexity of grayscale texture, and the more it has texture features corresponding to damage such as wrinkling and depression; at the same time, the larger the confidence coefficient of the corresponding shadow damage area, the greater the damage confidence reference value provided; therefore, the method for obtaining the damage feature index includes:
[0089] The grayscale standard deviation and average gradient magnitude of pixels within the suspected damage area are fused to obtain the texture anomaly coefficient; the texture anomaly coefficient of the suspected damage area and the confidence coefficient of the corresponding damage shadow area are fused to obtain the damage feature index.
[0090] Specifically, the grayscale standard deviation of pixels in the suspected damage area is multiplied and combined with the average gradient magnitude to obtain the texture anomaly coefficient; the texture anomaly coefficient of the suspected damage area is multiplied with the confidence coefficient of the corresponding damage shadow area to obtain the damage feature index of the suspected damage area.
[0091] It should be noted that if there is no corresponding damage shadow area in the suspected damage area, then it is not a real damage area and its damage characteristic index can be regarded as 0.
[0092] Finally, for each vegetable seed, the damage characteristic indices of all suspected damaged areas are summed, and the sum is mapped to the sigmoid function for normalization to obtain the damage score of the vegetable seed.
[0093] In one embodiment of the present invention, damage grading can also be performed; when the damage score is in the interval [0, 0.3), the vegetable seed is determined to be "undamaged"; when the damage score is in the interval [0.3, 0.6), the vegetable seed is determined to be "slightly damaged"; when the damage score is in the interval [0.6, 1], the vegetable seed is determined to be "severely damaged"; this provides a clear basis for subsequent damage classification; the implementer can also define the damage grading rules themselves, and can also construct a damage feature database to provide a reference for subsequent damage detection.
[0094] Based on the same inventive concept, the present invention also proposes a visual detection system for vegetable seed damage. The system includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, it implements a visual detection method for vegetable seed damage as described in steps S1-S4 above.
[0095] In summary, this invention first acquires a top-lit detection image and identifies all suspected damage areas for each vegetable seed. Then, in a side-lit detection image, it acquires the corresponding suspected damage shadow area for each suspected damage area. Further analysis and evaluation of the side-bottom shadow interference parameters of each suspected damage shadow area are conducted. Then, combining the grayscale texture difference between the shadow area and its corresponding area in the top-lit detection image, as well as the boundary morphology similarity between the shadow area and its corresponding suspected damage area, a confidence coefficient for each suspected damage shadow area is obtained. Finally, for each vegetable seed, seed damage is assessed based on the complexity of the grayscale texture within each suspected damage area, and the grayscale information and confidence coefficient of each suspected damage shadow area corresponding to each suspected damage area. This invention, based on the complex texture features of damage depressions and the characteristics of shadows generated under specific lighting conditions, accurately identifies damaged areas in vegetable seeds, improving the accuracy of visual detection of vegetable seed damage.
[0096] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0097] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A visual detection method for vegetable seed damage, characterized in that, The method includes: Obtain all suspected damage areas of each vegetable seed in the top light detection image under top lighting conditions, and obtain the suspected damage shadow area corresponding to each suspected damage area in the side light detection image under side lighting conditions; Based on the uniformity of grayscale texture and the direction of the region in each suspected damage shadow region, and combined with the grayscale texture difference between it and the corresponding suspected damage region, the side bottom shadow interference parameters of each suspected damage shadow region are obtained. Based on the grayscale texture information of each suspected damage shadow region and the side bottom shadow interference parameter, combined with the grayscale texture difference between it and the corresponding region at the same position in the top light detection image, and the boundary shape similarity between it and the corresponding suspected damage region, the confidence coefficient of each suspected damage shadow region is obtained. For each vegetable seed, seed damage is assessed based on the complexity of the grayscale texture within each suspected damage area, the grayscale information of each suspected damage shadow area corresponding to each suspected damage area, and the confidence coefficient. The method for obtaining the side-bottom shadow interference parameters includes: In each vegetable seed, perpendicular lines are drawn from the two endpoints of the long axis of each suspected damage shadow area. Among all seed boundary segments between the two perpendicular lines, the seed boundary segment closest to the long axis is taken as the reference segment. Based on the angle and distance between the reference segment and the long axis, the first lateral shading index of the corresponding suspected damage shadow area is obtained. The difference between the mean gradient magnitude of each pixel within a suspected damage shadow region and the mean gradient magnitude of the corresponding pixel within the suspected damage shadow region is used as a texture discrimination parameter; the negative correlation mapping result of the grayscale standard deviation of the pixels within the suspected damage shadow region is used as a shadow confidence weight; the texture discrimination parameter is weighted using the shadow confidence weight, and the weighted result is used as the second side bottom shadow index of the corresponding suspected damage shadow region; By fusing the first and second side-bottom shadow indices, the side-bottom shadow interference parameters are obtained. The method for obtaining the first side bottom shadow index includes: The cosine of the angle between the reference segment and the major axis is used as the orientation consistency parameter. The orientation consistency parameter is weighted using the negative correlation mapping result of the Euclidean distance between the reference segment and the major axis to obtain the first side-bottom shadow index.
2. The method for visually detecting damage to vegetable seeds according to claim 1, characterized in that, The method for obtaining the suspected damaged area includes: In each vegetable seed in the top light detection image, all pixels are clustered according to the gradient magnitude, and region connectivity detection is performed on pixels in the same cluster. Suspected damaged regions are screened out from all connected regions based on the average gradient magnitude.
3. The method for visually detecting damage to vegetable seeds according to claim 1, characterized in that, The method for obtaining the suspected damage shadow area includes: For each suspected damage area, all adjacent connected regions corresponding to the same location in the side-lit detection image are considered as suspected damage shadow areas.
4. The method for visually detecting damage to vegetable seeds according to claim 1, characterized in that, The method for obtaining the confidence coefficient includes: The negative correlation mapping result of the gray-scale mean of pixels in each suspected damage shadow region is used as the shadow reference weight; the difference between the gray-scale mean of pixels in each suspected damage shadow region and the corresponding region at the same position in the top light detection image is used as the shadow deviation; the shadow deviation is weighted using the shadow reference weight, and the weighted result is used as the first confidence parameter; the DTW similarity between the chain codes of the corresponding boundaries of each suspected damage shadow region and the corresponding suspected damage region is used as the second confidence parameter. The negative correlation mapping result of the side-bottom shadow interference parameter of each suspected damage shadow region is used as the confidence reference weight; the first confidence parameter and the second confidence parameter are fused, and the fusion result is weighted using the confidence reference weight to obtain the confidence coefficient.
5. The method for visually detecting damage to vegetable seeds according to claim 1, characterized in that, Methods for assessing seed damage include: For each suspected damaged area, a damaged shadow area is selected from all the suspected damaged shadow areas based on the grayscale information and the confidence coefficient of each suspected damaged shadow area. Based on the confidence parameter of the damaged shadow area and the grayscale texture complexity of the suspected damaged area, a damage feature index is obtained for each suspected damaged area. For each vegetable seed, the sum of the damage feature indices of all suspected damaged areas is normalized to obtain a damage score.
6. The method for visually detecting damage to vegetable seeds according to claim 5, characterized in that, The method for obtaining the damage shadow region includes: For each suspected damage area, the suspected damage shadow area with the highest confidence coefficient is selected as a candidate area; if the gray value of all pixels in the candidate area is less than a preset threshold, it is determined to be a damage shadow area of the suspected damage area.
7. The method for visually detecting damage to vegetable seeds according to claim 5, characterized in that, The method for obtaining the damage characteristic index includes: The grayscale standard deviation and average gradient magnitude of pixels within the suspected damage area are fused to obtain the texture anomaly coefficient; the texture anomaly coefficient of the suspected damage area and the confidence coefficient of the corresponding damage shadow area are fused to obtain the damage feature index.
8. A visual detection system for vegetable seed damage, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the visual detection method for vegetable seed damage as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Fine marking method for colon cancer lesion in CT (Computed Tomography) image
CN119380945A
Seed quality visual detection method for soybean breeding
CN120198900A