Search

CN-121998942-A - Defect detection method, electronic device, storage medium, and program product

CN121998942ACN 121998942 ACN121998942 ACN 121998942ACN-121998942-A

Abstract

The application provides a defect detection method, electronic equipment, a storage medium and a program product, wherein the defect detection method realizes the directional suppression of background noise and the reinforcement of weak characteristic defects by carrying out frequency domain enhancement processing on a target detection area image on the surface of a target object, so that the defects are separated from the background noise in a frequency domain, further carries out differential operation processing on the defect characteristic enhancement image and the target detection area image, improves the gray contrast of the defects and the background through gray difference value amplification and offset adjustment, and improves the accuracy of defect detection in a scene with lower gray contrast of the surface defects and the background of the target object by adopting a combination mode of the frequency domain enhancement processing and the differential operation processing.

Inventors

  • YUAN XIAOJUN
  • YANG AN
  • LI SHUXIU

Assignees

  • 深圳市卓见智能制造有限公司

Dates

Publication Date
20260508
Application Date
20260126

Claims (10)

  1. 1. A defect detection method, comprising: Acquiring a target detection area image of the surface of a target object; Performing frequency domain enhancement processing on the target detection area image to generate a defect characteristic enhancement image; Performing differential operation processing on the defect characteristic enhanced image and the target detection area image to generate a differential image; and detecting the defects of the surface of the target object according to the differential image.
  2. 2. The defect detection method of claim 1, wherein the performing frequency domain enhancement processing on the target detection area image to generate a defect feature enhanced image comprises: Performing fast Fourier transform on the target detection area image to obtain a frequency domain image corresponding to the target detection area image; Carrying out convolution processing on the frequency domain image and a preset frequency domain Gaussian filter to obtain a convolved frequency domain image, wherein the smoothing coefficients of the preset frequency domain Gaussian filter in the main direction and the vertical direction are determined according to the gray distribution characteristics of the original image on the surface of the target object; And performing inverse fast Fourier transform on the convolved frequency domain image to obtain the defect characteristic enhanced image.
  3. 3. The defect detection method according to claim 1, wherein the performing differential operation processing on the defect-characteristic enhanced image and the target detection area image to generate a differential image includes: Selecting a second pixel point corresponding to the first pixel point space pixel coordinates from the target detection area image aiming at each first pixel point in the defect characteristic enhanced image, and calculating the gray value of a third pixel point in the difference image under the corresponding space pixel coordinates based on a preset difference operation formula, the gray value of the first pixel point and the gray value of the corresponding second pixel point, wherein a difference operation parameter in the preset difference operation formula is determined according to the gray distribution characteristics of the original image on the surface of the target object; And generating the differential image according to the gray values of all the third pixel points.
  4. 4. A defect detection method according to any one of claims 1 to 3, wherein the detecting a defect of the target object surface from the differential image comprises: generating a defect judgment image according to the differential image; determining whether a defect line exists in the defect judging image; Responding to the defect judging image, wherein the defect judging image has a defect line, the line length of at least one defect line is larger than or equal to a preset length threshold value, determining that the surface of the target object has a defect which does not meet the preset requirement, and determining that the target object is unqualified; Responding to the defect judgment image, wherein the defect lines exist in the defect judgment image, the line length of each defect line is smaller than the preset length threshold value, determining that the surface of the target object does not have defects which do not meet the preset requirement, and determining that the target object is qualified; and responding to the defect judging image without a defect line, determining that the surface of the target object does not have a defect which does not meet the preset requirement, and determining that the target object is qualified.
  5. 5. The defect detection method of claim 4, wherein generating a defect determination image from the differential image comprises: carrying out Gaussian smoothing on the differential image based on preset Gaussian smoothing parameters to obtain a denoising image; Calculating a line response value of each pixel point in the denoising image; and generating the defect judging image according to the line response values of all the pixel points in the denoising image.
  6. 6. The defect detection method of claim 5, wherein generating the defect determination image from line response values of all pixel points in the denoised image comprises: generating a defect response image according to line response values of all pixel points in the denoising image; performing double-threshold screening processing on the defect response image, and determining a pixel type of each pixel in the defect response image, wherein the pixel type comprises a target defect pixel, a candidate defect pixel and a non-defect pixel; Generating a defect line according to the target defect pixel point and the candidate defect pixel point; and generating the defect judging image according to the defect lines and the non-defect pixel points.
  7. 7. A defect detection method according to any one of claims 1 to 3, wherein the acquiring a target detection area image of the target object surface comprises: acquiring an original image of the surface of the target object; And performing image clipping processing on the original image to obtain the target detection area image.
  8. 8. An electronic device comprising a processor and a memory communicatively coupled to the processor; The memory stores computer-executable instructions; The processor executes computer-executable instructions stored in the memory to implement the defect detection method of any one of claims 1 to 7.
  9. 9. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the defect detection method of any of claims 1 to 7.
  10. 10. A computer program product comprising a computer program which, when executed by a processor, implements the defect detection method according to any one of claims 1 to 7.

Description

Defect detection method, electronic device, storage medium, and program product Technical Field The present application relates to the field of machine vision and industrial inspection, and in particular, to a defect inspection method, an electronic device, a storage medium, and a program product. Background The metal stamping part is widely applied to the industrial fields of automobile parts, electronic elements, hardware fittings and the like. In the stamping process, the surface of the product can generate concave-convex pattern defects such as strip-shaped concave stripes, convex stripes and the like due to the factors such as die abrasion, uneven stamping pressure distribution, material ductility difference and the like, and the appearance and the service performance of the product are directly affected. Thus, defect detection is a key element in industrial quality control. At present, in some application scenes, the gray value of the surface image of a metal stamping part is usually concentrated under the influence of material characteristics and light source system configuration, so that the surface defect and background step of the metal stamping part are not obvious, the contrast is extremely low, and great challenges are brought to defect detection. In the related art, a common visual algorithm is generally adopted to detect the surface defects of the metal stamping part. Specifically, spatial domain filtering (such as mean value filtering and median value filtering) is firstly adopted, the average value or the median value of the pixels in the field is directly calculated in the pixel space of the original image on the surface of the metal stamping part so as to weaken image noise, then a simple edge detection operator (such as Canny operator and Sobel operator) is adopted, the gradient variation of the gray level of the pixels of the image is calculated, and the edge position of the gray level mutation caused by the defect in the image is captured and positioned, so that the detection of the surface defect of the metal stamping part is realized. However, in the above method for detecting the surface defect of the metal stamping part by adopting the common visual algorithm, in the scene that the gray contrast between the surface defect of the metal stamping part and the background is low, the problem of low detection accuracy exists. Disclosure of Invention The embodiment of the application provides a defect detection method, electronic equipment, a storage medium and a program product, which are used for solving the problem that in the related art, a common visual algorithm is adopted to detect the surface defect of a metal stamping part, and in a scene with lower gray contrast between the surface defect of the metal stamping part and the background, the detection accuracy is lower. In a first aspect, the application provides a defect detection method, which comprises the steps of obtaining a target detection area image of a target object surface, carrying out frequency domain enhancement processing on the target detection area image to generate a defect feature enhancement image, carrying out differential operation processing on the defect feature enhancement image and the target detection area image to generate a differential image, and detecting defects of the target object surface according to the differential image. In one possible implementation manner, performing frequency domain enhancement processing on a target detection area image to generate a defect feature enhancement image, wherein the method comprises the steps of performing fast Fourier transform on the target detection area image to obtain a frequency domain image corresponding to the target detection area image, performing convolution processing on the frequency domain image and a preset frequency domain Gaussian filter to obtain a convolved frequency domain image, determining smoothing coefficients of the preset frequency domain Gaussian filter in a main direction and a vertical direction according to gray distribution characteristics of an original image on the surface of a target object, and performing inverse fast Fourier transform on the convolved frequency domain image to obtain the defect feature enhancement image. In one possible implementation manner, differential operation processing is performed on the defect feature enhanced image and the target detection area image to generate a differential image, wherein the differential operation processing comprises the steps of selecting a second pixel point corresponding to the first pixel point space pixel coordinate in the target detection area image for each first pixel point in the defect feature enhanced image, calculating the gray value of a third pixel point in the differential image under the corresponding space pixel coordinate based on a preset differential operation formula, the gray value of the first pixel point and the gray value of the corresponding second pi