A method and system for determining defects in printed circuit boards based on image comparison
By combining image comparison technology with template matching, OTSU algorithm and morphological dilation, the difficulties in identifying defects in printed circuit board defects caused by insufficient datasets and changes in illumination are solved, and efficient and accurate defect determination is achieved.
Patent Information
- Application Number
- CN202411637406.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-15
AI Technical Summary
Existing printed circuit board defect detection technologies suffer from problems such as limited and imbalanced datasets, difficulty in displaying defect features, challenges in image binarization under different lighting conditions, and the impact of noise on detection, resulting in insufficient detection accuracy and robustness.
By acquiring the normal defect map, UV defect map, and CAM map of the printed circuit board, preliminary template matching and secondary judgment are performed. The binarization threshold is calculated using the OTSU algorithm. Combined with median filtering and morphological dilation, a pixel matrix is constructed for difference comparison, which solves the problems of missed identification and noise interference in defect identification.
It improves the accuracy and robustness of defect detection, reduces the false negative rate, adapts to image processing under different lighting conditions, and enhances the reliability of defect judgment.
Smart Images

Figure CN119715535B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection technology, and in particular to a method and system for determining defects in printed circuit boards based on image comparison. Background Technology
[0002] As a crucial support and carrier for electronic components in modern electronic products, the quality of printed circuit boards (PCBs) directly affects the efficiency and reliability of these products, and consequently, the overall competitiveness of downstream products. Due to the complex and intricate manufacturing process of PCBs, surface defects are unavoidable, necessitating the use of defect detection equipment. Currently, the most commonly used defect detection equipment by PCB manufacturers includes Automated Optical Inspection (AOI) and Virtual Rescan (VRS) technology. These systems utilize image processing algorithms and Artificial Intelligence (AI) algorithms, respectively, to acquire and detect defects on the PCBs.
[0003] However, both the image matching algorithms commonly used in AOI equipment and the AI target detection algorithms used in VRS equipment have limitations. For example, AOI equipment has a high false detection rate, misclassifying many normal points as abnormal. These shortcomings significantly impact the analysis of printed circuit board defects and subsequent repair processes. Therefore, the accuracy of defect identification and the efficiency of filtering become crucial. VRS equipment acquires images of defect points detected by AOI equipment. For each point, it acquires a color image (Normal), an ultraviolet (UV) image, and a corresponding production data standard image (CAM image). This image is then input into the AI target detection algorithm for identification to determine whether the point is a true defect. This overcomes the high false detection rate of AOI equipment, reduces the amount of manual inspection, and saves inspection costs. VRS equipment is effectively promoting the progress of printed circuit board inspection equipment towards the goal of zero false detection.
[0004] AI object detection algorithms boast advantages such as high detection accuracy and flexible network structure, and are robust to illumination and geometric variance. However, they typically require a large amount of data for network training. In practical applications, collecting a large number of defective images is difficult and expensive. Due to a lack of sufficient training data, deep learning-based methods often encounter insufficient generalization ability, leading to decreased defect recognition accuracy. Furthermore, some large defects cannot be displayed in images, causing the model to fail to extract features and resulting in missed detections. Existing object detection algorithms neglect the fact that CAM images of printed circuit boards can provide effective and accurate information for detection, making it difficult to meet the requirement of not missing defects in terms of accuracy and robustness.
[0005] In summary, the main problems with existing printed circuit board defect detection technologies include the following:
[0006] 1. The performance of deep learning-based models largely depends on the availability of large and balanced datasets. However, many industrial environments often face the problem of limited and imbalanced datasets. Some rare defects make it difficult to collect enough defect images to train the model, resulting in insufficient accuracy and robustness of existing models.
[0007] 2. Deep learning-based models identify defects by extracting defect features. However, some defects are too large to be fully displayed on a single image, resulting in some images failing to display defect features and forming featureless defects. This makes it impossible for the model to determine whether a point has a defect, leading to missed identification.
[0008] 3. Currently, there is no algorithm for comparing CAM standard images and UV images of printed circuit boards. Previous research has focused on color image defects of printed circuit boards under visible light, and most studies only focus on using printed circuit board defect samples, while ignoring the accurate information of CAM images.
[0009] 4. Images acquired under different lighting conditions vary significantly. It is difficult to find the appropriate threshold for image binarization under different lighting intensities, leading to image binarization failure and affecting subsequent defect judgment.
[0010] 5. Different environments and lighting conditions can cause varying degrees of noise when acquiring images, affecting the determination of defects at the points. Summary of the Invention
[0011] The purpose of this invention is to provide a method and system for determining defects in printed circuit boards based on image comparison, in order to solve the above-mentioned problems in the prior art.
[0012] This invention provides a method for determining defects in printed circuit boards based on image comparison, comprising:
[0013] Obtain and process the Normal defect map, UV defect map, and CAM map of the printed circuit board (PCB). Use the processed Normal defect map and CAM map to perform a primary defect assessment of the PCB.
[0014] The printed circuit board (PCB) defects are determined by combining the initial defect assessment result with the processed UV defect image. The final PCB defect assessment result is then obtained.
[0015] This invention provides a printed circuit board defect determination system based on image comparison, comprising:
[0016] The primary defect assessment module acquires and processes the Normal defect map, UV defect map, and CAM map of the printed circuit board, and uses the processed Normal defect map and CAM map to perform a primary defect assessment of the printed circuit board; and
[0017] The secondary judgment module is used to combine the primary judgment result and the processed UV defect map to perform a secondary judgment of printed circuit board defects, and obtain the final printed circuit board defect judgment result.
[0018] This invention also provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the above-described image comparison-based printed circuit board defect determination method.
[0019] This invention also provides a computer-readable storage medium storing an information transmission implementation program, which, when executed by a processor, implements the steps of the above-described image comparison-based printed circuit board defect determination method.
[0020] The embodiments of the present invention can include the following beneficial effects: The embodiments of the present invention utilize template matching to accurately obtain the CAM standard map region, utilize morphological dilation to reduce the difference between non-defect positions in the CAM standard map and the UV defect map, and effectively solve the problem of missed identification caused by the low generalization ability of the AI model in VRS for featureless defects and rare defects by calculating and comparing the pixel values of the CAM standard map and the UV defect map. Furthermore, the embodiments of the present invention utilize the OTSU algorithm to calculate the dynamic binarization threshold, which effectively solves the problem of poor universality of the binarization threshold under different illumination intensities. In addition, the embodiments of the present invention use median filtering to remove noise and other redundant information interference, avoiding the problem of excessive image noise affecting the point determination. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in one or more embodiments of this specification or in 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 recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of the printed circuit board defect determination method based on image comparison according to an embodiment of the present invention;
[0023] Figure 2 This is a flowchart of an image comparison method for determining defects in printed circuit boards according to an embodiment of the present invention;
[0024] Figure 3 This is a preliminary template matching process flowchart of an embodiment of the present invention;
[0025] Figure 4 These are the Normal defect map, UV defect map, and CAM map of the printed circuit board obtained from the AOI device, which are obtained through the VRS device according to embodiments of the present invention.
[0026] Figure 5 This is the processed Normal defect image of the present invention (where a is the cropped Normal defect image and b is the Normal grayscale image).
[0027] Figure 6 This is the processed UV defect image of this invention (where a is the cropped UV defect image and b is the UV grayscale image).
[0028] Figure 7 This is the processed CAM image of the present invention (where a is the CAM grayscale image and b is the CAM preliminary template matching and cropping image).
[0029] Figure 8 This is a flowchart of the cyclic expansion and template matching process according to an embodiment of the present invention;
[0030] Figure 9 This is a UV binarized denoised image according to an embodiment of the present invention;
[0031] Figure 10 This is a CAM binarized image according to an embodiment of the present invention;
[0032] Figure 11 This is a CAM binarized dilatation map according to an embodiment of the present invention;
[0033] Figure 12 This is a flowchart of the four-way sum-difference algorithm processing according to an embodiment of the present invention;
[0034] Figure 13 This is a schematic diagram of the pixels and results of each row, each column, each diagonal, and each sub-diagonal of the horizontal defect image pixel matrix in an embodiment of the present invention.
[0035] Figure 14 This is a schematic diagram of the pixels and results of each row, each column, each diagonal, and each sub-diagonal of the vertical defect map pixel matrix according to an embodiment of the present invention.
[0036] Figure 15 This is a schematic diagram of the pixels and results of each row, each column, each diagonal, and each sub-diagonal of the defect map pixel matrix in the main diagonal direction of the present invention.
[0037] Figure 16 This is a schematic diagram of the pixels and results of each row, each column, each diagonal, and each sub-diagonal of the defect image pixel matrix in an embodiment of the present invention.
[0038] Figure 17 This is a pixel matrix pixel difference comparison image of the horizontal defect map according to an embodiment of the present invention;
[0039] Figure 18 This is a comparison image of the pixel matrix and the difference between pixels in the vertical defect image according to an embodiment of the present invention;
[0040] Figure 19 This is a comparison image of the difference between the pixel matrix of the defect map in the main diagonal direction according to an embodiment of the present invention;
[0041] Figure 20 This is a comparison image of the sub-diagonal defect image pixel matrix and the difference between pixels in an embodiment of the present invention;
[0042] Figure 21 This is a schematic diagram of a printed circuit board defect determination system based on image comparison according to an embodiment of the present invention. Detailed Implementation
[0043] To enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of this document.
[0044] Method Implementation Examples
[0045] According to embodiments of the present invention, a method for determining defects in printed circuit boards based on image comparison is provided. Figure 1This is a flowchart of the printed circuit board defect determination method based on image comparison according to an embodiment of the present invention, as follows: Figure 1 As shown, the printed circuit board defect determination method based on image comparison according to an embodiment of the present invention specifically includes:
[0046] Step S101: Obtain the Normal defect map, UV defect map, and CAM map of the printed circuit board and process them. Use the processed Normal defect map and CAM map to perform a first-order defect determination of the printed circuit board, specifically including:
[0047] The normal and UV defect images of the printed circuit board are obtained through a VRS device, and the CAM image of the printed circuit board is obtained through an AOI device. The normal and UV defect images are cropped and converted into grayscale images to obtain normal grayscale images and UV grayscale images. The CAM image is then converted into a grayscale image to obtain a CAM grayscale image.
[0048] Template matching is performed on the Normal grayscale image and the CAM grayscale image, and the maximum similarity of the points is calculated. The maximum similarity of the points is compared with a preset threshold range. If the maximum similarity of the points is greater than the upper limit of the threshold range, the corresponding points are determined to be normal points; if the maximum similarity of the points is less than the lower limit of the threshold range, the corresponding points are determined to be defective points; if the maximum similarity of the points is within the threshold range, the region with the highest similarity in the CAM grayscale image is cropped to obtain the CAM secondary judgment image.
[0049] Step S102: Combine the primary judgment result and the processed UV defect image to perform a secondary judgment of the printed circuit board defects, obtaining the final printed circuit board defect judgment result, specifically including:
[0050] The OTSU algorithm is used to calculate the binarization threshold of the UV defect map. This threshold is then used to binarize the UV grayscale image. Median filtering is then used to denoise the binarized UV grayscale image, resulting in a denoised UV binarized image. The CAM secondary decision image is then binarized to obtain a CAM binarized image. Cyclic morphological dilation is performed on the CAM binarized image, and template matching is continuously performed between the cyclically dilated CAM binarized image and the denoised UV binarized image until the region with the highest similarity to the CAM binarized image is obtained as the CAM binarized dilated image. The UV binarized denoised image and the CAM binarized dilatation image are used to construct corresponding pixel matrices. The sums of each row, column, main diagonal, and sub-diagonal of the UV and CAM pixel matrices are calculated. The sums of each row, column, main diagonal, and sub-diagonal of the UV pixel matrix are then subtracted from the sums of the corresponding pixels in the CAM pixel matrix to obtain several pixel sum differences. It is then determined whether these differences satisfy a judgment condition. If yes, the corresponding point is determined to be a defective point; otherwise, the corresponding point is determined to be a normal point.
[0051] The determination condition is that there are 12 consecutive pixels and differences among the plurality of pixels and differences that are all greater than a preset threshold.
[0052] The following details the specific application of the image comparison-based printed circuit board defect determination method according to embodiments of the present invention, such as... Figure 2 As shown, the above technical solutions of the embodiments of the present invention will be described in detail.
[0053] An image comparison method for determining defects in printed circuit boards, as proposed in this invention, includes the following steps:
[0054] 1. After obtaining the color defect image (Normal image), ultraviolet defect image (UV image), and CAM standard image through the VRS device, input them into AI for judgment. If the AI judges it as NG (abnormal), the result is directly output. If the AI judges it as OK (normal), the image is processed by cropping, converting to grayscale, etc., and then the Normal image and CAM image are matched with templates to initially locate the CAM image area. At the same time, the matching similarity is calculated, and the similarity determines whether the point is normal, abnormal, or proceeds to the next step.
[0055] 2. Extract the region with the highest similarity to the CAM image, and after processing the image by cropping, binarization, morphological dilation, and denoising, perform cyclic dilation on the CAM image and match it with the UV image template to accurately locate the position of the CAM image, while reducing the difference between the two images and obtaining the best CAM image.
[0056] 3. Calculate the pixel sum of each row, each column, each diagonal, and each subdiagonal of the pixel matrix of the UV binarized image and the CAM binarized image respectively. Then, find the difference between the pixel sums of corresponding positions in the four directions, magnify the difference positions, and finally determine whether the point contains a defect.
[0057] Specifically, embodiments of the present invention provide an image comparison method for determining defects in printed circuit boards, including: preliminary template matching, cyclic dilation and template matching, and a four-way sum-difference algorithm.
[0058] 1. Figure 3 The flowchart for the preliminary template matching process involves cropping and converting the collected Normal defect image and CAM standard image to grayscale, performing preliminary template matching to calculate similarity, initially locating the position of the CAM standard image, extracting the matching area of the CAM image, and determining whether it is normal, abnormal, or proceeding to the next step based on the similarity.
[0059] The specific content is: a normal defect map obtained through a VRS device (e.g., ...). Figure 4 As shown in Figure a, with a resolution of 512×512), UV defect map (as shown in Figure a) Figure 4 As shown in b, the CAM drawing of the printed circuit board obtained from the AOI equipment (with a resolution of 512×512) Figure 4 As shown in c, the resolution is 736×736. The obtained Normal defect image is cropped to a resolution of 480×480 and converted to grayscale (e.g., ...). Figure 5 As shown in a and 5b), the obtained UV defect image is cropped to a resolution of 440×440 and converted to grayscale (e.g., ...). Figure 6 (as shown in a and 6b), the obtained CAM standard image is converted into a grayscale image (e.g., ...). Figure 7 As shown in a). Template matching is performed on the processed Normal grayscale image and CAM grayscale image to obtain the highest similarity x. If x is greater than 0.75, the point is judged as OK (normal); if x is less than 0.2, the point is judged as NG (abnormal); if the similarity is between 0.2 and 0.75, the 480×480 region with the highest similarity in the CAM grayscale image is extracted (e.g., ...). Figure 7 (as shown in b).
[0060] 2. Figure 8 The flowchart for cyclic dilation and template matching is as follows: the OTSU algorithm is used to obtain the UV binarized image and remove noise. Cyclic morphological dilation and template matching are performed on the CAM image until the optimal region is found, the difference between the two images is reduced and the position of the CAM image is locked. The best dilated image and matching region of the CAM are then extracted.
[0061] Specifically, the process involves reading the grayscale values of the UV grayscale image obtained in the previous step and calculating the UV using the Otsu algorithm. Figure 2 Value-based thresholding, using this threshold to convert UV grayscale Figure 2 The image is then binarized, and then median filtering is used with a kernel of 7 to obtain a denoised UV binarized image, such as... Figure 9 As shown. The CAM grayscale obtained in the previous step is cropped. Figure 2 Value-based, such as Figure 10 As shown, morphological dilation is performed using a (2,2) dilation kernel. Template matching is performed after each dilation step until the highest similarity is obtained, with a maximum dilation count limited to 5. The 440×440 region with the highest similarity in the CAM binarized image is then extracted, as shown below. Figure 11 As shown.
[0062] 3. Figure 12 The flowchart for the four-way sum-difference algorithm is as follows: The UV binarized denoised image and CAM binarized cropped image obtained in the previous step are used to construct a pixel matrix. The sum of each row, each column, each main diagonal, and each sub-diagonal is calculated separately. Then, the difference between the corresponding positions of the pixel sum of each row, each column, each main diagonal, and each sub-diagonal is calculated. The point is determined to be normal or abnormal based on the set threshold.
[0063] Specifically, the UV binarized denoised image and CAM binarized cropped image obtained in the previous step are used to construct an i×j pixel matrix, which are as follows:
[0064]
[0065]
[0066] Where, matrix Q ij P represents the pixel matrix of the UV binarized denoised image. ij Let Q represent the pixel matrix of the CAM binary cropped image, where q and p represent each pixel in the image, i represents the number of rows in the image, j represents the number of columns in the image, and the total number of pixels in the image is i×j. ij Sum of matrix P ij All are n×n square matrices, i.e., i max =n,j max =n;
[0067] Summing each of their rows separately, the formula is:
[0068]
[0069] Summing each of their columns separately, the formula is:
[0070]
[0071] For each of their main diagonals, the summation of the k-th main diagonal (indexed from k=1-n to k=n-1) is given by the formula:
[0072]
[0073] For each of their subdiagonals, the summation of the k-th subdiagonal (indexed from k=1 to k=2n-1) is given by the formula:
[0074]
[0075] Plotting the summation of the Q and P matrices in four directions yields the pixel count and plot of the transverse defect image (e.g., ...). Figure 13 (as shown), vertical defect map pixel matrix and curve map (as shown) Figure 14 (As shown), the main diagonal defect image pixels and curves (such as...) Figure 15 (As shown), sub-diagonal defect image pixels and curves (such as...) Figure 16 (As shown).
[0076] After obtaining the four-way sums of the Q and P matrices, the differences are calculated at corresponding positions for the pixel sums of each row, column, main diagonal, and subdiagonal. Specifically:
[0077] The pixel difference between the corresponding index rows of Q and P is:
[0078]
[0079] The pixel difference between the corresponding index columns of Q and P is:
[0080]
[0081] The pixel difference between the main diagonal indices of Q and P is:
[0082]
[0083] The pixel difference between the sub-diagonal indices of Q and P is:
[0084]
[0085] After obtaining the pixel difference, curves are plotted for the corresponding index positions in the four directions of the Q matrix and P matrix, respectively, to obtain the pixel difference comparison image of the horizontal defect image (e.g., ...). Figure 17 (as shown), vertical defect map pixel matrix and curve map (as shown) Figure 18 (As shown), the main diagonal defect image pixels and curves (such as...) Figure 19 (As shown), sub-diagonal defect image pixels and curves (such as...) Figure 20(As shown). The pixel difference is set as the threshold w, and the sum of the pixels at the corresponding index position and the maximum value divided by 2.5 is set as the threshold f. If the difference between 12 consecutive pixels is greater than both thresholds w and f, the difference curve for that position is displayed in the comparison chart, while other positions are displayed as 0, and that position is considered NG; if the difference between 12 consecutive pixels is less than both thresholds w and f, that position is considered OK.
[0086] System Implementation Examples
[0087] According to embodiments of the present invention, a printed circuit board defect determination system based on image comparison is provided. Figure 21 This is a schematic diagram of a printed circuit board defect determination system based on image comparison according to an embodiment of the present invention, as shown below. Figure 21 As shown, the printed circuit board defect determination system based on image comparison according to an embodiment of the present invention specifically includes:
[0088] The primary defect assessment module 2100 is used to acquire and process the Normal defect map, UV defect map, and CAM map of the printed circuit board, and then use the processed Normal defect map and CAM map to perform a primary defect assessment of the printed circuit board. Specifically, it is used for:
[0089] The normal and UV defect images of the printed circuit board are obtained through a VRS device, and the CAM image of the printed circuit board is obtained through an AOI device. The normal and UV defect images are cropped and converted into grayscale images to obtain normal grayscale images and UV grayscale images. The CAM image is then converted into a grayscale image to obtain a CAM grayscale image.
[0090] Template matching is performed on the Normal grayscale image and the CAM grayscale image, and the maximum similarity of the points is calculated. The maximum similarity of the points is compared with a preset threshold range. If the maximum similarity of the points is greater than the upper limit of the threshold range, the corresponding points are determined to be normal points; if the maximum similarity of the points is less than the lower limit of the threshold range, the corresponding points are determined to be defective points; if the maximum similarity of the points is within the threshold range, the region with the highest similarity in the CAM grayscale image is cropped to obtain the CAM secondary judgment image.
[0091] The secondary judgment module 2102 is used to combine the primary judgment result and the processed UV defect map to perform a secondary judgment of printed circuit board defects, and obtain the final printed circuit board defect judgment result. Specifically, it is used for:
[0092] The OTSU algorithm is used to calculate the binarization threshold of the UV defect map. This threshold is then used to binarize the UV grayscale image. Median filtering is then used to denoise the binarized UV grayscale image, resulting in a denoised UV binarized image. The CAM secondary decision image is then binarized to obtain a CAM binarized image. Cyclic morphological dilation is performed on the CAM binarized image, and template matching is continuously performed between the cyclically dilated CAM binarized image and the denoised UV binarized image until the region with the highest similarity to the CAM binarized image is obtained as the CAM binarized dilated image. The UV binarized denoised image and the CAM binarized dilatation image are used to construct corresponding pixel matrices. The sums of each row, column, main diagonal, and sub-diagonal of the UV and CAM pixel matrices are calculated. The sums of each row, column, main diagonal, and sub-diagonal of the UV pixel matrix are then subtracted from the sums of the corresponding pixels in the CAM pixel matrix to obtain several pixel sum differences. It is then determined whether these differences satisfy a judgment condition. If yes, the corresponding point is determined to be a defective point; otherwise, the corresponding point is determined to be a normal point.
[0093] The embodiments of the present invention are system embodiments corresponding to the above method embodiments. The specific operation of each module can be understood by referring to the description of the method embodiments, and will not be repeated here.
[0094] In summary, there is currently no publicly available technology for comparing UV defect maps and CAM standard maps of VRS equipment to determine defects. Existing printed circuit board defect detection technologies ignore the effective information provided by the CAM standard map of the printed circuit board. When replacing batches of printed circuit boards in VRS equipment, the low generalization ability of existing models and the lack of defect features lead to missed defect identification, and the recognition effect of image detection algorithms is difficult to meet industrial requirements. In contrast, the embodiments of this invention utilize template matching to accurately obtain the CAM standard map region, use morphological dilation to reduce the difference between non-defect positions in the CAM standard map and the UV defect map, and calculate and compare the pixel values of the CAM standard map and the UV defect map through image comparison algorithms. This effectively solves the problem of missed identification caused by the low generalization ability of AI models in VRS for featureless and rare defects. Furthermore, the Otsu algorithm is used to calculate a dynamic binarization threshold, effectively solving the problem of poor universality of the binarization threshold under different illumination intensities. An adaptive binarization threshold can be calculated under different illumination intensities. Median filtering is used to remove noise and other redundant information interference, effectively solving the problem of excessive image noise affecting point location determination.
[0095] Device Example 1
[0096] This invention provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, performs the steps described in the method embodiment.
[0097] Device Example 2
[0098] This invention provides a computer-readable storage medium storing an information transmission implementation program, which, when executed by a processor, performs the steps described in the method embodiment.
[0099] The computer-readable storage media described in this embodiment include, but are not limited to, ROM, RAM, disk, or optical disk.
[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; 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 or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for determining defects in printed circuit boards based on image comparison, characterized in that... include: Obtain and process the Normal defect image, UV defect image, and CAM image of the printed circuit board. Use the processed Normal defect image and CAM image to perform a primary defect assessment of the printed circuit board, specifically including: The normal and UV defect images of the printed circuit board are obtained through a VRS device, and the CAM image of the printed circuit board is obtained through an AOI device. The normal and UV defect images are cropped and converted into grayscale images to obtain normal grayscale images and UV grayscale images. The CAM image is then converted into a grayscale image to obtain a CAM grayscale image. Template matching is performed on the Normal grayscale image and the CAM grayscale image, and the maximum similarity of the points is calculated. The maximum similarity of the points is compared with a preset threshold range. If the maximum similarity of the points is greater than the upper limit of the threshold range, the corresponding points are determined to be normal points; if the maximum similarity of the points is less than the lower limit of the threshold range, the corresponding points are determined to be defective points; if the maximum similarity of the points is within the threshold range, the region with the highest similarity in the CAM grayscale image is cropped to obtain the CAM secondary judgment image. A second defect assessment of the printed circuit board (PCB) is performed by combining the initial assessment result with the processed UV defect image to obtain the final PCB defect assessment result, which includes: The OTSU algorithm is used to calculate the binarization threshold of the UV defect map. This threshold is then used to binarize the UV grayscale image. Median filtering is then used to denoise the binarized UV grayscale image, resulting in a denoised UV binarized image. The CAM secondary decision image is then binarized to obtain a CAM binarized image. Cyclic morphological dilation is performed on the CAM binarized image, and template matching is continuously performed between the cyclically dilated CAM binarized image and the denoised UV binarized image until the region with the highest similarity to the CAM binarized image is obtained as the CAM binarized dilated image. The UV binarized denoised image and the CAM binarized dilatation image are used to construct corresponding pixel matrices. The sums of each row, column, main diagonal, and sub-diagonal of the UV and CAM pixel matrices are calculated. The sums of each row, column, main diagonal, and sub-diagonal of the UV pixel matrix are then subtracted from the sums of the corresponding pixels in the CAM pixel matrix to obtain several pixel sum differences. It is then determined whether these differences satisfy a judgment condition. If yes, the corresponding point is determined to be a defective point; otherwise, the corresponding point is determined to be a normal point.
2. The method according to claim 1, characterized in that, The determination condition is that there are 12 consecutive pixels and differences among the plurality of pixels and differences that are all greater than a preset threshold.
3. A printed circuit board defect determination system based on image comparison, characterized in that... include: The primary defect assessment module acquires and processes the Normal defect map, UV defect map, and CAM map of the printed circuit board. It then uses the processed Normal defect map and CAM map to perform a primary defect assessment of the printed circuit board. Specifically, it is used for: The normal and UV defect images of the printed circuit board are obtained through a VRS device, and the CAM image of the printed circuit board is obtained through an AOI device. The normal and UV defect images are cropped and converted into grayscale images to obtain normal grayscale images and UV grayscale images. The CAM image is then converted into a grayscale image to obtain a CAM grayscale image. Template matching is performed on the Normal grayscale image and the CAM grayscale image, and the maximum similarity of the points is calculated. The maximum similarity of the points is compared with a preset threshold range. If the maximum similarity of the points is greater than the upper limit of the threshold range, the corresponding points are determined to be normal points; if the maximum similarity of the points is less than the lower limit of the threshold range, the corresponding points are determined to be defective points; if the maximum similarity of the points is within the threshold range, the region with the highest similarity in the CAM grayscale image is cropped to obtain the CAM secondary judgment image. The secondary judgment module is used to combine the primary judgment result and the processed UV defect map to perform a secondary judgment of printed circuit board defects, obtaining the final printed circuit board defect judgment result. Specifically, it is used for: The OTSU algorithm is used to calculate the binarization threshold of the UV defect map. This threshold is then used to binarize the UV grayscale image. Median filtering is then used to denoise the binarized UV grayscale image, resulting in a denoised UV binarized image. The CAM secondary decision map is then binarized to obtain a CAM binarized image. Cyclic morphological dilation is performed on the CAM binarized image, and template matching is continuously performed between the cyclically dilated CAM binarized image and the denoised UV binarized image until the region with the highest similarity to the CAM binarized image is obtained as the CAM binarized image. Inflation map; Construct corresponding pixel matrices using the UV binarized denoised map and the CAM binarized inflation map respectively, and sum each row, each column, each main diagonal, and each sub-diagonal of the UV pixel matrix and the CAM pixel matrix respectively. Subtract the sum of pixels in each row, each column, each main diagonal, and each sub-diagonal of the UV pixel matrix from the sum of pixels at the corresponding position in the CAM pixel matrix to obtain several pixel sum differences. Determine whether the several pixel sum differences meet the determination conditions. If so, determine the corresponding point as a defect point. If not, the corresponding point is determined to be a normal point.
4. An electronic device, characterized in that, include: The memory, the processor, and the computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the printed circuit board defect determination method based on image comparison as described in any one of claims 1-2.
5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an information transmission implementation program, which, when executed by a processor, implements the steps of the printed circuit board defect determination method based on image comparison as described in any one of claims 1-2.
Citation Information
Patent Citations
Digital image handling based comparing method of PCB template
CN108254380A
PCB maintenance system and maintenance method based on false point defect detection
CN110579479A