Search

CN-121982021-A - Board card defect detection method and system based on image processing

CN121982021ACN 121982021 ACN121982021 ACN 121982021ACN-121982021-A

Abstract

The invention provides a board card defect detection method and system based on image processing, the method comprises the steps of collecting an original image of a board card to be detected, sequentially carrying out image pretreatment and image detail splitting on the original image to obtain a background image and a detail image, carrying out first enhancement treatment on the background image to obtain an enhanced background image, carrying out second enhancement treatment on the detail image to obtain an enhanced detail image, fusing the enhanced background image and the enhanced detail image to obtain a target enhanced image, carrying out iterative enhancement on a depth image based on the original image to obtain an enhanced depth image, fusing the enhanced depth image and the target enhanced image to obtain a final fused image, and inputting the final fused image into a defect detection model to carry out defect detection to output a board card defect detection result.

Inventors

  • HUANG WEI
  • TIAN FENG
  • MAO HONGYANG

Assignees

  • 江西萤火虫微电子科技有限公司
  • 南昌森木科技有限公司

Dates

Publication Date
20260505
Application Date
20260402

Claims (10)

  1. 1. The board card defect detection method based on image processing is characterized by comprising the following steps of: collecting an original image of a board card to be detected, and sequentially carrying out image preprocessing and image detail splitting on the original image to obtain a background image and a detail image; Performing first enhancement processing on the background image to obtain an enhanced background image, and performing second enhancement processing on the detail image to obtain an enhanced detail image; fusing the enhanced background image and the enhanced detail image to obtain a target enhanced image; acquiring a depth image of a board card to be detected, and carrying out iterative enhancement on the depth image based on the original image to obtain an enhanced depth image; And fusing the enhanced depth image with the target enhanced image to obtain a final fused image, acquiring a pre-trained defect detection model, and inputting the final fused image into the defect detection model for defect detection so as to output a board card defect detection result.
  2. 2. The method for detecting the board card defect based on the image processing according to claim 1, wherein the step of sequentially performing the image preprocessing and the image detail splitting on the original image to obtain the background image and the detail image specifically comprises the following steps: sequentially performing image cutting, image rotation and Gaussian filtering on the original image to obtain a preprocessed image; determining filtering weights : ; In the formula, To be pixel points Neighborhood as center The pixel points in the inner-layer pixel array, The first spatial domain standard deviation and the value domain standard deviation are respectively, Respectively, the pixel points are represented by the pixel points, Gray values of (2); Filtering the preprocessed image based on the filtering weights to obtain a filtered image : ; Determining split target images And filtering an image Is a linear equation of origin: ; In the formula, Respectively a first linear coefficient and a second linear coefficient, Expressed in pixels A window that is centered; Constructing a solving formula based on the original linear equation: ; In the formula, For the window reconstruction error(s), Is a regularization parameter; And carrying out minimization treatment on window reconstruction errors in the solving formula to obtain the solution: , ; In the formula, For the number of pixels in the window, In window for filtering image The average value of the inner part of the frame, In window for filtering image The variance of the inner-range is calculated, In window for original image An inner mean value; To be solved to Substituting the background image into the original linear equation to obtain a split target image, carrying out average processing on the split target images linearly output by all windows to obtain a background image, and subtracting the background image from the original image to obtain a detail image.
  3. 3. The method for detecting board card defects based on image processing according to claim 1, wherein the step of performing first enhancement processing on the background image to obtain an enhanced background image comprises: determining a cumulative distribution function of the background image Based on the normalized cumulative distribution function Determining a first threshold value And a second threshold value : , ; Setting a first segmentation parameter Second segmentation parameter Third segmentation parameter Based on the first segmentation parameters Second segmentation parameter Third segmentation parameter Determining a first coefficient Second coefficient : , ; Constructing a piecewise mapping function based on the first coefficient and the second coefficient : ; Determining the mean value of the background image Adjusting parameters Based on the mean value Adjusting parameters Determining segmentation threshold ; Storing the pixel points with the pixel gray level not greater than the segmentation threshold value in the background image into a first subset, and storing the pixel points with the pixel gray level greater than the segmentation threshold value in the background image into a second subset; Determining a cumulative distribution function of the first subset Cumulative distribution function of second subset ; Based on the cumulative distribution function Cumulative distribution function Determining a final mapping function : ; In the formula, Is a gray level number; The final mapping function is applied to the background image to obtain an enhanced background image.
  4. 4. The method for detecting board card defects based on image processing according to claim 1, wherein the step of performing second enhancement processing on the detail image to obtain an enhanced detail image comprises: extracting a histogram of non-zero pixel values in the detail image and determining a non-zero pixel median value based on the histogram ; Setting threshold parameters Based on the threshold parameter Median to the non-zero pixel Determining an inhibition threshold ; Setting zero pixel values smaller than the suppression threshold in the detail image and reserving pixel values not smaller than the suppression threshold to obtain a suppression image; And performing gamma transformation on the pixel points in the suppressed image to obtain an enhanced detail image.
  5. 5. The method for detecting board card defects based on image processing according to claim 1, wherein the step of fusing the enhanced background image and the enhanced detail image to obtain a target enhanced image comprises: Using linear weights Enhancing the background image And the enhanced detail image Performing linear fusion to obtain target enhanced image : 。
  6. 6. The method for detecting board card defects based on image processing according to claim 1, wherein the step of iteratively enhancing the depth image based on the original image to obtain an enhanced depth image comprises: calculating color weights based on the original image : ; In the formula, The second spatial domain standard deviation and the color domain standard deviation are respectively, As the center pixel Is used for the display of the display panel, Respectively the original image is in any channel of RGB Upper pixel Pixel values of (2); Computing depth weights based on the depth images : ; In the formula, The third spatial domain standard deviation and the depth domain standard deviation are respectively, In order to be a depth field, Respectively any channel of depth image in depth domain Upper pixel Pixel values of (2); Based on color weights Depth weight Constructing an optimization function: ; In the formula, For enhanced depth images to be solved In the pixel A depth value at which the depth value is to be determined, In-pixel for depth image Where the effective measurement is upsampled to the high resolution coordinates by interpolation, Is the first The number of regularization parameters is set to, For the number of regulars, As a function of the potential of the material, A transformation matrix corresponding to the convolution kernel; Solving the optimization target in the optimization function through gradient descent iteration to obtain an iterated enhanced depth image : ; In the formula, For the iteration step size, Is the first The convolution kernel after the multiple iterations corresponds to the transformation matrix, In order to transpose the symbol, Is the first Activating the function after the iteration; and repeatedly executing the iterative process until the iteration stopping condition is met, and outputting the enhanced depth image after the last iteration.
  7. 7. An image processing-based board defect detection system, the system comprising: The processing module is used for collecting an original image of the board card to be detected, and sequentially carrying out image preprocessing and image detail splitting on the original image to obtain a background image and a detail image; The enhancement module is used for carrying out first enhancement processing on the background image to obtain an enhanced background image, and carrying out second enhancement processing on the detail image to obtain an enhanced detail image; The fusion module is used for fusing the enhanced background image and the enhanced detail image to obtain a target enhanced image; The iteration module is used for acquiring a depth image of the board card to be detected, and carrying out iteration enhancement on the depth image based on the original image so as to obtain an enhanced depth image; The output module is used for fusing the enhanced depth image with the target enhanced image to obtain a final fused image, acquiring a pre-trained defect detection model, and inputting the final fused image into the defect detection model for defect detection so as to output a board card defect detection result.
  8. 8. The board card defect detection system based on image processing of claim 7, wherein the fusion module is specifically configured to: Using linear weights Enhancing the background image And the enhanced detail image Performing linear fusion to obtain target enhanced image : 。
  9. 9. A computer comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the image processing-based board defect detection method according to any one of claims 1 to 6 when the computer program is executed.
  10. 10. A storage medium having stored thereon a computer program which, when executed by a processor, implements the image processing-based board defect detection method according to any one of claims 1 to 6.

Description

Board card defect detection method and system based on image processing Technical Field The invention belongs to the technical field of automobile auxiliary driving, and particularly relates to a board card defect detection method and system based on image processing. Background Printed circuit boards, also known as board cards, are the core components of electronic products, the quality of which directly determines the performance and reliability of the final product. As electronic devices are being developed toward high density and miniaturization, the wiring of PCBs is becoming more complex and the variety of defects is increasing. Common defects include hole-lack=, mouse bite, open circuit, short circuit, flying wire, scrap copper, etc. Even minor imperfections may lead to reduced circuit performance, signal interference, increased power consumption, and even equipment failure and safety hazards. Therefore, the efficient and accurate defect detection of the PCB is a key link for ensuring the whole quality of the electronic product. Traditional PCB defect detection mainly relies on manual visual inspection or simple image processing algorithms. The manual visual inspection has the problems of low efficiency, strong subjectivity, easy fatigue, poor consistency and the like, and is difficult to meet the requirements of the detection speed and the quality stability of a large-scale automatic production line. The detection method based on the traditional image processing generally adopts template matching, a subtraction method, morphological operation and the like, and the methods are sensitive to illumination conditions, angles and noise of image acquisition, have weak generalization capability, are difficult to process complex background and diversified defects, and have higher false detection rate and omission rate. In recent years, with the rapid development of deep learning technology, a convolutional neural network-based target detection model is widely applied to the field of PCB defect detection. The models can automatically learn the layering characteristics of defects through end-to-end training, and compared with the traditional method, the model has obviously improved recognition accuracy and generalization capability. However, existing deep learning schemes still suffer from the following deficiencies in practical industrial applications: The image detection precision for small objects with dense textures is limited, wherein the PCB image contains a large number of tiny components and fine wires, the size of defects (such as holes and mouse biting notches) is extremely small, and the characteristics are not obvious. The general target detection network is easy to lose the space information of the small target in the down sampling process, so that detection omission is caused; The sensor is sensitive to image noise, and false detection is easy to generate, wherein factors such as illumination change of an industrial field, sensor noise, reflection of a plate and the like can introduce the image noise, the noise and the real defect are difficult to effectively distinguish by a single deep learning model, and the false detection rate is increased; the prior method generally directly detects the original image, does not separate the background information and the detail information of the image, so that the low-frequency change (such as uneven illumination) of the background area interferes with defect identification, and the high-frequency edge information of the detail area cannot be fully strengthened; The method only uses two-dimensional image information, lacks the capability of detecting three-dimensional defects, and is difficult to accurately judge partial defects (such as component tilting and abnormal welding spot height) only by using the two-dimensional image, so that the method needs to be combined with three-dimensional depth information for comprehensive detection. However, the existing scheme does not integrate a depth sensor, or simply superimposes depth data, and cannot effectively utilize a color image to guide depth map reconstruction so as to improve the depth information quality; The method has the advantages of simple processing links and limited enhancement effect, and part of the method only adopts histogram equalization or simple filtering to enhance the image, so that over enhancement and brightness drift are easy to cause, noise suppression is insufficient, and the subsequent detection precision is affected. Disclosure of Invention In order to solve the technical problems, the invention provides a board card defect detection method and system based on image processing, which are used for solving the technical problems in the prior art. In a first aspect, the present invention provides the following technical solutions, and a board card defect detection method based on image processing, including: collecting an original image of a board card to be detected, and sequentiall