A non-standard industrial product defect detection method based on image processing

By calculating the crack degree and gradient difference of pixels in grayscale images of non-standard industrial products, adjusting the threshold and using the CA algorithm, the problem of inaccurate detection in the existing technology is solved, and higher detection accuracy and automation are achieved.

CN118608525BActive Publication Date: 2024-10-01XIAN KANGCHUANG ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411081093.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-10-01
Estimated Expiration
2044-08-08

AI Technical Summary

Technical Problem

When the existing technology handles new defects that are significantly different from the training data, the defect detection algorithm cannot accurately identify them, resulting in inaccurate detection results.

Method used

By acquiring grayscale images of non-standard industrial products, calculating the crack degree and gradient difference of pixels, adjusting the initial threshold to form an adaptive threshold, and using the CA algorithm to detect crack defects to improve detection accuracy.

Benefits of technology

It achieves more accurate identification of crack defects in non-standard industrial products, adapts to different image conditions and crack characteristics, reduces manual intervention and misjudgment, and improves detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608525B_ABST
    Figure CN118608525B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image data processing, and the present invention relates to a non-standard industrial product defect detection method based on image processing, the method comprising: obtaining a grayscale image of a non-standard industrial product; setting a corresponding initial threshold for each pixel in the grayscale image, calculating the crack degree of each pixel, the crack degree is proportional to the crack prediction factor and the gradient difference between the pixel and the neighborhood around the pixel; adjusting the initial threshold based on the crack degree to obtain an adaptive threshold; based on the adaptive threshold, using a CA algorithm to perform crack defect detection on non-standard industrial products. The present invention evaluates the crack degree of a pixel by calculating the crack prediction factor and the gradient difference, and adjusts the initial threshold according to the crack degree to form an adaptive threshold, so that the detection algorithm can adapt to different image conditions and crack characteristics, and improve the accuracy of crack detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image data processing and a method for detecting defects of non-standard industrial products based on image processing. Background Art

[0002] Non-standard industrial products are mainly used to meet the needs of large-scale industrial production, especially in the chemical and petrochemical industries. When designing a new industrial device, some equipment is special and cannot be found in the existing serialized list. It needs to be designed and manufactured separately. This type of equipment is called non-standard products. In the manufacturing process of non-standard industrial products, processing techniques (such as cutting, stamping, welding) may leave geometric features on the surface of the product, such as sharp edges or uneven marks. When there are cracks on the surface of the product, the edges of the cracks may be similar to the edges of these geometric features, making crack detection complicated.

[0003] At present, the patent application document with publication number CN111524107A discloses a defect detection method, a defect detection device and a computer-readable storage medium. The method includes: using a target detection algorithm to detect the object image; when the target detection algorithm is used to determine whether the object is qualified, using a visual recognition algorithm to detect the object image, that is, obtaining the grayscale / color difference threshold of the object image and the current grayscale / color difference of the position to be detected of the object image, and comparing the current grayscale / color difference with the grayscale / color difference threshold, and determining whether the object is qualified according to the grayscale / color difference comparison result.

[0004] Although the above operation solves the problem that the target detection algorithm may not be able to effectively identify new defects by combining the target detection algorithm and the visual recognition algorithm, and reduces the risk of missed detection, the algorithm may have limitations when dealing with new defects that are significantly different from the training data, resulting in the algorithm being unable to accurately identify the defects and inaccurate detection results. Summary of the invention

[0005] In order to solve the technical problem that the above algorithm may have limitations, resulting in reduced accuracy of the detection results, the present invention provides solutions in the following aspects.

[0006] A non-standard industrial product defect detection method based on image processing, comprising:

[0007] Get grayscale images of non-standard industrial products;

[0008] A corresponding initial threshold is set for each pixel in the grayscale image, and the crack degree of each pixel is calculated. The crack degree is proportional to the crack prediction factor and the gradient difference between the pixel and the surrounding neighborhood of the pixel. The crack prediction factor is: ; In the formula, For the The crack prediction factor of each pixel, For the The gray value of a pixel, For the Pixels and The average gray value of the neighboring pixels around the pixel point, For the Pixels and The grayscale variance of the neighboring pixels around the pixel point, is the grayscale image corresponding to The number of pixels with the same grayscale value. Indicates normalization processing;

[0009] Adjusting the initial threshold based on the crack degree to obtain an adaptive threshold;

[0010] Based on the adaptive threshold, the CA algorithm is used to detect crack defects in non-standard industrial products.

[0011] The present invention utilizes the CA algorithm to perform crack defect detection. First, a grayscale image of a non-standard industrial product is obtained. The crack prediction factor and gradient difference in the grayscale image are calculated to evaluate the crack degree of the pixel point. The initial threshold is adjusted according to the calculated crack degree to form an adaptive threshold, which can be optimized according to different areas of the image content. This allows the detection algorithm to adapt to different image conditions and crack characteristics, thereby improving the accuracy of crack detection.

[0012] Preferably, the adaptive threshold satisfies the relationship:

[0013] ; In the formula, For the The adaptive threshold of pixels For the The crack degree of each pixel, For the The initial threshold of pixels, It is an exponential function with the natural constant e as its base.

[0014] When the crack degree of a pixel is high, the adaptive threshold of the pixel is lowered so that the crack area is easier to be identified by the detection algorithm. By lowering the threshold of the crack area, the crack features can be made more prominent in image processing, which is convenient for subsequent crack detection and analysis.

[0015] Preferably, the method of performing crack defect detection on non-standard industrial products using a CA algorithm based on an adaptive threshold comprises:

[0016] Setting a defect detection condition; the defect detection condition is that the significance value of the pixel point is less than or equal to the adaptive threshold of the pixel point;

[0017] The grayscale image is traversed to obtain all pixel points that meet the defect detection conditions and mark them as crack pixel points, thereby detecting the crack area.

[0018] By traversing the grayscale image and automatically obtaining the pixels that meet the conditions, the automation of crack detection is achieved and manual intervention is reduced.

[0019] Preferably, after marking the pixel point as a crack, the method further comprises:

[0020] Obtain the connected domain of each crack pixel point, and calculate the number of pixel points in each connected domain;

[0021] A pixel threshold is set. When the number of pixels in a connected domain is greater than the pixel threshold, the connected domain is marked as a crack area.

[0022] By identifying the connected domain of crack pixels, the actual area of ​​the crack can be determined more accurately, avoiding misjudging isolated noise points as cracks.

[0023] Preferably, the crack degree satisfies the relationship:

[0024] ; In the formula, For the The crack degree of each pixel, For the Pixels and The gradient difference of the neighborhood around the pixel point, Indicates normalization processing.

[0025] Preferably, the Pixels and The process of obtaining the gradient difference of the neighborhood around a pixel point includes:

[0026] Use the Sobel operator to calculate the The gradient value of a pixel and its surrounding neighboring pixels;

[0027] Calculate the The sum of the absolute values ​​of the differences between the gradient values ​​of the pixel points and the gradient values ​​of the surrounding neighborhood pixels;

[0028] The product of the sum of the absolute values ​​of the differences and the weighting factor is taken as the gradient difference; the weighting factor is The information entropy of a pixel and its surrounding pixels.

[0029] Using information entropy as a weighting factor increases the consideration of the complexity of grayscale distribution, making the gradient difference more comprehensive.

[0030] Preferably, the Pixels and The process of obtaining the gradient difference of the neighborhood around a pixel point includes:

[0031] Calculate the The variance of the gradient difference between a pixel point and its surrounding neighboring pixels; and the variance is used as the gradient difference.

[0032] Preferably, the crack degree also satisfies the relationship:

[0033] ; In the formula, For the The crack degree of each pixel, For the The gradient difference between a pixel and its surrounding pixels is For the The weight of the pixel, For the The total number of pixels and their surrounding neighborhood pixels, Indicates normalization processing.

[0034] Beneficial effects: By analyzing the features of each pixel in the image and calculating the degree of cracks to adaptively adjust the threshold, crack defects in non-standard industrial products can be identified more accurately, and the image changes in different situations can be better adapted, thereby improving the accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0036] Figure 1 It is a method flow chart of steps S1 to S4 in a non-standard industrial product defect detection method based on image processing in an embodiment of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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 creative work are within the scope of protection of the present invention.

[0038] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0039] Reference Figure 1 A non-standard industrial product defect detection method based on image processing includes steps S1 to S4, which are as follows:

[0040] S1: Obtain a grayscale image of a non-standard industrial product.

[0041] In an embodiment of the present invention, a high-definition camera, a scanner or other image acquisition equipment is used to acquire the surface image of a non-standard industrial product, and the acquired color image is grayed. Thereafter, in order to reduce the noise in the image, the grayscale image may be preprocessed (such as using Gaussian filtering, median filtering, non-local mean filtering, etc.).

[0042] S2: A corresponding initial threshold is set for each pixel in the grayscale image, and the crack degree of each pixel is calculated. The crack degree is proportional to the crack prediction factor and the gradient difference between the pixel and the neighborhood around the pixel.

[0043] In the manufacturing process of non-standard industrial products, specific processing techniques or surface treatment methods are used, such as cutting, stamping, welding, etc. These operations may leave some geometric features on the surface of non-standard industrial products, such as sharp edges, uneven marks, etc. When cracks exist, their edges may be similar to the edges of the geometric features. Therefore, in an embodiment of the present invention, surface cracks of non-standard industrial products are detected by using a CA algorithm.

[0044] Specifically, in the embodiment of the present invention, the grayscale image is traversed to obtain all pixels, and an initial threshold is set for each pixel. Take pixels as an example and set the corresponding initial threshold as . Provide a starting point for each step using the CA algorithm.

[0045] First The pixel point is taken as the center, and the The neighborhood size of each pixel point is 7×7 pixels, for example, 3×3, 5×5 pixels, etc. can be selected in other embodiments. Then, the crack prediction factor is calculated by analyzing the grayscale characteristics of each pixel point and its surrounding neighborhood pixels to evaluate the possibility of cracks in the pixel point in the image. The analysis process is as follows:

[0046] Get the grayscale image The gray value of each pixel is calculated Pixels and The average gray value of all pixels in the area around the pixel;

[0047] Calculate the The absolute difference between the gray value of a pixel and the average gray value of all pixels in its surrounding neighborhood. This difference measures the difference in brightness between the central pixel and the surrounding area.

[0048] Calculate the The grayscale variance of the pixel and its surrounding neighboring pixels is counted, and the grayscale image with the first pixel is counted. The total number of pixels with the same grayscale value.

[0049] The first The crack prediction factor of each pixel satisfies the following relationship:

[0050]

[0051] In the formula, For the The crack prediction factor of each pixel, For the The gray value of a pixel, For the Pixels and The average gray value of the neighboring pixels around the pixel point, For the Pixels and The grayscale variance of the neighboring pixels around the pixel point, is the grayscale image corresponding to The number of pixels with the same grayscale value. Indicates normalization processing.

[0052] in, For the The absolute difference between the gray value of a pixel and the average gray value of all pixels in its surrounding neighborhood. The bigger, The bigger, The smaller the description The more pixels there are, the greater the crack prediction factor will be.

[0053] In obtaining the After the crack prediction factor of each pixel is obtained, the crack prediction factors of all pixels in the grayscale image can be obtained by the same method.

[0054] It should be noted that since the formation of the geometric feature edges of non-standard industrial products is caused by industrial forging, and the formation of cracks is an unexpected factor. Therefore, compared with the texture features of the geometric feature edges of non-standard industrial products and the crack area, the gradient changes in the geometric feature edge area will be smoother and neater, and the gradient values ​​corresponding to the gradient changes will be more consistent. Therefore, it is necessary to continue to perform feature analysis on the pixel point and all the pixels in its surrounding area, so as to calculate the gradient difference between the pixel point and its surrounding neighboring pixels, and then combine the above-obtained crack prediction factors to obtain the crack degree of the pixel point. The analysis process is as follows:

[0055] In the embodiment of the present invention, the Sobel operator is used to calculate the The gradient value of a pixel and its surrounding neighboring pixels;

[0056] Then calculate the The sum of the absolute values ​​of the differences between the gradient value of a pixel and the gradient values ​​of its surrounding neighboring pixels;

[0057] Then the product of the sum of the absolute values ​​of the differences and the weighting factor is taken as the first The gradient difference between a pixel and its surrounding neighboring pixels; the weighting factor is The information entropy of a pixel and its surrounding neighborhood pixels.

[0058] The above Pixels and The gradient difference of the neighborhood around a pixel satisfies the following relationship:

[0059]

[0060] In the formula, For the Pixels and The gradient difference of the neighborhood around the pixel point, For the The gradient value of a pixel, is the number of pixels in the surrounding neighborhood. The gradient value of a pixel, is the total number of pixels in the surrounding neighborhood, For the The information entropy of the pixel point and its surrounding neighboring pixels. When the neighborhood size is 7×7 pixels, the example is 7×7 pixels. .

[0061] In other embodiments, the The variance of the gradient difference between a pixel and its surrounding neighboring pixels is used as the The gradient difference between a pixel and its surrounding pixels.

[0062] Similarly, the gradient differences between all pixels in the grayscale image and their surrounding neighborhood pixels can be obtained.

[0063] The first The crack degree of each pixel satisfies the following relationship:

[0064]

[0065] In the formula, For the The crack degree of each pixel, For the Pixels and The gradient difference of the neighborhood around the pixel point, Indicates normalization processing.

[0066] Similarly, the crack degree of all pixels in the grayscale image can be obtained.

[0067] In another embodiment, the The crack degree of each pixel also satisfies the following relationship:

[0068]

[0069] In the formula, For the The crack degree of each pixel, For the Pixels and The gradient difference of the neighborhood around the pixel point, For the The weight of the pixel, For the The total number of pixels and their surrounding neighborhood pixels, represents normalization processing. Can be set based on experience.

[0070] The larger the The more abnormal the gray value of a pixel is compared with the gray values ​​of its surrounding pixels, The larger the The more drastic the gradient change of each pixel, the The larger it is, the more likely it is that the pixel is a crack pixel.

[0071] S3: adjusting the initial threshold based on the crack degree to obtain an adaptive threshold.

[0072] After the crack degree of all pixels in the grayscale image is obtained in step S2, the corresponding initial threshold is adjusted to obtain the corresponding adaptive threshold, which satisfies the following relationship:

[0073]

[0074] In the formula, For the The adaptive threshold of pixels For the The crack degree of each pixel, For the The initial threshold of pixels, It is an exponential function with the natural constant e as its base.

[0075] Different areas may have different crack manifestations due to different lighting, materials or other factors. By dynamically adjusting the threshold according to the degree of crack at each pixel, the real crack area can be detected more accurately. This helps reduce the situation where non-crack areas are mistakenly identified as cracks, and also reduces the omission of real crack areas.

[0076] S4: Based on the adaptive threshold, the CA algorithm is used to detect crack defects on non-standard industrial products.

[0077] Specifically, the saliency value of the pixel point is first taken as the condition for defect detection, and then all pixels are traversed to obtain all pixels that meet the defect detection conditions and mark them as crack pixels, so as to detect the crack area of ​​non-standard industrial products through the CA algorithm.

[0078] In addition, after obtaining all potential crack pixel points, there may be some potential crack pixel points that appear in the form of scattered points, that is, in the form of single pixel points. The reason for this phenomenon may be that the noise in the image is not filtered thoroughly at the beginning, resulting in a significant performance similar to the crack area. Therefore, after obtaining all crack pixel points, the connected domain of each crack pixel point can also be obtained, and the number of pixels in each connected domain is calculated, and a pixel threshold is set (in the embodiment of the present invention, the pixel threshold is set to 10). When the number of pixels in the connected domain is greater than the pixel threshold, the connected domain is marked as a crack area, and then those tiny areas that may not be real cracks are filtered out, thereby reducing the false detection rate.

[0079] The present invention utilizes the CA algorithm to perform crack defect detection. First, a grayscale image of a non-standard industrial product is obtained. The crack prediction factor and gradient difference in the grayscale image are calculated to evaluate the crack degree of the pixel point. The initial threshold is adjusted according to the calculated crack degree to form an adaptive threshold, which can be optimized according to different areas of the image content. This allows the detection algorithm to adapt to different image conditions and crack characteristics, thereby improving the accuracy of crack detection.

[0080] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly defined.

[0081] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A method for detecting defects in non-standard industrial products based on image processing, characterized in that: include: Get grayscale images of non-standard industrial products; A corresponding initial threshold is set for each pixel in the grayscale image, and the crack degree of each pixel is calculated. The crack degree is proportional to the crack prediction factor and the gradient difference between the pixel and the surrounding neighborhood of the pixel. The crack prediction factor is: ; In the formula, For the The crack prediction factor of each pixel, For the The gray value of a pixel, For the Pixels and The average gray value of the neighboring pixels around the pixel point, For the Pixels and The grayscale variance of the neighboring pixels around the pixel point, is the grayscale image corresponding to The number of pixels with the same grayscale value. Indicates normalization processing; the crack degree satisfies the relationship: ; In the formula, For the The crack degree of each pixel, For the Pixels and The gradient difference of the neighborhood around the pixel point, Indicates normalization processing; The initial threshold is adjusted based on the crack degree to obtain an adaptive threshold; the adaptive threshold satisfies the relationship: ; In the formula, For the The adaptive threshold of pixels For the The crack degree of each pixel, For the The initial threshold of pixels, is an exponential function with the natural constant e as base; Based on the adaptive threshold, the CA algorithm is used to detect crack defects in non-standard industrial products.

2. The non-standard industrial product defect detection method based on image processing according to claim 1 is characterized in that: The method of using the CA algorithm to detect crack defects on non-standard industrial products based on the adaptive threshold includes: Setting a defect detection condition; the defect detection condition is that the significance value of the pixel point is less than or equal to the adaptive threshold of the pixel point; The grayscale image is traversed to obtain all pixel points that meet the defect detection conditions and mark them as crack pixel points, thereby detecting the crack area.

3. The non-standard industrial product defect detection method based on image processing according to claim 2 is characterized in that: After marking the pixel point as a crack, the method further includes: Obtain the connected domain of each crack pixel point, and calculate the number of pixel points in each connected domain; A pixel threshold is set. When the number of pixels in a connected domain is greater than the pixel threshold, the connected domain is marked as a crack area.

4. The non-standard industrial product defect detection method based on image processing according to claim 3 is characterized in that: The said Pixels and The process of obtaining the gradient difference of the neighborhood around a pixel point includes: Use the Sobel operator to calculate the The gradient value of a pixel and its surrounding neighboring pixels; Calculate the The sum of the absolute values ​​of the differences between the gradient values ​​of the pixel points and the gradient values ​​of the surrounding neighborhood pixels; The product of the sum of the absolute values ​​of the differences and the weighting factor is taken as the gradient difference; the weighting factor is The information entropy of a pixel and its surrounding neighborhood pixels.

5. The non-standard industrial product defect detection method based on image processing according to claim 4 is characterized in that: The said Pixels and The process of obtaining the gradient difference of the neighborhood around a pixel point includes: Calculate the The variance of the gradient difference between a pixel point and its surrounding neighboring pixels; and the variance is used as the gradient difference.