Electronic component welding spot detection method and system
By extracting the grayscale gradient direction and the intensity change trend of neighboring pixels in the solder joint area, analyzing the continuous grayscale blocks inside the solder joint, and combining morphological operations to process isolated pixels and hollow pixels, a solder joint structure recognition layer is generated. This solves the problem of difficulty in identifying subtle defects in traditional solder joint detection methods, and improves detection accuracy and classification efficiency.
Patent Information
- Application Number
- CN202511984538.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-04-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional solder joint inspection methods are difficult to effectively handle minute defects on high-density circuit boards, leading to missed detections or misjudgments. Furthermore, they fail to fully consider the diversity of solder joints under different operating conditions, affecting the accuracy and reliability of the inspection.
By extracting the grayscale gradient direction and the intensity change trend of neighboring pixels in the solder joint area, analyzing the continuous grayscale blocks inside the solder joint, and combining morphological operations to process isolated pixels and hollow pixels, a solder joint structure recognition layer is generated. Grayscale consistency and edge stability are optimized to form a solder joint defect type detection and discrimination dataset.
It improved the detection rate and classification accuracy of solder joint defects, reduced false detections, and optimized the efficiency of solder joint defect classification and area identification.
Smart Images

Figure CN121883390A_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 detecting solder joints of electronic components. Background Technology
[0002] The field of defect detection technology refers to the use of various technical means to detect, identify, and analyze the quality of products or components during various manufacturing, production, or assembly processes to ensure that they meet design requirements and have good performance. This field encompasses a variety of technical means, including visual inspection, sensor inspection, acoustic wave inspection, and X-ray inspection. Visual inspection is a common method that uses high-precision camera equipment and image processing algorithms to conduct detailed observation and analysis of the surface or interior of objects. It is widely used in industries such as electronics, automobiles, and medical devices. With the continuous development of technology, intelligent and automated defect detection systems are gradually becoming mainstream, especially in the production and assembly of electronic components, where quality control is of paramount importance.
[0003] Traditional electronic component solder joint inspection methods involve visual or sensor-based checks to verify whether the solder joints meet standards. These methods employ manual inspection or automated equipment combined with simple image processing algorithms to detect defects such as short circuits, cold solder joints, and overheating. The core of these methods is to image the solder joints under specific visual conditions using a camera or sensor, and then determine defects based on pre-defined rules. Common inspection techniques include image processing-based solder joint morphology analysis, size comparison, and surface reflectivity analysis. The quality of the solder joints is judged by setting thresholds and detecting the brightness and edge features of the solder joint area.
[0004] Existing technologies rely on traditional vision or sensor methods to detect solder joints using simple image processing algorithms, primarily based on features such as the shape, size, and reflectivity of the solder joints in the image. This method has limitations in practical applications, especially when imaging the surface of high-density circuit boards. Due to the uneven grayscale distribution and complex local variations of solder joints, traditional algorithms struggle to effectively handle subtle defects, leading to missed detections or misjudgments in actual operation. Furthermore, traditional methods rely on fixed standard templates when identifying solder joint defects, failing to fully consider the diversity of solder joints under different operating conditions, resulting in insufficient ability to identify complex defects and consequently affecting overall detection accuracy and reliability. Summary of the Invention
[0005] To address the technical problems existing in the prior art, embodiments of the present invention provide a method for detecting solder joints of electronic components, comprising the following steps: To achieve the above objectives, the present invention adopts the following technical solution: a method for detecting solder joints of electronic components, comprising the following steps: S1: Based on the gray-level distribution structure of the solder joint area in the high-density circuit board surface imaging image, extract the local gray-level gradient direction of the solder joint and the intensity change trend of neighboring pixels, mark the gray-level continuity path, identify the spatial connectivity relationship of pixels in the solder joint area, and obtain the solder joint structure recognition layer. S2: Based on the solder joint structure recognition layer, extract continuous grayscale blocks inside the solder joint, analyze the local grayscale consistency and edge direction stability of the solder joint on the imaging plane, expand adjacent areas by grayscale direction and remove grayscale abrupt points to generate target solder joint integrity area blocks. S3: Based on the target solder joint integrity region map, mark the location set of isolated pixels and empty pixels, apply morphological connection operation to the location, merge adjacent small grayscale blocks, remove fragments with an area lower than the background noise standard, and obtain the solder joint outline closed layer. S4: Based on the target area data in the closed layer of the weld point contour, compare the structural characteristics of the standard weld point geometric template, match the predefined defect classification label according to the difference value, record the spatial location and attribute features, and form a weld point defect type detection and discrimination dataset.
[0006] As a further embodiment of the present invention, the solder joint structure recognition layer includes pixel distribution features, gray-level gradient direction set, and spatial connectivity weight parameters; the target solder joint integrity region patch includes gray-level consistency segments, edge direction aggregation areas, and gray-level anomaly removal markers; the solder joint contour closure layer includes closed boundary structures, void connection paths, and low-noise region filtering results; and the solder joint defect type detection and discrimination dataset includes contour curvature feature values, gray-level density distribution parameters, and edge offset indices.
[0007] As a further aspect of the present invention, the steps for defining the solder joint structure identification layer are as follows: S101: Based on the gray-scale distribution structure of the solder joint area in the high-density circuit board surface imaging image, extract the horizontal and vertical gray-scale values of the pixel and the gray-scale difference of its adjacent pixels, analyze the gray-scale gradient in the two directions, determine the intensity of gray-scale change, and generate a set of pixel gray-scale change intensity values. S102: Based on the set of pixel grayscale change intensity values, analyze the grayscale gradient direction of the pixel and its neighboring pixels, compare the consistency of the gradient direction of continuous pixels, identify monotonically changing pixel paths, record the path sequence and direction continuity, and generate a set of direction-maintaining path intensity values. S103: Call the set of direction-maintaining path strength values, filter paths with consistent directions among the boundary pixels of the solder joint, judge them according to linear continuity and map them to the image space to obtain the solder joint structure recognition layer.
[0008] As a further aspect of the present invention, the steps for creating the target solder joint integrity region block are as follows: S201: Based on the solder joint structure recognition layer, extract continuous gray blocks within the solder joint, count the gray difference between a pixel and its adjacent pixels, extract the edge direction stability value within the region, compare the edge direction stability difference between adjacent pixels, determine the range of change, and generate an edge direction stability interval. S202: Call the edge direction stability interval, filter the pixels whose edge direction stability difference meets the preset solder joint aggregation threshold, merge and detect the local edge concentration by region, determine the edge aggregation region as the expandable region, and generate the gray-scale direction extended primitive coordinate set; S203: Based on the gray-scale direction extended primitive coordinate set, extract neighboring pixels and compare the gray-scale change rate. After removing pixels whose gray-scale abrupt changes exceed a preset threshold, perform region reconstruction to obtain the target solder joint integrity region block.
[0009] As a further aspect of the present invention, the step of creating the closed layer of the solder joint outline specifically includes: S301: Based on the target solder joint integrity region block, extract pixels with low grayscale difference, mark the coordinates of pixels without neighbor connectivity, perform morphological connection on the set of points with adjacent distance less than a preset connection threshold, and obtain the number of void connection regions. S302: Call the number of void connection regions, filter the region area values, remove regions smaller than the preset background noise area threshold, merge connected blocks with connected boundaries, reconstruct the boundaries of the merged regions, and obtain the weld point outline closed layer.
[0010] As a further aspect of the present invention, the steps of the solder joint defect type detection and discrimination dataset are specifically as follows: S401: Call the target area in the closed layer of the weld point contour, extract the gray-scale direction change in the grid, identify the curvature range of each contour block, and obtain the contour curvature dispersion. S402: Based on the contour curvature dispersion, extract the boundary pixel density and the edge offset angle of the continuous gray segment, calculate the difference with the standard weld point geometric template of the same type of structure, identify the differences in edge offset, gray density and structural morphology, and summarize them into feature difference items to obtain the structural difference data of the target area. S403: Call the structural difference data of the target area, match the difference with the defect classification label discrimination threshold, record the spatial coordinates and corresponding labels of the areas that meet the conditions, and obtain the weld joint defect type detection and discrimination dataset.
[0011] As a further aspect of the present invention, the boundary pixel density and the continuous grayscale segment edge offset angle refer to the distribution density of boundary pixels and the offset angle of grayscale changes within the weld joint outline edge area. The calculation of the difference between the standard weld point geometric template and the target area refers to comparing the preset standard weld point geometric template with the structure of the target area to identify differences in edge offset, gray density, and structural morphology.
[0012] As a further aspect of the present invention, the method further includes step S5: S5: Based on the solder joint defect type detection and discrimination dataset, extract the coding sequence of each type of solder joint region, perform similarity clustering on the coding sequence and assign a unified label number, identify the mapping relationship between the type index and the spatial region, and output the solder joint defect classification and partition identification label set; The weld joint defect classification and identification tag set includes a unified type code, a spatial mapping index, and a classification region identifier.
[0013] As a further aspect of the present invention, the step of classifying and identifying the weld joint defect label set specifically includes: S501: Based on the solder joint defect type detection and discrimination dataset, extract the grayscale code value of each type of solder joint region, unify the sequence length and standardize the direction arrangement to obtain the solder joint code sequence set; S502: Based on the solder joint coding sequence set, identify the position difference of gray scale change between sequences, construct a deviation matrix and perform clustering, assign numbers to groups, associate type labels with spatial positions, and obtain a solder joint type cluster number mapping table; S503: Call the weld joint type clustering number mapping table, extract the weld joint area boundary and label index according to the number, organize the relationship between the number and coordinates and record the type identifier, and obtain the weld joint defect classification partition identification label set.
[0014] An electronic component solder joint inspection system, comprising: The solder joint structure extraction module extracts the gradient difference of pixel gray values based on the gray distribution structure of the solder joint area in the high-density circuit board surface imaging image, identifies the consistency score between the absolute value of the gray value difference of adjacent pixels and the gradient direction, filters continuous paths and counts the set of pixels with a direction change rate less than a threshold, locates the boundary distribution of the pixel set in the original image, and constructs a solder joint structure boundary layer. Based on the solder joint structure boundary layer, the solder joint region identification module extracts the standard deviation of pixel intensity, edge fluctuation and density distribution coefficient within the closed area, determines the area that conforms to the geometric characteristics of the standard solder joint, marks the densely oriented segments within the edge, removes gray-level abrupt points, and constructs a solder joint integrity clustering block. The solder joint contour generation module locates discontinuous points and isolated strong gray points based on the solder joint integrity cluster block, fills the region according to the point spacing and connectivity, connects broken areas, removes fragments smaller than the noise threshold, merges residual graphics, and generates a solder joint contour layer. Based on the weld point contour layer, the defect comparison and analysis module extracts the region boundary curvature, structural density and edge offset angle, compares the deviation of feature values, marks abnormal regions and standard deviation distribution, and constructs a weld point defect type detection and discrimination dataset. The solder joint defect classification module extracts the regional grayscale encoding index based on the solder joint defect type detection and discrimination dataset, identifies structural similarity, groups and encodes according to similarity, analyzes the correspondence between labels and layer coordinates, and outputs a solder joint defect classification partition identification label set.
[0015] Compared with the prior art, the advantages and positive effects of the present invention are as follows: This invention effectively identifies local structural features of solder joints by extracting the grayscale gradient direction and intensity variation trend of neighboring pixels in the solder joint region, solving the problem of inaccurate detection of subtle changes in solder joints in existing technologies. By analyzing continuous grayscale blocks within the solder joint, the grayscale consistency and edge stability of the solder joint are optimized, overcoming the shortcomings of traditional methods in handling complex solder joint morphologies and effectively improving the defect detection rate. Morphological operations are combined to process isolated and hollow pixels, solving the problems of background noise interference and fragmentation, ensuring precise closure of the solder joint outline, and enhancing the classification accuracy of solder joint defects. Simultaneously, similarity clustering of solder joint defects further improves the ability to identify defect types, reduces false detections, and optimizes the accuracy and efficiency of solder joint defect classification and region recognition. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of the steps of the present invention; Figure 2 This is a detailed schematic diagram of S1 of the present invention; Figure 3 This is a detailed schematic diagram of S2 of the present invention; Figure 4 This is a detailed schematic diagram of S3 of the present invention; Figure 5 This is a detailed schematic diagram of S4 of the present invention; Figure 6 This is a detailed schematic diagram of S5 of the present invention; Figure 7 This is a system module diagram of the present invention. Detailed Implementation
[0018] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0019] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0020] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent.
[0021] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0022] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0023] Please see Figure 1 This invention provides a method for detecting solder joints of electronic components, comprising the following steps: S1: Based on the gray-level distribution structure of the solder joint area in the high-density circuit board surface imaging image, extract the local gray-level gradient direction of the solder joint and the intensity change trend of neighboring pixels, mark the gray-level continuity path, identify the spatial connectivity relationship of pixels in the solder joint area, and obtain the solder joint structure recognition layer. S2: Based on the solder joint structure recognition layer, extract continuous grayscale blocks inside the solder joint, analyze the local grayscale consistency and edge direction stability of the solder joint on the imaging plane, expand adjacent areas by grayscale direction and remove grayscale abrupt points to generate a target solder joint integrity area block. S3: Based on the integrity region map of the target solder joint, mark the location set of isolated pixels and empty pixels, apply morphological connection operation to the location, merge adjacent small grayscale blocks, remove fragments with an area lower than the background noise standard, and obtain the solder joint outline closed layer. S4: Based on the target area data in the closed layer of weld point contour, compare the structural characteristics of the standard weld point geometric template, match the predefined defect classification label according to the difference value, record the spatial location and attribute features, and form a weld point defect type detection and discrimination dataset. S5: Based on the solder joint defect type detection and discrimination dataset, extract the encoding sequence of each type of solder joint region, perform similarity clustering on the encoding sequence and assign a unified label number, identify the mapping relationship between the type index and the spatial region, and output the solder joint defect classification and partition identification label set.
[0024] The solder joint structure recognition layer includes pixel distribution features, gray-level gradient direction set, and spatial connectivity weight parameters. The target solder joint integrity region patch includes gray-level consistency segments, edge direction aggregation areas, and gray-level anomaly removal markers. The solder joint contour closure layer includes closed boundary structures, void connection paths, and low-noise region filtering results. The solder joint defect type detection and discrimination dataset includes contour curvature feature values, gray-level density distribution parameters, and edge offset indicators. The solder joint defect classification and partitioning recognition label set includes unified type encoding, spatial mapping index, and classification region identifier.
[0025] Please see Figure 2 The specific steps for identifying the solder joint structure layer are as follows: S101: Based on the gray-scale distribution structure of the solder joint area in the high-density circuit board surface imaging image, extract the horizontal and vertical gray-scale values of the pixel and the gray-scale difference of its adjacent pixels, analyze the gray-scale gradient in the two directions, determine the intensity of gray-scale change, and generate a set of pixel gray-scale change intensity values. Based on high-density circuit board surface imaging images, the input high-density circuit board surface imaging images are preprocessed, including image distortion correction, random noise elimination, and image brightness unification. Then, for the preprocessed image, the grayscale values of each pixel in the horizontal and vertical directions are extracted, and the grayscale differences between that pixel and its neighboring pixels in the horizontal and vertical directions are calculated. For example, for coordinates... The pixel has a grayscale value of The horizontally adjacent pixels are grayscale value Vertically adjacent pixels are grayscale value Then the horizontal grayscale difference Vertical grayscale difference By calculating the grayscale difference, the grayscale gradient of a pixel in the horizontal and vertical directions can be obtained. For example, if the grayscale value of pixel (100, 150) is 120, the grayscale value of the pixel to its right (101, 150) is 125, and the grayscale value of the pixel below it (100, 151) is 118, then the horizontal grayscale difference is... Vertical grayscale difference These two values represent the horizontal and vertical grayscale gradients of the pixel, respectively. Then, based on these horizontal and vertical grayscale gradients, the intensity of the pixel's grayscale change is determined, and this intensity is expressed as the gradient magnitude. To represent, its calculation formula is as follows: ,in This represents the horizontal grayscale gradient of a pixel. This represents the grayscale gradient of a pixel in the vertical direction. The innovation of this formula lies in its ability to comprehensively quantify the drastic changes in grayscale around a pixel by combining horizontal and vertical grayscale gradients, avoiding incomplete gradient information in a single direction. For example, for the pixel (100, 150) mentioned above, its horizontal grayscale gradient... Vertical grayscale gradient Then its grayscale change intensity This value indicates that the grayscale change of this pixel is relatively obvious. The grayscale change intensity values are summarized to generate a set of pixel grayscale change intensity values.
[0026] S102: Based on the set of pixel grayscale change intensity values, analyze the grayscale gradient direction of the pixel and its neighboring pixels, compare the consistency of the gradient direction of continuous pixels, identify monotonically changing pixel paths, record the path sequence and direction continuity, and generate a set of direction-preserving path intensity values. Based on the set of pixel grayscale change intensity values, the gradient direction is calculated using the arctangent function between the horizontal and vertical grayscale gradients of that pixel. For example, if a pixel has a horizontal grayscale gradient of 5 and a vertical grayscale gradient of -2, its gradient direction is calculated by dividing the arctangent of -2 by 5, which is approximately -21.8 degrees. Then, the degree of gradient direction consistency between consecutive pixels is compared. The standard for determining consistency is that if the angle between the gradient directions of two adjacent pixels is less than a preset gradient direction consistency threshold, then the directions are considered consistent. The gradient direction consistency threshold is set to 15 degrees. This setting has been experimentally verified. Statistical analysis of 5000 healthy solder joint image samples revealed that over 95% of consecutive edge pixels had gradient direction angles not exceeding 15 degrees. Therefore, 1... Five degrees is used as the boundary for identifying continuous edges. Under the condition that the angle between the two pixels is less than 15 degrees, the two pixels are classified as having the same direction. Based on this, pixel paths with monotonically changing characteristics are identified. Starting from a specific pixel, the path is tracked along the direction with high gradient direction continuity. The sequence of each pixel and its gradient direction continuity are recorded during the tracking process. For example, if the gradient direction of pixel A is 0 degrees, the gradient direction of its neighboring pixel B is 5 degrees, the gradient direction of C is 10 degrees, and the gradient direction of D is 16 degrees, then A, B, and C form a path with the same direction. However, the angle between D and C exceeds 15 degrees and is not classified as a path. All the identified monotonically changing pixel path sequence information and the degree of direction continuity are quantified to generate a set of direction-preserving path strength values.
[0027] S103: Call the set of direction-preserving path strength values, filter paths with consistent direction among the pixels at the weld point boundary, judge them according to linear continuity and map them to the image space to obtain the weld point structure recognition layer; The process involves calling a set of direction-preserving path strength values to identify all pixels with grayscale change intensity exceeding a specific threshold within a predefined candidate region of solder joints in the image. These pixels are then used as potential boundary points. This threshold is the average grayscale change intensity calculated in S101 plus a standard deviation. For example, if the average intensity is 50 and the standard deviation is 10, pixels with an intensity greater than 60 are selected. Among the identified boundary pixels, the direction-preserving path generated in S102 is searched, and paths within these paths where the gradient direction of all pixels makes an angle of less than 10 degrees with the average gradient direction of the path are selected. This 10-degree threshold is determined through multiple manual annotations and machine recognition comparisons of solder joint edges of various sizes and shapes. This value distinguishes between real solder joint edges and internal background noise. Finally, linear continuity is judged and mapped to the image space. The criterion for linear continuity is that the distance between any three consecutive pixels in the path... The ratio of the straight-line distance to the actual length of the path is greater than 0.95, and the distance between adjacent pixels is less than 1.5 pixels. For example, if three consecutive pixels have coordinates (X1, Y1), (X2, Y2), and (X3, Y3), and the square root of the sum of coordinates X3 minus X1 squared plus Y3 minus Y1 squared, divided by the square root of the sum of coordinates X2 minus X1 squared plus Y2 minus Y1 squared, plus the square root of the sum of coordinates X3 minus X2 squared plus Y3 minus Y2 squared, the result of this calculation is greater than 0.95, and the square root of the sum of coordinates X2 minus X1 squared plus Y2 minus Y1 squared is less than 1.5 pixels, then it is determined to have linear continuity. For paths that meet the conditions, their pixel coordinates are mapped back to the corresponding positions in the original image and highlighted in binary image form to obtain the solder joint structure recognition layer, which accurately presents the preliminary outline of the solder joint.
[0028] Please see Figure 3 The specific steps for creating the target solder joint integrity area block are as follows: S201: Based on the solder joint structure recognition layer, extract continuous gray blocks within the solder joint, count the gray difference between a pixel and its adjacent pixels, extract the edge direction stability value within the region, compare the edge direction stability difference between adjacent pixels, determine the range of change, and generate the edge direction stability interval. Based on the weld joint structure recognition layer, grayscale blocks are defined by the layer. The absolute value of the grayscale difference between an internal pixel and its adjacent pixels (up, down, left, and right) is statistically analyzed. For example, given pixel (X, Y) with grayscale G(X, Y), the absolute value of the grayscale difference G(X+1, Y) - G(X, Y) is calculated. The average of these absolute grayscale difference values is then used to obtain the mean local grayscale change of the pixel. Next, based on this mean, the edge trend stability value within the region is extracted. The stability value is defined as the reciprocal of the variance between the mean local grayscale change of the central pixel and the mean of its 8 neighboring pixels within a 3x3 pixel window. A smaller variance indicates higher stability. For example, the mean of 9 pixels... The values are 10, 12, 11, 9, 10, 13, 11, 10, 9, with a variance of 1.33 and a stability of approximately 0.75. Then, the edge direction stability differences between adjacent pixels are compared, and the absolute value of the difference between the stability values of two adjacent pixels is calculated. For example, pixel A has a stability of 0.75, pixel B has a stability of 0.85, and the difference is 0.1. Based on the difference, the range of change is determined, and the maximum and minimum differences of all adjacent pixels in the entire solder joint area are statistically analyzed to determine the stability change range. For example, the maximum difference is 0.5, the minimum difference is 0.01, and the range is 0.01 to 0.5, thus generating the edge direction stability range.
[0029] S202: Call the edge direction stability interval, filter pixels whose edge direction stability difference meets the preset solder joint aggregation threshold, merge and detect local edge concentration by region, determine the edge aggregation region as the expandable region, and generate grayscale direction extended primitive coordinate set; The edge direction stability interval is called. If the difference in edge direction stability between adjacent pixels is less than 0.1, the pixels are considered to have high clustering. The threshold is obtained by analyzing a large amount of solder joint edge stability data. Regions with a difference of less than 0.1 correspond to the smooth transition area inside the solder joint. Pixels that meet the condition are screened and merged by region. Connected pixels are clustered into different regions. Then, the local edge concentration of the region is detected. The concentration is evaluated by calculating the ratio of the number of pixels in the region to the number of edge pixels in its 5x5 neighborhood. If the region contains 100 pixels and there are 20 edge pixels in its 5x5 neighborhood, the local edge concentration is 20%. Then, the region with a local edge concentration higher than 15% is determined to be an expandable region. The 15% threshold has been verified by experiments to identify the solder joint body region and avoid misidentification of isolated noise points or background regions. If the local edge concentration of the merged region is 25%, it is identified as an expandable region. The expandable region indicates the potential for the solder joint outline to extend outward or inward. A gray-scale direction expansion primitive coordinate set is generated, which contains the pixel coordinates of the expandable region.
[0030] S203: Based on the gray-scale direction extended primitive coordinate set, extract neighboring pixels and compare the gray-scale change rate. After removing pixels whose gray-scale change exceeds the preset threshold, perform region reconstruction to obtain the target solder joint integrity region block. Based on the gray-scale direction extended primitive coordinate set, with the primitive coordinate point as the center, the average absolute value of the difference between its gray-scale value and that of all pixels in its neighborhood is calculated. For example, if the gray-scale value of the primitive point is Gc and the gray-scale value of its 8 neighboring points is Gi, the average rate is the sum of the absolute values of the eight Gi minus Gc divided by eight. Subsequently, pixels whose gray-scale abrupt changes exceed a preset threshold are removed. The threshold is set to 50. If the average gray-scale change rate is greater than 50, a gray-scale abrupt change is identified. The threshold setting takes into account the small smooth transition of gray-scale at the edge of the solder joint and the rapid changes in the background or defect area. For example, if the average rate of the primitive point's neighborhood is 60, exceeding the threshold of 50, the primitive point is removed, indicating that the area does not belong to the solder joint body. After that, region reconstruction is performed on the remaining pixels. The region reconstruction uses connected component analysis to reassemble the interconnected pixels that were not removed into a new region. For example, multiple primitive coordinate points that meet the conditions are spatially adjacent and are merged into a continuous region. This fills in the small holes inside the solder joint region, corrects irregular edges, and obtains a complete region patch of the target solder joint. The patch is a refined representation of the solder joint entity region.
[0031] Please see Figure 4 The specific steps for closing the solder joint outline layer are as follows: S301: Based on the target solder joint integrity region map, extract pixels with low grayscale differences, mark the coordinates of pixels without neighbor connectivity, perform morphological connection on the set of points with adjacent distances less than a preset connection threshold, and obtain the number of void connection regions. Based on the target solder joint integrity region map, pixels are defined as internal pixels within the map whose grayscale value variation is less than 10. The numerical settings are based on analysis of numerous solder joint images, indicating that the grayscale within the solder joint is uniform with minimal variation, distinguishing between the inside and outside of the solder joint. If a pixel in the map has a grayscale value of 180, and surrounding pixels have grayscale values between 170 and 190, it is considered to have a low grayscale difference. Coordinates of pixels with low grayscale difference but no neighboring connectivity are marked; that is, there are no connected pixels with low grayscale difference within a 3x3 neighborhood of the point. These marked points represent tiny voids or breaks within the solder joint. If a pixel does not belong to the set of low-grayscale-difference pixel points, then the pixel is marked. Then, morphological connection is performed on the set of pixels whose adjacent distance is less than a preset connection threshold. The threshold is set to 3 pixels. Through experiments, the threshold setting effectively bridges the small gaps inside the solder joint and avoids connecting irrelevant background noise. If the coordinates of two marked void points (X1, Y1) and (X2, Y2) are such that the square root of the sum of the squares of X2-X1 and Y2-Y1 is less than 3 pixels, then the two void points are connected by morphological operation. The number of void connection regions is obtained. The number represents the total number of discrete void regions formed inside the solder joint after connection.
[0032] S302: Calculate the number of void connection regions, filter the region area values, remove regions smaller than the preset background noise area threshold, merge connected blocks with connected boundaries, reconstruct the boundaries of the merged regions, and obtain the weld point outline closed layer. The system calls the number of void connection regions and removes regions with an area smaller than a preset background noise area threshold. The background noise area threshold is set to 10 pixels, which is obtained through statistical analysis of background noise in a large number of solder joint images. Most non-solder joint voids or small noise areas are smaller than 10 pixels. Therefore, 10 pixels distinguishes noise from actual internal defects. If the void connection region has an area of 8 pixels, it is considered background noise and is removed. If the area is 15 pixels, it is retained. The retained regions are identified as potential internal defects. Then, connected components with connected boundaries are merged. If two retained void connection regions have a shared pixel boundary in the image space, they are merged into one region. If two retained void regions A and B have adjacent pixel points (50, 50) in region A and (50, 51) in region B, then A and B are merged. After that, the boundaries of the merged regions are reconstructed. Image morphological closure operations are used to smooth the outer contour of the merged regions and fill its internal small gaps. For example, a 3x3 circular structuring element is used to perform a closure operation on the merged regions to obtain a solder joint contour closure layer. The layer presents the outer contour of the solder joint and the representation of the main internal defects.
[0033] Please see Figure 5 The specific steps for the solder joint defect type detection and discrimination dataset are as follows: S401: Call the target area in the closed layer of the weld point contour, extract the gray-scale direction change in the grid, identify the curvature range of each contour block, and obtain the contour curvature dispersion. The target area in the closed layer of the solder joint outline is called, and the target area of the solder joint is divided into a 10 by 10 pixel grid. The gray-level gradient direction of all pixels in each grid is calculated, and the direction distribution is statistically analyzed. If the gradient direction of the pixels in the grid is concentrated in the range of 0 degrees ±10 degrees, the gray-level direction change is small. If the direction is evenly distributed from 0 degrees to 360 degrees, the change is large. Then, the curvature range of each grid outline is identified. By sampling the solder joint outline in the grid, the curvature value of the sampling point is calculated. The curvature value is defined as the rate of change of the tangent direction. If three consecutive pixels (X1, Y1) on the outline are within the grid, the curvature value is considered to be within the range of 0 degrees ±10 degrees. (X2, Y2) and (X3, Y3) are used to calculate the curvature by fitting circular arcs. The curvature calculation range is from -0.5 to 0.5, which covers all shapes from curved to straight. Then, all curvature values in each grid are counted to obtain the maximum and minimum curvature values, forming the contour curvature range. If the grid contour curvature range is from -0.05 to 0.05, it indicates that the region contour is close to a straight line. The contour curvature dispersion is obtained, and the dispersion measure quantifies the distribution width of the curvature values in each grid. If the grid curvature dispersion is 0.1, it indicates that the region contour curvature changes little and the shape is consistent.
[0034] S402: Based on the contour curvature dispersion, extract the boundary pixel density and the edge offset angle of continuous gray segment, calculate the difference with the standard weld point geometric template of the same type of structure, identify the differences in edge offset, gray density and structural morphology, and summarize them into feature difference items to obtain the structural difference data of the target area. Boundary pixel density and continuous grayscale segment edge offset angle refer to the distribution density of boundary pixels and the offset angle of grayscale changes within the edge area of the solder joint outline. The calculation of differences between the standard weld point geometric template and the target area structure refers to comparing the preset standard weld point geometric template with the target area structure to identify differences in edge offset, gray density and structural morphology. Based on the contour curvature dispersion, density is the ratio of the number of weld point contour pixels within the grid to the total number of pixels in the grid. For example, a 10x10 grid with 15 boundary pixels has a density of 0.15. The edge offset angle is the maximum angle between the line segment formed by 10 consecutive gray-scale pixels at the edge of the weld point contour and the ideal straight line. The selection of 10 pixels has been experimentally verified to capture small local edge offsets. For example, if the angle between the line segment and the ideal straight line is 3 degrees, the offset angle is 3 degrees. Subsequently, the structural differences with the standard weld point geometric template are calculated. The template is preset and obtained from the 3D scanning morphology analysis of the perfect weld point. For example, for a frustum-shaped weld point template, when calculating the differences, the feature values of the target area are compared with the corresponding feature values of the template. For example, if the template density is 0.20 and the target area density is 0.15, the density difference is 0.05. Then, the differences in edge offset, gray-scale density, and structural morphology are identified. The differences are obtained by comparing the corresponding features of the target area and the template. For example, if the edge offset angle of the target area is 5 degrees larger than that of the template, it is identified as an edge offset difference and summarized as a feature difference item to obtain the structural difference data of the target area. The data includes quantized feature difference values.
[0035] S403: Call the structural difference data of the target area, match the difference with the defect classification label discrimination threshold, record the spatial coordinates and corresponding labels of the areas that meet the conditions, and obtain the weld joint defect type detection discrimination dataset; The system retrieves structural difference data of the target region, sets a threshold, and distinguishes different types of solder joint defects. For example, an edge offset difference greater than 3 degrees is marked as "edge collapse," a boundary pixel density difference greater than 0.1 is marked as "insufficient solder," and structural morphology differences, such as a region's curvature dispersion exceeding the standard template by 0.2, are marked as "abnormal shape." The thresholds are derived through expert experience and machine learning algorithm training. Experts annotate 10,000 known defect type solder joint images, analyze feature difference data, determine the feature difference range corresponding to different defects, and form a discrimination threshold. For the structural difference data of each solder joint region, the system compares whether each difference value exceeds or meets the corresponding defect discrimination threshold. For regions that meet the conditions, their spatial coordinates and corresponding defect labels are recorded. For example, if the edge offset difference of a solder joint region is 4 degrees, exceeding the "edge collapse" threshold of 3 degrees, the spatial coordinates of the region are recorded with the "edge collapse" label. The system obtains a solder joint defect type detection and discrimination dataset, which details the location of each detected defect region and its corresponding defect type.
[0036] Please see Figure 6 The specific steps for classifying and identifying the label set for weld joint defects are as follows: S501: Based on the solder joint defect type detection and discrimination dataset, extract the grayscale code value of each type of solder joint region, unify the sequence length and standardize the direction arrangement to obtain the solder joint code sequence set; Based on the solder joint defect type detection and discrimination dataset, for solder joint regions identified as defects in the dataset, the grayscale values of all pixels within each region are extracted according to a preset scanning path, such as from left to right or from top to bottom. Then, the grayscale values are serialized to form grayscale encoding values for the solder joint region. For example, for a 3x3 defect region, the grayscale value matrix is {100, 110, 105; 95, 100, 112; 102, 98, 107}, and the encoded values are 100, 110, 105, 95, 100, 112, 102, 98, 107. Subsequently, the sequence length is standardized and the orientation is normalized. If the original encoded sequence lengths are inconsistent, they are unified to a preset fixed length by interpolation or truncation, for example, to 100 grayscale values. The orientation is also standardized, with all sequences scanning clockwise from the top left corner of the image to ensure that the encoded values have a consistent start and direction. For example, a sequence of 80 values is expanded to 100 values, and a sequence of 120 values is truncated to retain the first 100 values. The solder joint encoding sequence set is obtained, which contains the standardized grayscale encoding sequence of the defective solder joint area.
[0037] S502: Based on the solder joint coding sequence set, identify the positional difference of grayscale change between sequences, construct a deviation matrix and perform clustering, assign numbers to groups, associate type labels with spatial locations, and obtain a solder joint type cluster number mapping table; Based on the solder joint coding sequence set, for any two grayscale coding sequences, the difference in grayscale values at corresponding positions is calculated. The number of points with differences exceeding a threshold is counted. The threshold is set to 10 grayscale levels, as determined experimentally, to distinguish significant differences between sequences. For example, if the grayscale value at position 50 in sequence A is 100 and the grayscale value at position 50 in sequence B is 120, the difference is 20, exceeding 10 grayscale levels. Then, a deviation matrix is constructed, where N is the total number of solder joint coding sequences, and the matrix element ij represents the difference in total grayscale change positions between the i-th and j-th sequences. For example, if the total difference between sequence A and sequence B is 50, the matrix element MAB equals 50. Subsequently, clustering is performed using the K-means clustering algorithm, with the deviation matrix as input. The solder joint coding sequence is divided into clusters. For example, if K is set to 5, the solder joint defect sequence is clustered into 5 types. Numbers are assigned to each group. For example, cluster 1 is numbered 001 and cluster 2 is numbered 002. The type label and spatial location are associated, such as "edge collapse" and "insufficient solder". The spatial location of the solder joint defect area in the image contained in the cluster is recorded. For example, cluster 001 is associated with the "edge collapse" defect type and the spatial coordinates of the multiple solder joint areas it contains are recorded. The solder joint type cluster number mapping table is obtained. The table lists the cluster number, defect type label and corresponding solder joint area spatial location.
[0038] S503: Call the weld joint type clustering number mapping table, extract the weld joint area boundary and label index according to the number, organize the relationship between the number and coordinate and record the type identifier, and obtain the weld joint defect classification partition identification label set; The process involves calling a cluster number mapping table for solder joint types. Based on the cluster numbers in the table, precise boundary information of associated solder joint regions is extracted. This boundary information is stored as a list of pixel coordinates. For example, the first solder joint region boundary associated with cluster number 001 is pixel points (X1, Y1), (X2, Y2), etc. The defect type label index corresponding to this cluster is then extracted. The label index is the defect classification label, such as "edge collapse," and is the numerical identifier in the preset defect type list. For example, the label index for "edge collapse" is 1. Subsequently, the relationship between the numbers and coordinates is organized, and the type identifier is recorded. Each cluster number is associated with its list of boundary coordinates of the solder joint regions it contains. The cluster number and corresponding defect type identifier of each solder joint region are recorded. For example, number 001 corresponds to solder joint region A, and its coordinates and type identifier are recorded. Number 001 corresponds to solder joint region B, and its coordinates and type identifier are also recorded. This ensures that each defect region can be traced back to its cluster type. The solder joint defect classification and partition identification label set is obtained. The label set is the result, containing the location of each solder joint defect region, its associated cluster number, and its detailed defect type label.
[0039] Please see Figure 7 An electronic component solder joint inspection system, comprising: The solder joint structure extraction module extracts the gradient difference of pixel gray values based on the gray distribution structure of the solder joint area in the high-density circuit board surface imaging image, identifies the consistency score between the absolute value of the gray value difference of adjacent pixels and the gradient direction, filters continuous paths and counts the set of pixels with a direction change rate less than a threshold, locates the boundary distribution of the pixel set in the original image, and constructs a solder joint structure boundary layer. The solder joint region recognition module is based on the solder joint structure boundary layer. It extracts the standard deviation of pixel intensity, edge fluctuation and density distribution coefficient within the closed area, determines the area that meets the geometric characteristics of standard solder joints, marks the densely oriented segments within the edge, removes gray-level abrupt points, and constructs a solder joint integrity clustering block. The solder joint contour generation module is based on the solder joint integrity cluster block, locates discontinuous points and isolated strong gray points, fills the region according to the point spacing and connectivity, connects broken areas, removes fragments smaller than the noise threshold, merges the residual graphics, and generates a solder joint contour layer. The defect comparison and analysis module is based on the weld point contour layer. It extracts the region boundary curvature, structural density and edge offset angle, compares the deviation of feature values, marks abnormal areas and standard deviation distribution, and constructs a weld point defect type detection and discrimination dataset. The solder joint defect classification module extracts the grayscale encoding index of the region based on the solder joint defect type detection and discrimination dataset, identifies the structural similarity, groups and encodes according to similarity, analyzes the correspondence between the label and the layer coordinate, and outputs a set of identification labels for solder joint defect classification partitions.
[0040] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection of the described technical solutions.
Claims
1. An electronic component joint inspection method characterized by comprising: Includes the following steps: S1: Based on the gray-level distribution structure of the solder joint area in the high-density circuit board surface imaging image, extract the local gray-level gradient direction of the solder joint and the intensity change trend of neighboring pixels, mark the gray-level continuity path, identify the spatial connectivity relationship of pixels in the solder joint area, and obtain the solder joint structure recognition layer. S2: Based on the solder joint structure recognition layer, extract continuous grayscale blocks inside the solder joint, analyze the local grayscale consistency and edge direction stability of the solder joint on the imaging plane, expand adjacent areas by grayscale direction and remove grayscale abrupt points to generate target solder joint integrity area blocks. S3: Based on the target solder joint integrity region map, mark the location set of isolated pixels and empty pixels, apply morphological connection operation to the location, merge adjacent small grayscale blocks, remove fragments with an area lower than the background noise standard, and obtain the solder joint outline closed layer. S4: Based on the target area data in the closed layer of the weld point contour, compare the structural characteristics of the standard weld point geometric template, match the predefined defect classification label according to the difference value, record the spatial location and attribute features, and form a weld point defect type detection and discrimination dataset.
2. The electronic component inspection method according to claim 1, wherein The weld joint structure recognition layer includes pixel distribution features, gray-level gradient direction set, and spatial connectivity weight parameters. The target weld joint integrity region patch includes gray-level consistent segments, edge direction aggregation areas, and gray-level anomaly removal markers. The weld joint contour closure layer includes closed boundary structures, void connection paths, and low-noise region filtering results. The weld joint defect type detection and discrimination dataset includes contour curvature feature values, gray-level density distribution parameters, and edge offset indices.
3. The electronic component inspection method according to claim 1, wherein The specific steps for identifying the solder joint structure layer are as follows: S101: Based on the gray-scale distribution structure of the solder joint area in the high-density circuit board surface imaging image, extract the horizontal and vertical gray-scale values of the pixel and the gray-scale difference of its adjacent pixels, analyze the gray-scale gradient in the two directions, determine the intensity of gray-scale change, and generate a set of pixel gray-scale change intensity values. S102: Based on the set of pixel grayscale change intensity values, analyze the grayscale gradient direction of the pixel and its neighboring pixels, compare the consistency of the gradient direction of continuous pixels, identify monotonically changing pixel paths, record the path sequence and direction continuity, and generate a set of direction-maintaining path intensity values. S103: Call the set of direction-maintaining path strength values, filter paths with consistent directions among the boundary pixels of the solder joint, judge them according to linear continuity and map them to the image space to obtain the solder joint structure recognition layer.
4. The electronic component inspection method according to claim 3, wherein The specific steps for creating the target solder joint integrity region block are as follows: S201: Based on the solder joint structure recognition layer, extract continuous gray blocks within the solder joint, count the gray difference between a pixel and its adjacent pixels, extract the edge direction stability value within the region, compare the edge direction stability difference between adjacent pixels, determine the range of change, and generate an edge direction stability interval. S202: Call the edge direction stability interval, filter the pixels whose edge direction stability difference meets the preset solder joint aggregation threshold, merge and detect the local edge concentration by region, determine the edge aggregation region as the expandable region, and generate the gray-scale direction extended primitive coordinate set; S203: Based on the gray-scale direction extended primitive coordinate set, extract neighboring pixels and compare the gray-scale change rate. After removing pixels whose gray-scale abrupt changes exceed a preset threshold, perform region reconstruction to obtain the target solder joint integrity region block.
5. The electronic component inspection method according to claim 4, wherein The specific steps for closing the solder joint outline layer are as follows: S301: Based on the target solder joint integrity region block, extract pixels with low grayscale difference, mark the coordinates of pixels without neighbor connectivity, perform morphological connection on the set of points with adjacent distance less than a preset connection threshold, and obtain the number of void connection regions. S302: Call the number of void connection regions, filter the region area values, remove regions smaller than the preset background noise area threshold, merge connected blocks with connected boundaries, reconstruct the boundaries of the merged regions, and obtain the weld point outline closed layer.
6. The electronic component inspection method according to claim 5, wherein The specific steps for the solder joint defect type detection and discrimination dataset are as follows: S401: Call the target area in the closed layer of the weld point contour, extract the gray-scale direction change in the grid, identify the curvature range of each contour block, and obtain the contour curvature dispersion. S402: Based on the contour curvature dispersion, extract the boundary pixel density and the edge offset angle of the continuous gray segment, calculate the difference with the standard weld point geometric template of the same type of structure, identify the differences in edge offset, gray density and structural morphology, and summarize them into feature difference items to obtain the structural difference data of the target area. S403: Call the structural difference data of the target area, match the difference with the defect classification label discrimination threshold, record the spatial coordinates and corresponding labels of the areas that meet the conditions, and obtain the weld joint defect type detection and discrimination dataset.
7. The electronic component inspection method according to claim 6, wherein The boundary pixel density and continuous grayscale segment edge offset angle refer to the distribution density of boundary pixels and the offset angle of grayscale changes within the weld joint outline edge area. The calculation of the difference between the standard weld point geometric template and the target area refers to comparing the preset standard weld point geometric template with the structure of the target area to identify differences in edge offset, gray density, and structural morphology.
8. The electronic component inspection method of claim 1, wherein The method also includes step S5: S5: Based on the solder joint defect type detection and discrimination dataset, extract the coding sequence of each type of solder joint region, perform similarity clustering on the coding sequence and assign a unified label number, identify the mapping relationship between the type index and the spatial region, and output the solder joint defect classification and partition identification label set; The weld joint defect classification and identification tag set includes a unified type code, a spatial mapping index, and a classification region identifier.
9. The electronic component inspection method according to claim 8, wherein The specific steps for classifying and identifying the label set for weld joint defects are as follows: S501: Based on the solder joint defect type detection and discrimination dataset, extract the grayscale code value of each type of solder joint region, unify the sequence length and standardize the direction arrangement to obtain the solder joint code sequence set; S502: Based on the solder joint coding sequence set, identify the position difference of gray scale change between sequences, construct a deviation matrix and perform clustering, assign numbers to groups, associate type labels with spatial positions, and obtain a solder joint type cluster number mapping table; S503: Call the weld joint type clustering number mapping table, extract the weld joint area boundary and label index according to the number, organize the relationship between the number and coordinates and record the type identifier, and obtain the weld joint defect classification partition identification label set.
10. An electronic component joint inspection system characterized by comprising: The system is used to implement the electronic component solder joint detection method according to any one of claims 1-9, the system comprising: The solder joint structure extraction module extracts the gradient difference of pixel gray values based on the gray distribution structure of the solder joint area in the high-density circuit board surface imaging image, identifies the consistency score between the absolute value of the gray value difference of adjacent pixels and the gradient direction, filters continuous paths and counts the set of pixels with a direction change rate less than a threshold, locates the boundary distribution of the pixel set in the original image, and constructs a solder joint structure boundary layer. Based on the solder joint structure boundary layer, the solder joint region identification module extracts the standard deviation of pixel intensity, edge fluctuation and density distribution coefficient within the closed area, determines the area that conforms to the geometric characteristics of the standard solder joint, marks the densely oriented segments within the edge, removes gray-level abrupt points, and constructs a solder joint integrity clustering block. The solder joint contour generation module locates discontinuous points and isolated strong gray points based on the solder joint integrity cluster block, fills the region according to the point spacing and connectivity, connects broken areas, removes fragments smaller than the noise threshold, merges residual graphics, and generates a solder joint contour layer. Based on the weld point contour layer, the defect comparison and analysis module extracts the region boundary curvature, structural density and edge offset angle, compares the deviation of feature values, marks abnormal regions and standard deviation distribution, and constructs a weld point defect type detection and discrimination dataset. The solder joint defect classification module extracts the regional grayscale encoding index based on the solder joint defect type detection and discrimination dataset, identifies structural similarity, groups and encodes according to similarity, analyzes the correspondence between labels and layer coordinates, and outputs a solder joint defect classification partition identification label set.
Citation Information
Cited By
Cable production identification monitoring system and method based on cable image
CN122089723A
