A defect detection method, system, computing device, and storage medium

By combining ring light source and coaxial light source for background purification and target feature enhancement, the problems of poor defect detection image quality and large background interference in the existing technology are solved, and higher detection accuracy and effect are achieved.

CN115546180BActive Publication Date: 2026-02-10GUANGDONG AOPUTE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211316484.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-26
Publication Date
2026-02-10
Estimated Expiration
2042-10-26

AI Technical Summary

Technical Problem

Existing technologies often produce defect detection images with poor image quality and significant background interference, leading to discrepancies between the detection results and the actual situation, resulting in unsatisfactory detection performance.

Method used

The original detection image is captured by illuminating it with a combination of ring light source and coaxial light source. Background purification and target feature enhancement processing are then performed, including binarization, gray value reduction and multiplication processing, to improve image contrast and reduce background interference.

Benefits of technology

It effectively reduces background interference, improves the accuracy of defect detection and image feedback effect, enhances the display of defect features, and improves the accuracy of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115546180B_ABST
    Figure CN115546180B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of AOI image processing, and discloses a defect detection method, a system, a computing device and a storage medium.The method comprises the following steps: taking a measured object to obtain an original detection image; performing background purification processing on the original detection image to obtain an intermediate detection image; and performing target feature strengthening processing on the intermediate detection image to obtain a final detection image.Through the background purification processing and the target feature strengthening processing on the original detection image, the present application is beneficial to reducing background interference, further improving the feedback effect of the detection image on defects, and improving the accuracy of defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of AOI image processing technology, and in particular to a defect detection method, system, computing device, and storage medium. Background Technology

[0002] AOI (Automatic Optical Inspection) is used in industry to detect defects in workpieces and has a wide range of applications in the field of machine vision.

[0003] Because the requirements for visual inspection vary across different application scenarios, for some products, the existing machine vision inspection process does not provide clear feedback on defects in the images obtained when performing defect detection. The image quality is poor, and there is significant background interference, resulting in a large discrepancy between the defect detection results and the actual situation, and the detection effect is not ideal. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a defect detection method, system, computing device, and storage medium, solving the problems of poor defect detection image quality and significant background interference in existing technologies, which lead to large discrepancies between the defect detection results and the actual situation, resulting in unsatisfactory detection effects.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] A defect detection method, comprising:

[0007] The object under test is photographed to obtain the original detection image;

[0008] The original detection image is subjected to background purification processing to obtain an intermediate detection image;

[0009] The intermediate detection image is subjected to target feature enhancement processing to obtain the final detection image.

[0010] Optionally, capturing the object under test to obtain the original detection image includes:

[0011] The object under test is photographed under the illumination of a ring light source to obtain the first raw detection image;

[0012] The object under test is photographed under the illumination of a coaxial light source to obtain a second original detection image.

[0013] Optionally, the step of performing background purification processing on the original detection image to obtain an intermediate detection image includes:

[0014] The first original detection image is binarized;

[0015] The first original detection image after binarization is superimposed with the second original detection image to obtain the intermediate detection image.

[0016] Optionally, the intermediate detection image includes a first grayscale threshold pixel region, a second grayscale threshold pixel region, and an intermediate grayscale pixel region, wherein the grayscale value of the first grayscale threshold pixel region is 0, the grayscale value of the second grayscale threshold pixel region is 255, and the grayscale value of the intermediate grayscale pixel region is greater than 0 and less than 255.

[0017] The step of performing target feature enhancement processing on the intermediate detection image to obtain the final detection image includes:

[0018] The intermediate detection image is subjected to grayscale value subtraction processing so that the grayscale value of each pixel in the intermediate grayscale pixel region tends to or equals zero.

[0019] Optionally, after performing grayscale value reduction processing on the intermediate detection image based on a preset reduction method, the method further includes:

[0020] The intermediate detection image is subjected to grayscale value doubling processing so that the grayscale value of each pixel in the second grayscale threshold pixel region tends to be equal to or equal to 255.

[0021] On the other hand, the present invention also provides a defect detection system, comprising:

[0022] The image acquisition unit is used to capture images of the object under test and obtain raw detection images.

[0023] Image processing unit, used for:

[0024] The original detection image is subjected to background purification processing to obtain an intermediate detection image; and,

[0025] The intermediate detection image is subjected to target feature enhancement processing to obtain the final detection image.

[0026] Optionally, the image acquisition unit includes:

[0027] A ring light source is used to provide the first illumination light when photographing the object under test to obtain the first raw detection image;

[0028] A coaxial light source is used to provide a second illumination light when photographing the object under test, thereby obtaining a second original detection image.

[0029] Optionally, the image processing unit is used for:

[0030] The first original detection image is binarized;

[0031] The binarized first original detection image is superimposed with the second original detection image to obtain the intermediate detection image; the intermediate detection image includes a first gray-scale threshold pixel region, a second gray-scale threshold pixel region, and an intermediate gray-scale pixel region, wherein the gray-scale value of the first gray-scale threshold pixel region is 0, the gray-scale value of the second gray-scale threshold pixel region is 255, and the gray-scale value of the intermediate gray-scale pixel region is greater than 0 and less than 255.

[0032] The intermediate detection image is subjected to grayscale value subtraction processing so that the grayscale value of each pixel in the intermediate grayscale pixel region tends to or equals zero.

[0033] The intermediate detection image is subjected to grayscale value doubling processing so that the grayscale value of each pixel in the second grayscale threshold pixel region tends to be equal to or equal to 255.

[0034] On the other hand, the present invention also provides a computing device, comprising:

[0035] Memory, used to store program instructions;

[0036] A processor is configured to invoke program instructions stored in the memory and execute the defect detection method described in any of the preceding items according to the obtained program.

[0037] On the other hand, the present invention also provides a computer-readable non-volatile storage medium including computer-readable instructions that, when read and executed by a computer, cause the computer to perform the defect detection method as described in any of the preceding claims.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] This invention provides a defect detection method, system, computing device, and storage medium. By performing background purification and target feature enhancement processing on the original detection image, it helps to reduce background interference and further improve the feedback effect of the detection image on defects, thereby effectively improving the accuracy of defect detection. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 This is a flowchart of the defect detection method in an embodiment of the present invention;

[0042] Figure 2This is a flowchart of step S3 of the defect detection method in this embodiment of the invention;

[0043] Figure 3 This is a schematic diagram of the first original detection image in an embodiment of the present invention;

[0044] Figure 4 This is a schematic diagram of the second original detection image in an embodiment of the present invention;

[0045] Figure 5 This is a schematic diagram of the first original detection image after binarization processing in an embodiment of the present invention;

[0046] Figure 6 This is a schematic diagram of the intermediate detection image in an embodiment of the present invention;

[0047] Figure 7 This is a schematic diagram of the final detected image in an embodiment of the present invention;

[0048] Figure 8 This is a structural block diagram of the defect detection system in an embodiment of the present invention.

[0049] In the above figure: 10, image acquisition unit; 20, image processing unit. Detailed Implementation

[0050] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0051] It should be understood that in the description of this invention, specific embodiments are merely used to explain the invention and not to limit it. The exemplary embodiments are described as processes or methods depicted as flowcharts; although the flowcharts describe the operations or steps in a certain order, many of these operations or steps can be performed in parallel, concurrently, or simultaneously, and the order of the operations can be rearranged. When an operation or step is completed, the corresponding process can be terminated, and additional steps not included in the drawings may also be included. The processes described above can correspond to methods, functions, procedures, subroutines, subroutines, etc., and the embodiments and features in the embodiments of this invention can be combined with each other without conflict.

[0052] The term "comprising" and its variations used in this invention are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The technical solutions of this invention will be further described below with reference to the accompanying drawings and specific embodiments; it should be understood that, for ease of description, only the parts related to this invention are shown in the drawings, not the entire structure.

[0053] Defect detection is widely used in the field of machine vision, and the requirements for visual inspection vary across different application scenarios. Due to these varying needs, for some products, defect detection based on existing machine vision inspection processes does not clearly reveal defects in the resulting images, exhibiting the following drawbacks:

[0054] 1. Poor image quality. A single lighting effect can only reflect some abnormalities in the material. For example, for defect detection of gears, it can only reflect obvious deformation of the gear tip, but cannot reflect the chipping defects at the tooth tip.

[0055] 2. The background interference is significant, making it difficult to distinguish between material defects and the background conditions.

[0056] The present invention provides the following technical solution to solve the above-mentioned problems of the prior art. The technical solution of the present invention will be described in detail below with reference to the accompanying drawings, taking the gear as the object to be tested.

[0057] Please refer to the reference. Figure 1 and Figure 2 This invention provides a defect detection method, including:

[0058] S1. Take a picture of the object being tested to obtain the original detection image.

[0059] In this step, when photographing the object under test, it is necessary to illuminate the object using a machine vision light source in order to obtain the desired photographic effect.

[0060] Preferably, in this embodiment, when photographing the object under test, the object is first photographed under the illumination of a ring light source to obtain a first original detection image, such as... Figure 3 As shown; then, the object under test is photographed under the illumination of a coaxial light source to obtain a second original detection image, as shown. Figure 4 As shown.

[0061] Understandably, the order of illumination from the ring light source and the coaxial light source can be adjusted according to the actual situation.

[0062] S2. Perform background purification processing on the original detection image to obtain the intermediate detection image.

[0063] Specifically, step S2 includes:

[0064] The first original detection image is binarized;

[0065] The first original detection image after binarization is superimposed with the second original detection image to obtain the intermediate detection image.

[0066] By illuminating the object under test with both a ring light source and a coaxial light source, images with different display effects can be obtained, and background purification can be achieved after processing.

[0067] Please refer to Figure 5 After binarizing the first original image, each pixel in the image has a gray value of 0 or 255. In this embodiment, the gray value of each pixel at the gear is 0, so that the gear appears black. The gray value of each pixel in the background area (i.e., the area other than the gear) is 255, so that the background appears white.

[0068] When the first original detection image after binarization is superimposed with the second original detection image, as shown... Figure 6 As shown, due to the threshold characteristics of grayscale values, the grayscale values ​​of each pixel in the background of the second original detection image reach the threshold extreme value, presenting a white effect. This can reduce background interference, enhance the defect features of the tested object, and thus achieve the purpose of background purification.

[0069] It is understood that the intermediate detection image includes a first grayscale threshold pixel region, a second grayscale threshold pixel region, and an intermediate grayscale pixel region. The grayscale value of the first grayscale threshold pixel region is 0, corresponding to the gear region; the grayscale value of the second grayscale threshold pixel region is 255, corresponding to the background region; the grayscale value of the intermediate grayscale pixel region is greater than 0 and less than 255, corresponding to the location of defects such as concave or convex shapes inside the gear, or other contour shapes in the gear.

[0070] The intermediate detection image after background purification can show obvious gear tip deformation, but the chipping defects on the gear end face are still difficult to show clearly. Therefore, step S3 needs to be performed to obtain better defect detection results.

[0071] S3. Perform target feature enhancement processing on the intermediate detection image to obtain the final detection image.

[0072] Step S3 includes:

[0073] S31. Perform grayscale value subtraction processing on the intermediate detection image so that the grayscale value of each pixel in the intermediate grayscale pixel region tends to or equals zero.

[0074] S32. Perform grayscale value doubling processing on the intermediate detection image so that the grayscale value of each pixel in the second grayscale threshold pixel region tends to be equal to 255.

[0075] In one implementation, when the grayscale value of the intermediate detection image is subtracted in step S31, the grayscale value is halved; when the grayscale value of the intermediate detection image is multiplied in step S32, the grayscale value is multiplied by 2. That is, the grayscale value subtraction of the intermediate detection image is based on 127.5, and the grayscale value multiplication of the intermediate detection image is 2 times. Such parameter settings are applicable to all cases and can eliminate the iterative processing step, thereby improving the efficiency of target feature enhancement processing of the intermediate detection image. Correspondingly, there may be certain differences in the effect under different conditions.

[0076] In actual operation, when the gray value of the intermediate detection image is halved in step S31, 127.5 is not used as the standard value, but other subtraction operations are set. In the subsequent doubling process, the background may not reach 255, but in fact it does not affect the image processing and detection effect.

[0077] In another implementation, when the grayscale value of the intermediate detection image is reduced in step S31 and the grayscale value of the intermediate detection image is multiplied in step S32, the parameters of reduction and multiplication are adjusted according to the actual situation of the original detection image. The parameters are selected based on the approximate average grayscale value of the intermediate grayscale pixel area to ensure that the pixels in the background are restored to 255, thereby making the target feature enhancement processing more effective.

[0078] It is understandable that in step S31, the value subtracted from the grayscale value is adjusted according to the actual situation. The ultimate goal is to make the grayscale value of each pixel in the middle grayscale pixel area of ​​the intermediate detection image return to zero, thereby purifying the pixels with non-zero grayscale values ​​to pure black. At this time, the grayscale value of the pixels with a grayscale value of 0 is still 0 after the overall grayscale value is subtracted, while the grayscale value of the pixels with a grayscale value of 255 is greater than 0 and less than 255.

[0079] Because the overall grayscale value of the image was subtracted in step S31, the grayscale value of the background area decreased synchronously. In this step, by multiplying the intermediate detection image (e.g., multiplying the grayscale value of each pixel by 2, 3, or other values), due to the threshold extremum characteristic of grayscale values, the grayscale value of pixels with a value greater than 0 and less than 255 returned to 255. The resulting image is as follows: Figure 7 As shown, this achieves the purpose of background restoration, thereby ensuring that the background area and feature area of ​​the object under test have sufficient grayscale difference, which can effectively improve the accuracy of defect detection.

[0080] Please refer to Figure 8 Based on the foregoing embodiments, the present invention also provides a defect detection system, comprising:

[0081] Image acquisition unit 10 is used to capture the object under test and obtain the original detection image;

[0082] Image processing unit 20, used for:

[0083] The original detection image is subjected to background purification processing to obtain an intermediate detection image; and,

[0084] The intermediate detection images are subjected to target feature enhancement processing to obtain the final detection image.

[0085] In this embodiment, the image acquisition unit 10 includes a light source and an imaging device. Specifically, the image acquisition unit 10 may include one or more light sources.

[0086] In this embodiment, the image acquisition unit 10 includes a ring light source, which is used to provide a first illumination light when photographing the object under test, so as to obtain a first original detection image;

[0087] The image acquisition unit 10 also includes a coaxial light source for providing a second illumination light when photographing the object under test, thereby obtaining a second original detection image.

[0088] When photographing the object under test, the object is first photographed under the illumination of a ring light source to obtain the first raw detection image, such as... Figure 3 As shown; then, the object under test is photographed under the illumination of a coaxial light source to obtain a second original detection image, as shown. Figure 4 As shown.

[0089] Understandably, the order of illumination from the ring light source and the coaxial light source can be adjusted according to the actual situation.

[0090] Furthermore, the image processing unit 20 is used for:

[0091] The first original detection image is binarized;

[0092] The binarized first original detection image is superimposed with the second original detection image to obtain an intermediate detection image. The intermediate detection image includes a first gray-scale threshold pixel region, a second gray-scale threshold pixel region, and an intermediate gray-scale pixel region. The gray-scale value of the first gray-scale threshold pixel region is 0, the gray-scale value of the second gray-scale threshold pixel region is 255, and the gray-scale value of the intermediate gray-scale pixel region is greater than 0 and less than 255.

[0093] The grayscale value of the intermediate detection image is reduced to make the grayscale value of each pixel in the intermediate grayscale pixel region approach or equal to zero.

[0094] The intermediate detection image is subjected to grayscale value doubling processing so that the grayscale value of each pixel in the second grayscale threshold pixel region tends to be equal to or equal to 255.

[0095] Please refer to Figure 5 After binarizing the first original image, each pixel in the image has a gray value of 0 or 255. In this embodiment, the gray value of each pixel at the gear is 0, so that the gear appears black. The gray value of each pixel in the area other than the gear (i.e. the background) is 255, so that the background appears white.

[0096] When the first original detection image after binarization is superimposed with the second original detection image, as shown... Figure 6 As shown, due to the threshold characteristics of grayscale values, the grayscale values ​​of each pixel in the background of the second original detection image reach the threshold extreme value, presenting a white effect, thereby achieving the purpose of background purification.

[0097] It is understood that the intermediate detection image includes a first grayscale threshold pixel region, a second grayscale threshold pixel region, and an intermediate grayscale pixel region. The grayscale value of the first grayscale threshold pixel region is 0, corresponding to the gear region; the grayscale value of the second grayscale threshold pixel region is 255, corresponding to the background region; the grayscale value of the intermediate grayscale pixel region is greater than 0 and less than 255, corresponding to the location of defects such as concave or convex shapes inside the gear, or other contour shapes in the gear.

[0098] The intermediate detection image after background purification can show obvious deformation of the gear tip, but the chipping defect on the gear end face is still difficult to show clearly. Therefore, it is necessary to further enhance the target feature of the intermediate detection image to obtain better defect detection effect.

[0099] Understandably, the subtraction value of the grayscale value can be adjusted according to the actual situation. The ultimate goal is to make the grayscale value of each pixel in the middle grayscale pixel area of ​​the intermediate detection image return to zero, thereby purifying the pixels with non-zero grayscale values ​​to pure black. At this time, the grayscale value of the pixel with the original grayscale value of 0 is still 0 after the overall grayscale value is subtracted, while the grayscale value of the pixel with the original grayscale value of 255 is greater than 0 and less than 255.

[0100] Because the overall grayscale value of the image has been reduced, the grayscale value of the background area decreases synchronously. By multiplying the grayscale value of each pixel in the intermediate detection image by 2, 3, or other values, due to the threshold extremum characteristic of grayscale values, the grayscale value of pixels with a value greater than 0 and less than 255 returns to 255. The resulting image is as follows. Figure 7 As shown, this achieves the purpose of background restoration, thereby ensuring that the background area and feature area of ​​the object under test have sufficient grayscale difference, which can effectively improve the accuracy of defect detection.

[0101] Based on the foregoing embodiments, this invention also provides a computing device, including:

[0102] Memory, used to store program instructions;

[0103] The processor is used to call program instructions stored in memory and execute any of the above defect detection methods according to the obtained program.

[0104] Based on the foregoing embodiments, this invention also provides a computer-readable non-volatile storage medium, including computer-readable instructions, which, when read and executed by a computer, cause the computer to perform any of the above-mentioned defect detection methods.

[0105] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A defect detection method, characterized in that, include: The object under test is photographed to obtain the original detection image; The original detection image is subjected to background purification processing to obtain an intermediate detection image; The intermediate detection image is subjected to target feature enhancement processing to obtain the final detection image; The process of photographing the object under test to obtain the original detection image includes: The object under test is photographed under the illumination of a ring light source to obtain the first raw detection image; The object under test is photographed under the illumination of a coaxial light source to obtain a second original detection image; The step of performing background purification processing on the original detection image to obtain an intermediate detection image includes: The first original detection image is binarized; The binarized first original detection image is superimposed with the second original detection image to obtain the intermediate detection image; The intermediate detection image includes a first grayscale threshold pixel region, a second grayscale threshold pixel region, and an intermediate grayscale pixel region. The grayscale value of the first grayscale threshold pixel region is 0, the grayscale value of the second grayscale threshold pixel region is 255, and the grayscale value of the intermediate grayscale pixel region is greater than 0 and less than 255. The step of performing target feature enhancement processing on the intermediate detection image to obtain the final detection image includes: The intermediate detection image is subjected to grayscale value subtraction processing so that the grayscale value of each pixel in the intermediate grayscale pixel region tends to or equals zero. Based on a preset subtraction method, after performing grayscale value subtraction processing on the intermediate detection image, the process further includes: The intermediate detection image is subjected to grayscale value doubling processing so that the grayscale value of each pixel in the second grayscale threshold pixel region tends to be equal to or equal to 255.

2. A defect detection system, characterized in that, include: The image acquisition unit is used to capture images of the object under test and obtain raw detection images. Image processing unit, used for: The original detection image is subjected to background purification processing to obtain an intermediate detection image; as well as, The intermediate detection image is subjected to target feature enhancement processing to obtain the final detection image; The image acquisition unit includes: A ring light source is used to provide the first illumination light when photographing the object under test to obtain the first raw detection image; A coaxial light source is used to provide a second illumination light when photographing the object under test, so as to obtain a second original detection image; The image processing unit is used for: The first original detection image is binarized; The binarized first original detection image is superimposed with the second original detection image to obtain the intermediate detection image; the intermediate detection image includes a first gray-scale threshold pixel region, a second gray-scale threshold pixel region, and an intermediate gray-scale pixel region, wherein the gray-scale value of the first gray-scale threshold pixel region is 0, the gray-scale value of the second gray-scale threshold pixel region is 255, and the gray-scale value of the intermediate gray-scale pixel region is greater than 0 and less than 255. The intermediate detection image is subjected to grayscale value subtraction processing so that the grayscale value of each pixel in the intermediate grayscale pixel region tends to or equals zero. The intermediate detection image is subjected to grayscale value doubling processing so that the grayscale value of each pixel in the second grayscale threshold pixel region tends to be equal to or equal to 255.

3. A computing device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the defect detection method as described in claim 1 according to the obtained program.

4. A computer-readable non-volatile storage medium, characterized in that, It includes computer-readable instructions that, when read and executed by a computer, cause the computer to perform the defect detection method as described in claim 1.

Citation Information

Patent Citations

  • Defect detection method and device, electronic equipment and storage medium

    CN114841946A

  • Detection device for IC bonding deviation detection

    CN214122040U