Image Processing-Based Method and System for Detecting Circuit Board Welding Defects
By using an image processing-based circuit board welding defect detection method, the image offset before and after welding is dynamically estimated. The degree of defect is quantified by using connected component analysis and coordinate changes of the control group. This solves the problem of low welding detection accuracy and achieves high-precision welding defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2026-03-10
AI Technical Summary
On automated circuit board welding production lines, industrial cameras are subject to limitations in installation position accuracy or the influence of mechanical vibrations on the production line, resulting in image position shifts before and after welding. Existing detection methods assume that the images before and after welding are perfectly aligned, leading to normal areas being misjudged as defects or defective areas being missed, thus reducing the accuracy of welding defect detection.
By using image processing-based methods, binary images before and after welding are obtained, region growing and connected component analysis are performed, the circularity and correlation of connected components are calculated, image offset is dynamically estimated, and the degree of defect is quantified by using the coordinate changes and area differences of the welding control group, thus realizing the detection of welding defects.
It effectively solves the problem of image position shift caused by installation position error and mechanical vibration, significantly reduces misjudgment and missed detection, improves the accuracy and robustness of welding defect detection, and is suitable for automated detection in complex industrial environments.
Smart Images

Figure CN121073897B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image data processing, and in particular to a circuit board welding defect detection method and system based on image processing. BACKGROUND
[0002] In the field of electronic manufacturing, as a carrier of electronic components and a key component of electrical connection, the welding quality of a circuit board (PCB) directly affects the performance stability and reliability of electronic products. With the development of consumer electronics, automotive electronics, industrial control and other industries, the integration of circuit boards is continuously improving, the component density is increasing, and the complexity of welding process is significantly increasing, which puts higher requirements on welding defect detection.
[0003] The current mainstream circuit board welding technology includes wave soldering, reflow soldering and other automatic welding processes. Wave soldering uses molten solder waves to weld circuit boards, which is suitable for welding of large quantities, single-sided or double-sided plug-in components; reflow soldering uses high-temperature gas or infrared radiation in a heating furnace to melt the solder paste pre-coated on the pads, thereby achieving the connection of surface mount devices (SMD) and circuit boards. Although these automatic welding technologies have achieved a high degree of automation, when facing high-density, miniaturized components (such as 01005 package components, Flip Chip chips, etc.), welding defects may still occur due to problems such as pad design, component coplanarity, and solder paste printing accuracy, such as pad falling off, bridging, monument, and virtual welding. Therefore, there is an urgent need for a circuit board welding defect detection method.
[0004] However, on the automatic welding production line of circuit boards, due to the installation position precision limitation of industrial cameras or the influence of production line mechanical vibration, it is difficult to ensure that the same position in the image is collected for each circuit board, resulting in unavoidable movement of the pre-welding and post-welding images. The traditional detection method assumes that the pre-welding and post-welding images are completely aligned, and directly matches the comparison area by fixing the coordinates (such as taking the center pixel point as the reference), but the actual offset will cause the position mismatch between the normal welding area and the corresponding pre-welding welding area. For example, a 50μm component mounting offset may cause a 2-3 pixel deviation between the center pixel point of the post-welding connected domain and the pre-welding welding area center, resulting in "normal area being misjudged as a defect" or "defect area being missed", reducing the precision of circuit board welding defect detection. SUMMARY
[0005] In order to solve the problem that industrial cameras are limited by installation position precision or affected by mechanical vibration of a production line, and it is difficult to ensure that the same position in the image is collected for each circuit board on the automatic welding production line of the circuit board, resulting in inevitable movement of the images before and after welding, and the traditional detection method assumes that the images before and after welding are completely aligned, and the matching and comparison areas are directly matched by fixed coordinates, but the actual offset will cause the position mismatch of the normal welding area and the corresponding pre-welding area to be welded, resulting in that the normal area is misjudged as a defect or the defect area is missed, and the precision of the welding defect detection of the circuit board is reduced, the application provides a circuit board welding defect detection method and system based on image processing.
[0006] In the first aspect, the application provides a circuit board welding defect detection method based on image processing, which adopts the following technical scheme:
[0007] The circuit board welding defect detection method based on image processing comprises the following steps: acquiring a pre-welding binary image and a post-welding binary image of a circuit board surface; performing region growing on all white pixel points in the post-welding binary image to obtain a plurality of connected domains; taking the circular degree value of each connected domain as the credibility of each connected domain being a post-welding region; based on the size of the credibility, acquiring a plurality of suspected post-welding normal regions; acquiring a plurality of comparison regions of each suspected post-welding normal region in the pre-welding binary image, determining the welding normal degree of each suspected post-welding normal region and each corresponding comparison region according to the correlation of the change curve between each post-welding region and each corresponding comparison region; taking the comparison region with the maximum welding normal degree and the corresponding suspected post-welding normal region as a welding comparison group, determining the change credibility value of each welding comparison group according to the module length and direction angle of the vector formed by the pixel points at the center of the minimum circumscribed circle of each welding comparison group in the same coordinate system; taking the coordinate change amount of the welding comparison group corresponding to the maximum value in the change credibility value as the offset change amount; based on the offset change amount, acquiring the welding region of each connected domain in the pre-welding binary image; determining the defect degree of each connected domain according to the offset change amount and the coordinate change amount and area difference of each connected domain and the welding region of each connected domain in the pre-welding binary image, and realizing the welding defect of the circuit board.
[0008] The beneficial effects are as follows: By introducing reliability assessment based on the circularity of connected components and correlation analysis of multiple control regions, the problem of image position shift before and after welding caused by installation position errors and mechanical vibration is effectively solved, avoiding mismatch between the normal welding area and the area to be welded, thus significantly reducing misjudgment and missed detection; by using the coordinate change vector of the welding control group to calculate the shift change, dynamic estimation and compensation of positional deviation between images are realized, making the welding defect detection method independent of fixed image alignment and enhancing the robustness of the method; by combining parameters such as the coordinate change and area of connected components, the degree of defect is quantified, improving the fineness and reliability of defect detection and more accurately reflecting the welding quality status; the influence of mechanical vibration of the production line and the uncertainty of industrial camera installation is fully considered, making it suitable for actual automated welding inspection scenarios and ensuring the stability and practicality of the detection system.
[0009] Furthermore, the method for obtaining the pre-welding binary image and the post-welding binary image is as follows: the pre-welding image and the post-welding image of the collected circuit board surface are respectively denoised and contrast enhanced, and then grayscale processing is performed to obtain the pre-welding grayscale image and the post-welding grayscale image. The pre-welding grayscale image and the post-welding grayscale image are respectively thresholded using the Otsu method to obtain the pre-welding binary image and the post-welding binary image.
[0010] Furthermore, the step of obtaining several suspected normal areas after welding includes: in response to the confidence level being greater than a preset judgment threshold, recording the corresponding connected components as suspected normal areas after welding.
[0011] Furthermore, the method for obtaining the reference area is as follows: for any suspected normal area after welding, the pixel at the center of the smallest circumcircle of the suspected normal area after welding is recorded as the center pixel of the suspected normal area after welding, and the multiple pre-marked areas to be welded in the binary image before welding that are closest to the pixel at the same coordinates as the center pixel are recorded as the reference area of the suspected normal area after welding.
[0012] Furthermore, the change curve is obtained as follows: For any suspected normal area after welding, in the binary image after welding, according to a fixed turning direction, the distance from each of the other suspected normal areas after welding to the center pixel of the suspected normal area after welding is obtained, resulting in a distance sequence of the suspected normal area after welding. Based on the distance sequence of the suspected normal area after welding, the change curve of the suspected normal area after welding is drawn. For any control area of the suspected normal area after welding, in the binary image before welding, according to a fixed turning direction, the distance from each of the other areas to be welded in the binary image before welding to the center pixel of the suspected normal area after welding is obtained, resulting in a distance sequence of the control area. Based on the distance sequence of the control area, the change curve of the control area is drawn.
[0013] The beneficial effects are as follows: by calculating the distance sequence between the center points of the suspected normal area after welding and its corresponding control area before welding, the spatial distribution characteristics between the areas can be accurately depicted, avoiding the errors caused by matching only single-point coordinates; by using the plotted change curves for correlation analysis, the structural similarity between the areas can be more comprehensively reflected, effectively reducing the impact of image movement, thereby improving the reliability of matching areas before and after welding.
[0014] Furthermore, the welding normality meets the following requirements:
[0015] In the formula, For the first The suspected normal area after welding is similar to the first The first suspected normal area after welding The welding normality of the control area For the first The suspected normal area after welding is similar to the first The first suspected normal area after welding The correlation between the change curves of the control regions.
[0016] The beneficial effects are as follows: the correlation is mapped to the welding normality through linear transformation, and the matching results are normalized to the [0,1] interval, which is convenient for intuitive understanding and subsequent comparison; the correlation measures the similarity of the change curve, integrates spatial relationship and shape features, reduces the influence of the deviation of a single feature, and thus improves the reliability of welding defect judgment.
[0017] Furthermore, the confidence value of the change satisfies:
[0018] In the formula, For the first The confidence value of the changes in the group welding control group Let be the mean of the magnitudes of the vectors formed by the pixels at the centers of the smallest circumcircles of all welding control groups in the same coordinate system. For the first The magnitude of the vector formed by the pixels at the center of the smallest circumcircle of the welding control group in the same coordinate system. Let be the mean of the direction angles of the vector formed by the pixels at the centers of the smallest circumcircles of all welding control groups in the same coordinate system. For the first The direction angle of the vector formed by the pixels at the center of the smallest circumcircle of the welding control group in the same coordinate system. As the first hyperparameter, This is the second hyperparameter. For the standard normalized function, It is the absolute value symbol.
[0019] The beneficial effects are as follows: by comparing the deviations of the coordinate vector magnitude and orientation angle of the control group from the overall mean, the consistency of the offset changes in each group of welding areas can be accurately assessed, reflecting the reliability of the welding position changes; the deviation index is normalized by using a standard normalization function, so that the deviations of the magnitude and orientation angle of different dimensions can be compared effectively at the same time, which facilitates a comprehensive judgment on the reliability of the changes in the welding control group.
[0020] Furthermore, the degree of defect satisfies:
[0021] In the formula, For the first The degree of defect of a connected component. and These represent the changes in the horizontal and vertical axes of the offset change, respectively. and The first The connected component and the first The changes in the x-coordinate and y-coordinate of each connected component in the binary graph before welding of the welded region. For the first The area of the welded region in the binary graph before welding of each connected component. For the first The area of each connected region. For the standard normalized function, It is the absolute value symbol.
[0022] The beneficial effects are as follows: the defect degree combines the differences in the horizontal and vertical coordinates of the connected domains with the area changes, comprehensively reflecting the spatial offset and dimensional changes of the welding area, and effectively capturing subtle anomalies that occur during the welding process; through standard normalization processing, parameters of different dimensions are unified, ensuring that the contribution of position and area changes to the defect degree is balanced, and improving the scientificity and accuracy of defect judgment; the defect degree adopts an average value method to integrate multiple indicators, sensitively revealing abnormal areas relative to the overall offset, reducing the possibility of misjudgment, and enhancing the accuracy of defect detection.
[0023] Furthermore, the implementation of image processing-based circuit board soldering defect detection includes: in response to the defect severity being greater than a preset defect threshold, recording the corresponding area of the connected component on the circuit board surface as a defect area, thereby completing the image processing-based circuit board soldering defect detection.
[0024] Secondly, the present invention provides a circuit board welding defect detection system based on image processing, which adopts the following technical solution:
[0025] The circuit board welding defect detection system based on image processing includes a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the aforementioned circuit board welding defect detection method based on image processing.
[0026] By adopting the above technical solution, the above-mentioned image processing-based circuit board welding defect detection method is generated into a computer program and stored in a memory so that it can be loaded and executed by a processor. In this way, a terminal device can be made based on the memory and the processor for convenient use.
[0027] The present invention has the following technical effects:
[0028] (1) By performing region growing on the white pixels of the binary image after welding, connected components are extracted and the circularity value is calculated as a reliability index. Connected components with higher circularity (such as standard solder joints which are usually circular or near-circular) are preferentially identified as "suspected normal areas after welding", thereby eliminating interference areas caused by abnormal factors such as component placement offset and pad deformation, and ensuring that the reference area for subsequent matching is closer to the actual welding situation. For each suspected normal area, multiple control areas are generated in the binary image before welding. The "welding normality" is determined by calculating the correlation between the two change curves, and the control area with the highest matching degree is selected as the "welding control group". Based on the coordinates of the minimum circumscribed circle center of the welding control group, the vector magnitude and direction angle are calculated to quantify the direction and distance of image offset (i.e., "offset change"). This process does not rely on a fixed coordinate reference, but dynamically matches the coordinate changes of the normal welding area to adaptively compensate for image movement caused by production line vibration or installation error, avoiding the position mismatch problem caused by "fixed coordinate matching" in traditional methods.
[0029] (2) By calculating the correlation of the change curves (such as grayscale change trends, edge feature matching degree, etc.), the post-weld area is allowed to dynamically match the pre-weld control area within a certain range. It is only judged as abnormal when the correlation is lower than the threshold, which significantly reduces misjudgments caused by positional offset. The coordinate correspondence between the pre-weld and post-weld areas is calibrated using the offset change amount to ensure that each connected region is accurately aligned with its pre-weld area. By comparing the coordinate change amount (reflecting the degree of positional offset) and the area change amount (reflecting the size of the solder joint, solder accumulation or missing status), a defect degree assessment model is constructed.
[0030] (3) By excluding low-confidence connected regions (such as noise areas like welding slag and stains) and focusing on high-confidence suspected normal areas, the impact of environmental interference such as production line vibration and light changes on the test results is effectively suppressed, ensuring the stability of the test in complex industrial environments. Attached Figure Description
[0031] Figure 1This is a flowchart of the circuit board welding defect detection method based on image processing in an embodiment of the present invention.
[0032] Figure 2 This is a schematic diagram of the post-welding image in the circuit board welding defect detection method based on image processing according to an embodiment of the present invention.
[0033] Figure 3 This is a schematic diagram of the grayscale image after welding in the circuit board welding defect detection method based on image processing according to an embodiment of the present invention.
[0034] Figure 4 This is a schematic diagram of the binary image after welding in the circuit board welding defect detection method based on image processing according to an embodiment of the present invention. Detailed Implementation
[0035] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0036] This invention discloses a circuit board soldering defect detection method based on image processing, referring to... Figure 1 This includes steps S1-S5:
[0037] S1: Obtain the binary image of the circuit board surface before and after soldering.
[0038] It should be noted that, on the automated circuit board welding production line, the circuit boards are fixed on both sides of the conveyor belt to prevent angular displacement. Vertical industrial cameras are set at the beginning and end of the automated circuit board welding production line to take vertical pictures of the circuit board surface before and after welding, generating images of the circuit board surface before and after welding.
[0039] Specifically, the binary images before and after welding are obtained as follows:
[0040] Images of the circuit board surface before and after soldering were collected (see image below for post-soldering image). Figure 2 The image is then denoised and contrast enhanced, followed by grayscale conversion to obtain the grayscale image before and after welding (see [link to grayscale image after welding]). Figure 3 The grayscale images before and after welding are segmented using the Otsu method (for example, the threshold is 134) to obtain the binary images before and after welding.
[0041] S2: Obtain the suspected normal area after welding in the binary image after welding.
[0042] It should be noted that, as Figure 4 As shown, after soldering the circuit board, the soldered area often appears as a regular silver-white circular area, while other areas often appear as irregularly shaped silver-white areas. Therefore, this step obtains all connected components in the binary graph after soldering and calculates the circularity value of the connected components to initially distinguish the suspected normal area after soldering from other areas.
[0043] For all white pixels in the binary image after welding, perform region growing to obtain multiple connected regions; use the circularity value of each connected region as the confidence level that each connected region is a welded region; based on the confidence level, obtain several suspected normal welded regions.
[0044] The circularity values satisfy:
[0045] ;
[0046] In the formula, Let be the circularity value of the connected component. Let the area of the connected region be . The circularity value ranges from the perimeter of the connected region obtained through chain code or boundary tracing. Between these values, the roundness value is 1 for a perfect circle.
[0047] Specifically, acquiring several suspected normal areas after welding includes:
[0048] In response to the confidence level being greater than a preset judgment threshold, the corresponding connected component is recorded as a suspected normal region after welding.
[0049] The implementers can set the judgment threshold according to the specific implementation situation. For example, 0.8. If the number of suspected normal areas after soldering is not greater than 1, it means that the circuit board has a serious defect and no further defect detection is required.
[0050] S3: Obtain multiple control areas in the binary image before welding for suspected normal areas after welding, and determine the welding normality of the suspected normal areas after welding and each corresponding control area.
[0051] It should be noted that, due to the limitation of angular offset, but the different positions of the two industrial cameras, complete synchronization cannot be guaranteed when acquiring images of the circuit board before and after soldering. This results in translational shifts in the images before and after soldering. A suspected normal area after soldering may appear at a certain location in the post-soldering binary image, but not necessarily at the same location in the pre-soldering image. This is because phenomena such as bridging (excessive solder causing two soldered areas to merge), spikes (solder ends too late, resulting in spikes at the solder edges), and offset (solder position shift causing solder displacement) can cause different changes in the position of the solder after soldering. Therefore, this step determines the corresponding region in the pre-soldering binary image based on the suspected normal area after soldering.
[0052] It needs further explanation that, since defective welded areas may exist within all extracted suspected normal post-weld areas, if the center point of a suspected normal post-weld area is used to correspond to the theoretical center point of that area before welding, even excluding image offset (due to vibrations during production line operation, and the possibility that the images captured by the beginning and end of the production line may not be perfectly identical due to settings differences), the two points will still not be in the same location. However, the center point of a suspected normal post-weld area with defects will still correspond to an area distributed around the theoretical center point in the binary image before welding. Therefore, this step addresses the coordinate offset problem caused by defects by expanding the search range (based on the minimum circumcircle) and using multi-reference area matching (taking the nearest multiple areas to be detected), ensuring that even with abrupt positional changes, the most likely corresponding area can still be found in the image before welding.
[0053] For each suspected normal area after welding, multiple control areas are obtained in the binary image before welding. Based on the correlation between the change curves of each post-weld area and each corresponding control area, the welding normality of each suspected normal area after welding and each corresponding control area is determined.
[0054] Specifically, the method for obtaining the control region is as follows:
[0055] For any suspected normal area after welding, the pixel at the center of the smallest circumcircle of the suspected normal area after welding is recorded as the center pixel of the suspected normal area after welding. The multiple pre-marked areas to be welded in the binary image before welding that are closest to the pixel with the same coordinates as the center pixel are recorded as the control area of the suspected normal area after welding.
[0056] The implementer can set the number of pre-marked areas to be welded that are closest to the pixel with the same coordinates as the center pixel in the binary image before welding, for example, the top 5 areas to be detected that are closest to the center pixel. If a suspected normal area after welding is located at the edge of the circuit board, only the part of the smallest circumscribed circle located on the circuit board will be selected for operation.
[0057] Specifically, the method for obtaining the change curve is as follows:
[0058] For any suspected normal area after welding, in the binary image after welding, according to a fixed turning direction, obtain the distance from each of the other suspected normal areas after welding to the center pixel of the suspected normal area after welding, and obtain the distance sequence of the suspected normal area after welding. Based on the distance sequence of the suspected normal area after welding, draw the change curve of the suspected normal area after welding.
[0059] For any control region of the suspected normal area after welding, in the binary image before welding, according to a fixed turning direction, obtain the distance from the center pixel of each other area to be welded in the binary image before welding to the suspected normal area after welding, and obtain the distance sequence of the control region. Based on the distance sequence of the control region, draw the change curve of the control region.
[0060] The implementers can set the turning direction according to the specific implementation situation. For example, counterclockwise. The turning direction needs to be consistent in the binary image before and after soldering on the same circuit board surface.
[0061] Specifically, the welding normality meets the following requirements:
[0062] ;
[0063] In the formula, For the first The suspected normal area after welding is similar to the first The first suspected normal area after welding The welding normality of the control area For the first The suspected normal area after welding is similar to the first The first suspected normal area after welding The correlation between the change curves of the control regions.
[0064] Wherein, the correlation is the Pearson correlation coefficient, because the Pearson correlation coefficient is... Between, here use Come to Processing was performed to make the Pearson correlation coefficient at between.
[0065] S4: Obtain welding control groups and determine the confidence value of the change for each welding control group.
[0066] It should be noted that the spatial distribution of the soldering control groups should conform to the global consistency of the circuit board design (such as the regular arrangement of component arrays), while image offset will cause the coordinates of all soldering control groups to deviate synchronously from their theoretical positions. Therefore, this step distinguishes between coordinate changes caused by "global offset" and "local soldering defects" by statistically analyzing the vector feature distribution of all soldering control groups. Therefore, this step determines the confidence value of the change for each soldering control group by calculating the vector magnitude (length of the vector) and orientation angle (the angle between the vector and the coordinate axis, ensuring that either the X-axis or Y-axis is selected).
[0067] The control area with the highest welding normality and the corresponding suspected normal area after welding are recorded as welding control groups. The change confidence value of each welding control group is determined based on the magnitude and direction angle of the vector formed by the pixels at the center of the smallest circumcircle of each welding control group in the same coordinate system.
[0068] Specifically, the confidence value of the change satisfies:
[0069] ;
[0070] In the formula, For the first The confidence value of the changes in the group welding control group Let be the mean of the magnitudes of the vectors formed by the pixels at the centers of the smallest circumcircles of all welding control groups in the same coordinate system. For the first The magnitude of the vector formed by the pixels at the center of the smallest circumcircle of the welding control group in the same coordinate system. Let be the mean of the direction angles of the vector formed by the pixels at the centers of the smallest circumcircles of all welding control groups in the same coordinate system. For the first The direction angle of the vector formed by the pixels at the center of the smallest circumcircle of the welding control group in the same coordinate system. As the first hyperparameter, This is the second hyperparameter. For the standard normalized function, It is the absolute value symbol.
[0071] in, It reflects the degree of deviation between the vector magnitude and the mean; the smaller the deviation, the higher the confidence value of the change. It reflects the degree of deviation of the direction angle from the mean; the smaller the deviation, the higher the reliability of the change.
[0072] The coordinate change of the welding control group corresponding to the maximum value among the aforementioned confidence values is recorded as the offset change.
[0073] S5: Obtain the defect area on the surface of the circuit board to realize the soldering defects of the circuit board.
[0074] It should be noted that welding defects (such as offset, bridging, and pad detachment) can cause anomalies in the coordinate offset (reflecting positional consistency) and area change (reflecting abnormal solder amount) between the connected regions after welding and the areas to be welded before welding. Therefore, this step requires comparing the actual coordinate change of each connected region with the global offset change to eliminate the influence of image movement, retain only the local offset caused by welding defects, and comprehensively assess the degree of defect by combining the area change.
[0075] Based on the offset change, the welding area of each connected component in the binary image before welding is obtained; according to the offset change and the coordinate change and area difference between each connected component and the welding area of each connected component in the binary image before welding, the defect degree of each connected component is determined, thereby realizing the welding defects of the circuit board.
[0076] Specifically, the degree of defect satisfies:
[0077] ;
[0078] In the formula, For the first The degree of defect of a connected component. and These represent the changes in the horizontal and vertical axes of the offset change, respectively. and The first The connected component and the first The changes in the x-coordinate and y-coordinate of each connected component in the binary graph before welding of the welded region. For the first The area of the welded region in the binary graph before welding of each connected component. For the first The area of each connected region. For the standard normalized function, It is the absolute value symbol.
[0079] in, It reflects the difference between local coordinate changes and global offset; the greater the difference, the higher the likelihood of a defect. It reflects changes in solder amount (an increase in area may indicate bridging, while a decrease may indicate a cold solder joint); the average of the three factors is used as a comprehensive measure of the defect severity to avoid misjudgment based on a single dimension.
[0080] Specifically, the implementation of image processing-based circuit board soldering defect detection includes:
[0081] In response to the defect severity being greater than a preset defect threshold, the corresponding area of the connected component on the circuit board surface is recorded as a defect area, thus completing the circuit board soldering defect detection based on image processing.
[0082] Implementers can set the defect threshold according to the specific implementation situation, for example, 0.5.
[0083] This invention also discloses an image processing-based circuit board soldering defect detection system, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the image processing-based circuit board soldering defect detection method according to this invention.
[0084] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.
[0085] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for detecting a soldering defect of a circuit board based on image processing, characterized by, The method comprises the following steps: obtaining a pre-welding binary image and a post-welding binary image of a circuit board surface; performing region growing on all white pixel points in the post-welding binary image to obtain a plurality of connected domains; taking a circular degree value of each connected domain as a credibility of each connected domain being a post-welding region; and obtaining a plurality of suspected post-welding normal regions based on the size of the credibility; obtaining a plurality of comparison regions of each suspected post-welding normal region in the pre-welding binary image, determining a welding normality of each suspected post-welding normal region and each corresponding comparison region according to a correlation of a change curve between each post-welding region and each corresponding comparison region; taking a comparison region corresponding to a maximum welding normality and a corresponding suspected post-welding normal region as a welding comparison group, and determining a change credibility of each welding comparison group according to a module length and a direction angle of a vector formed by a pixel point at a center of a minimum circumscribed circle of each welding comparison group in a same coordinate system; taking a coordinate change amount of the welding comparison group corresponding to a maximum value in the change credibility as an offset change amount; obtaining a welding region of each connected domain in the pre-welding binary image based on the offset change amount; determining a defect degree of each connected domain according to the offset change amount and a coordinate change amount and an area difference of each connected domain and the welding region of each connected domain in the pre-welding binary image, so as to realize welding defect detection of the circuit board based on image processing.
2. The image processing-based circuit board solder joint defect detection method according to claim 1, characterized by, The pre-welding binary image and the post-welding binary image are obtained in the following manner: performing denoising and contrast enhancement on a pre-welding image and a post-welding image collected from a circuit board surface, and then performing grayscale processing to obtain a pre-welding grayscale image and a post-welding grayscale image; and performing threshold segmentation on the pre-welding grayscale image and the post-welding grayscale image by using the Otsu method to obtain the pre-welding binary image and the post-welding binary image.
3. The image processing-based circuit board solder joint defect detection method of claim 1, wherein, The suspected post-welding normal regions are obtained in the following manner: in response to the credibility being greater than a preset judgment threshold, taking the corresponding connected domain as a suspected post-welding normal region.
4. The image processing-based circuit board solder joint defect detection method of claim 1, wherein, The comparison regions are obtained in the following manner: for any suspected post-welding normal region, taking a pixel point at a center of a minimum circumscribed circle of the suspected post-welding normal region as a center pixel point of the suspected post-welding normal region, and taking a plurality of pre-marked to-be-welded regions in the pre-welding binary image closest to the center pixel point as comparison regions of the suspected post-welding normal region.
5. The image processing-based circuit board solder joint defect detection method of claim 4, wherein, The change curve is obtained in the following manner: for any suspected post-welding normal region, obtaining distances from each suspected post-welding normal region to the center pixel point of the suspected post-welding normal region in the post-welding binary image according to a fixed turning direction to obtain a distance sequence of the suspected post-welding normal region, and drawing a change curve of the suspected post-welding normal region based on the distance sequence of the suspected post-welding normal region. For any control region of the suspected post-weld normal region, in the pre-weld binary image, the distance from each remaining to-be-welded region to the center pixel point of the suspected post-weld normal region is obtained in a fixed turning direction, a distance sequence of the control region is obtained, and a change curve of the control region is drawn based on the distance sequence of the control region.
6. The image processing-based circuit board solder joint defect detection method of claim 1, wherein, The welding normality satisfies: ; In the formula, For the first The suspected normal area after welding is similar to the first The first suspected normal area after welding The welding normality of the control area For the first The suspected normal area after welding is similar to the first The first suspected normal area after welding The correlation between the change curves of the control regions.
7. The image processing-based circuit board solder joint defect detection method of claim 1, wherein, The change credibility satisfies: ; wherein is the minimum circumscribed circle of the i-th welding control group, is the change reliability of the i-th welding control group, is the average of the lengths of the vectors formed by the pixel points at the center of the minimum circumscribed circle of all welding control groups in the same coordinate system, is the minimum circumscribed circle of the i-th welding control group, is the length of the vector formed by the pixel points at the center of the minimum circumscribed circle of the i-th welding control group in the same coordinate system, is the average of the direction angles of the vectors formed by the pixel points at the center of the minimum circumscribed circle of all welding control groups in the same coordinate system, is the minimum circumscribed circle of the i-th welding control group, is the direction angle of the vector formed by the pixel points at the center of the minimum circumscribed circle of the i-th welding control group in the same coordinate system, is the first hyperparameter, is the second hyperparameter, is the standard normalization function, is the absolute value symbol.
8. The image processing-based circuit board solder joint defect detection method of claim 1, wherein, The defect degree satisfies: ; In the formula, is the defect degree of the th connected domain, and are the horizontal coordinate change and the vertical coordinate change in the offset change, respectively, and are the horizontal coordinate change and the vertical coordinate change of the th connected domain and the th connected domain in the welding area of the binary image before welding, respectively, is the area of the th connected domain in the welding area of the binary image before welding, is the area of the th connected domain, is a standard normalization function, is an absolute value symbol.
9. The image processing-based circuit board solder joint defect detection method of claim 1, wherein, The implementation of the image processing-based circuit board welding defect detection includes: In response to the defect degree being greater than a preset defect threshold, the connected domain in the corresponding region on the surface of the circuit board is recorded as a defect region, and the image processing-based circuit board welding defect detection is completed.
10. A circuit board soldering defect detection system based on image processing, characterized by, It includes: A processor and a memory, the memory stores computer program instructions, when the computer program instructions are executed by the processor, the image processing-based circuit board welding defect detection method according to any one of claims 1-9 is realized.
Citation Information
Patent Citations
Wedge-shaped welding spot detection method and motion control device
CN115876786A
Displacement component detection apparatus, displacement component detection method, and computer-readable recording medium
US20200292411A1