Processing method, device, equipment and medium for periodic texture image

By using gradient automatic multi-scale peak search algorithm and proximity alignment algorithm, the target texture period and detection threshold are automatically learned, which solves the problem of poor robustness of traditional print quality detection methods and improves detection accuracy and robustness.

CN118822984BActive Publication Date: 2025-03-04SINO MV TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410894447.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2025-03-04
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

Traditional printed quality inspection methods rely on manually set detection thresholds and texture periods, which are poorly robust, resulting in low detection accuracy and are susceptible to factors such as environment, lighting and production processes.

Method used

Gradient automatic multi-scale peak search algorithm (GAMPD) is used to find the texture period of the image, and abnormal pixel points are detected through proximity comparison algorithm and automatically adjusted detection threshold. The target texture period, target detection threshold and target gold template images are automatically learned through multiple parameter detection operations.

Benefits of technology

It improves the accuracy and robustness of detection parameters, reduces the probability of detection errors, simplifies the process of obtaining detection parameters, and reduces manual intervention and time consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118822984B_ABST
    Figure CN118822984B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device, equipment and medium for processing periodic texture images, including: collecting a first image of a product under test, taking it as a current image and performing the following parameter detection operations: using GAMPD to find the texture period of the current image; detecting whether there are abnormal pixels in the current image one by one according to each texture period according to a neighbor comparison algorithm and a current detection threshold; determining the texture period without abnormal pixels as a candidate texture period; collecting a second image of the product under test after the position is moved, taking the spliced ​​image of the product and the current image as a new current image, and performing the parameter detection operation again; stopping until it is detected that there are no abnormal pixels in the current image, determining the target texture period, target detection threshold and target golden template image through the above steps; using the target texture period, target detection threshold and target golden template image to perform image defect detection. The present disclosure can improve the accuracy of image defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to a method, device, equipment and medium for processing a periodic texture image. Background Art

[0002] Various defects may occur during the production process of printed products, such as ink spots, foreign matter, incomplete text, missing prints, etc. Once these defects appear on the product packaging, the visual appearance of the product will be greatly reduced, seriously affecting the product brand and reducing customer satisfaction. In traditional detection methods, printed products can be imaged through industrial cameras, and the computer's image detection and processing system can be used to perform real-time analysis and processing based on detection parameters such as texture cycle, detection threshold and template image to achieve printed product quality detection and monitoring. The above detection parameters are generally manually set empirical values, and printed product detection will be affected by multiple factors such as environment, lighting, production process and noise. These factors will make the detection parameters less robust, which will lead to a high probability of error in printed product quality detection and low detection accuracy. Summary of the invention

[0003] In order to solve the above technical problems, the present disclosure provides a method, device, equipment and medium for processing a periodic texture image.

[0004] According to one aspect of the present disclosure, a method for processing a periodic texture image is provided, comprising:

[0005] Capture a first image of the product under test, use the first image as the current image and perform the following parameter detection operations:

[0006] Using a gradient automatic multi-scale peak finding algorithm GAMPD to find at least one texture period of the current image;

[0007] According to each of the texture cycles, one by one, detecting whether there are abnormal pixels in the current image according to a neighbor comparison algorithm and a current detection threshold; wherein the current detection threshold is a threshold adjusted at least once based on a preset initial detection threshold and a difference;

[0008] The texture period corresponding to the absence of the abnormal pixel point is determined as a candidate texture period, and the parameter detection operation is completed once;

[0009] Acquire a second image of the product under test after the position is moved, use a spliced ​​image of the second image and the current image as a new current image, and perform the parameter detection operation again;

[0010] The parameter detection operation is performed multiple times until it is detected that there are no abnormal pixels in the current image, and then the final target texture period, target detection threshold and target golden template image are determined based on the candidate texture period, the current detection threshold and the current image obtained when the parameter detection operation is stopped;

[0011] Image defect detection is performed using the target texture period, the target detection threshold, and the target golden template image.

[0012] According to another aspect of the present disclosure, a device for processing a periodic texture image is provided, comprising:

[0013] The image acquisition module is used to acquire a first image of the product under test, use the first image as the current image and perform the following parameter detection operations:

[0014] A period search module, used for searching at least one texture period of the current image by using a gradient automatic multi-scale peak search algorithm GAMPD;

[0015] A periodic review module, used to detect whether there are abnormal pixels in the current image one by one according to each texture period, based on a neighbor comparison algorithm and a current detection threshold; wherein the current detection threshold is a threshold adjusted at least once based on a preset initial detection threshold and a difference;

[0016] A period determination module, used for determining the texture period corresponding to the absence of the abnormal pixel point as a candidate texture period, and completing the parameter detection operation once;

[0017] An operation repetition execution module, used for acquiring a second image of the product under test after the position is moved, taking a spliced ​​image of the second image and the current image as a new current image, and performing the parameter detection operation again;

[0018] a parameter determination module, configured to perform the parameter detection operation multiple times until the current image is detected to have no abnormal pixels, and to determine a final target texture period, a target detection threshold, and a target golden template image based on the candidate texture period, the current detection threshold, and the current image obtained when the parameter detection operation is stopped;

[0019] An image defect detection module is used to perform image defect detection using the target texture period, the target detection threshold and the target golden template image.

[0020] The present disclosure also provides an electronic device, the electronic device comprising:

[0021] processor;

[0022] a memory for storing instructions executable by the processor;

[0023] The processor is used to read the executable instructions from the memory and execute the instructions to implement the above method.

[0024] The present disclosure also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the above method.

[0025] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0026] In the process of performing parameter detection operations multiple times, the technical solution can use the GAMPD algorithm to accurately calculate the texture period of the current image and continuously adjust the current detection threshold during detection; on this basis, by splicing a new current image and repeatedly performing the parameter detection operation, the texture period and the detection threshold can be continuously learned for the current image until there are no abnormal pixels in the current image, and the current image can be considered to be a defect-free image. Therefore, the current image is used as the target golden template image; compared with the existing method of learning a large number of images, the above-mentioned method of continuously learning and automatically obtaining the target golden template image through parameter detection operations is more convenient and efficient.

[0027] At the same time, the target texture period and target detection threshold determined when the parameter detection operation is stopped are the result of continuous learning and adjustment, and are both detection parameters with the best accuracy, which improves the accuracy of the detection parameters. Compared with the method of manually setting the detection period, the above-mentioned method of automatically learning the target texture period through parameter detection operation not only improves the accuracy of the period, but also does not require manual intervention, thus reducing time consumption. Similarly, for the target detection threshold, the existing method requires manual setting and adjustment of the threshold, which is cumbersome and consumes a lot of time. However, this solution can simplify the process of obtaining the target detection threshold and improve the efficiency and accuracy of determining the target detection threshold by automatically adjusting the detection threshold during the detection process.

[0028] Therefore, the learning and adjustment process of the above detection parameters is fully automatic, which improves the accuracy of the parameters, does not require user intervention, and reduces time consumption. Then, using the above target texture period, target detection threshold and target golden template image for image defect detection can reduce the probability of defect detection errors and improve detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0031] Figure 1 This is a flow chart of a method for processing a periodic texture image according to an embodiment of the present disclosure;

[0032] Figure 2 A schematic diagram of a current image according to an embodiment of the present disclosure;

[0033] Figure 3 This is a schematic diagram of a process of detecting a current image according to an embodiment of the present disclosure;

[0034] Figure 4 A schematic diagram of another current image according to an embodiment of the present disclosure;

[0035] Figure 5 A schematic diagram of generating a target golden template image according to an embodiment of the present disclosure;

[0036] Figure 6 This is a flow chart of the image defect detection method described in the embodiment of the present disclosure;

[0037] Figure 7 This is a structural block diagram of a device for processing periodic texture images according to an embodiment of the present disclosure;

[0038] Figure 8 It is a schematic diagram of the structure of the electronic device described in the embodiment of the present disclosure. DETAILED DESCRIPTION

[0039] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0040] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0041] Considering that the current traditional detection method relies on manually set detection threshold parameters with poor robustness, it is very easy to cause false detection if the product has color fluctuations;

[0042] Traditional detection methods rely on manual measurement to detect cycles with low accuracy. When multi-cycle aliasing occurs, manual measurement is very difficult, and incorrect cycle setting will result in false detection.

[0043] The traditional golden template comparison method requires learning a large number of images, resulting in a high probability of error in print quality detection and low detection accuracy.

[0044] Based on this, the embodiments of the present disclosure provide a method, device, equipment and medium for processing periodic texture images. The technology can automatically calculate the optimal detection parameters by performing parameter detection operations multiple times: target texture period, target detection threshold and target golden template image, and use the above detection parameters to perform image defect detection to improve detection accuracy.

[0045] For ease of understanding, two methods of printed product image defect detection, namely, neighboring texture grayscale comparison (abbreviated as neighboring comparison) and golden template comparison, are first described here.

[0046] Proximity comparison method: In the real-time detection process, the detection image and the reference image are obtained according to certain periodic rules, and the reference image is subtracted from the detection image to generate a difference image; this method requires setting the texture detection cycle and detection threshold.

[0047] Golden template comparison method: train and learn a set of defect-free golden template images, and use the image to be detected to subtract the golden template image to generate a difference map; this method requires learning a large number of images and has high requirements for image consistency. In the above image defect detection methods, there are the following disadvantages: the accurate texture detection cycle and detection threshold need to be set manually; the detection threshold needs to be set and adjusted manually, which is cumbersome and time-consuming; the process of obtaining the golden template image is cumbersome and requires a large number of images.

[0048] In this case, if Figure 1 As shown, the present disclosure provides a method for processing periodic texture images, which can be applied to the detection of surface defects of industrial products such as printed materials and fabrics. The method can be executed by a periodic texture image processing device configured in a terminal, and the device can be implemented by software and / or hardware. Figure 1 , the processing method of periodic texture image may include the following steps:

[0049] S102: Acquire a first image of the product under test, use the first image as a current image and perform the following parameter detection operations.

[0050] In this embodiment, the product to be tested is, for example, a printed product. The printed product itself may have a periodic texture structure on its surface, or a plurality of identical printed products may be neatly arranged to form a periodic texture structure. The camera captures an image of the printed product to obtain a first image. It is understood that the first image includes the texture structure on the surface of the product to be tested, but due to the camera viewing angle or the size and quantity of the product to be tested, the texture structure in the first image may be able to show complete periodicity, or may not be able to show complete and correct periodicity. For example Figure 2 In the first image shown, the five-pointed star pattern is periodic, while the six-pointed star pattern is not periodic. In this case, the first image is used as the current image and the parameter detection operation shown in the following steps S104-S108 is performed.

[0051] S104, using GAMPD (Gradient Automatic multiscale-based peak detection) to find at least one texture period of the current image.

[0052] Among them, using GAMPD to find at least one texture period of the current image may include the following embodiments.

[0053] Extract the gray value of the current image as the input signal of GAMPD; the input signal can be expressed as x = [x1, x2, ..., x N-1 ,x N ], x represents the gray value of the current image, and the input signal contains one or more texture cycles.

[0054] The input signal is guided filtered to filter out noise interference in the input signal, that is, to filter out noise interference in the current image while retaining edge details of the texture structure in the current image. Compared with the conventional AMPD algorithm, this embodiment adds a process of guided filtering of the input signal. Therefore, the GAMPD algorithm used in this embodiment is an improved AMPD algorithm. Using GAMPD to search for at least one texture period of the current image can improve the image signal quality, thereby improving the accuracy of the texture period.

[0055] Next, GAMPD is used to find at least one texture period of the input signal after filtering out noise interference.

[0056] In the specific implementation, a window function w is used k Group the input signal x, W k =2k|k=1,2,...,L, where L=N / 2. Reorganize the grouped data, and the reorganized matrix is ​​recorded as m k,i , refer to the following:

[0057]

[0058] Among them, i=1,…,k+1,…N-K+2,…N.

[0059] Calculate the local maximum scaling map of the input signal and represent it with an L×N matrix M:

[0060]

[0061] Sum the rows of matrix M:

[0062]

[0063] Find the vector γ k The scale factor of the global minimum is: λ = argMin(γ k ), remove the part of the M matrix that is larger than the scale factor 1, and get the new matrix Mr:

[0064] M r =(m k,i ),i∈{1,2,…,N}k∈{1,2,…,λ}

[0065]

[0066] Let σ i =0, solve the equation to obtain its eigenvector: p = [p1, p2, ..., p m ], m is the number of peaks, p i is the i-th texture cycle.

[0067] Through the above GAMPD algorithm, at least one texture cycle of the current image can be found.

[0068] S106. Detect whether there are abnormal pixels in the current image one by one according to each texture period, based on a neighbor comparison algorithm and a current detection threshold; wherein the current detection threshold is a threshold adjusted at least once based on a preset initial detection threshold and a difference.

[0069] Reference Figure 3 The implementation process of this step can be referred to as follows.

[0070] (1) Each texture period is taken as the current texture period one by one.

[0071] (2) According to the current texture period T i , detect whether there are abnormal pixels in the current image based on the neighbor comparison algorithm and the current detection threshold.

[0072] The neighbor comparison algorithm in this embodiment can be understood as: according to the current texture period T iGet the current image and the reference image, the reference image can be the current texture period T i The standard image under the condition of ; the current image is subtracted from the reference image and the current detection threshold in turn, and the subtraction result is binarized to generate a first difference image. The first difference image is a blob image. In the first difference image, abnormal pixels are displayed in white, and other pixels without abnormalities are displayed in black. White abnormal pixels are called blob points.

[0073] This embodiment detects whether there are abnormal pixels in the current image based on the neighbor comparison algorithm and the current detection threshold, that is, determines whether there are abnormal pixels in the first difference image. The following step (3) or (4) is performed according to the determination result.

[0074] (3) If it does not exist, determine the current texture period T i is a candidate texture period. If the current image is in the current texture period T i No abnormal pixels are detected, indicating that the texture structure between the current image and the reference image is the same, and the current texture period T i is a complete cycle with repeatability, such as Figure 2 The texture period presented between the five-pointed stars in the figure. In this case, the current texture period T i The texture is saved as a candidate cycle. At this point, the detection process for whether there are abnormal pixels in the current image can be terminated.

[0075] (4) If it exists, the next texture period T i+1 As the new current texture cycle, the current image is detected again based on the neighbor comparison algorithm and the current detection threshold to see if there are abnormal pixels. If the current image detects abnormal pixels in the current texture cycle, it means that the texture structure between the current image and the reference image is different, and the current texture cycle is wrong. In this case, the next texture cycle T is started. i+1 Continue to detect. For the new current texture period T i+1 The method of detecting whether there are abnormal pixels in the current image according to the neighbor comparison algorithm and the current detection threshold is the same as the above embodiment and will not be repeated here.

[0076] Through the above embodiment, after traversing all texture cycles, the abnormal pixel points existing in the current image are marked as reference abnormal points. If there are still abnormal pixel points after all texture cycles are traversed, they are marked as reference abnormal points, so as to avoid the influence of the reference abnormal points on defect detection in actual image defect detection.

[0077] Regarding the detection threshold in the above embodiment, when detecting for the first time, the current detection threshold is a preset initial detection threshold, such as 10. In the actual detection process, the initial detection threshold is not necessarily appropriate, resulting in too many or too few abnormal pixels being detected, which are not within the preset reasonable number range. Therefore, this embodiment can adjust the current detection threshold once or multiple times according to the preset difference until the detected abnormal pixels are within the preset number range. Based on this, in the process of detecting whether there are abnormal pixels in the current image according to the neighbor comparison algorithm and the current detection threshold, the method provided by this embodiment can also include:

[0078] Get the current detection threshold; wherein, when the current image is detected for the first time, the current detection threshold is a preset initial detection threshold.

[0079] According to the texture period, detect whether there are abnormal pixels in the current image based on the neighbor comparison algorithm and the current detection threshold; if there are abnormal pixels in the current image, determine whether the number of abnormal pixels is within a preset number range.

[0080] If it is not within the quantity range, the current detection threshold is adjusted according to the preset difference to obtain a new current detection threshold. Exemplarily, the preset difference is added to the current detection threshold to obtain a new current detection threshold. In addition, the maximum and minimum values ​​of the detection threshold can also be set to ensure that the continuously adjusted detection threshold is within a reasonable range defined by the above maximum and minimum values.

[0081] The above operation is repeated until the number of abnormal pixels is within the number range, and the latest adjusted current detection threshold is used as the current detection threshold corresponding to the next texture cycle.

[0082] By continuously adjusting the current detection threshold, the final detection threshold after adjustment can be made the optimal value suitable for the current image detection scene.

[0083] S108. Determine the texture period corresponding to the case where there is no abnormal pixel point as a candidate texture period, and complete a parameter detection operation.

[0084] According to the above embodiment, after the current image is detected, the texture period corresponding to the absence of abnormal pixels is determined as a candidate texture period, and a parameter detection operation is completed. Through this parameter detection operation, the optimal candidate texture period and the optimal current detection threshold corresponding to the current image can be obtained. Then, referring to the following step S110, a new current image can be continuously acquired, and the parameter detection operation can be repeatedly performed to further optimize and adjust the candidate texture period and the current detection threshold that have been obtained.

[0085] S110, capturing a second image of the product under test after the position is moved, taking a spliced ​​image of the second image and the current image as a new current image, and performing the parameter detection operations shown in the above steps S104-S108 again.

[0086] In this embodiment, the product under test is moved according to a certain step length, a second image of the product under test after the position is moved is collected, a spliced ​​image of the second image and the current image is used as a new current image, and the parameter detection operation shown in the above steps S104-S108 is performed again.

[0087] exist Figure 2 In the figure, the hexagonal star pattern does not show periodicity, but by moving the tested product and splicing the images multiple times (e.g., n times), Figure 4 As shown, it is found that in the new current image after splicing, the hexagonal star is also periodic, or in other words, the combination pattern formed by three five-pointed stars and one hexagonal star is also periodic. Therefore, this embodiment can obtain a new candidate texture period by repeatedly performing the parameter detection operation.

[0088] Of course, in the process of repeatedly executing the parameter detection operation, the current detection threshold is also continuously adjusted.

[0089] S112, performing the parameter detection operation multiple times until it is detected that there are no abnormal pixels in the current image, and then determining the final target texture period, target detection threshold and target golden template image based on the candidate texture period, current detection threshold and current image obtained when the parameter detection operation is stopped.

[0090] According to the above embodiment, the parameter detection operation is performed multiple times until it is detected that there are no abnormal pixels in the current image. In this case, the current image is generally an image after multiple splicing, and no abnormal pixels can be detected, indicating that the current image can present a repeated and periodic texture structure. At the same time, the current detection threshold is also the optimal threshold that is continuously adjusted as the detection process proceeds. Therefore, the candidate texture period obtained when the parameter detection operation is stopped is determined as the final target texture period, and the current detection threshold obtained when the parameter detection operation is stopped is determined as the final target detection threshold.

[0091] And, refer to Figure 5 , the process of determining the target golden template image may include: periodically processing the current image obtained when the parameter detection operation is stopped according to the target texture period, dividing the current image into multiple sub-images with the same texture structure; and fusing the multiple sub-images into the target golden template image.

[0092] like Figure 4For example, the current image has multiple repeated texture structures consisting of three five-pointed stars and one six-pointed star, and the target texture period is the period formed by the above texture structure. The current image is periodically processed according to the target texture period, and the current image is divided into multiple sub-images: sub-image 1, sub-image 2, ... sub-image n, each sub-image includes a texture structure. Combined Figure 5 When performing image fusion, these sub-images with the same texture structure are superimposed together, and the average pixel value between the sub-images is calculated to form a fused image. The texture structure in the fused image is the average result of the texture structure in each sub-image. The averaged texture structure can more accurately present the periodic texture of the image, so that the fused image is used as the target golden template image used in actual detection.

[0093] At this point, through the above steps S102-S112, the learning process of the target texture period, target detection threshold and target golden template image is completed. The target texture period, target detection threshold and target golden template image in this embodiment are obtained by repeatedly performing parameter detection operations without manual intervention, which can better fit and adapt to the real detection scenes such as the environment, lighting, production process, etc. of the tested product, increase the robustness of the above detection parameters, and then apply them to actual detection to effectively improve the detection accuracy.

[0094] S114, performing image defect detection using the target texture period, the target detection threshold, and the target golden template image.

[0095] Reference Figure 6 , this embodiment provides a method for image defect detection using a target texture period, a target detection threshold, and a target golden template image, including the following steps S202-S210:

[0096] Step S202, obtaining an image to be detected of the product to be detected. In this embodiment, the image to be detected can be pre-processed by filtering or the like to improve the quality of the image to be detected.

[0097] Step S204, dividing the image to be detected into a plurality of periodic units with the same texture structure according to the target texture period. The implementation process of this step can refer to the above embodiment of dividing the current image into sub-images, and the specific description is omitted.

[0098] Step S206, detecting whether there are abnormal pixels in each periodic unit according to a neighbor comparison algorithm and a target detection threshold, and obtaining a first detection result.

[0099] Step S208, detect whether there are abnormal pixels in each periodic unit according to the target golden template image and the target detection threshold, and obtain the second detection result. This step uses the target golden template to detect abnormal pixels, which is the golden template comparison algorithm; specifically, the current periodic unit is subtracted from the target golden template image and the target detection threshold in turn, and the subtraction result is binarized to generate a second difference map. The second difference map is a blob map. In the second difference map, abnormal pixels are displayed in white, and other non-abnormal pixels are displayed in black. White abnormal pixels are called blob points. Detect whether there are abnormal pixels in the second difference map to obtain the second detection result.

[0100] According to the above embodiments, the target golden template image in this embodiment is determined based on the current image without abnormal pixels by performing parameter detection operations multiple times until it is detected that there are no abnormal pixels in the current image. Based on this, compared with the traditional method of learning a large number of images, the method of obtaining the target golden template image is more convenient and efficient; and after continuously splicing new current images and performing parameter detection operations, the target golden template image obtained is more accurate. Similarly, the target detection threshold is also the result of continuous adjustment during the detection process, and has higher accuracy. On this basis, the second detection result obtained using the target golden template image and the target detection threshold will be more accurate.

[0101] Step S210: determining whether there is a defect in the image to be detected according to the first detection result and the second detection result.

[0102] In a specific implementation manner, the abnormal area in the image to be detected may be determined based on abnormal pixels that exist simultaneously in the first detection result and the second detection result.

[0103] In order to avoid false detection, this embodiment combines the neighbor comparison algorithm and the golden template comparison algorithm, and sets the condition that the abnormal pixels exist simultaneously in the first detection result and the second detection result corresponding to the above two algorithms, so as to improve the stability and accuracy of the detection. The area formed by the abnormal pixels that exist simultaneously in the first detection result and the second detection result is determined as the abnormal area in the image to be detected.

[0104] The prior art generally only uses one of the neighbor comparison algorithm or the golden template comparison algorithm, which will lead to inaccurate detection of abnormal pixels, and more or less situations will occur. However, considering that the abnormal pixels detected by only using the neighbor comparison algorithm or only using the golden template comparison algorithm are very likely to be noise and errors; therefore, this embodiment combines the neighbor comparison algorithm and the golden template comparison algorithm together. If the abnormal pixel points existing in the first detection result obtained by using the neighbor comparison algorithm also exist in the second detection result obtained by using the golden template comparison algorithm, the abnormal pixel points are detected in both different algorithms, indicating that their accuracy rate is extremely high. Therefore, the abnormal pixel points existing in both the first detection result and the second detection result are determined as accurate abnormal pixel points, and then the abnormal area in the image to be detected is determined based on these accurate abnormal pixel points. This embodiment combines the neighbor comparison algorithm and the golden template comparison algorithm, which can effectively improve the accuracy and stability of determining abnormal pixels and abnormal areas.

[0105] Extract the features of the abnormal points in the abnormal area; the features of the abnormal points include: shape features and grayscale features. Specifically, the shape features and grayscale features of the abnormal area can be extracted through the feature extraction model. The shape features include but are not limited to: the circumscribed rectangle, duty cycle, major semi-axis and minor semi-axis of the abnormal area; the grayscale features include but are not limited to: the maximum grayscale value, the minimum grayscale value of the abnormal area, and the difference and variance between the abnormal area and the normal texture area in the image to be detected.

[0106] Determine whether there are defects in the image to be detected based on the abnormal point features. Specifically, the above abnormal point features can be compared with the preset abnormal rules, for example, whether the duty cycle in the shape feature meets the preset duty cycle range, and whether the maximum grayscale value in the grayscale feature meets the preset grayscale value range. If the abnormal feature can be compared with the abnormal rule, it can be determined that there are real defects in the image to be detected.

[0107] In summary, the processing method of the periodic texture image provided by the embodiment of the present disclosure includes: first, collecting the first image of the product under test, taking the first image as the current image and performing the following parameter detection operation: using GAMPD to find at least one texture period of the current image; one by one, according to each texture period, detecting whether there are abnormal pixels in the current image according to the neighbor comparison algorithm and the current detection threshold; wherein the current detection threshold is a threshold adjusted at least once based on the preset initial detection threshold and the difference; determining the texture period corresponding to the absence of abnormal pixels as the candidate texture period, and completing a parameter detection operation. Then, collecting the second image of the product under test after the position is moved, taking the spliced ​​image of the second image and the current image as the new current image, and performing the parameter detection operation again. Perform the parameter detection operation multiple times until it is stopped when it is detected that there are no abnormal pixels in the current image, and determine the final target texture period, target detection threshold and target golden template image based on the candidate texture period, current detection threshold and current image obtained when the parameter detection operation is stopped. Finally, use the target texture period, target detection threshold and target golden template image to perform image defect detection.

[0108] In the process of performing parameter detection operations multiple times, the technical solution can use the GAMPD algorithm to accurately calculate the texture period of the current image and continuously adjust the current detection threshold during detection; on this basis, by splicing a new current image and repeatedly performing the parameter detection operation, the texture period and the detection threshold can be continuously learned for the current image until there are no abnormal pixels in the current image, and the current image can be considered to be a defect-free target golden template image. Therefore, the current image is used as the target golden template image; compared with the existing method of learning a large number of images, the above-mentioned method of continuously learning and automatically obtaining the target golden template image through parameter detection operations is more convenient and efficient.

[0109] At the same time, the target texture period and target detection threshold determined when the parameter detection operation is stopped are the result of continuous learning and adjustment, and are both detection parameters with the best accuracy, which improves the accuracy of the detection parameters. Compared with the method of manually setting the detection period, the above-mentioned method of automatically learning the target texture period through parameter detection operation not only improves the accuracy of the period, but also does not require manual intervention, thus reducing time consumption. Similarly, for the target detection threshold, the existing method requires manual setting and adjustment of the threshold, which is cumbersome and consumes a lot of time. However, this solution can simplify the process of obtaining the target detection threshold and improve the efficiency and accuracy of determining the target detection threshold by automatically adjusting the detection threshold during the detection process.

[0110] Therefore, the learning and adjustment process of the above detection parameters is fully automatically performed, which improves the accuracy of the parameters, does not require user intervention, and reduces time consumption.

[0111] Then, using the above-mentioned target texture period, target detection threshold and target golden template image to perform image defect detection can reduce the probability of defect detection errors and improve detection accuracy.

[0112] In addition, in the process of performing parameter detection operations and in the process of using the above adjusted detection parameters for image defect detection, the proximity matching algorithm and the golden template matching algorithm are used simultaneously, which can greatly improve the detection accuracy and stability.

[0113] Figure 7 The present disclosure provides a block diagram of a periodic texture image processing device, which is used to implement the above-mentioned periodic texture image processing method. Figure 7 , the processing device of the periodic texture image may include the following modules:

[0114] The image acquisition module 310 is used to acquire a first image of the product under test, use the first image as the current image and perform the following parameter detection operations:

[0115] A period search module 320, configured to use a gradient automatic multi-scale peak search algorithm GAMPD to search for at least one texture period of the current image;

[0116] The periodic review module 330 is used to detect whether there are abnormal pixels in the current image according to each texture period one by one according to a neighbor comparison algorithm and a current detection threshold; wherein the current detection threshold is a threshold adjusted at least once based on a preset initial detection threshold and a difference value;

[0117] A period determination module 340 is used to determine the texture period corresponding to the absence of the abnormal pixel point as a candidate texture period, and complete the parameter detection operation once;

[0118] An operation repetition execution module 350 is used to collect a second image of the product under test after the position is moved, use a spliced ​​image of the second image and the current image as a new current image, and perform the parameter detection operation again;

[0119] A parameter determination module 360 ​​is used to perform the parameter detection operation multiple times until it is detected that there are no abnormal pixels in the current image, and to determine a final target texture period, a target detection threshold, and a target golden template image based on the candidate texture period, the current detection threshold, and the current image obtained when the parameter detection operation is stopped;

[0120] The image defect detection module 370 is used to perform image defect detection using the target texture period, the target detection threshold and the target golden template image.

[0121] In one embodiment, the period search module 320 is further configured to:

[0122] Extracting the grayscale value of the current image as an input signal of GAMPD;

[0123] Performing guided filtering on the input signal to filter out noise interference in the input signal;

[0124] The GAMPD is used to find at least one texture cycle of the input signal after the noise interference is filtered out.

[0125] In one embodiment, the periodic review module 330 is further used to:

[0126] Taking each of the texture cycles as the current texture cycle;

[0127] According to the current texture period, detecting whether there are abnormal pixels in the current image according to a neighbor comparison algorithm and a current detection threshold;

[0128] If not, determining the current texture cycle as a candidate texture cycle;

[0129] If so, the next texture period is used as a new current texture period, and the current image is detected again based on the neighbor comparison algorithm and the current detection threshold to see if there are abnormal pixels.

[0130] In one embodiment, in the process of detecting whether there are abnormal pixels in the current image according to the neighbor comparison algorithm and the current detection threshold, the device further includes a threshold adjustment module, which is used to:

[0131] Obtaining a current detection threshold; wherein, when the current image is detected for the first time, the current detection threshold is a preset initial detection threshold;

[0132] According to the texture period, detecting whether there are abnormal pixels in the current image according to a neighbor comparison algorithm and the current detection threshold;

[0133] In the case where there are abnormal pixels in the current image, determining whether the number of the abnormal pixels is within a preset number range;

[0134] If it is not within the quantity range, adjusting the current detection threshold according to a preset difference to obtain a new current detection threshold;

[0135] The above operation is repeatedly performed until the number of abnormal pixels is within the number range, and the latest adjusted current detection threshold is used as the current detection threshold corresponding to the next texture period.

[0136] In one embodiment, the parameter determination module 360 ​​further includes a golden template generation unit, which is used to:

[0137] Performing periodic processing on the current image obtained when the parameter detection operation is stopped according to the target texture period, dividing the current image into a plurality of sub-images with the same texture structure;

[0138] The multiple sub-images are fused into a target golden template image.

[0139] In one embodiment, the image defect detection module 370 is further configured to:

[0140] Acquire the image to be inspected of the product under inspection;

[0141] Dividing the image to be detected into a plurality of periodic units with the same texture structure according to the target texture period;

[0142] Detecting whether there are abnormal pixels in each of the periodic units according to the proximity comparison algorithm and the target detection threshold, and obtaining a first detection result;

[0143] Detecting whether there are abnormal pixels in each of the periodic units according to the target golden template image and the target detection threshold, and obtaining a second detection result;

[0144] Determine whether there is a defect in the image to be detected according to the first detection result and the second detection result.

[0145] In one embodiment, the image defect detection module 370 is further configured to:

[0146] Determine an abnormal area in the image to be detected according to abnormal pixels that exist simultaneously in the first detection result and the second detection result;

[0147] Extracting abnormal point features of the abnormal area; wherein the abnormal point features include: shape features and grayscale features;

[0148] Determine whether there is a defect in the image to be detected according to the abnormal point feature.

[0149] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0150] Figure 8 The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Figure 8 As shown, the electronic device 400 includes one or more processors 401 and a memory 402 .

[0151] The processor 401 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0152] The memory 402 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may run the program instructions to implement the method for processing periodic texture images of the embodiments of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0153] In one example, the electronic device 400 may further include: an input device 403 and an output device 404, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0154] In addition, the input device 403 may also include, for example, a keyboard, a mouse, and the like.

[0155] The output device 404 can output various information to the outside, including the determined distance information, direction information, etc. The output device 404 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0156] Of course, to simplify, Figure 8 Only some of the components related to the present disclosure in the electronic device 400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 400 may also include any other appropriate components.

[0157] Furthermore, this embodiment also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the above-mentioned method for processing periodic texture images.

[0158] The computer program product of a method, device, electronic device and medium for processing periodic texture images provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0159] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0160] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for processing a periodic texture image, characterized in that: include: Capture a first image of the product under test, use the first image as the current image and perform the following parameter detection operations: Using a gradient automatic multi-scale peak finding algorithm GAMPD to find at least one texture period of the current image; According to each of the texture cycles, detect whether there are abnormal pixels in the current image according to a neighbor comparison algorithm and a current detection threshold; wherein the current detection threshold is a threshold adjusted at least once based on a preset initial detection threshold and a preset difference; the adjustment comprises: within the range of a maximum value and a minimum value of the preset detection threshold, adding the preset difference to the current detection threshold to obtain a new current detection threshold; when the current image is detected for the first time, the current detection threshold is the preset initial detection threshold; The texture period corresponding to the absence of the abnormal pixel point is determined as a candidate texture period, and the parameter detection operation is completed once; Acquire a second image of the product under test after the position is moved, use a spliced ​​image of the second image and the current image as a new current image, and perform the parameter detection operation again; The parameter detection operation is performed multiple times until it is detected that there are no abnormal pixels in the current image, and then the final target texture period, target detection threshold and target golden template image are determined based on the candidate texture period, the current detection threshold and the current image obtained when the parameter detection operation is stopped; Image defect detection is performed using the target texture period, the target detection threshold, and the target golden template image.

2. The method according to claim 1, characterized in that The using GAMPD to search for at least one texture period of the current image includes: Extracting the grayscale value of the current image as an input signal of GAMPD; Performing guided filtering on the input signal to filter out noise interference in the input signal; The GAMPD is used to find at least one texture cycle of the input signal after the noise interference is filtered out.

3. The method according to claim 1, characterized in that The detecting whether there are abnormal pixels in the current image one by one according to each of the texture periods according to a neighbor comparison algorithm and a current detection threshold comprises: Taking each of the texture cycles as the current texture cycle; According to the current texture period, detecting whether there are abnormal pixels in the current image according to a neighbor comparison algorithm and a current detection threshold; If not, determining the current texture cycle as a candidate texture cycle; If so, the next texture period is used as a new current texture period, and the current image is detected again based on the neighbor comparison algorithm and the current detection threshold to see if there are abnormal pixels.

4. The method according to claim 1 or 3, characterized in that: In the process of detecting whether there are abnormal pixels in the current image according to the neighbor comparison algorithm and the current detection threshold, the method further includes: Obtaining a current detection threshold; wherein, when the current image is detected for the first time, the current detection threshold is a preset initial detection threshold; According to the texture period, detecting whether there are abnormal pixels in the current image according to a neighbor comparison algorithm and the current detection threshold; In the case where there are abnormal pixels in the current image, determining whether the number of the abnormal pixels is within a preset number range; If it is not within the quantity range, adjusting the current detection threshold according to a preset difference to obtain a new current detection threshold; The above operation is repeatedly performed until the number of abnormal pixels is within the number range, and the latest adjusted current detection threshold is used as the current detection threshold corresponding to the next texture period.

5. The method according to claim 1, characterized in that The process of determining the target golden template image includes: Performing periodic processing on the current image obtained when the parameter detection operation is stopped according to the target texture period, dividing the current image into a plurality of sub-images with the same texture structure; The multiple sub-images are fused into a target golden template image.

6. The method according to claim 1, characterized in that The method of performing image defect detection using the target texture period, the target detection threshold, and the target golden template image includes: Acquire the image to be inspected of the product under inspection; Dividing the image to be detected into a plurality of periodic units with the same texture structure according to the target texture period; Detecting whether there are abnormal pixels in each of the periodic units according to the proximity comparison algorithm and the target detection threshold, and obtaining a first detection result; Detecting whether there are abnormal pixels in each of the periodic units according to the target golden template image and the target detection threshold, and obtaining a second detection result; Determine whether there is a defect in the image to be detected according to the first detection result and the second detection result.

7. The method according to claim 6, characterized in that The determining whether there is a defect in the image to be detected according to the first detection result and the second detection result includes: Determine an abnormal area in the image to be detected according to abnormal pixels that exist simultaneously in the first detection result and the second detection result; Extracting abnormal point features of the abnormal area; wherein the abnormal point features include: shape features and grayscale features; Determine whether there is a defect in the image to be detected according to the abnormal point feature.

8. A device for processing periodic texture images, characterized in that: include: The image acquisition module is used to acquire a first image of the product under test, use the first image as the current image and perform the following parameter detection operations: A period search module, used for searching at least one texture period of the current image by using a gradient automatic multi-scale peak search algorithm GAMPD; A periodic review module, for detecting whether there are abnormal pixels in the current image one by one according to each texture period, according to a neighbor comparison algorithm and a current detection threshold; wherein the current detection threshold is a threshold adjusted at least once based on a preset initial detection threshold and a preset difference; the adjustment comprises: within the range of a maximum value and a minimum value of the preset detection threshold, adding the preset difference to the current detection threshold to obtain a new current detection threshold; when the current image is detected for the first time, the current detection threshold is the preset initial detection threshold; A period determination module, used for determining the texture period corresponding to the absence of the abnormal pixel point as a candidate texture period, and completing the parameter detection operation once; An operation repetition execution module, used for acquiring a second image of the product under test after the position is moved, taking a spliced ​​image of the second image and the current image as a new current image, and performing the parameter detection operation again; a parameter determination module, configured to perform the parameter detection operation multiple times until the current image is detected to have no abnormal pixels, and to determine a final target texture period, a target detection threshold, and a target golden template image based on the candidate texture period, the current detection threshold, and the current image obtained when the parameter detection operation is stopped; An image defect detection module is used to perform image defect detection using the target texture period, the target detection threshold and the target golden template image.

9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Defect detection method and device, equipment and storage medium

    CN114298985A

  • Product defect detection method, device and equipment and readable storage medium

    CN114937037A