Vacuum printed circuit board defect detection system based on machine vision
By using a machine vision-based method 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
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-03-25
- 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 pore area can be accurately extracted and foreign objects in it can be detected.
Smart Images

Figure CN119693359A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and more particularly to a vacuum printed circuit board defect detection system based on machine vision. Background Art
[0002] Circuit boards are essential hardware in circuit design. Printed circuit boards (PCBs) have good product consistency and are easy to design in a standardized manner, which is conducive to mechanization and automation in the production process. Before the via plugging process, the holes need to be inspected to determine whether there are foreign objects, reduce problems in subsequent processing, and avoid potential quality risks. When edge detection is performed on the PCB surface image to extract the hole area to detect foreign objects, due to the high amount of film noise around the holes in the image, the Gaussian filter in the traditional Canny edge detection algorithm cannot effectively remove the noise to accurately extract the hole area.
[0003] At present, a patent application document with publication number CN113554695A discloses a method for intelligent identification and positioning of part holes, which collects original images; pre-processes the collected images to improve the overall identification and positioning accuracy of the parts: first, the collected part images are denoised, and a filtering algorithm combining multiple filters is used to select the most suitable noise reduction filter by comparison, and the overall image after filtering is first binarized and then histogram equalized, and morphological operations are performed on the overall image after histogram equalization: morphological operations include image dilation and image erosion, and Canny edge detection is performed on the image: feature extraction is performed on the holes on the part image: Hough circle transformation is performed on the holes on the part image in the image coordinate system to determine the position coordinates of the center of the hole to be processed, and then the improved contour search method is used to determine whether the hole contour is a circle, and a circular fitting is performed on the holes confirmed to be circular, and the circular coordinates, radius, and area are output through the output function.
[0004] In the above method, it is difficult to effectively remove the noise when there is a lot of noise around the hole, and the accuracy of the circular area obtained by the fitting method is not high. In some cases, a large fitting deviation may occur. In summary, the above method cannot accurately extract the hole area. Summary of the invention
[0005] In order to solve the problem in the prior art that the hole area cannot be accurately extracted to detect foreign matter, the present invention provides the following solution.
[0006] The present invention provides a vacuum printed circuit board defect detection system based on machine vision, comprising: an acquisition module, used to acquire the surface image of the PCB board to be plugged, and calculate the color difference of each pixel; a window module, connected to the acquisition module, used to obtain the best window for each pixel; a filtering module, connected to the window module, used to filter the image according to the best window for each pixel, and perform defect detection on the filtered image; wherein the size of the best window for each pixel is 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: the window corresponding to the maximum window characteristic value is selected from the preset multiple initial windows, and it is used as the first window corresponding to the pixel; the process of obtaining the window characteristic value is: taking any initial window as the target window, clustering the color difference values of each pixel in the target window to obtain multiple clustering clusters, and calculating the window characteristic 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.
[0007] The calculation of the optimal window size for each pixel in the present invention is based on multiple dimensions. The feature distribution in the initial window is obtained by clustering, and the window eigenvalue is calculated accordingly. The initial window corresponding to the maximum window eigenvalue is selected as the first window of the corresponding pixel, and the optimal window size is calculated based on the difference between the neighboring pixels of the pixel and the pixel, the first window size of the pixel, and the first window size of each neighboring pixel. The local characteristics and neighborhood association of the pixel are fully considered. The rationality and efficiency of window calculation are optimized by clustering and maximizing the selection of eigenvalues. This method enhances the ability to capture detailed features in the area and can accurately extract the hole area for detection.
[0008] Preferably, 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.
[0009] This formula quantifies the difference in hole feature distribution between pixel i and its neighboring pixel v. By comparing the maximum eigenvalues of the two, it is clear whether there is a significant feature change between regions. The greater the difference, the smaller the first window weight of pixel v. Through the design of weight parameters, 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 characteristic value specifically includes: ,in, Represents the pixel 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 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.
[0011] The internal characteristics of the region (color difference mean) and boundary characteristics (curvature variance) are integrated to achieve a multi-dimensional description of the hole characteristics.
[0012] Preferably, the calculating the color difference of each pixel point specifically includes: presetting a reference color value, the color difference being the difference between the RGB value of each pixel point in the image and the reference color value.
[0013] Preferably, the reference color value specifically includes: taking the average RGB value of all pixels in the hole area in the known hole image as the reference color value.
[0014] By introducing reference color values, the color difference calculation standard is unified, which improves the detection accuracy. By using the known hole area information, the accuracy and adaptability of the system are enhanced.
[0015] Preferably, the initial window size is an odd number greater than 1.
[0016] This ensures that the window is centered on the pixel and can evenly cover the surrounding area, improving the consistency and effectiveness of window calculations and providing mathematical symmetry support for subsequent filtering and clustering.
[0017] Preferably, the initial window is a square window with the pixel point t as the center and the initial window size as the side length.
[0018] Preferably, clustering the color difference values of each pixel in the target window includes: clustering the color difference value of each pixel in the target window using a DBSCAN clustering algorithm.
[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, 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 effect of the present invention is that the calculation of the optimal window size for each pixel in the present invention is based on multiple dimensions. The feature distribution in the initial window is obtained by clustering, and the window eigenvalue is calculated accordingly. The initial window corresponding to the maximum window eigenvalue is screened out as the first window of the corresponding pixel, and the optimal window size is calculated based on the difference between the neighboring pixels of the pixel and the pixel, the first window size of the pixel, and the first window size of each neighboring pixel. The local characteristics and neighborhood correlation of the pixel are fully considered. The rationality and efficiency of the window calculation are optimized by clustering and maximizing the selection of eigenvalues. This method enhances the ability to capture detailed features in the area, and can accurately extract the hole area to detect foreign matter therein. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 Schematic diagram of a vacuum printed circuit board defect detection system based on machine vision provided by an embodiment of the present invention; Figure numerals: 1. acquisition module; 2. window module; 3. filtering module. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0023] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0024] Figure 1 The figure 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.
[0025] like Figure 1 As shown, the vacuum printed circuit board defect detection system based on machine vision provided by the embodiment of the present invention includes: a collection module 1, a window module 2 and a filter module 3; The acquisition module 1 is used to acquire the surface image of the PCB board to be plugged and calculate the color difference of each pixel.
[0026] Specifically, the color difference is the difference between the RGB value of each pixel in the image and the reference color value. In some embodiments, the reference color value specifically includes: taking the average RGB value of all pixels in the hole area in the known hole image as the reference color value.
[0027] Specifically, a high-definition industrial camera is used to obtain an image of the area to be inspected on the surface of the PCB board to be plugged under a uniform light source. Each pixel in the image is traversed to extract its RGB value. Since the hole to be plugged is generally copper metal, color data can be sampled from the known hole image, and the average RGB value of all pixels in the hole area in the known hole image is used as the reference color value for calculation.
[0028] After obtaining the reference color value, the Euclidean distance formula can generally be used to calculate the color difference of all pixels in the surface image of the PCB board to be plugged.
[0029] The window module 2 is connected to the acquisition module 1 and is used to obtain the best window for each pixel.
[0030] The optimal window size is not only related to the pixel itself, but also to the neighboring pixels of the pixel.
[0031] When finding the optimal window size for a pixel, it is necessary to first filter out the first window size corresponding to each pixel from multiple initial window sizes of the pixel and its neighboring pixels. Specifically, for each pixel, filter out the window corresponding to the maximum window eigenvalue from multiple preset initial windows, and use it as the first window corresponding to the pixel. The initial window size is an odd number greater than 1. Divide the initial window of each pixel according to the initial window size. The divided initial window is a square area with the pixel as the center and the initial window size as the side length. The initial window size is actually the number of pixels contained in the side length of the square area. The process of obtaining the window eigenvalue is as follows: take any initial window as the target window, cluster the color difference values of each pixel in the target window to obtain multiple clustering clusters. The generally used clustering algorithm is the DBSCAN algorithm. In some embodiments, the clustering radius can be set to 5 and the minimum number of points can be set to 3. Calculate the window eigenvalue 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.
[0032] The hole characteristic value specifically includes: ,in, Represents the pixel 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 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.
[0033] Characterizes the pixel t in the target window The variance of the curvature of all pixels on the boundary line of the clusters, The smaller the value, the greater the curvature consistency of the points on the cluster boundary line, the closer the boundary line is to the edge line of the hole area, and the greater the possibility that the cluster belongs to the hole area. However, the boundary line of some clusters may include the edge of the target window. In this case, even if the boundary line of the cluster includes the edge line of the hole area, its The value will also be large, so the The cluster boundaries only include the The boundaries of the clusters are inside the first window and cannot include the target window boundaries. is the pixel t in the target window. The mean color difference of all pixels in a cluster, The smaller the value, the more similar the color information of the points in the cluster is to the hole area, and the greater the possibility that the cluster belongs to the hole area.
[0034] At this point, the first window size of the pixel point and the first window size corresponding to its neighboring pixel points are obtained.
[0035] If the first window corresponding to the pixel is directly used to filter the PCB board image, some pixels may have unstable filtering effects due to noise and other factors. Since the positions of the neighboring pixels are adjacent, the positions of the neighboring pixels and the hole area should be close to the positions of the central pixel and the hole area. Therefore, the first window of the pixel can be corrected by the first window of the neighboring pixels to obtain the final optimal window.
[0036] Therefore, the optimal window size , 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 correction value of the first window size of the pixel is calculated based on the domain pixel, and then the correction value is added to the first window size of the pixel and divided by 2 to get the average. This average 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, so it is necessary to divide this mean by 2, take the integer, and then multiply by 2 and add 1.
[0037] N in the above optimal window size formula is generally 4 or 8. When N=4, the neighborhood pixels are the four immediately adjacent pixels above, below, left, and right of the pixel. When N=8, the neighborhood pixels are the eight immediately adjacent pixels above, below, left, right, upper left, upper right, lower left, and lower right of the pixel.
[0038] In the optimal window size calculation formula, 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, represents the maximum value of the hole feature value of the gth cluster in the first window corresponding to pixel i, and b represents the total number of clusters in the first window corresponding to pixel i. This weight definition ensures that the pixel point that is closer to the hole feature value of pixel i has a greater weight in the optimal window size of pixel i.
[0039] The filtering module 3 is connected to the window module 2, and is used to filter the image according to the optimal window size of each pixel point, and perform defect detection on the filtered image.
[0040] In some embodiments, 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, 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. If there is foreign matter in the hole area, in order to reduce subsequent processing problems, an early warning should be issued to remind the staff to take relevant measures to avoid potential quality risks.
[0041] The vacuum printed circuit board defect detection system based on machine vision provided by the embodiment of the present invention collects the surface image of the PCB board to be plugged, calculates the color difference of each pixel point, and then calculates the optimal window size of each pixel point, filters the image according to the optimal window size of each pixel point, and performs defect detection on the filtered image. The optimal window size is related to the neighborhood pixel points of each pixel point. An initial window is established with any pixel point in the image as the center, and all the pixels in the window are clustered based on the color difference value using DBSCAN. The hole feature value is established by combining the curvature consistency of the points on the cluster boundary line and the color difference mean of all the pixels in the cluster cluster, and then the window feature value of this initial window is calculated, and the window feature value is negatively correlated with the maximum value of the hole feature value of all clusters of the initial window. After traversing all the initial windows for each pixel point, 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 the pixel point is calculated according to the first window size and corresponding weight of the neighborhood pixel points around the pixel point and the first window size of the pixel point. The present invention fully considers the local characteristics and neighborhood association of the pixel point. By clustering and maximizing the selection of eigenvalues, the rationality and efficiency of window calculation are optimized. This method enhances the ability to capture detailed features in the area and can accurately extract the hole area to detect whether there is foreign matter in the hole area.
[0042] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0043] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A 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
Rubber ring production quality detection method based on artificial intelligence
CN116703251A
Circuit board defect detection method and device based on artificial intelligence, equipment and medium
CN117314909A
Cited By
Defect detection method and system for PCB plug hole processing based on machine vision
CN120598941A
Defect detection method and system for PCB hole processing based on machine vision
CN120598941B