Vacuum Printed Circuit Board Defect Detection System Based on Machine Vision
By using machine vision technology in the printed circuit board detection system, the color difference of each pixel point is calculated and the optimal window is obtained, the problem of inaccurate extraction of the hole area is solved, and accurate detection of the hole area and foreign object recognition is achieved.
Patent Information
- Application Number
- CN202510199242.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2045-02-24
AI Technical Summary
In the prior art, when detecting the hole area of the printed circuit board, it is difficult to effectively remove the coating noise, resulting in inaccurate extraction of the hole area.
Using a vacuum printed circuit board defect detection system based on machine vision, the color difference of each pixel point is calculated through the acquisition module, the window module obtains the best window for each pixel point, and the filtering module filters the image according to the best window to achieve accurate extraction of the hole area.
Through clustering and maximizing selection of eigenvalues, the rationality and efficiency of window calculations are optimized, the ability to capture detailed features in the area is enhanced, and the hole area can be accurately extracted and foreign objects in it can be detected.
Smart Images

Figure CN119693359B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing. More specifically, the present invention relates to a vacuum printed circuit board defect detection system based on machine vision. Background Art
[0002] The circuit board is an essential hardware in circuit design. Since the printed circuit board (PCB) has good product consistency and is easy to standardize the design, it is conducive to realizing mechanization and automation in the production process. Before the plug hole process, it is necessary to detect the holes to judge whether there are foreign objects, reduce problems in subsequent processing, and avoid potential quality risks. When performing edge detection on the PCB surface image to extract the hole area for detecting foreign objects, due to more film coating noise around the holes in the image, the Gaussian filtering in the traditional Canny edge detection algorithm cannot effectively remove the noise to accurately extract the hole area.
[0003] Currently, the patent application document with the publication number CN113554695A discloses a method for intelligent identification and positioning of part hole positions. This method collects the original picture; preprocesses the collected picture to improve the overall identification and positioning accuracy of the part: first, denoises the collected part picture, uses a filtering algorithm combining multiple filters, selects the most suitable noise reduction filter by comparison, first binarizes the overall picture after filtering and then performs histogram equalization, and performs morphological operations on the overall picture after histogram equalization processing: the morphological operations include image dilation and image erosion, performs Canny edge detection on the picture: extracts features of the hole positions on the part picture: determines the position coordinates of the center of the hole to be processed by performing Hough circle transformation on the hole positions on the part picture in the image coordinate system, then judges whether the hole position contour is circular by an improved contour search method, performs circular fitting on the confirmed circular hole positions, and outputs the circle coordinates, radius, and area through an output function.
[0004] In the above method, it is difficult to effectively remove the noise when there is more noise around the holes, and the accuracy of obtaining the circular area by the fitting method is not high, and there may be a large fitting deviation in some cases. Generally speaking, the above method cannot accurately extract the hole area. Summary of the Invention
[0005] To solve the problem that the hole area cannot be accurately extracted to detect foreign objects in the prior art, the present invention provides the following solutions.
[0006] The present invention provides a defect detection system for vacuum printed circuit boards based on machine vision, including: an acquisition module for acquiring the surface image of the PCB board to be plugged with holes and calculating the color difference of each pixel point; a window module connected to the acquisition module for obtaining the best window for each pixel point; a filtering module connected to the window module for filtering the image according to the best window of each pixel point and performing defect detection on the filtered image; wherein, the size of the best window for each pixel point is: , is the rounding function, is the index number of the neighboring pixel points of pixel point i, is the total number of neighboring pixel points of pixel point i, is the weight of the v-th neighboring pixel point of pixel point i, is the size of the first window of the v-th neighboring pixel point of pixel point i, is the size of the first window of pixel point i; the first window is: the window corresponding to the maximum window feature value selected from a plurality of preset initial windows is used as the first window corresponding to the corresponding pixel point; the process of obtaining the window feature value is: taking any initial window as the target window, clustering the color difference values of the pixel points in the target window to obtain a plurality of clustering clusters, and calculating the window feature value , , where is the total number of clustering clusters of the target window, is the hole feature value, and the hole feature value characterizes the possibility that pixel point t belongs to the hole area in the -th clustering cluster under the target window.
[0007] In the present invention, the calculation of the best window size for each pixel point is based on multiple dimensions. By clustering, the feature distribution in the initial window is obtained, and based on this, the window feature value is calculated. The initial window corresponding to the maximum window feature value is selected as the first window corresponding to the corresponding pixel point. The best window size is calculated according to the difference between the neighboring pixel points of the pixel point and the pixel point, the size of the first window of the pixel point, and the size of the first window of each neighboring pixel point. The local characteristics and neighborhood relevance of the pixel points are fully considered. Through clustering and the maximization selection of feature values, the rationality and efficiency of window calculation are optimized. This method enhances the ability to capture detailed features in the region and can accurately extract the hole area for detection.
[0008] Preferably, the weight of the v-th neighboring pixel point of pixel point i is specifically: , where is the weight of the v-th neighboring pixel point of pixel point i, is an empirical constant, Denote the maximum value of the hole feature value of the v-th pixel in the neighborhood of pixel i in the f-th clustering cluster in the corresponding first window. Let a represent the total number of clustering clusters of the v-th pixel in the neighborhood of pixel i in the corresponding first window. Denote the maximum value of the hole feature value of pixel i in the g-th clustering cluster in the corresponding first window. Let b represent the total number of clustering clusters of pixel i in the corresponding first window.
[0009] This formula quantifies the difference in the hole feature distribution between pixel i and its neighboring pixel v. By comparing the maximum feature values of the two, it clarifies whether there are significant feature changes between regions. The greater the difference, the smaller the weight of the first window of pixel v. Through the design of the weight parameter, the influence of neighborhood information on the calculation of the optimal window size of pixels is enhanced, further improving the adaptability and robustness of local feature detection.
[0010] Preferably, the hole feature value specifically includes: , where Denote the hole feature value of the -th clustering cluster of pixel t in the target window, Characterize the variance of the curvature of all pixels on the boundary line of the -th clustering cluster of pixel t in the target window, Is the average color difference of all pixels in the -th clustering cluster of pixel t in the target window. The boundary line of the clustering cluster is composed of pixels inside the target window.
[0011] It synthesizes the internal characteristics of the region (average color difference) and boundary characteristics (curvature variance), realizing a multi-dimensional description of the hole feature.
[0012] Preferably, the calculation of the color difference of each pixel specifically includes: presetting a reference color value, and the color difference is the difference between the RGB value of each pixel in the image and the reference color value.
[0013] Preferably, the reference color value specifically includes: taking the average value of the RGB values of all pixels in the hole region of the known hole image as the reference color value.
[0014] By introducing the reference color value, the standard of color difference calculation is ensured to be unified, improving the detection accuracy. Utilizing the information of the known hole region enhances the accuracy and adaptability of the system.
[0015] Preferably, the initial window size is an odd number greater than 1.
[0016] It ensures that the window is centered on the pixel and can evenly cover the surrounding area, improving the consistency and effectiveness of window calculation. It provides mathematical symmetry support for subsequent filtering and clustering.
[0017] Preferably, the initial window is a square window centered on the pixel point t with the initial window size as the side length.
[0018] Preferably, the clustering of the color difference values of each pixel point in the target window includes: using the DBSCAN clustering algorithm to cluster the color difference values of each pixel point in the target window.
[0019] Preferably, the filtering module specifically includes: graying the surface image of the PCB board to be plugged, performing Gaussian filtering on the grayed image according to the optimal window size of each pixel point, then using the sobel operator to detect the edge of the hole area, extracting the hole area image, and detecting whether there is foreign matter in the hole area image. If there is foreign matter, the PCB board is defective.
[0020] The beneficial effects of the present invention are as follows: In the present invention, the calculation of the optimal window size for each pixel point is based on multiple dimensions. By clustering, the feature distribution in the initial window is obtained, and based on this, the window feature value is calculated. The initial window corresponding to the maximum window feature value is selected as the first window of the corresponding pixel point. The optimal window size is calculated according to the difference between the neighboring pixel points of the pixel point and the pixel point, the first window size of the pixel point, and the first window size of each neighboring pixel point. The local characteristics and neighborhood relevance of the pixel points are fully considered. Through clustering and the maximization selection of feature values, the rationality and efficiency of window calculation are optimized. This method enhances the ability to capture detailed features in the region and can accurately extract the hole area to detect foreign matter therein. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] By referring to 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 understandable. In the drawings, several embodiments of the present invention are shown in an exemplary rather than restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0022] Figure 1 is a schematic diagram of a vacuum printed circuit board defect detection system based on machine vision provided by an embodiment of the present invention;
[0023] Reference numerals: 1, acquisition module; 2, window module; 3, filtering module. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0024] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0025] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0026] Figure 1 It is a schematic diagram of a vacuum printed circuit board defect detection system based on machine vision according to an embodiment of the present invention.
[0027] As Figure 1 shown, the vacuum printed circuit board defect detection system based on machine vision provided by the embodiment of the present invention includes: an acquisition module 1, a window module 2 and a filtering module 3;
[0028] The acquisition module 1 is used to acquire the surface image of the PCB board to be plugged with holes and calculate the color difference of each pixel point.
[0029] Specifically, the color difference is the difference between the RGB values of each pixel point in the image and the reference color value. And the reference color value, in some embodiments, specifically includes: taking the average value of the RGB values of all pixel points in the hole area of the known hole image as the reference color value.
[0030] Specifically, under a uniform light source, a high-definition industrial camera is used to acquire the image of the area to be detected on the surface of the PCB board to be plugged with holes. Each pixel point in the image is traversed to extract its RGB value. Since the holes to be plugged are generally made of copper metal, color data can be sampled from the known hole image, and the average value of the RGB values of all pixel points in the hole area of the known hole image is used as the calculated reference color value.
[0031] After obtaining the reference color value, generally, the Euclidean distance formula can be used to calculate the color difference of all pixel points in the surface image of the PCB board to be plugged with holes.
[0032] The window module 2 is connected to the acquisition module 1 and is used to obtain the best window for each pixel point.
[0033] The size of the best window is related not only to the pixel point itself but also to the neighboring pixel points of the pixel point.
[0034] When finding the optimal window size for a pixel, the first window size corresponding to each pixel needs to be screened from multiple initial window sizes of the pixel and its neighboring pixels. Specifically, for each pixel, the window corresponding to the maximum window feature value is screened from a preset number of initial windows, and it is used as the first window of the corresponding pixel. The initial window size is an odd number greater than 1. Each pixel's initial window is divided according to the initial window size. The divided initial window is a square area centered on the pixel with the initial window size as the side length. The initial window size is actually the number of pixels included in the side length of the square area. The process of obtaining the window feature value is as follows: Taking any initial window as the target window, clustering the color differences of the pixels in the target window to obtain multiple clustering clusters. Generally, the clustering algorithm used is the DBSCAN algorithm. In some embodiments, the clustering radius can be set to 5 and the minimum number of points to 3. Calculate the window feature value of the target window , , where is the total number of clustering clusters of the target window, is the hole feature value, and the hole feature value characterizes the possibility that the pixel point t belongs to the hole area in the th clustering cluster under the target window.
[0035] The hole feature value specifically includes: , where represents the hole feature value of the pixel point t in the th clustering cluster in the target window, characterizes the variance of the curvatures of all pixel points on the boundary line of the th clustering cluster of the pixel point t in the target window, is the average color difference of all pixel points in the th clustering cluster of the pixel point t in the target window. The boundary line of the clustering cluster is composed of pixel points inside the target window.
[0036] characterizes the variance of the curvatures of all pixel points on the boundary line of the th clustering cluster of the pixel point t in the target window, The smaller the value, the greater the curvature consistency of the points on the boundary line of the clustering cluster, the closer the boundary line is to the edge line of the hole area, and thus the greater the possibility that the clustering cluster belongs to the hole area. And the boundary line of some clustering clusters may include the side of the target window. In this case, even if the boundary line of the clustering cluster includes the edge line of the hole area, its value will be large. Therefore, the boundary line of the th clustering cluster only includes the boundary inside the first window of the th clustering cluster and cannot include the target window boundary. is the mean color difference of all pixel points in the th clustering cluster of pixel point t in the target window. The smaller the value, the closer the color information of the points in the clustering cluster is to the hole area, and the greater the possibility that the clustering cluster belongs to the hole area.
[0037] So far, the first window size of this pixel point and the first window sizes corresponding to its neighboring pixel points have been obtained.
[0038] If the first window corresponding to the above pixel point is directly used to filter the PCB board image, the filtering effect of some pixel points may be unstable due to factors such as noise. Since the neighboring pixel points are adjacent in position, the position of the neighboring pixel points relative to the hole area should be close to the position of the central pixel point relative to the hole area. Therefore, the first window of the neighboring pixel points can be used to correct the first window of this pixel point to obtain the final optimal window.
[0039] Therefore, the optimal window size , is the rounding function, is the index number of the neighboring pixel point of pixel point i, is the total number of neighboring pixel points of pixel point i, is the weight of the vth neighboring pixel point of pixel point i, is the size of the first window of the vth neighboring pixel point of pixel point i, is the size of the first window of pixel point i. is to calculate the correction value of the first window size of this pixel point according to the neighboring pixel points, then add this correction value to the first window size of this pixel point and divide by 2 to find the mean value. This mean value may not be an odd number, and the optimal window size generally needs to be an odd number. Therefore, it is necessary to find the odd number closest to this mean value. So, it is necessary to divide this mean value by 2, take the integer, then multiply by 2 and add 1.
[0040] In the above optimal window size formula, N is generally 4 or 8. When N = 4, the neighboring pixel points are the four adjacent pixel points above, below, left, and right of this pixel point. When N = 8, the neighboring pixel points are the eight adjacent pixel points above, below, left, right, upper left, upper right, lower left, and lower right of this pixel point.
[0041] In the optimal window size calculation formula, the weight of the vth neighboring pixel point of pixel point i is specifically: , where is the weight of the vth neighboring pixel point of pixel point i, is an empirical constant, Denote the maximum value of the hole feature value of the v-th pixel in the neighborhood of pixel i in the f-th clustering cluster in the corresponding first window. Let a denote the total number of clustering clusters of the v-th pixel in the neighborhood of pixel i in the corresponding first window. Denote the maximum value of the hole feature value of the g-th clustering cluster of pixel i in the corresponding first window. Let b denote the total number of clustering clusters of pixel i in the corresponding first window. This weight definition ensures that the closer the pixel is to the hole feature value of pixel i, the greater the weight of its first window size in the optimal window size of pixel i.
[0042] The filtering module 3 is connected to the window module 2 and is configured to filter the image according to the optimal window size of each pixel and perform defect detection on the filtered image.
[0043] In some embodiments, the filtering module specifically includes: grayscale the surface image of the PCB board with vias to be plugged, perform Gaussian filtering on the grayscaled image according to the optimal window size of each pixel, then use the sobel operator to detect the edge of the hole region, extract the hole region image, and detect whether there is foreign matter in the hole region image. If there is foreign matter, the PCB board is defective. If there is foreign matter in the hole region, to reduce subsequent processing problems, a warning should be issued to remind the staff to take relevant measures to avoid potential quality risks.
[0044] A vacuum printed circuit board defect detection system based on machine vision provided by an embodiment of the present invention collects the surface image of the PCB board with vias to be plugged, calculates the color difference of each pixel, then calculates the optimal window size of each pixel, filters the image according to the optimal window size of each pixel, and performs defect detection on the filtered image. The optimal window size is related to the neighboring pixels of each pixel. An initial window is established with any pixel in the image as the center, and all pixels in the window are clustered using DBSCAN based on the color difference value. The hole feature value is established by combining the curvature consistency of the points on the boundary line of the clustering cluster and the average color difference of all pixels in the clustering cluster, and then the window feature value of this initial window is calculated. The window feature value is negatively correlated with the maximum value of the hole feature values of all clustering clusters in this initial window. After traversing the values of all initial windows for each pixel, the initial window size that makes the window feature value the largest is taken as the first window size, and the optimal window size of this pixel is calculated according to the first window size and the corresponding weight of the neighboring pixels around the pixel and the first window size of this pixel. The present invention fully considers the local characteristics and neighborhood correlation of pixels. Through clustering and maximizing the selection of feature values, the rationality and efficiency of window calculation are optimized. This method enhances the ability to capture detailed features within the region and can accurately extract the hole region to detect whether there is foreign matter in the hole region.
[0045] In the description of this specification, "a plurality of" and "several" mean at least two, such as two, three or more, etc., unless otherwise specifically defined.
[0046] Although this specification has shown and described multiple 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 think of many changes, alterations and alternative ways without departing from the spirit and concept of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in the practice of the present invention.
Claims
1. A vacuum printed circuit board defect detection system based on machine vision, characterized in that: include: An acquisition module is used to acquire the surface image of the PCB board to be plugged and calculate the color difference of each pixel; The window module is connected to the acquisition module and is used to obtain the best window for each pixel; A filtering module, connected to the window module, is used to filter the image according to the optimal window of each pixel point and perform defect detection on the filtered image; Among them, the size of the optimal window for each pixel for: , is the rounding function, is the index number of the neighboring pixel of pixel i, is the total number of neighboring pixels of pixel i, is the weight of the vth pixel in the neighborhood of pixel i, is the size of the first window of the vth neighboring pixel of pixel i, is the size of the first window of pixel i; The first window is: a window corresponding to the maximum window characteristic value is selected from a plurality of preset initial windows, and the window is used as the first window corresponding to the pixel point; The process of obtaining the window feature value is as follows: taking any initial window as the target window, clustering the color difference values of each pixel in the target window to obtain multiple clusters, and calculating the window feature value of the target window , ,in, is the total number of clusters in the target window, is the hole feature value, which represents the pixel point t in the target window. The probability that a cluster belongs to the hole region.
2. The vacuum printed circuit board defect detection system based on machine vision according to claim 1 is characterized in that: The weight of the vth pixel in the neighborhood of the pixel i is specifically: ,in, is the weight of the vth pixel in the neighborhood of pixel i, is an empirical constant, represents the maximum value of the hole feature value of the fth cluster in the first window corresponding to the vth pixel in the neighborhood of pixel i, a represents the total number of clusters in the first window corresponding to the vth pixel in the neighborhood of pixel i, It represents the maximum value of the hole feature value of the g-th cluster in the first window corresponding to the pixel i, and b represents the total number of clusters in the first window corresponding to the pixel i.
3. The vacuum printed circuit board defect detection system based on machine vision according to claim 1 is characterized in that: The hole characteristic value specifically includes: ,in, Represents the pixel point t in the target window The hole eigenvalues of the clusters, Characterizes the pixel t in the target window The variance of the curvature of all pixels on the boundary line of the clusters, is the pixel point t in the target window The color difference mean of all pixels in a cluster is obtained, and the cluster boundary line is composed of pixels inside the target window.
4. The vacuum printed circuit board defect detection system based on machine vision according to claim 1, characterized in that: The calculating the color difference of each pixel point specifically includes: A reference color value is preset, and the color difference is the difference between the RGB value of each pixel in the image and the reference color value.
5. The vacuum printed circuit board defect detection system based on machine vision according to claim 4 is characterized in that: The reference color value specifically includes: The average RGB value of all pixels in the hole area of the known hole image is taken as the reference color value.
6. The vacuum printed circuit board defect detection system based on machine vision according to claim 1, characterized in that: The initial window size is an odd number greater than 1.
7. The vacuum printed circuit board defect detection system based on machine vision according to claim 1 is characterized in that: The initial window is a square window with pixel point t as the center and the initial window size as the side length.
8. The vacuum printed circuit board defect detection system based on machine vision according to claim 1, characterized in that: The clustering of the color difference values of each pixel in the target window includes: The DBSCAN clustering algorithm is used to cluster the color difference value of each pixel in the target window.
9. The vacuum printed circuit board defect detection system based on machine vision according to claim 1, characterized in that: The filtering module specifically includes: The surface image of the PCB board to be plugged is grayed, and Gaussian filtering is performed on the grayed image according to the optimal window size of each pixel. The Sobel operator is then used to detect the edge of the hole area, and the hole area image is extracted to detect whether there is foreign matter in the hole area image. If there is foreign matter, the PCB board is defective.
Citation Information
Patent Citations
Part hole site intelligent identification and positioning method
CN113554695A
Computer PCB mainboard production quality detection method
CN115272350A
Plastic toy quality detection method and device, electronic equipment and storage medium
CN116503404A