A method for detecting coating quality of PCB board
Through industrial cameras, the images of PCB boards are collected and image-processed, bubble characteristics are extracted and bubble size is calculated, which solves the problem that bubbles affect the flatness and insulation performance of the coating during the PCB board coating process, and effectively detects and improves the bubbles.
Patent Information
- Application Number
- CN202410250146.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-05
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-03-05
AI Technical Summary
The bubbles or bubbles that occur during the coating of PCB boards affect the flatness and insulation properties of the coating, and the prior art is difficult to effectively detect and solve.
The PCB board images are collected by industrial cameras, and through image segmentation, edge filtering, bubble feature extraction and size calculation, combined with morphological operations and contour detection algorithms, bubble results are classified, and detection conclusions and suggestions are output.
Effective detection of the coated bubbles of PCB board is achieved, the flatness and insulation performance of the coating are improved, and the bubble problem is solved.
Smart Images

Figure CN117994243B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of PCB board detection, and in particular to a PCB board coating quality detection method. Background Art
[0002] PCB is the abbreviation of printed circuit board. It is a substrate used to support and connect electronic components. It is made of insulating material and covered with a conductive layer pattern. By drawing circuit paths on the conductive layer, the PCB can provide a reliable electrical connection and mechanical support, allowing electronic components to be installed and connected to each other.
[0003] When PCB boards are coated with conformal coating, bubbles or blistering may occur due to the presence of impurities such as oil, moisture or dust on the surface, or the air squeezed into the coating film during the coating process, which affects the flatness and insulation performance of the coating. Therefore, a PCB board coating quality detection method is proposed to solve the above problems. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] In view of the deficiencies in the prior art, the present invention provides a PCB board coating quality detection method, which has the advantages of detecting bubbles, etc., and solves the problem of blistering or bubbles affecting the flatness and insulation performance of the coating.
[0006] (II) Technical solution
[0007] In order to achieve the above-mentioned purpose of detecting bubbles, the present invention provides the following technical solutions:
[0008] A PCB coating quality detection method comprises the following steps:
[0009] S1. Use an industrial camera to capture images of PCB boards, segment the PCB images, and obtain a map of the conformal coating coverage area;
[0010] S2. Perform edge filtering on the image of the area covered by the conformal coating to obtain an image containing bubble edge information;
[0011] S3. extracting bubble features in the image of the area covered by the three-proof paint to obtain a bubble feature map set;
[0012] S4. traverse the bubble feature map set, calculate the bubble size according to the bubble feature map in turn, and obtain a bubble result set;
[0013] S5. Classify the bubble result set to obtain the detection result;
[0014] S6. Output conclusions and suggestions based on the test results.
[0015] Preferably, the specific steps of segmenting the PCB image in step S1 are:
[0016] S1.1. Load the acquired PCB board image into the image file using the image processing library (OpenCV);
[0017] S1.2. Use weighted average method to convert the image into grayscale image;
[0018] S1.3. Compare the pixel values of the traversal grayscale image with the grayscale value threshold, and divide the pixels whose pixel values are within the grayscale value threshold into the three-conformal paint coverage area map, otherwise divide them into other areas.
[0019] Preferably, the gray value threshold in step S1.3 is obtained by:
[0020] S1.3.1. Apply conformal coating to the PCB without any electronic components mounted on it;
[0021] S1.3.2. Use the image processing library (OpenCV) to load the image file and obtain the grayscale value of the image;
[0022] S1.3.3. Calculate grayscale value threshold by grayscale value
[0023] Gray value - α<<Gray value threshold<<Gray value + α
[0024] Among them, α is the correction coefficient.
[0025] Preferably, the specific steps of the edge filtering process in step S2 are:
[0026] S2.1. Use the Sobel operator to calculate the horizontal and vertical gradients of the image of the area covered by the conformal coating;
[0027] The calculation formula is:
[0028] Among them G x and G y Represent the gradient values in the horizontal and vertical directions respectively;
[0029] S2.2. According to the set threshold, the gradient amplitude is binarized, and pixels exceeding the threshold are marked as edge points, and pixels below the threshold are marked as non-edge points;
[0030] S2.3. Re-mark some pixels marked as non-edge points but adjacent to edge points as edge points to obtain more complete edge information;
[0031] S2.4. Obtain an image containing bubble edge information.
[0032] Preferably, the specific method for extracting bubble features in step S3 is:
[0033] S3.1. According to the threshold of edge strength, the edge image is divided into two binary images, one of which contains obvious edge features and the other contains background or noise;
[0034] S3.2. Use morphological operations to further enhance edge features and fill in broken edges.
[0035] Specific methods of using morphological operations to enhance edge features:
[0036] S3.2.1. Define a circular structure element, the radius of which is β;
[0037] S3.2.2. Traverse the pixel points in the edge feature map, cover the structure element at the position, and take the maximum pixel value in the covered area as the pixel value of the current position;
[0038] S3.2.3. Repeat the operation in S3.2.2 for multiple iterations to enhance the effect, and each iteration uses the result of the previous iteration as input;
[0039] S3.2.4. Obtain an image with enhanced edge features.
[0040] Preferably, the specific steps of calculating the bubble size and obtaining the bubble result set in step S4 are:
[0041] S4.1. According to the bubble feature map, use the contour detection algorithm-findContours function to extract the contour of each bubble;
[0042] S4.2. Use the contourArea function in the OpenCV library to calculate the area of the contour;
[0043] S4.3. performing area conversion calculation according to the contour area of each bubble in combination with the resolution or scale parameter of the image, thereby obtaining a bubble value;
[0044] S4.4. Add the bubble value to the bubble result set.
[0045] Preferably, the specific steps of classifying the bubble result set to obtain the detection result in step S5 are:
[0046] S5.1. Set the bubble classification threshold γ, where γ is a positive integer between 0 and 300, and set a small bubble set A and a large bubble set B;
[0047] S5.2. Traverse the bubble result set. When 0≤current bubble value≤γ, add the current bubble value to A, otherwise add it to B; S5.3. Count A and B to get the detection result.
[0048] Preferably, the specific steps of calculating the test results by counting A and B in step S5.3 are:
[0049] S5.3.1. Set the bubble ratio threshold to θ, the detection result to Ф, and obtain the number of elements M of set A and the number of elements N of set B;
[0050] S5.3.2. Determine the size of N and θ, the size of M and θ, and output Ф.
[0051] (III) Beneficial effects
[0052] Compared with the prior art, the present invention provides a PCB coating quality detection method, which has the following beneficial effects:
[0053] The PCB coating quality detection method detects the bubble situation of the PCB board by segmenting the collected PCB image, obtaining the three-proof paint coverage area map, and then performing edge filtering, extracting bubble features, calculating bubble size and other steps, and classifying the bubble result set to obtain conclusions and suggestions, thereby realizing the detection of PCB coating bubbles and solving the problem of blistering or bubbles on the PCB, which affects the flatness and insulation performance of the coating. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A schematic diagram of a detection process of a PCB coating quality detection method proposed by the present invention;
[0055] Figure 2 A schematic diagram of an edge filtering process of a PCB coating quality detection method proposed by the present invention;
[0056] Figure 3 A schematic flow chart of a grayscale threshold acquisition method for a PCB coating quality detection method proposed in the present invention. DETAILED DESCRIPTION
[0057] The following will be combined with 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 only 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] See also Figure 1-3 , a PCB board coating quality detection method, comprising the following steps:
[0059] S1. Use an industrial camera to capture images of PCB boards, segment the PCB images, and obtain a map of the conformal coating coverage area;
[0060] S2. Perform edge filtering on the image of the area covered by the conformal coating to obtain an image containing bubble edge information;
[0061] S3. extracting bubble features in the image of the area covered by the three-proof paint to obtain a bubble feature map set;
[0062] S4. traverse the bubble feature map set, calculate the bubble size according to the bubble feature map in turn, and obtain a bubble result set;
[0063] S5. Classify the bubble result set to obtain the detection result;
[0064] S6. Output conclusions and suggestions based on the test results
[0065]
[0066] In this embodiment, the specific steps of segmenting the PCB image in step S1 are:
[0067] S1.1. Load the acquired PCB board image into the image file using the image processing library (OpenCV);
[0068] S1.2. Use weighted average method to convert the image into grayscale image;
[0069] Among them, the grayscale image conversion steps are as follows:
[0070] Read a color image, which includes the pixel values of the red channel (R), green channel (G), and blue channel (B);
[0071] For each pixel's RGB value (R, G, B), use the following formula to calculate the corresponding grayscale value;
[0072] Gray value = 0.2989 × R + 0.5870 × G + 0.1140 × B (the weights of 0.2989, 0.5870, and 0.1140 come from the sensitivity of the human eye to different colors);
[0073] Applying the calculated grayscale value to the corresponding pixel position to obtain a grayscale image;
[0074] Repeat the above steps until all pixels are converted into grayscale values, and the final result is a grayscale image.
[0075] S1.3. Compare the pixel values of the traversal grayscale image with the grayscale value threshold, and divide the pixels whose pixel values are within the grayscale value threshold into the three-conformal paint coverage area map, otherwise divide them into other areas.
[0076] In this embodiment, the gray value threshold is obtained in step S1.3:
[0077] S1.3.1. Apply conformal coating to the PCB without any electronic components mounted on it;
[0078] S1.3.2. Use the image processing library (OpenCV) to load the image file and obtain the grayscale value of the image;
[0079] S1.3.3. Calculate grayscale value threshold by grayscale value
[0080] Gray value - α<<Gray value threshold<<Gray value + α
[0081] Among them, α is the correction coefficient;
[0082] The steps to obtain the α correction coefficient are as follows:
[0083] S1.3.3.1. Traverse the grayscale value X of each pixel in the image n , get the grayscale mean W;
[0084] S1.3.3.2.
[0085] In this embodiment, the specific steps of edge filtering processing in step S2 are:
[0086] S2.1. Use the Sobel operator to calculate the horizontal and vertical gradients of the image of the area covered by the conformal coating;
[0087] The calculation formula is:
[0088] Among them G x and G y Represent the gradient values in the horizontal and vertical directions respectively;
[0089] S2.2. According to the set threshold, the gradient amplitude is binarized, and pixels exceeding the threshold are marked as edge points, and pixels below the threshold are marked as non-edge points;
[0090] S2.3. Re-mark some pixels marked as non-edge points but adjacent to edge points as edge points to obtain more complete edge information;
[0091] S2.4. Obtain an image containing bubble edge information.
[0092] In this embodiment, the specific method of extracting bubble features in step S3 is:
[0093] S3.1. According to the threshold of edge strength, the edge image is divided into two binary images, one of which contains obvious edge features and the other contains background or noise;
[0094] S3.2. Use morphological operations to further enhance edge features and fill in broken edges.
[0095] Specific methods of using morphological operations to enhance edge features:
[0096] S3.2.1. Define a circular structure element, the radius of which is β;
[0097] S3.2.2. Traverse the pixel points in the edge feature map, cover the structure element at the position, and take the maximum pixel value in the covered area as the pixel value of the current position;
[0098] S3.2.3. Repeat the operation in S3.2.2 for multiple iterations to enhance the effect, and each iteration uses the result of the previous iteration as input;
[0099] S3.2.4. Obtain an image with enhanced edge features.
[0100] In this embodiment, the specific steps of calculating the bubble size in step S4 and obtaining the bubble result set are:
[0101] S4.1. According to the bubble feature map, use the contour detection algorithm-findContours function to extract the contour of each bubble;
[0102] S4.2. Use the contourArea function in the OpenCV library to calculate the area of the contour;
[0103] S4.3. performing area conversion calculation according to the contour area of each bubble in combination with the resolution or scale parameter of the image, thereby obtaining a bubble value;
[0104] Among them, the specific steps of area conversion calculation are:
[0105] When the scale parameter of the image is known:
[0106] If the area of the bubble outline in the original image is A1, and the image scale parameter is P1 (i.e., a certain length corresponds to the number of pixels in the image), it needs to be converted to an actual area of A2, and the corresponding scale parameter is P2 (i.e., a certain length corresponds to a unit length in the real world). The following formula can be used for conversion:
[0107] A2=(A1 / P1)×(P2 2 );
[0108] When the resolution of the image is known:
[0109] If the area of the bubble outline in the original image is A1, and the resolution of the image is R1 (i.e., the number of pixels in the image), it needs to be converted to an actual area of A2, and the corresponding resolution is R2 (i.e., the number of unit areas in the real world). The following formula can be used for conversion:
[0110] A2 = (A1 × R2) / R1;
[0111] S4.4. Add the bubble value to the bubble result set.
[0112] In this embodiment, step S5 classifies the bubble result set to obtain the specific steps of the detection result:
[0113] S5.1. Set the bubble classification threshold γ, where γ is a positive integer between 0 and 300, and set a small bubble set A and a large bubble set B;
[0114] S5.2. Traverse the bubble result set. When 0≤current bubble value≤γ, add the current bubble value to A, otherwise add it to B; S5.3. Count A and B to get the detection result.
[0115] In this embodiment, the specific steps of calculating the detection results by counting A and B in step S5.3 are as follows:
[0116] S5.3.1. Set the bubble ratio threshold to θ, the detection result to Ф, and obtain the number of elements M of set A and the number of elements N of set B;
[0117] S5.3.2. Determine the size of N and θ, the size of M and θ, and output Φ;
[0118]
[0119] The beneficial effects of the present invention are as follows: the PCB coating quality detection method detects, by segmenting the collected PCB image to obtain a three-proof paint coverage area map, and then performs edge filtering processing, extracting bubble features, calculating bubble sizes and other steps to obtain the bubble situation of the PCB board, and classifies the bubble result set to obtain conclusions and suggestions, thereby realizing the detection of PCB coating bubbles and solving the problem that blistering or bubbles appear on the PCB and affect the flatness and insulation performance of the coating.
[0120] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A PCB coating quality detection method, characterized in that: The following steps are involved: S1. Use an industrial camera to capture images of PCB boards, segment the images of PCB boards, and obtain the conformal coating coverage area; S2. Perform edge filtering on the image of the area covered by the conformal coating to obtain an image containing bubble edge information; The specific steps of the edge filtering process are: S2.
1. Use the Sobel operator to calculate the gradient of the image of the area covered by the conformal coating; The calculation formula is: Among them G x and G y Represent the gradient values in the horizontal and vertical directions respectively; S2.
2. Binarize the gradient value according to the set threshold value, mark the pixels exceeding the threshold value as edge points, and mark the pixels below the threshold value as non-edge points; S2.
3. Re-mark some pixels marked as non-edge points but adjacent to edge points as edge points to obtain more complete edge information; S2.
4. Obtain an image containing bubble edge information; S3. extracting bubble features in the image of the area covered by the three-proof paint to obtain a bubble feature map set; The specific method for extracting bubble features: S3.
1. According to the threshold of edge strength, the edge image is divided into two binary images, one of which contains obvious edge features and the other contains background or noise; S3.
2. Use morphological operations to further enhance edge features and fill in broken edges; Specific methods of using morphological operations to enhance edge features: S3.2.
1. Define a circular structure element, the radius of which is β; S3.2.
2. Traverse the pixel points in the edge feature map, cover the structure element at the position, and take the maximum pixel value in the covered area as the pixel value of the current position; S3.2.
3. Repeat the operation in S3.2.2 for multiple iterations to enhance the effect, and each iteration uses the result of the previous iteration as input; S3.2.
4. Obtain an image with enhanced edge features; S4. traverse the bubble feature map set, calculate the bubble size according to the bubble feature map in turn, and obtain the bubble result set; S5. Classify the bubble result set to obtain the detection result; S5.
1. Set the bubble classification threshold γ, where γ is a positive integer between 0 and 300, and set a small bubble set A and a large bubble set B; S5.
2. Traverse the bubble result set. When 0≤current bubble value≤γ, add the current bubble value to A, otherwise add it to B; S5.
3. Count A and B to get the test result; S5.3.
1. Set the bubble ratio threshold as θ, the detection result as Ф, and obtain the number of elements M of the small bubble set A and the number of elements N of the large bubble set B; S5.3.
2. Determine the size of N and θ, the size of M and θ, and output Φ; S6. Output conclusions and suggestions based on the test results; 2. A PCB coating quality detection method according to claim 1, characterized in that: The specific steps of segmenting the PCB board image in step S1 are: S1.
1. Load the acquired PCB board image into the image file using the image processing library; S1.
2. Use weighted average method to convert the image into grayscale image; S1.
3. Compare the pixel values of the traversal grayscale image with the grayscale value threshold, and divide the pixels whose pixel values are within the grayscale value threshold into the conformal coating coverage area, otherwise divide them into other areas; Method for obtaining the gray value threshold: S1.3.
1. Apply conformal coating to PCB boards without electronic components mounted on them; S1.3.
2. Use the image processing library to load the image file and obtain the grayscale value of the image; S1.3.
3. Calculate the gray value threshold value by the gray value of the image; Gray value - α < gray value threshold < gray value + α Among them, α is the correction coefficient.
3. A PCB coating quality detection method according to claim 1, characterized in that: The specific steps of calculating the bubble size and obtaining the bubble result set in step S4 are as follows: S4.
1. According to the bubble feature map, use the contour detection algorithm-findContours function to extract the contour of each bubble; S4.
2. Use the contourArea function in the OpenCV library to calculate the area of the contour; S4.
3. Perform area conversion calculation based on the contour area of each bubble in combination with the resolution or scale parameter of the bubble feature map to obtain the bubble value; S4.
4. Add the bubble value to the bubble result set.
Citation Information
Cited By
A method and system for detecting the quality of three-proof coating of a PCB board
CN120182265B
