Label defect detection system and method based on image processing
The label defect detection system based on image correction, multi-scale feature extraction and adaptive threshold calculation solves the problem that traditional methods are sensitive to environmental changes and achieves high accuracy and sensitivity detection in complex backgrounds.
Patent Information
- Application Number
- CN202510692673.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-05-27
AI Technical Summary
Existing label defect detection systems are sensitive to changes in ambient lighting, label deformation, and complex background interference, and are prone to misjudgment or missed detection, especially when the label is slightly offset or deformed.
A label defect detection system based on image processing is adopted. The image correction module performs illumination correction, the feature map module performs multi-scale feature extraction, the threshold determination module calculates the adaptive local threshold, the image enhancement module performs residual calculation and differential operation, and the defect scoring module performs multi-level fusion to generate a defect scoring map and perform detection.
It improves the robustness and accuracy of label image defect detection, can identify small, blurred or deformed defects in complex environments, adapt to lighting changes, and enhances the sensitivity and scalability of detection.
Smart Images

Figure CN120672671A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a label defect detection system, method, electronic device, and non-transitory computer-readable storage medium based on image processing. Background Art
[0002] In industrial production, labels, as a crucial component of product packaging, not only carry product information but also directly influence consumers' perception of product quality. Existing label defect detection systems primarily rely on traditional image processing methods, such as edge detection, template matching, and color histogram analysis, coupled with fixed inspection processes, to identify common defects such as label detachment, misalignment, blurring, wrinkling, and unclear printing.
[0003] However, traditional image processing methods are sensitive to factors such as ambient lighting changes, label deformation, and complex background interference, making them prone to misjudgment or missed detections. Furthermore, template matching methods rely on preset templates, which often lead to detection failures when the label is slightly offset or deformed. Summary of the Invention
[0004] In response to the technical problems existing in the prior art, the present invention provides a label defect detection system, method, electronic device and non-transitory computer-readable storage medium based on image processing, which can improve the accuracy of label defect detection.
[0005] The technical solution of the present invention to solve the above technical problems is as follows: The present invention provides a label defect detection system based on image processing, the system comprising: The image correction module is used to obtain a corrected image after illumination correction through a nonlinear compensation model based on the local brightness distribution and global statistical parameters of the original input label image; A feature map module is used to extract features from the corrected image using a multi-scale convolution kernel group to generate a multi-scale feature map; A threshold determination module is used to calculate a spatially adaptive local threshold based on the multi-scale feature map combined with the local area mean and standard deviation; An image enhancement module, configured to perform residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; A defect scoring module is used to generate a defect scoring map based on the enhanced feature map by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect detection module is configured to calculate a defect score of the label image according to the defect score map, and detect defects in the label image by comparing the defect score with a preset threshold.
[0006] Furthermore, the image correction module is further configured to: By calculating the deviation of local brightness from global brightness statistical parameters; establishing the nonlinear compensation model according to the deviation; According to the nonlinear compensation model, the brightness distribution of each pixel of the label image is dynamically adjusted to obtain a corrected image.
[0007] Furthermore, the feature map module is also used to: Obtain the scale and scale attenuation factor of the desired feature map; constructing a scale attenuation term according to the scale and the scale attenuation factor; After extracting features from the offset point pixels of the corrected image using the multi-scale convolution kernel group, processing is performed in combination with the scale attenuation term to obtain the multi-scale feature map.
[0008] Furthermore, the threshold determination module is further configured to: Obtaining the local mean and local standard deviation of each pixel of the multi-scale feature map; Determine the maximum of all local standard deviations; The adaptive local threshold is determined according to the local mean, the local standard deviation, and the maximum value of all local standard deviations.
[0009] Furthermore, the image enhancement module is further configured to: Calculating the square of the difference between the multi-scale feature map and the adaptive local threshold; Processing the multi-scale feature map by a Laplace operator to obtain a second-order derivative result of the multi-scale feature map; The enhanced feature map is determined according to the square value and a second-order derivative result of the multi-scale feature map.
[0010] Furthermore, the defect scoring module is also used to: Acquiring morphological features of the label image; Processing the enhanced features through a Gaussian smoothing kernel to obtain spatially weighted features; The enhanced features, the spatial weighted features and the morphological features are weightedly fused to generate the defect score map.
[0011] Furthermore, the defect detection module is also used to: Obtaining the area of the target region to be detected in the label image; The defect score map is integrated and then divided by the target area to obtain the defect score of the label image.
[0012] The present invention also provides a label defect detection method based on image processing, the method comprising: According to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a nonlinear compensation model; According to the corrected image, a multi-scale convolution kernel group is used to perform feature extraction to generate a multi-scale feature map; Calculating a spatially adaptive local threshold based on the multi-scale feature map in combination with the local area mean and standard deviation; Performing residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; According to the enhanced feature map, a defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect score of the label image is calculated according to the defect score map, and the defects of the label image are detected by comparing the defect score with a preset threshold.
[0013] In addition, to achieve the above-mentioned purpose, the present invention also proposes an electronic device, comprising: a memory for storing a computer software program; a processor for reading and executing the computer software program, thereby implementing a label defect detection method based on image processing as described above.
[0014] In addition, to achieve the above-mentioned purpose, the present invention also proposes a non-transitory computer-readable storage medium, in which a computer software program is stored. When the computer software program is executed by a processor, it implements a label defect detection method based on image processing as described above.
[0015] The beneficial effects of the present invention are: (1) The present invention can improve the robustness of label image defect detection in complex environments; (2) The present invention can improve the accuracy and sensitivity of label image defect detection; (3) The present invention can enhance the adaptability and scalability of the nonlinear compensation model.
[0016] In summary, this paper combines traditional image processing methods with multi-scale depth features to construct a label defect detection method with excellent adaptability, accuracy, and robustness. It can effectively identify small, blurred, or deformed defects in various environments. This method is insensitive to changes in lighting and can dynamically adjust parameters for optimal judgment. It is particularly suitable for complex backgrounds, low contrast, and strong reflective scenes encountered during the actual production and inspection of label products, and has broad practical value and promotion potential. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A scene diagram of a label defect detection method based on image processing provided by the present invention; Figure 2 A schematic structural diagram of a label defect detection system based on image processing provided by the present invention; Figure 3 A flowchart of a label defect detection method based on image processing provided by the present invention; Figure 4 A schematic diagram of the hardware structure of a possible electronic device provided by the present invention; Figure 5 A schematic diagram of the hardware structure of a possible computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION
[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.
[0019] See also Figure 1 , Figure 1 This is a scene diagram of a label defect detection method based on image processing provided by the present invention. Figure 1 As shown, the terminal and server are connected via a network, such as a wired or wireless network. Terminals include, but are not limited to, portable devices such as mobile phones and tablets installed with various network platform applications, as well as fixed devices such as computers, kiosks, and advertising machines. The server provides various business services to users, including service push servers and user recommendation servers.
[0020] It should be noted that Figure 1 The scene diagram of a label defect detection method based on image processing shown is only an example. The terminal, server and application scenario described in the embodiment of the present invention are for the purpose of more clearly illustrating the technical solution of the embodiment of the present invention, and do not generate a limitation on the technical solution provided by the embodiment of the present invention. Ordinary technicians in this field know that with the evolution of the system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present invention is also applicable to similar technical problems.
[0021] Among them, the terminal can be used to: According to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a nonlinear compensation model; According to the corrected image, a multi-scale convolution kernel group is used to perform feature extraction to generate a multi-scale feature map; Calculating a spatially adaptive local threshold based on the multi-scale feature map in combination with the local area mean and standard deviation; Performing residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; According to the enhanced feature map, a defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect score of the label image is calculated according to the defect score map, and the defects of the label image are detected by comparing the defect score with a preset threshold.
[0022] See also Figure 2 , Figure 2 This is a structural schematic diagram of a label defect detection system based on image processing provided by the present invention.
[0023] like Figure 2 As shown, an embodiment of the present invention proposes a label defect detection system based on image processing, including: The image correction module 201 is used to obtain a corrected image after illumination correction through a nonlinear compensation model based on the local brightness distribution and global statistical parameters of the original input label image; A feature map module 202 is configured to extract features from the corrected image using a multi-scale convolution kernel group to generate a multi-scale feature map; A threshold determination module 203 is configured to calculate a spatially adaptive local threshold based on the multi-scale feature map in combination with the local region mean and standard deviation; An image enhancement module 204 is configured to perform residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; The defect scoring module 205 is configured to generate a defect scoring map based on the enhanced feature map by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect detection module 206 is configured to calculate a defect score of the label image according to the defect score map, and detect defects in the label image by comparing the defect score with a preset threshold.
[0024] In some embodiments, the image correction module 201 is further configured to: By calculating the deviation of local brightness from global brightness statistical parameters; establishing the nonlinear compensation model according to the deviation; According to the nonlinear compensation model, the brightness distribution of each pixel of the label image is dynamically adjusted to obtain a corrected image.
[0025] Among them, each pixel in the label image is represented as: in, is the midpoint of the original input label image The pixel value of is the midpoint of the rectified image after correction of, is the midpoint The local brightness, is the average brightness of the image, is the brightness variance, is the first adaptive parameter, is the second adaptive parameter.
[0026] In the specific implementation, is the midpoint of the original input label image The pixel value of the original image at point The grayscale value of , that is, the input image pixel, is generally in the range of [0,255]. is the midpoint of the rectified image after correction The pixel value of represents the corrected image pixel value, that is, the output image pixel, taking into account the result of illumination compensation. is the midpoint The local brightness of the pixel The local brightness of a point, usually the average of a small window centered at that point. It is the average brightness of the image, that is, the global brightness statistical parameter, which represents the average grayscale value of all pixels. is the brightness variance, which represents the variance of all pixel grayscale values. It is the first adaptive parameter, which controls the enhancement amplitude (usually set to 0.5-2). It is the second adaptive parameter that controls the influence of brightness difference (usually set to 0.1~1).
[0027] Assume that in the label image, there are the following typical parameters: =100, the pixel value of the original image is 100; 90, the local brightness of the point (for example, the average of the 5×5 neighborhood) is 90; 120 means the average brightness of the entire image is 120; 400 means the brightness variance is 400 (i.e. the standard deviation is 20); 1.0, for example, could be an enhancement parameter; 0.5, for example, can be a difference-sensitive parameter.
[0028] The calculation process is as follows: 1+1.0⋅0.32465=1.32465; 100⋅1.32465≈132.47.
[0029] Therefore, the original image pixels =100, corrected pixels ≈132.47, that is, the pixel becomes brighter after illumination compensation (compensating for the problem of local dim brightness).
[0030] In summary, the core idea of the illumination compensation method of the present invention is that when the local brightness of a pixel Lower than the average brightness of the entire image When the index value approaches 1, the pixel brightness is enhanced. When the local brightness is close to or higher than the average brightness of the entire image, the index approaches 0, indicating no enhancement or slight adjustment. This effectively compensates for insufficient brightness at edges, shadows, and occlusions, improving the robustness of subsequent defect detection.
[0031] In some embodiments, the feature map module 202 is further configured to: Obtain the scale and scale attenuation factor of the desired feature map; constructing a scale attenuation term according to the scale and the scale attenuation factor; After extracting features from the offset point pixels of the corrected image using the multi-scale convolution kernel group, processing is performed in combination with the scale attenuation term to obtain the multi-scale feature map.
[0032] Among them, the multi-scale feature map is expressed as: in, is a multi-scale feature map of scale s, is the multi-scale convolution kernel weight, is the scale attenuation factor, is the midpoint of the rectified image after correction The pixel value of is the midpoint of the corrected image The pixel value of .
[0033] In the specific implementation, this formula is essentially a weighted convolution operation with a scale penalty term, which exponentially decays the scale when extracting multi-scale texture features.
[0034] Represents a multi-scale feature map of scale s. Represents the convolution kernel weight at scale s, which is equivalent to a multi-scale convolution kernel group, usually a k×k kernel matrix. Represents the corrected image China-Israel is the center offset ( ) is the pixel value at . represents the scale attenuation term (suppressing excessive high-scale eigenvalues), where >0 controls the decay speed. Indicates the current scale (e.g. 1, 2, 3 correspond to convolution kernels of different sizes).
[0035] Now process an image region , the current point is =(5,5), with scale s=2 and a 3×3 convolution kernel.
[0036] Pixel value after image correction
[0037] Convolution kernel weights
[0038] Scale s=2, scale attenuation factor γ=0.3, calculate the scale attenuation factor: = ≈0.5488; For each ( ) to do the product : The corresponding values are: The sum is 9.00+15.625+9.225+14.75+24.4+15.125+8.925+15.5+9.00=121.55.
[0039] F(s=2)=121.55⋅0.5488≈66.69.
[0040] For a given point (x, y), at scale s=2, its multi-scale eigenvalue F(2)≈66.69.
[0041] In summary, the multi-scale convolution kernel of the present invention It can simulate structural responses of different sizes (such as edges, defects, deformations) to improve the robustness of detection; scale attenuation factor It effectively suppresses the response amplification caused by larger scales, making features of different scales comparable; the final F(s) will serve as an important input for the next step (adaptive threshold) and enhancement step to improve the quality of local responses.
[0042] In some embodiments, the threshold determination module 203 is further configured to: Obtaining the local mean and local standard deviation of each pixel of the multi-scale feature map; Determine the maximum of all local standard deviations; The adaptive local threshold is determined according to the local mean, the local standard deviation, and the maximum value of all local standard deviations.
[0043] Among them, the adaptive local threshold can be expressed as: in, is the adaptive local threshold, Yes The local mean of Yes The local standard deviation of is the maximum value of all local standard deviations in the entire image, is the first adjustment coefficient, is the second adjustment coefficient, It is a multi-scale feature map.
[0044] In the specific implementation, is the local mean, which means The average value of the grayscale values of all pixels in the neighborhood of a certain pixel (x, y) in the image (usually a small window, such as 3×3, 5×5, etc.) can also be understood as the average brightness of the local area around the pixel. , the local and characteristic information of the point are as follows: =125, =20, =40, =66.69, =10, =0.01.
[0045] =10⋅0.5⋅1.6669≈8.3345; 125+8.3345=133.3345.
[0046] The final adaptive local threshold is 125+8.3345=133.3345, which means that if the grayscale value of the current pixel is greater than 133.33, it may be considered as some kind of abnormal high response area (such as label breakage, pollution, etc.); if it is lower than the threshold, it may be a normal area.
[0047] In summary, the present invention combines local statistical features with deep feature responses. Its advantages lie in its sensitivity to local illumination changes (regulated by the standard deviation); the introduction of multi-scale texture features F(s) enhances the response to structural defects; the normalization design makes the threshold comparable between different images or regions; and it can replace the traditional fixed threshold method and adapt to complex label backgrounds (folds, stains, printing defects, etc.).
[0048] In some embodiments, the image enhancement module 204 is further configured to: Calculating the square of the difference between the multi-scale feature map and the adaptive local threshold; Processing the multi-scale feature map by a Laplace operator to obtain a second-order derivative result of the multi-scale feature map; The enhanced feature map is determined according to the square value and a second-order derivative result of the multi-scale feature map.
[0049] Among them, the enhanced feature map can be expressed as: in, is the enhanced feature map, is the Laplace operator, is the first enhancement coefficient, is the second enhancement coefficient. Yes The result of applying the second derivative of the Laplace operator.
[0050] In the specific implementation, Used to enhance the response of defective areas, assuming that for a certain point in the image To perform the calculation, input the following data: =66.69, =133.33, =1.0, =0.5.
[0051] In the neighborhood The value of is (for the Laplace operator):
[0052] ≈4440.61.
[0053] Take the center point =66.69, the four neighborhood points are: =67, =66, =65, =64.
[0054] =−266.76+262=−4.76.
[0055] =1.0⋅4440.61+0.5⋅(−4.76)=4440.61−2.38=4438.23.
[0056] The output of the enhanced image at this point is The value of ≈4438.23 is significantly higher than that of the non-defective area (generally F≈T), so it can be regarded as a possible defect response hotspot.
[0057] In summary, the present invention When the feature map deviates significantly from the threshold (i.e., defect area), the value is rapidly amplified, and the high response is to the abnormal area; Identify local texture changes (such as edges and mutations) and enhance texture details; the combination of the two can detect brightness / texture anomalies and suppress background noise.
[0058] In some embodiments, the defect scoring module 205 is further configured to: Acquiring morphological features of the label image; Processing the enhanced features through a Gaussian smoothing kernel to obtain spatially weighted features; The enhanced features, the spatial weighted features and the morphological features are weightedly fused to generate the defect score map.
[0059] Among them, the defect score graph can be expressed as: in, is the defect score graph, is the Gaussian smoothing kernel, is the morphological feature of the label image, They are the first weight, the second weight and the third weight respectively.
[0060] In the specific implementation, It can be the area of the region, boundary density, etc. is a spatially weighted feature.
[0061] Assume that for a point in an image Defect scoring, the relevant data are as follows: =4438.23, Taking the 3×3 kernel as an example, the standard deviation =1.0, then: In the neighborhood The value (3×3) is: Morphological characteristics = 0.85 (e.g., boundary density, normalized), They are 0.5, 0.4 and 0.1 respectively.
[0062] =4400⋅0.0625+4420⋅0.125+4410⋅0.0625+4430⋅0.125+4438.23⋅0.25+4440⋅0.125+4425⋅0.0625+4435⋅0.125+4445⋅0.0625=275+552.5+275.625+553.75+1109.56+555+276.5625+554.375+277.8125=4429.185.
[0063] =2219.115+1771.674+0.085=3990.874.
[0064] Finally, the defect score of this point is ≈3990.87, this value will be used as the key basis for the final defect judgment and sent to the final threshold judgment.
[0065] In summary, the present invention can maintain the local contrast intensity of the image; smooth the response while maintaining the structure; introduce regional level structural information, such as whether the region is closed and whether there are edges; avoid relying solely on pixels or textures, and have higher defect localization robustness.
[0066] In some embodiments, the defect detection module 206 is further configured to: Obtaining the area of the target region to be detected in the label image; The defect score map is integrated and then divided by the target area to obtain the defect score of the label image.
[0067] Among them, the defect score can be expressed as: in, is the normalized defect score, is the target detection area, is the preset threshold.
[0068] In the specific implementation, Used to determine whether there are defects in the area, Indicates a point on the defect score graph The pixel score, The total defect score is obtained by integrating (summing) the score values of the entire inspection area. A represents the area of the inspection area (number of pixels). , indicating a defect.
[0069] Assuming the detection area size is 5×5 (i.e. 25 pixels), the corresponding area The values are as follows (units omitted): Now, directly sum the above 25 D(x,y) values, the total in the edge area is ≈10+12+13+…≈275; The sum of the middle abnormal areas (9 points in total): 4000+3990+4050+3980+4020+3975+3995+4030+3985=36025.
[0070] The detection area is 5×5=25 pixels.
[0071] , assuming 100, then: , indicating a defect.
[0072] In summary, the present invention normalizes the overall defect characteristics of the region by integration; it can avoid misjudgment caused by local pixel anomalies; and the flexible setting of η can adapt to different tolerance requirements.
[0073] See also Figure 3 , provides a flowchart of a label defect detection method based on image processing of the present invention, comprising the following steps: Step 301: Obtain a corrected image after illumination correction using a nonlinear compensation model based on the local brightness distribution and global statistical parameters of the original input label image. Step 302: extract features using a multi-scale convolution kernel group based on the corrected image to generate a multi-scale feature map; Step 303: Calculate a spatially adaptive local threshold based on the multi-scale feature map in combination with the local area mean and standard deviation; Step 304: performing residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; Step 305: Generate a defect score map based on the enhanced feature map by multi-level fusion of original enhanced features, spatial weighted features, and morphological features; Step 306 : Calculate the defect score of the label image according to the defect score map, and detect defects in the label image by comparing the defect score with a preset threshold.
[0074] It should be noted that the specific embodiments and beneficial effects of the above steps 301-306 can be found in the aforementioned description of modules 201-206, which will not be repeated here.
[0075] See also Figure 4 , Figure 4 Schematic diagram of an embodiment of an electronic device provided by an embodiment of the present invention. Figure 4 As shown, an embodiment of the present invention provides an electronic device 400, including a memory 410, a processor 420, and a computer program 411 stored in the memory 410 and executable on the processor 420. When the processor 420 executes the computer program 411, the following steps are implemented: According to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a nonlinear compensation model; According to the corrected image, a multi-scale convolution kernel group is used to perform feature extraction to generate a multi-scale feature map; Calculating a spatially adaptive local threshold based on the multi-scale feature map in combination with the local area mean and standard deviation; Performing residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; According to the enhanced feature map, a defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect score of the label image is calculated according to the defect score map, and the defects of the label image are detected by comparing the defect score with a preset threshold.
[0076] See also Figure 5 , Figure 5 Schematic diagram of an embodiment of a computer-readable storage medium provided in an embodiment of the present invention. Figure 5 As shown, this embodiment provides a computer-readable storage medium 500 on which a computer program 411 is stored. When the computer program 411 is executed by a processor, the following steps are implemented: According to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a nonlinear compensation model; According to the corrected image, a multi-scale convolution kernel group is used to perform feature extraction to generate a multi-scale feature map; Calculating a spatially adaptive local threshold based on the multi-scale feature map in combination with the local area mean and standard deviation; Performing residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; According to the enhanced feature map, a defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect score of the label image is calculated according to the defect score map, and the defects of the label image are detected by comparing the defect score with a preset threshold.
[0077] It should be noted that, in the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0078] Those skilled in the art will appreciate that embodiments of the present invention may be provided as systems, methods, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0079] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or boxes.
[0080] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction system that is implemented in the process. Figure 1 a process or multiple processes and / or boxes Figure 1The function specified in one or more boxes.
[0081] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0082] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0083] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A label defect detection system based on image processing, characterized in that: The system comprises: The image correction module is used to obtain a corrected image after illumination correction through a nonlinear compensation model based on the local brightness distribution and global statistical parameters of the original input label image; A feature map module is used to extract features from the corrected image using a multi-scale convolution kernel group to generate a multi-scale feature map; A threshold determination module is used to calculate a spatially adaptive local threshold based on the multi-scale feature map combined with the local area mean and standard deviation; An image enhancement module, configured to perform residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; A defect scoring module is used to generate a defect scoring map based on the enhanced feature map by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect detection module is configured to calculate a defect score of the label image according to the defect score map, and detect defects in the label image by comparing the defect score with a preset threshold.
2. The label defect detection system based on image processing according to claim 1, characterized in that: The image correction module is further used for: By calculating the deviation of local brightness from global brightness statistical parameters; establishing the nonlinear compensation model according to the deviation; According to the nonlinear compensation model, the brightness distribution of each pixel of the label image is dynamically adjusted to obtain a corrected image.
3. The label defect detection system based on image processing according to claim 2, characterized in that: The feature map module is further used to: Obtain the scale and scale attenuation factor of the desired feature map; constructing a scale attenuation term according to the scale and the scale attenuation factor; After extracting features from the offset point pixels of the corrected image using the multi-scale convolution kernel group, processing is performed in combination with the scale attenuation term to obtain the multi-scale feature map.
4. The label defect detection system based on image processing according to claim 3, characterized in that: The threshold determination module is further configured to: Obtaining the local mean and local standard deviation of each pixel of the multi-scale feature map; Determine the maximum of all local standard deviations; The adaptive local threshold is determined according to the local mean, the local standard deviation, and the maximum value of all local standard deviations.
5. The label defect detection system based on image processing according to claim 4, characterized in that: The image enhancement module is further configured to: Calculating the square of the difference between the multi-scale feature map and the adaptive local threshold; Processing the multi-scale feature map by a Laplace operator to obtain a second-order derivative result of the multi-scale feature map; The enhanced feature map is determined according to the square value and a second-order derivative result of the multi-scale feature map.
6. The label defect detection system based on image processing according to claim 5, characterized in that: The defect scoring module is also used to: Acquiring morphological features of the label image; Processing the enhanced features through a Gaussian smoothing kernel to obtain spatially weighted features; The enhanced features, the spatial weighted features and the morphological features are weightedly fused to generate the defect score map.
7. The label defect detection system based on image processing according to claim 6, characterized in that: The defect detection module is further configured to: Obtaining the area of the target region to be detected in the label image; The defect score map is integrated and then divided by the target area to obtain the defect score of the label image.
8. A label defect detection method based on image processing, the method implementing the system according to claim 1, characterized in that: The method comprises: According to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a nonlinear compensation model; According to the corrected image, a multi-scale convolution kernel group is used to perform feature extraction to generate a multi-scale feature map; Calculating a spatially adaptive local threshold based on the multi-scale feature map in combination with the local area mean and standard deviation; Performing residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after nonlinear enhancement; According to the enhanced feature map, a defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features; The defect score of the label image is calculated according to the defect score map, and the defects of the label image are detected by comparing the defect score with a preset threshold.
Citation Information
Patent Citations
High-credibility small target detection method in complex environment
CN117253117A
Image deep learning noise reduction method for low-illumination scenes such as night and tunnel
CN119107248A
Printed circuit board defect detection method and system based on image recognition
CN119804490A
Machine vision detection method and system for printed circuit defects, medium, program and terminal
CN119941669A
Hole protection cap detection method and apparatus, computer device and storage medium
WO2021000524A1