Solder paste three-dimensional detection parameter automatic configuration method and system based on gerber file
By parsing Gerber files and using the K-means color clustering algorithm, the 3D detection parameters for solder paste are automatically configured, solving the problems of low efficiency and insufficient accuracy in parameter configuration in existing technologies. This achieves efficient and accurate solder paste detection, improving soldering reliability and product yield.
Patent Information
- Application Number
- CN202511588763.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-03
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-11-03
AI Technical Summary
The existing 3D solder paste inspection equipment suffers from inefficient parameter configuration and insufficient accuracy, resulting in poor solder paste printing quality control and affecting soldering reliability and product yield.
By parsing Gerber files, the geometric parameters of the pads are automatically extracted, a detection frame coordinate system is established, and the K-means color clustering algorithm is used to extract the color statistical features of the substrate, solder paste and silkscreen. The upper and lower limits of the tolerance values are calculated, and the center coordinates of the detection frame are automatically corrected, so as to realize the automatic generation and precise positioning of the detection frame.
It significantly improves parameter configuration efficiency, reduces the positional deviation of the detection frame, enhances the objectivity and repeatability of parameter settings, avoids missed detections and false alarms, and ensures the stability of solder paste printing quality.
Smart Images

Figure CN121053129B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic parameter configuration technology, and in particular to an automatic configuration method and system for solder paste three-dimensional detection parameters based on Gerber files. Background Technology
[0002] In surface mount technology (SMT) production lines, solder paste printing quality directly affects soldering reliability and product yield. Automated optical inspection (AOI) technology is a key step in quality control after solder paste printing. Solder paste 3D inspection equipment uses optical imaging systems and 3D contour measurement technology to accurately measure parameters such as solder paste height, volume, and area of each pad on the PCB board, comparing them with preset tolerance ranges to identify printing defects such as insufficient solder, excessive solder, misalignment, and solder spikes. However, existing solder paste 3D inspection equipment suffers from inefficiency and insufficient accuracy in parameter configuration. Summary of the Invention
[0003] This invention provides an automatic configuration method and system for solder paste 3D detection parameters based on Gerber files. This invention realizes automatic generation and precise positioning of the detection frame, effectively compensates for accumulated errors, and reduces the positional deviation of the detection frame.
[0004] In a first aspect, the present invention provides an automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files, the automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files comprising:
[0005] Parse the pad attribute dataset of the Gerber file, and establish the detection box coordinate data in the device coordinate system based on the pad attribute dataset;
[0006] Acquire Mark point images and convert them to the HSV color space to create Mark point matching contour templates;
[0007] Based on the Mark point matching contour template, images of the substrate, solder paste and silkscreen area are acquired and color segmentation parameter sets are calculated.
[0008] The upper and lower limits of the tolerance value are calculated based on the pad attribute dataset, and a grouped tolerance value configuration table is generated based on the upper and lower limits of the tolerance value.
[0009] The camera is controlled to acquire RGB image sets of each pad and extract the solder paste outline to calculate the centroid offset. The center coordinates of the detection frame are then corrected based on the centroid offset, and the detection frame configuration file is output.
[0010] In conjunction with the first aspect, in a first implementation of the first aspect of the present invention, the step of parsing the pad attribute dataset of the Gerber file and establishing detection box coordinate data in the device coordinate system based on the pad attribute dataset includes:
[0011] Read the D-code definition and aperture parameters of the Gerber file and parse the drawing instructions to identify the pad pattern dataset;
[0012] The flash coordinates and aperture size are extracted by traversing the pad pattern dataset, and a set of pad geometric parameters is generated based on the flash coordinates and aperture size;
[0013] Extract the package name from the Gerber file and associate the package name with the pad coordinates to obtain the pad attribute dataset;
[0014] Based on the pad attribute dataset, a detection box is generated and diagonal Mark points are identified to establish the detection box coordinate data in the device coordinate system.
[0015] In conjunction with the first aspect, in a second implementation of the first aspect of the present invention, the step of generating a detection box based on the pad attribute dataset and identifying diagonal Mark points to establish detection box coordinate data in the device coordinate system includes:
[0016] The detection boxes are generated by traversing the pad attribute dataset and the vertex coordinates are recorded to obtain the geometric data of the detection boxes in the Gerber coordinate system.
[0017] Identify the diagonal Mark points, calculate the proportionality coefficients and differences between the Gerber nominal distance and angle and the measured values, and obtain the coordinate mapping parameter set;
[0018] An affine transformation matrix is constructed based on the coordinate mapping parameter set, and a coordinate transformation is performed on the detection box based on the affine transformation matrix to obtain the detection box coordinate data in the device coordinate system.
[0019] In conjunction with the first aspect, in a third implementation of the first aspect of the present invention, the step of acquiring the Mark point image and converting it to the HSV color space, and creating a Mark point matching contour template, includes:
[0020] Control the camera to move to the Mark point and acquire RGB image data of the Mark point;
[0021] The RGB image of the Mark points is converted to HSV space, and foreground pixels that meet the threshold conditions are filtered and connected component analysis is performed to obtain the binary mask image of the Mark points;
[0022] Contour tracking and polygon approximation processing are performed on the binary mask image of the Mark points to obtain the Mark point matching contour template.
[0023] In conjunction with the first aspect, in a fourth implementation of the first aspect of the present invention, the step of acquiring images of the substrate, solder paste, and silkscreen area based on the Mark point matching contour template and calculating the color segmentation parameter set includes:
[0024] The camera is controlled to acquire images of the substrate, solder paste, and silkscreen area and convert them to the YCrCb color space to obtain multiple YCrCb images;
[0025] Clustering is performed on the multiple YCrCb images to generate color statistical parameters;
[0026] The upper and lower limits of the threshold for each component are calculated based on the color statistical parameters, and a color segmentation parameter group is generated based on the upper and lower limits of the threshold for each component.
[0027] In conjunction with the first aspect, in a fifth implementation of the first aspect of the present invention, the step of performing clustering on the plurality of YCrCb images to generate color statistical parameters includes:
[0028] Within the multiple YCrCb images, pixel coordinates are randomly generated and color vectors are extracted. K-means iterative clustering is then performed to select clusters.
[0029] Based on the clusters, rectangular sampling frames are uniformly generated on each YCrCb image. The pixels within the frames are traversed to calculate the mean and standard deviation of each color component, thereby obtaining color statistical parameters.
[0030] In conjunction with the first aspect, in a sixth implementation of the first aspect of the present invention, the step of calculating the upper and lower limits of the tolerance value based on the pad attribute dataset and generating a grouped tolerance value configuration table based on the upper and lower limits of the tolerance value includes:
[0031] The pad attribute dataset is traversed, grouped by package type, and the average area of the pads in each group is calculated to obtain the average area parameter.
[0032] The unit area coefficient is obtained by querying the process standard database, and the unit area coefficient is multiplied by the average area parameter to obtain the allowable range of height and volume for each group.
[0033] The upper and lower limits of the allowable values are calculated based on the allowable range of height and volume for each group, and a group allowable value configuration table is generated based on the upper and lower limits of the allowable values.
[0034] In conjunction with the first aspect, in the seventh implementation of the first aspect of the present invention, the control camera acquires a set of RGB images of each pad and extracts the solder paste outline to calculate the centroid offset, and corrects the center coordinates of the detection frame according to the centroid offset, and outputs a detection frame configuration file, including:
[0035] The camera is moved to each pad position and RGB images are acquired by traversing the coordinate data of the detection frame to obtain a set of RGB images.
[0036] The RGB image set is traversed and converted to the YCrCb color space. The maximum connected component boundary contour is extracted based on the solder paste binarization threshold to obtain the set of solder paste contour coordinates for each pad.
[0037] The centroid offset between the centroid and the center of the detection frame is calculated by traversing the set of solder paste contour coordinates. When the centroid offset exceeds the threshold, the center coordinates of the detection frame are updated, and the detection frame configuration file is output.
[0038] In conjunction with the first aspect, in the eighth implementation of the first aspect of the present invention, the automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files further includes:
[0039] The control grating projection device projects sinusoidal stripe gratings onto the solder paste surface of each pad and continuously changes the phase shift angle. At each phase shift angle, it acquires images of deformed stripes on the solder paste surface to obtain a phase shift image sequence.
[0040] Based on the gray values of corresponding pixels in the phase-shifted image sequence at different phase-shift angles, the phase value of the pixel is calculated, and the phase values of all pixels are subjected to phase unrolling processing to obtain a continuous phase distribution map.
[0041] The phase value of each pixel in the continuous phase distribution map is converted into the measured value of solder paste volume. It is then determined whether the measured value of solder paste volume falls within the upper and lower limits of the volume tolerance value of the corresponding group in the group tolerance value configuration table, and the determination result is recorded.
[0042] Secondly, the present invention provides an automatic configuration system for solder paste three-dimensional detection parameters based on Gerber files, the automatic configuration system for solder paste three-dimensional detection parameters based on Gerber files comprising:
[0043] The parsing module is used to parse the pad attribute dataset of the Gerber file and establish the detection box coordinate data in the device coordinate system based on the pad attribute dataset.
[0044] Create a module to acquire Mark point images and convert them to the HSV color space, and create Mark point matching contour templates;
[0045] The acquisition module is used to acquire images of the substrate, solder paste and silkscreen area based on the Mark point matching contour template and calculate the color segmentation parameter set;
[0046] The calculation module is used to calculate the upper and lower limits of the tolerance value based on the pad attribute dataset, and generate a grouped tolerance value configuration table based on the upper and lower limits of the tolerance value;
[0047] The output module is used to control the camera to acquire RGB image sets of each pad, extract the solder paste outline, calculate the centroid offset, correct the center coordinates of the detection frame based on the centroid offset, and output the detection frame configuration file.
[0048] The technical solution provided by this invention automatically extracts precise geometric parameters such as the center coordinates, dimensions, rotation angle, and package type of each pad by directly parsing the Gerber file generated during the PCB design stage. This achieves automatic generation and precise positioning of the detection frame, fundamentally replacing the inefficient method of operators manually selecting pads one by one on the physical PCB in existing technologies. For complex PCBs containing hundreds of pads, parameter configuration time is reduced from 2-3 hours to 5-10 minutes, improving configuration efficiency by more than 20 times. By establishing a mapping transformation matrix from the Gerber coordinate system to the device coordinate system and automatically calculating the distance scaling factor and rotation correction angle, this invention effectively compensates for PCB manufacturing tensile deformation and board entry angle deviation, achieving a detection frame positioning accuracy within 0.05 mm, which is an improvement compared to the traditional method with a positioning error of more than 0.2 mm. This invention employs a K-means color clustering algorithm to automatically extract the color statistical features of the substrate, solder paste, and silkscreen. It automatically calculates binarized threshold parameters based on the mean and standard deviation, replacing the existing method of manually adjusting thresholds based entirely on operator experience. The deviation of threshold parameters configured by different operators is reduced from over 30% to within 5%, improving the objectivity and repeatability of parameter settings. By automatically grouping pads according to package type and automatically calculating the upper and lower limits of the height, volume, and area tolerances for each group based on the average area and solder paste printing process standards, this invention establishes a quantitative standard for tolerance setting, avoiding missed detections and false alarms caused by improper tolerance setting. The consistency deviation of tolerance parameters is controlled within 5%. The automatic detection frame correction function in learning mode effectively compensates for accumulated errors and reduces the positional deviation of the detection frame by calculating the offset between the solder paste centroid and the detection frame center and adaptively updating the detection frame coordinates.
[0049] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0050] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0051] Figure 1 This is a schematic diagram of an embodiment of the automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files in this invention.
[0052] Figure 2 This is a schematic diagram of an embodiment of the automatic configuration system for solder paste three-dimensional detection parameters based on Gerber files in this invention. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. 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.
[0054] The terms "comprising" and "having," and any variations thereof, used in the embodiments of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0055] To facilitate understanding of this embodiment, a detailed description of the automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files, as disclosed in this embodiment of the invention, will be provided first. For example... Figure 1 As shown, this method includes the following steps:
[0056] 101. Parse the pad attribute dataset of the Gerber file and establish the detection box coordinate data in the device coordinate system based on the pad attribute dataset;
[0057] Specifically, the Gerber file parsing engine is invoked to perform structured reading of the PCB design file to be processed. This includes reading the D-code definition section and the aperture parameter section. By establishing a mapping table between aperture numbers and graphic shapes (circles, rectangles, irregular shapes, etc.), the corresponding drawing instruction sequences are parsed, and the graphic dataset used for pad drawing is identified. Based on this, semantic decoding of the drawing commands is performed, combining instructions such as D01 and D03 with the aperture geometry to achieve effective identification of all pad entities. The pad graphic dataset is traversed, extracting the flash coordinates representing the center position of each pad and the corresponding aperture size information. Each flash coordinate is combined with its corresponding aperture length, width, aspect ratio, angle value, and shape type to generate a set of pad geometric parameters. The spatial distribution and statistical characteristics of each parameter in the pad geometric parameter set are recorded. Simultaneously, the component layer and attribute extension fields of the Gerber file are parsed to extract semantic information such as package name, component number, and network identifier for each pad. A mapping table between coordinate positions and package names is established, constructing a pad attribute dataset with the pad center coordinates as the primary key. This dataset includes multi-dimensional structured fields such as package type, pad size, and number information. Based on the center position of each pad in the pad attribute dataset, a corresponding detection frame graphic element is automatically generated. The initial frame size is determined by the pad area and package standard, while the rotation angle of the detection frame inherits from the original angle attribute of the pad. Mark point graphic features are searched among the identified pads. By identifying the positions of the two diagonal Mark points, a mapping relationship between Gerber coordinates and device coordinates is established. The scaling factor and rotation correction angle are calculated using the Mark point spacing and direction. Finally, the Gerber coordinates of all pad detection frames are uniformly converted to pulse equivalent units in the device coordinate system, forming the detection frame coordinate data.
[0058] 102. Acquire Mark point images and convert them to the HSV color space to create Mark point matching contour templates;
[0059] Specifically, based on the nominal coordinates of the Mark point, it is converted into the expected position in the device coordinate system through coordinate mapping. The industrial camera is then controlled to move above the target Mark point according to the expected position. After the field of view is aligned, RGB image data of the Mark point area is acquired. The RGB image of the Mark point is converted to the HSV color space in real time using a color space conversion algorithm to enhance the color separation capability of metallic texture features. The hue channel H reflects spectral color attributes, the saturation channel S reflects color purity, and the brightness channel V reflects the image brightness level. Based on the typical characteristic of the Mark point exhibiting a distinct metallic luster, a hue range of 35–45 degrees, a saturation range of 40–80%, and a brightness range of 60–90% are set as color screening thresholds. Threshold screening is performed on all pixels in the HSV image to select foreground pixel regions that meet the above color conditions. Connectivity analysis is performed on the selected image to identify the largest or most regularly shaped connected regions in the foreground region. These connected regions are then used to construct a binary mask image, where foreground pixels are set to high values and background pixels are set to zero values, forming the basis of the Mark point boundary contour. A contour extraction algorithm is used to perform contour tracking on the binary mask image, sequentially marking the boundary point sequence of the foreground region. The Douglas-Peucker polygon approximation algorithm is then used to compress the boundary curves to reduce redundant vertices while preserving the geometric features of the contour. The compressed polygon boundary is used as the standard geometric template for Mark points. The vertex coordinate sequence, number of sides, rotation angle, and area parameters of the contour are recorded to construct a Mark point matching contour template with matching tolerance control capabilities.
[0060] 103. Acquire images of the substrate, solder paste, and silkscreen areas based on Mark point matching contour templates and calculate color segmentation parameter sets;
[0061] Specifically, the industrial camera is guided sequentially to the target areas using a Mark point coordinate system. These areas include blank areas on the substrate without component obstructions, solder pad areas covered with solder paste, and areas with dense silkscreen markings. Image acquisition is performed at each target location to obtain high-resolution RGB images. Each RGB image is then uniformly converted to the YCrCb color space, where the Y component represents the image's luminance intensity, and the Cr and Cb components represent the chromaticity distribution of red and blue, respectively. An adaptive sampling mechanism is used on the converted YCrCb images to uniformly extract multiple pixels as sample data. The K-means clustering algorithm is then used to cluster the distribution patterns of pixels across the Y, Cr, and Cb channels. The number of cluster centers is set to 3 to correspond to the three typical surface materials: substrate, solder paste, and silkscreen. After the clustering process, the pixel percentage of each cluster center is calculated, and the cluster with the highest percentage is selected as the dominant color distribution model. The mean and standard deviation of each pixel cluster are then calculated across the three channel dimensions to construct a set of color statistical parameters. Based on color statistical parameters, the upper and lower limits of the threshold for each channel are determined using statistical analysis results. The upper limit is defined as the mean plus 2 standard deviations, and the lower limit is defined as the mean minus 2 standard deviations, covering more than 95% of the target area pixels to form a color threshold envelope. Based on the color threshold range, corresponding color segmentation parameter sets are generated. Independent Y, Cr, and Cb threshold ranges are set for the substrate background, solder paste outline, and silkscreen pattern, respectively, and a color feature database is constructed to generate the color segmentation parameter sets.
[0062] 104. Calculate the upper and lower limits of the tolerance value based on the pad attribute dataset, and generate a grouped tolerance value configuration table based on the upper and lower limits of the tolerance value;
[0063] Specifically, the pad attribute dataset is traversed, and the package type field is extracted as the grouping criterion. All pads are automatically divided into several package categories according to their package names. Each group contains multiple pad objects with similar geometric features and process standards. After grouping, the geometric area parameters of the pads within each group are statistically analyzed, and the average area of each group is calculated as the average area parameter for the current package type, forming a list of average area values corresponding one-to-one with each package type. The system connects to the enterprise's internal solder paste printing process standard database to retrieve the unit area height coefficient and volume coefficient corresponding to different package types. These coefficients are empirically set values, reflecting the optimal solder paste coverage range under the conditions of standard solder paste thickness and pad size matching. The aforementioned unit area coefficient is multiplied by the average area parameter of each package group to obtain the height and volume tolerance ranges for each group. Based on this, range expansion logic is applied to set upper and lower limits for height for each package type, for example, a default lower limit of 0.08 mm and an upper limit of 0.15 mm. The volume upper and lower limits are derived by multiplying the area parameter by two proportional coefficients of 0.08 and 0.15, thus achieving automatic estimation of the tolerance range based on the package type. The height and volume upper and lower limits are further linked with the original area parameter to calculate the complete tolerance range for each group in the three dimensions of area, volume, and height. These are then uniformly archived and organized into a structured group tolerance configuration table. The group tolerance configuration table uses the package name as the primary key index and records the upper and lower limits of the area threshold, volume threshold, and height threshold, as well as the default tolerance band width for each package type.
[0064] 105. Control the camera to acquire RGB image sets of each pad and extract the solder paste outline to calculate the centroid offset. Correct the center coordinates of the detection box according to the centroid offset and output the detection box configuration file.
[0065] Specifically, based on the coordinate data of the detection frames, the system traverses and schedules the movement of the industrial camera along the equipment coordinate system to the physical position of the pad corresponding to the center of each detection frame, sequentially completing the automatic acquisition of multi-channel color images. All acquired images are sets of original RGB images containing the actual solder paste printing status. Color space conversion is performed on each RGB image set, converting it from RGB mode to YCrCb color space to enhance the solder paste region separation capability in the chromaticity dimension. Threshold filtering is applied to each image according to preset solder paste color segmentation parameters to select foreground pixels that meet the range conditions of brightness Y value and chromaticity Cr / Cb value. Binarization is then performed, and a connected component analysis algorithm is called on the processed image to extract the solder paste image region with the largest area and continuous shape. The outer boundary contour data of this region is identified and extracted, forming a set of solder paste contour coordinates corresponding to each pad. The set of solder paste contour coordinates is traversed, and centroid calculation is performed on each contour region to obtain the geometric center coordinates of the contour shape in the image coordinate system. Simultaneously, the center coordinate values of the corresponding frames in the detection frame data are called to calculate the centroid offset between the two in the horizontal and vertical directions. When the offset between a pad detection frame and the actual solder paste centroid exceeds a set threshold range (e.g., 0.05mm) in any direction, the current detection frame is marked as requiring correction. Based on the direction and value of the centroid offset, the center coordinates of the original detection frame are translated by an equal amount, achieving automatic correction and adjustment of the detection frame position. After all detection frame centroid offset calculations and coordinate correction steps are completed, the updated coordinate parameters are summarized and a detection frame configuration file is generated. This file records the corrected center position, contour status, corresponding pad number, and offset correction mark for each detection frame in the device coordinate system.
[0066] In one specific embodiment, the process of performing step 101 may specifically include the following steps:
[0067] Read the D-code definition and aperture parameters of the Gerber file and parse the drawing instructions to identify the pad pattern dataset;
[0068] The flash coordinates and aperture size are extracted by traversing the pad pattern dataset, and a set of pad geometric parameters is generated based on the flash coordinates and aperture size;
[0069] Extract the package name from the Gerber file and associate and match the package name with the pad coordinates to obtain the pad attribute dataset;
[0070] Based on the pad attribute dataset, a detection box is generated and diagonal Mark points are identified to establish the detection box coordinate data in the device coordinate system.
[0071] Specifically, the offline programming software uses a Gerber parsing engine to read Gerber source files containing multi-layer PCB graphic information. It locates and extracts the D-code definition section and aperture library description section from the file. By parsing the mapping relationship between aperture numbers and shape parameters, it reconstructs the geometric shape and size information corresponding to each aperture number, such as the diameter of a circular aperture, the length and width of a rectangular aperture, and the rotation angle. The drawing instructions undergo syntax recognition and semantic interpretation, identifying drawing commands from D10 to D999 and parsing the aperture numbers they point to. Combining the coordinate values and command types provided in the instructions (e.g., D03 represents flash, D01 represents line drawing), it determines the positional distribution and shape characteristics of the pads. From this, it filters out all pad graphics defined using the D03 flash method and constructs a preliminary pad graphics dataset, which includes the center flash coordinates of each pad, the referenced aperture number, the graphic type, and the layer affiliation. The process iterates through the pad image dataset, reading the flash coordinates and aperture number for each pad entry. It then searches the parsed aperture parameter table for the corresponding geometric dimensions and combines them with the coordinates to generate a set of geometric parameters for each pad. These parameters include center coordinates, pad length, width, area, rotation angle, and shape type. Simultaneously, it parses extended attribute segments or component layer annotation areas containing package information from the Gerber file, extracting the package name, package number, and corresponding pad number for each device. By matching the pad number with its spatial coordinates, it associates and integrates the package name with the corresponding pad geometric parameters to establish a pad attribute dataset. This dataset uses the pad center coordinates as the primary key and incorporates package type, package number, net identifier, and graphic parameters. Based on this dataset, an initial detection box is generated according to the position and size information of each pad. The detection box's center is aligned with the pad's geometric center, and its size is appropriately extended to ensure coverage of the solder paste area, referencing the pad shape. The Mark point recognition operation is performed. By parsing graphic elements with specific aperture numbers and size characteristics in the graphic layer, two Mark points in the diagonal direction are identified. The positions of these two points in the Gerber coordinate system are used to establish a reference base. By comparing the distance and angle relationship between these two points and the Mark points on the actual PCB, the rotation correction angle and scaling factor from the Gerber coordinate system to the device coordinate system are calculated. Based on the mapping relationship, the center coordinates of all detection frames are converted from Gerber units (such as mm or mil) to pulse equivalent units in the device coordinate system. The output is detection frame coordinate data containing the center coordinates, angle, package type mark and group number of the detection frame.
[0072] In one specific embodiment, the process of generating a detection box and identifying diagonal Mark points based on the pad attribute dataset, and establishing the detection box coordinate data in the device coordinate system, can specifically include the following steps:
[0073] The detection boxes are generated by traversing the pad attribute dataset and the vertex coordinates are recorded to obtain the geometric data of the detection boxes in the Gerber coordinate system;
[0074] Identify the diagonal Mark points, calculate the proportionality coefficients and differences between the Gerber nominal distance and angle and the measured values, and obtain the coordinate mapping parameter set;
[0075] An affine transformation matrix is constructed based on the coordinate mapping parameter set, and the coordinate transformation of the detection box is performed based on the affine transformation matrix to obtain the detection box coordinate data in the device coordinate system.
[0076] Specifically, the pad attribute dataset is traversed and processed to read the geometric center coordinates, shape type, and package size of each pad. Based on this, corresponding rectangular detection boxes are generated according to standardized rules. The center of the detection box coincides with the center of the pad, and the side length is derived from the length and width of the pad according to a preset boundary expansion ratio. If the pad is rectangular, the boundary is directly set by the length and width; if it is circular, the diameter is expanded into a square bounding box. In terms of coordinate recording, the center point coordinates of the detection box are retained, and the absolute coordinate values of the four vertices of the detection box in the Gerber coordinate system are calculated and recorded. These are then combined with attribute information such as package type and component number to form a set of detection box geometric data. After the initial construction of all detection boxes is completed, the Mark point recognition and coordinate mapping parameter extraction process begins. Prioritize the identification of two Mark points located diagonally in the pad attribute dataset or graphic layer information. These two Mark points have unique aperture markings and size parameters, can be stably identified in the Gerber image, and have calibration functions. The system reads the center coordinates of the two Mark points and calculates their nominal distance and angle in the Gerber coordinate system as raw reference data. Simultaneously, the system controls an industrial camera to acquire images of the corresponding Mark points on the PCB. Image recognition algorithms extract the center positions of the actual Mark points and calculate the measured distance and angle. By comparing the proportional relationship and offset angle difference between the Gerber nominal values and the measured values, key parameters such as the proportional coefficients in the X and Y axes, the overall rotation angle difference, and the translation offset are derived. These parameters are then combined to form a coordinate mapping parameter set. A two-dimensional affine transformation matrix is constructed based on this parameter set. The matrix contains four types of transformation factors: rotation, scaling, shearing, and translation. By parameterizing the matrix, a unified and continuous coordinate mapping is achieved between any two-dimensional coordinate systems. The affine matrix is then used to perform matrix multiplication on the coordinates of each vertex and center in the detection box geometry data, achieving a full mapping transformation from Gerber coordinate space to device coordinate space. High-precision floating-point calculations are used during the transformation process, with rotation accuracy error not exceeding 0.001 radians and scaling ratio controlled within 0.01 mm. The actual projection position of each detection frame in the device coordinate system is obtained, and its updated center point coordinates, boundary four vertex coordinates, and the transformed package type and component number are recorded. All detection frame coordinate data are output in the form of a structured configuration file.
[0077] In one specific embodiment, the process of performing step 102 may specifically include the following steps:
[0078] Control the camera to move to the Mark point and acquire RGB image data of the Mark point;
[0079] The RGB image of the Mark points is converted to HSV space, and foreground pixels that meet the threshold conditions are selected. Connectivity analysis is then performed to obtain the binary mask image of the Mark points.
[0080] Contour tracking and polygon approximation are performed on the binary mask image of the Mark points to obtain the Mark point matching contour template.
[0081] Specifically, based on the nominal coordinates of the Mark points extracted from the Gerber file, the coordinates are converted into the expected positions in the device coordinate system through coordinate mapping. This drives a high-precision multi-axis motion platform to control the industrial camera, which moves sequentially to the theoretical positions of each Mark point. Upon reaching the target position, the camera triggers an image acquisition command to obtain RGB color image data covering the Mark point area. The RGB color images are then simultaneously displayed on the operating software interface for image processing. A color space conversion operation is performed, converting the acquired RGB images to the HSV color space. Hue (H) describes the color type, saturation (S) represents the purity of the color, and lightness (V) represents the brightness of the image. Compared to the RGB color model, the HSV space is more effective at separating color attributes from lighting interference, which is beneficial for extracting Mark point graphics with obvious metallic features. Based on the typical color representation of the metallic luster of the Mark point, the threshold range for hue H is set to 35° to 45°, corresponding to the color gamut of brass or metallic gold. The saturation range for S is set to 40% to 80% to exclude overly bright or overly dark pseudo-foreground pixels. The threshold range for brightness V is set to 60% to 90% to filter out dark background areas or reflective interference areas. Foreground filtering is performed on all pixels in the HSV image based on the threshold conditions. Pixels that meet the H, S, and V channel range conditions are set as high foreground values, and the rest are set as low background values, generating a binary image. Connectivity analysis is then performed on the binary image to automatically identify all connected pixel regions. The largest and most regularly shaped connected region is selected as the main Mark point region, and a binary mask image of the current region is output as an intermediate result. Contour tracking is performed on the binary mask image using a contour detection algorithm to extract the pixel sequence of the connected region boundaries from the mask image, construct the contour path, and assign topological numbers. After obtaining the initial boundary path, polygon approximation processing is performed. The contour path is thinned and compressed using the Douglas-Peucker simplification algorithm. The approximation accuracy is controlled by setting a threshold, so that the approximation result can retain the main shape features of the Mark point contour while eliminating noise jitter or jagged edge effects formed during image acquisition. The approximated polygon path is used as the standard geometric template for the Mark point. Its vertex coordinate sequence, number of sides, angle distribution, area, and other shape feature parameters are extracted and recorded, and saved as a matching contour template.
[0082] In one specific embodiment, the process of performing step 103 may specifically include the following steps:
[0083] The camera is controlled to acquire images of the substrate, solder paste, and silkscreen area and convert them to the YCrCb color space to obtain multiple YCrCb images;
[0084] Clustering was performed on multiple YCrCb images to generate color statistics parameters;
[0085] Calculate the upper and lower limits of the threshold for each component based on the color statistical parameters, and generate a color segmentation parameter set based on the upper and lower limits of the threshold for each component.
[0086] Specifically, based on the Mark point coordinate mapping relationship, the camera is guided to move sequentially to the center coordinates of the target substrate, solder paste, and silkscreen area in a preset order, and completes high-resolution color image acquisition tasks above each target area, obtaining RGB original images representing the substrate background, solder paste printing surface, and silkscreen pattern, respectively. Each RGB image is converted to the YCrCb color space, where the Y component represents the image luminance component, and the Cr and Cb components reflect the chromaticity shift of red and blue, respectively. This has good brightness and color decoupling capabilities and is suitable for stably extracting the surface color features of different materials under varying lighting conditions. Through the conversion process, multiple YCrCb format image data corresponding to the three types of areas are obtained. Color clustering is performed on the converted YCrCb images. Representative image blocks are selected from each image for pixel sampling, and the Y, Cr, and Cb channel values of the sample pixels are used to form a feature vector, which is then input into the clustering algorithm module. The K-means clustering algorithm is used, with the number of categories set to 3, to correspond to the background color of the substrate area, the metallic gray of the solder paste, and the white or yellow material features commonly found in silkscreen printing. Clustering algorithms partition samples in the feature space, assigning all pixels to the nearest cluster centers, and iteratively updating until the clustering results converge. After clustering, the number of pixels and their distribution locations for each cluster center are counted. The cluster with the most pixels or the widest coverage area in each region is selected as the dominant color cluster for that region. The mean and standard deviation of the cluster in the Y, Cr, and Cb channels are calculated to form a set of color statistical parameters. The mean of each color channel reflects the central trend of the color category, while the standard deviation reflects the dispersion of color changes. Based on the above color statistical parameters, the upper and lower thresholds of the color components are calculated. Using a 95% confidence interval definition method, the lower threshold of each channel is set to the mean minus twice the standard deviation, and the upper threshold is set to the mean plus twice the standard deviation, constructing a color range envelope interval. For the substrate area, this range accurately covers a large area of the PCB background color; for the solder paste area, the threshold setting adapts to the typical characteristics of low saturation and medium-high brightness in silver-gray; and for the silkscreen area, the offsets of Cr and Cb are used to distinguish common white and yellow silkscreen ink colors. The upper and lower limit ranges of the Y, Cr, and Cb channels in the above three areas are organized into a structured color segmentation parameter group, named substrate segmentation parameter, solder paste segmentation parameter, and silkscreen segmentation parameter, respectively, and written into the color feature configuration file.
[0087] In one specific embodiment, the process of performing clustering on multiple YCrCb images to generate color statistical parameters may specifically include the following steps:
[0088] Pixel coordinates are randomly generated within multiple YCrCb images, and color vectors are extracted. K-means iterative clustering is then performed to select the cluster.
[0089] Based on the clustering, rectangular sampling frames are uniformly generated on each YCrCb image. The pixels within the frames are traversed to calculate the mean and standard deviation of each color component, thus obtaining the color statistical parameters.
[0090] Specifically, random sampling is performed on multiple YCrCb images. A large number of pixel coordinates are generated in each image using a uniform distribution or pseudo-random algorithm, spatially covering different areas of the image. The Y, Cr, and Cb channel values of each random pixel are extracted as color vectors. All sampled color vectors are combined into a multi-dimensional sample set and input into the K-means clustering module. The expected number of cluster centers is set to 3, corresponding to the three typical color clusters of substrate, solder paste, and silkscreen. The K-means algorithm determines the cluster with the shortest distance by calculating the Euclidean distance between each sample vector and the current cluster center, and continuously updates the cluster centers. This process is iterated until the objective function converges. After each iteration, the compactness and intra-cluster variance of each cluster are calculated to ensure the stability and discriminative power of the clustering results. After K-means clustering, the color clusters that best match the expected region characteristics are selected as target clusters. For example, for solder paste areas, low-saturation, high-brightness gray-brightness clusters are selected; for substrate areas, background color clusters with small color variations and medium brightness are selected; and for silkscreen areas, white or yellow clusters with high brightness and high saturation are selected. Based on the spatial distribution characteristics of the selected clusters, several rectangular sampling frames are uniformly generated on the original YCrCb image. Each sampling frame covers an area of 20x20 pixels and is arranged within the effective area of the image according to the principle of equal spacing. Each sampling frame is traversed, and the color data of each pixel is read point by point. The mean and standard deviation of the pixel values for the Y, Cr, and Cb channels are calculated respectively to obtain the color distribution statistical characteristics of the cluster in different image regions. The statistical results of all sampling frames are merged and summarized, and a color statistical parameter set is formed based on the summary results. This set includes the global mean, global standard deviation, and variance range of the color distribution for each channel. Based on the color statistical parameter set (i.e. the mean and standard deviation of the Y, Cr, and Cb components in multiple sampling frames), a color segmentation parameter range applicable to a specific area in the substrate area, solder paste area, or silkscreen area is constructed.
[0091] In one specific embodiment, the process of performing step 104 may specifically include the following steps:
[0092] Traverse the pad attribute dataset, group it by package type, and calculate the average pad area of each group to obtain the average area parameter.
[0093] The unit area coefficient is obtained by querying the process standard database, and the unit area coefficient is multiplied by the average area parameter to obtain the allowable range of height and volume for each group;
[0094] The upper and lower limits of the allowable values are calculated based on the allowable range of height and volume for each group, and a group allowable value configuration table is generated based on the upper and lower limits of the allowable values.
[0095] Specifically, the pad attribute dataset is logically grouped. Based on the package type field of the pad, sets of pads with the same package code are grouped into one package group. For each group, the geometric dimensions of all pads are sequentially read, especially length, width, diameter, and other shape parameters, and converted into effective pad area using an area formula. Within each package group, the average area parameter is calculated to obtain the average pad area parameter for the current package type. A preset solder paste printing process standard database is accessed. This database stores process recommendation parameters such as unit area volume factor and height factor associated with different package types. Based on the package type field of the current package group, the corresponding process template is called to extract the recommended height range (e.g., 0.08mm~0.15mm per unit area) and recommended volume range (e.g., 0.08~0.15 times the volume factor per unit area) corresponding to the standard unit area. The average area parameter of each package group is multiplied by the height coefficient and volume coefficient per unit area to calculate the recommended upper and lower limits of height and volume for the current group. For example, if the average area is 0.35 mm²... 2 Therefore, the permissible height range is 0.08×0.35~0.15×0.35mm, and the permissible volume range is 0.08×0.35~0.15×0.35mm. 3 Based on the above multiplication results, the upper and lower limits of the allowable values are uniformly organized, and an allowable value parameter structure is constructed, including fields such as "package name", "average area", "lower limit of height", "upper limit of height", "lower limit of volume", and "upper limit of volume". An independent allowable value entry is generated for each package group. The allowable value structures of all package groups are summarized to construct a group allowable value configuration table, and written into the configuration file or parameter database in a standard format.
[0096] In one specific embodiment, the process of performing step 105 may specifically include the following steps:
[0097] The camera is moved to each pad position by traversing the coordinate data of the detection box to acquire RGB images, resulting in a set of RGB images.
[0098] The RGB image set is traversed and converted to the YCrCb color space. The maximum connected component boundary contour is extracted based on the solder paste binarization threshold to obtain the set of solder paste contour coordinates for each pad.
[0099] Iterate through the set of solder paste outline coordinates to calculate the centroid offset between the centroid and the center of the detection box. When the centroid offset exceeds the threshold, update the center coordinates of the detection box and output the detection box configuration file.
[0100] Specifically, based on the detection frame coordinate data generated during the offline programming phase, each pad under test is sequentially traversed, and the industrial camera is controlled to move to a designated position in the device coordinate system according to these coordinate points. Simultaneously, image acquisition commands are triggered synchronously through the motion control system. The camera acquires a high-resolution RGB image above the center of each detection frame, constructing an RGB image set containing the actual image information of all pads. After acquisition, color space conversion is performed on each RGB image sequentially. The standard YCrCb conversion algorithm is used to map the image from RGB mode to the luminance-chrominance decoupled YCrCb space, enhancing the separation capability of the low-saturation silver-gray region of the solder paste. A pre-set solder paste binarization color threshold range is called to conditionally filter the Y, Cr, and Cb components of each pixel in the image. Pixels that simultaneously meet the thresholds of all three channels are marked as foreground, and the rest are marked as background to generate a binary image result. Connectivity analysis is performed on the binary image to identify the contour of the actual solder paste printing area by finding the largest connected region. A boundary tracking algorithm is used to extract the complete outer contour path of the region, generating a set of solder paste contour coordinates corresponding to each detection frame. Centroid calculation is performed on each contour region. The geometric center estimation method is used to obtain the centroid coordinates of the current solder paste morphology region. Vector difference calculation is then performed between these coordinates and the original center coordinates of the detection frame to obtain the centroid offset. The magnitude of the centroid offset is compared with a preset threshold, with an offset tolerance of 0.05mm. When the offset in any direction exceeds the preset threshold, the current detection frame is marked as having an abnormal offset state, and correction logic is invoked to update and correct the center coordinates of the current detection frame using the current offset as a translation vector. The system allows batch processing of offsets from multiple detection frames and supports displaying highlighted areas in learning mode. Automatic correction is performed after operator confirmation to ensure high-precision alignment between the detection frame center and the actual solder paste printing area. All corrected detection frame coordinates are uniformly written to the updated detection frame configuration file, which records the device coordinate center, contour fitting status, offset correction value, and corresponding pad identification information for each detection frame.
[0101] In one specific embodiment, the automatic configuration method for solder paste 3D detection parameters based on Gerber files further includes the following steps:
[0102] The control grating projection device projects sinusoidal stripe gratings onto the solder paste surface of each pad and continuously changes the phase shift angle. At each phase shift angle, it acquires images of deformed stripes on the solder paste surface to obtain a phase shift image sequence.
[0103] Based on the gray values of corresponding pixels in the phase-shifted image sequence at different phase shift angles, the phase value of each pixel is calculated, and the phase values of all pixels are subjected to phase unrolling processing to obtain a continuous phase distribution map.
[0104] Convert the phase value of each pixel in the continuous phase distribution map into the measured value of solder paste volume, determine whether the measured value of solder paste volume falls within the upper and lower limits of the volume tolerance value of the corresponding group in the group tolerance value configuration table, and record the judgment result.
[0105] Specifically, based on the coordinate information provided by the detection frame configuration file, the control device platform moves to the position corresponding to each pad and simultaneously activates the grating projection device to vertically project a set of sinusoidal stripe patterns with a specific period onto the current solder paste surface. Simultaneously, phase modulation technology continuously controls the phase shift angle of the projected pattern, completing pattern projection at different phase shift angles under a standard five-step or nine-step phase shift sampling mechanism. After each projection, an industrial camera acquires the corresponding deformed stripe image in real time, forming a phase shift image sequence. Each frame in the sequence corresponds to the brightness distribution of the solder paste surface at a certain phase shift angle. For each pixel in the phase shift image sequence, its grayscale value sequence at different phase shift angles is extracted. The initial phase value of the pixel is calculated using a sinusoidal phase reconstruction algorithm. The phase value represents the spatial displacement and optical path change of the stripe at that point. Since the phase value only cycles within the range [0, 2π], a phase unfolding algorithm is used to perform continuous phase processing on the entire image, restoring the jumping wrapper phase sequence to a true spatial phase function, resulting in a phase distribution map with physical continuity. Based on this, the phase height mapping function established during system calibration is invoked to convert the phase value of each pixel into its corresponding physical height value. This value is then integrated with the spatial boundary within the detection frame to calculate the total volume of solder paste within the current pad detection area, yielding the measured solder paste volume for each detection frame. The group tolerance configuration table is read, and based on the package type associated with the current detection frame, the upper and lower limits of the volume tolerance recorded in the configuration table for the current group are found. The measured volume of the current pad is compared to the upper and lower limits for interval judgment. If the measured value is within the tolerance range, it is marked as "volume qualified"; if it is below the lower limit or above the upper limit, it is marked as "volume insufficient" or "volume excessive," respectively. All judgment results, along with pad coordinates, package group, measured value, and tolerance range information, are recorded in the detection result dataset.
[0106] After obtaining the pad attribute dataset and before generating the detection box, the process includes adaptive FOV (Field of View) mesh generation and dynamic optimization of the detection path based on pad density distribution: The effective detection area of the PCB board in the device coordinate system is uniformly meshed according to a preset initial FOV size. The width of the initial FOV is set to 0.9 times the width of the camera's field of view, and the height is set to 0.9 times the height of the camera's field of view to ensure a 10% overlap between adjacent FOVs. The center coordinates of each pad in the pad attribute dataset are traversed to determine which mesh cell the pad falls into. The number of pads contained in each mesh cell is counted as the pad density value of that mesh. The mean and standard deviation of the pad density values of all mesh cells are calculated. Pad density values greater than the mean plus one standard deviation are considered as the result. The grid is marked as high-density grid, grids with pad density values less than the mean minus one standard deviation are marked as low-density grid, and the remaining grids are marked as medium-density grid, thus obtaining the pad density distribution map of the PCB board. The high-density grid in the pad density distribution map is traversed, and the FOV size of the high-density grid is reduced to 0.7 times the initial FOV size. The high-density grid area is then re-divided according to the reduced FOV size, increasing the number of FOVs in the area to reduce the number of pads within a single FOV. The low-density grid is traversed, and it is merged with adjacent low-density grids to form a larger FOV area. The size of the merged FOV does not exceed 1.5 times the initial FOV size, and the number of pads within the merged FOV does not exceed 1 / 3 of the number of pads in the medium-density grid.To achieve a 2x increase in size, the initial FOV size is maintained for the medium-density grid. After adaptive FOV partitioning, all FOV cells, their center coordinates, and boundary ranges are statistically analyzed to obtain an adaptive FOV grid dataset. The center coordinates of all FOV cells in the adaptive FOV grid dataset are used as graph nodes, and the Euclidean distance between adjacent FOV cells is used as edge weights to construct a complete graph. The FOV cell closest to the origin of the device coordinate system is used as the starting node. A nearest neighbor heuristic algorithm is used to traverse all unvisited FOV nodes. Each time, the nearest unvisited node is selected from the current node as the next visited node. The visit order of all nodes is recorded as the initial detection path. The total path length of the initial detection path is calculated as the distance between all adjacent FOV nodes. The initial path length is obtained by summing the distances. A 2-opt local search optimization is performed on the initial detection path. For any two non-adjacent edges in the path, these edges are deleted and reconnected in a cross-connection manner to form a new path. The total path length of the new path is calculated. If the new path length is less than the current path length, a path swap operation is accepted and the current path is updated. The 2-opt swap operation is repeated until 100 consecutive swap operations fail to reduce the path length or the number of iterations reaches 1000, resulting in an optimized detection path sequence. The access order number of each FOV unit in the detection path sequence is recorded in the adaptive FOV grid dataset. During subsequent detection, the camera moves to each FOV position sequentially according to the access order number to acquire images.
[0107] After obtaining the Mark point matching contour template and before acquiring images of the substrate solder paste and silkscreen areas, the process includes multi-light source image fusion and feature enhancement based on VIHL vector expressions: The light source controller sequentially turns on the red, green, blue, and white LED light sources. When each light source is turned on, the camera acquires an image of the PCB board under the current lighting conditions, resulting in four original light source images: a red light image, a green light image, a blue light image, and a white light image. The red light image is denoted as side.r, the green light image as side.g, the blue light image as side.b, and the white light image as top. Each pixel in each light source image is then extracted. The grayscale values of the locations are used to construct a four-channel image data structure, resulting in a multi-source original image dataset. For substrate area feature extraction, a first VIHL vector expression is constructed as "(side.r+side.g+side.b) / 3". This expression averages the corresponding pixel grayscale values of the red, green, and blue light images to obtain the average brightness image of the three colors. For solder paste area feature extraction, a second VIHL vector expression is constructed as "(side.r-side.g).abs+(side.g-side.b).abs+(side.b-side.r).abs". This expression calculates the red, green, and blue light values. The sum of the absolute values of the differences between each pair of channels is used to obtain a color difference image to enhance the metallic luster of the solder paste. For the feature extraction requirements of the silkscreen area, a third VIHL vector expression is constructed as "top.gray*2-side.gray". This expression amplifies the brightness component of the white light image by a factor of two and subtracts the brightness components of the three colors to obtain a silkscreen contrast enhancement image, resulting in a set of VIHL expressions for the three target regions. Each pixel position in the multi-source original image dataset is traversed, and the grayscale values of that pixel in the red, green, and blue light images are read and denoted as R, G, and B, respectively. The first VIHL vector expression "(side.r+side. In the expression "g+side.b) / 3", replace side.r with R, side.g with G, and side.b with B. Calculate (R+G+B) / 3 to obtain the grayscale value of the pixel in the substrate feature image. Calculate the second VIHL vector expression "|RG|+|GB|+|BR|" to obtain the grayscale value of the pixel in the solder paste feature image. Read the grayscale value of the pixel in the white light image and record it as W. Calculate the grayscale component grayy of the third VIHL vector expression and obtain the three-color light grayscale value as S_gray using the formula 0.299R+0.587G+0.114B. Calculate the grayscale value using the formula 0.299W+0.587W+0.The white light grayscale value obtained from 114W is denoted as T_gray. The grayscale value of this pixel in the silkscreen feature image is obtained by calculating "T_gray*2-S_gray". After traversing and calculating all pixel positions, the substrate feature enhancement image, solder paste feature enhancement image, and silkscreen feature enhancement image are obtained. These three feature enhancement images are then used for subsequent calculations of color segmentation parameters for the substrate area, solder paste area, and silkscreen area, respectively.
[0108] The process, after obtaining the group tolerance configuration table and before controlling the camera to acquire images of each pad, includes a multi-objective optimization algorithm based on variable genetic factors to optimize the upper and lower limits of the tolerance values for each group in the group tolerance configuration table. This involves querying historical inspection records with the same package type as the current PCB board from the inspection history database, statistically analyzing the actual inspection results for each package group under different tolerance parameters, calculating the ratio of the number of missed inspections to the total number of defects in that group to obtain the missed inspection rate objective function, calculating the ratio of the number of false alarms to the total number of inspections to obtain the false alarm rate objective function, and minimizing the missed inspection rate objective function and the false alarm rate objective function as two conflicting optimization objectives. This optimizes the upper and lower limits of the solder paste height tolerance for each group. The upper and lower limits of volume tolerance, area tolerance, and area tolerance are used as six decision variables to be optimized, resulting in a multi-objective optimization problem model. The six decision variables for each group are encoded with real numbers to form chromosome individuals. The first gene locus of the chromosome encodes the upper limit of height tolerance, the second gene locus encodes the lower limit of height tolerance, the third gene locus encodes the upper limit of volume tolerance, the fourth gene locus encodes the lower limit of volume tolerance, the fifth gene locus encodes the upper limit of area tolerance, and the sixth gene locus encodes the lower limit of area tolerance. An initial population of 100 chromosome individuals is randomly generated, with an initial crossover probability of 0.9, an initial mutation probability of 0.1, an initial genotype of 1.0, and a genotype decay coefficient of 0. 95. Obtain the initial parameter set for the optimization algorithm; traverse each chromosome individual in the current population, decode the six gene positions of the chromosome into the tolerance parameters of the corresponding group, re-perform the pass / fail judgment for all pads of the group in the historical detection data based on the tolerance parameters, and calculate the false negative rate and false positive rate after re-judgment as the two objective function values of the chromosome individual. Perform non-dominated sorting on the objective function values of all individuals in the population to obtain multiple Pareto level layers, calculate the crowding distance between each individual and its neighboring individuals in the target space, calculate the fitness value of each individual based on the Pareto level and crowding distance, select the individuals with the top 50% fitness values as the parent population, and perform crossover probability on two randomly paired individuals in the parent population. A single-point crossover operation is performed to generate offspring individuals, with the product of the current crossover probability and the genotype. Gaussian mutation is then performed on the generated offspring individuals, with the mutation probability being the product of the current mutation probability and the genotype. The genotype is then multiplied by the genotype decay coefficient to obtain the updated genotype. This process of selection, crossover, mutation, and genotype update is repeated until 200 iterations are reached or the Pareto front remains unchanged for 50 consecutive generations, resulting in the final optimized population. From the final optimized population, all non-dominated solutions with a Pareto level of 1 are selected to form the Pareto optimal solution set. For each solution in the Pareto optimal solution set, the weighted sum of the false negative rate and the false positive rate is calculated, with the false negative rate weighting coefficient set to 0.7. The false alarm rate weighting coefficient is set to 0.3. The solution with the smallest weighted sum is selected as the optimal compromise solution. The six gene positions of the optimal compromise solution are decoded to obtain the optimized upper and lower limits of the height tolerance, volume tolerance, volume tolerance, area tolerance, and area tolerance. The decoded optimized tolerance parameters are used to replace the original upper and lower limits of the tolerance values for the corresponding groups in the group tolerance value configuration table, resulting in the optimized group tolerance value configuration table.
[0109] After obtaining the inspection frame configuration file, the process also includes dynamic adjustment of tolerance values and process capability assessment based on statistical process control. During continuous batch inspection of the PCB board using the inspection frame configuration file, the measured values of solder paste height, volume, and area for each pad are recorded in real time. When the cumulative number of pads inspected in the same package type group reaches 30, the measured height values of all pads in that group are arranged in chronological order. The arithmetic mean of the measured height value sequence is calculated as the height mean of that group. The square root of the sum of the squares of the differences between the measured height values and the height mean is obtained by dividing by the sample size minus 1. The upper limit of the height tolerance value for that group is read from the group tolerance value configuration table and denoted as USL, and the lower limit is denoted as LSL. The process capability index Cpk is calculated using the formula Cpk = min((USL - height mean) / (3 height standard deviation)). The height Cpk value for this group is calculated using (height mean - LSL) / (3 height standard deviations). The same statistical calculation process is then applied to the measured volume and area values to obtain their respective volume Cpk and area Cpk values, resulting in a process capability index set for this packaging group. It is then determined whether the height Cpk, volume Cpk, and area Cpk values in the process capability index set are all greater than the acceptable threshold of 1.33. If all three Cpk values are greater than 1.33, the tolerance settings for this group are considered reasonable and the production process is stable, and the current tolerance parameters are kept unchanged. If the height Cpk value is less than 1.33, the height tolerance range is considered too strict or the production process fluctuates too much. The 1st percentile of the measured height value is used as the new lower limit of the height tolerance value, and the 99th percentile is used as the new upper limit. These newly calculated upper and lower limits replace the values in the group tolerance configuration table for this group. The original height tolerance upper and lower limits are adjusted using the same tolerance adjustment process for volume Cpk and area Cpk values to obtain a dynamically adjusted group tolerance configuration table. Time series trend monitoring is established for the height Cpk, volume Cpk, and area Cpk values in the process capability index set. When the Cpk values of five consecutive batches show a monotonically decreasing trend and the difference between the Cpk value of the latest batch and the Cpk value of the first batch is greater than 0.2, it is determined that the process capability of this parameter has deteriorated, and a process capability warning signal is generated. The warning signal records the type of deteriorated parameter, the current Cpk value, the deterioration magnitude, and the package group identifier involved. The warning signal is pushed to the equipment human-machine interface to prompt the operator to check the stencil cleanliness, squeegee pressure, printing speed, and other process parameters of the solder paste printing equipment. At the same time, the warning signal and the corresponding measured value sequence data are saved to the quality analysis database for process engineers to perform root cause analysis.
[0110] After obtaining the detection frame configuration file, the actual batch detection process includes a constraint-based finite-time adaptive parameter adjustment mechanism to address data transmission anomalies and hardware performance degradation. During continuous batch detection, the measured values of solder paste height, volume, and area for each pad are checked for data integrity. The deviation between the current measured value and the historical average of the package group to which the pad belongs is calculated. When the deviation of the measured height, volume, or area exceeds three times the historical average, the detection data for that pad is identified as an abnormal data point. The pad number, abnormal parameter type, and abnormal timestamp of the abnormal data point are recorded. The number of abnormal data points appearing in 10 consecutive pads is counted. When the number of abnormal data points exceeds three, interference in the detection data transmission channel or sensor output anomaly is detected, and a data correction mechanism is initiated to obtain an abnormal detection data identifier set. For the data points identified as abnormal in the abnormal detection data identifier set, an interpolation correction transformation based on adjacent pad data is established. Take the measured heights of the preceding and following pads on the PCB board along the X-axis and record them as H_prev and H_next, respectively. Also, read the measured heights of the preceding and following pads along the Y-axis and record them as H_up and H_down, respectively. Calculate the arithmetic mean of the four adjacent measured heights: (H_prev + H_next + H_up + H_down) / 4. Use this as the height correction value for the abnormal pad. Replace the original measured height value of the abnormal pad with the corrected height value. Also, adjust the measured volume and area values accordingly. Perform the same adjacent pad interpolation correction process to obtain the corrected detection dataset; at the same time, detect the average brightness value of the images captured by the camera. When the average brightness value of the images of 5 consecutive FOVs decreases by more than 15% compared with the brightness value at the initial calibration, it is determined that there is a brightness attenuation fault in the LED light source. Calculate the ratio of the current brightness value to the initial brightness value as the light source attenuation coefficient. Multiply the upper and lower limits of the brightness Y component thresholds of the substrate, solder paste, and silkscreen in the color segmentation parameter group by the reciprocal of the light source attenuation coefficient for compensation and correction to obtain the color segmentation parameters after hardware fault compensation.An adaptive adjustment rule base for tolerance values based on fuzzy inference is established. The input fuzzy variables are defined as the average false alarm rate and average false negative rate of the current batch. The average false alarm rate is divided into three fuzzy sets: low (less than 5%), medium (5%-15%), and high (greater than 15%). The average false negative rate is also divided into three fuzzy sets: low (less than 2%), medium (2%-5%), and high (greater than 5%). The output fuzzy variable is defined as the tolerance value adjustment amount, which is divided into five fuzzy sets: negative large adjustment (reduced by 20%), negative small adjustment (reduced by 10%), unchanged, positive small adjustment (increased by 10%), and positive large adjustment (increased by 20%). Fuzzy rules are established: if the average false alarm rate is high and the average false negative rate is low, the tolerance value adjustment amount is a positive large adjustment; if the average false alarm rate is medium and the average false negative rate is medium, the tolerance value adjustment amount is... The allowable value adjustment is kept constant. If the average false alarm rate is low and the average false negative rate is high, the allowable value adjustment is negatively adjusted significantly. A complete set of 9 fuzzy inference rules is constructed to cover all input combinations. For each package group, the average false alarm rate and average false negative rate of the current batch are calculated as fuzzy inputs. The membership degree of the input value in each fuzzy set is calculated through the membership function. Fuzzy inference is performed to obtain the output fuzzy set. The centroid method is used to perform defuzzification calculation to obtain the accurate allowable value adjustment percentage. The current height allowable value upper limit of the group is multiplied by (1 + allowable value adjustment percentage) to obtain the adjusted height allowable value upper limit. The height allowable value lower limit is multiplied by (1 + allowable value adjustment percentage) to obtain the adjusted height allowable value lower limit. The same fuzzy inference adjustment process is performed on the volume allowable value and the area allowable value to obtain the adaptively adjusted group allowable value.The finite-time convergence control law is designed to ensure that the tolerance parameter converges to a steady state within a finite number of detection batches. The tolerance vector of the i-th encapsulation group in the k-th batch is defined as V_i(k)=[H_upper_i(k), H_lower_i(k), Vol_upper_i(k), Vol_lower_i(k),Area_upper_i(k)]. [Area_lower_i(k)], calculate the Euclidean distance d_i(k) = ||V_i(k) - V_i(k-1)|| between adjacent batch tolerance value vectors as the tolerance value change range. Set the convergence judgment threshold to 2% of the norm of the initial tolerance value vector. When the tolerance value change ranges d_i(k), d_i(k-1), and d_i(k-2) of three consecutive batches are all less than the convergence judgment threshold, it is determined that the tolerance value parameter of the group has converged to a stable state, and the adaptive adjustment of the tolerance value of the group is stopped. Set the maximum number of adjustment batches to 20 batches as a finite time constraint. When the number of adjustment batches reaches 20, regardless of whether convergence has occurred, the adjustment is stopped and the final tolerance value state of the group is recorded. Calculate the proportion of the number of groups that have reached the convergence state to the total number of groups in all encapsulation groups as the system stability index. When the system stability index is greater than 90%, it is determined that the overall detection parameter configuration has reached a stable operating state.
[0111] The above describes the automatic configuration method for solder paste 3D detection parameters based on Gerber files in embodiments of the present invention. The following describes the automatic configuration system for solder paste 3D detection parameters based on Gerber files in embodiments of the present invention. Please refer to [link to relevant documentation]. Figure 2 One embodiment of the automatic configuration system for solder paste 3D detection parameters based on Gerber files in this invention includes:
[0112] The parsing module 201 is used to parse the pad attribute dataset of the Gerber file and establish the detection box coordinate data in the device coordinate system based on the pad attribute dataset.
[0113] Create module 202 to acquire Mark point images and convert them to the HSV color space, and create Mark point matching contour templates;
[0114] The acquisition module 203 is used to acquire images of the substrate, solder paste and silkscreen areas based on the Mark point matching contour template and calculate the color segmentation parameter set;
[0115] The calculation module 204 is used to calculate the upper and lower limits of the tolerance value based on the pad attribute dataset, and generate a grouped tolerance value configuration table based on the upper and lower limits of the tolerance value.
[0116] The output module 205 is used to control the camera to acquire RGB image sets of each pad, extract the solder paste outline, calculate the centroid offset, correct the center coordinates of the detection box based on the centroid offset, and output the detection box configuration file.
[0117] Through the collaborative efforts of the aforementioned components, and by directly parsing the Gerber files generated during the PCB design phase, precise geometric parameters such as the center coordinates, dimensions, rotation angles, and package types of each pad are automatically extracted. This enables the automatic generation and precise positioning of the detection frame, fundamentally replacing the inefficient method of operators manually selecting pads one by one on the physical PCB in existing technologies. For complex PCBs containing hundreds of pads, parameter configuration time is reduced from 2-3 hours to 5-10 minutes, improving configuration efficiency by more than 20 times. By establishing a mapping transformation matrix from the Gerber coordinate system to the device coordinate system and automatically calculating the distance scaling factor and rotation correction angle, this invention effectively compensates for PCB manufacturing tensile deformation and board entry angle deviations. The detection frame positioning accuracy reaches within 0.05 mm, an improvement compared to the traditional method with a positioning error of more than 0.2 mm. This invention employs a K-means color clustering algorithm to automatically extract the color statistical features of the substrate, solder paste, and silkscreen. It automatically calculates binarized threshold parameters based on the mean and standard deviation, replacing the existing method of manually adjusting thresholds based entirely on operator experience. The deviation of threshold parameters configured by different operators is reduced from over 30% to within 5%, improving the objectivity and repeatability of parameter settings. By automatically grouping pads according to package type and automatically calculating the upper and lower limits of the height, volume, and area tolerances for each group based on the average area and solder paste printing process standards, this invention establishes a quantitative standard for tolerance setting, avoiding missed detections and false alarms caused by improper tolerance setting. The consistency deviation of tolerance parameters is controlled within 5%. The automatic detection frame correction function in learning mode effectively compensates for accumulated errors and reduces the positional deviation of the detection frame by calculating the offset between the solder paste centroid and the detection frame center and adaptively updating the detection frame coordinates.
[0118] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0119] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0120] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for automatically configuring solder paste 3D detection parameters based on Gerber files, characterized in that, include: Parse the pad attribute dataset of the Gerber file, and establish the detection box coordinate data in the device coordinate system based on the pad attribute dataset; Acquire Mark point images and convert them to the HSV color space to create Mark point matching contour templates; Based on the Mark point coordinate mapping relationship, the camera is guided to move sequentially to the center coordinates of the target substrate, solder paste and silk screen area in a preset order, and completes the high-resolution color image acquisition task above each target area, respectively acquiring images of the substrate, solder paste and silk screen area and calculating the color segmentation parameter group; The upper and lower limits of the tolerance value are calculated based on the pad attribute dataset, and a grouped tolerance value configuration table is generated based on the upper and lower limits of the tolerance value. The camera is controlled to acquire RGB image sets of each pad and extract the solder paste outline to calculate the centroid offset. The center coordinates of the detection frame are then corrected based on the centroid offset, and the detection frame configuration file is output.
2. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 1, characterized in that, The process of parsing the pad attribute dataset from the Gerber file and establishing bounding box coordinate data in the device coordinate system based on the pad attribute dataset includes: Read the D-code definition and aperture parameters of the Gerber file and parse the drawing instructions to identify the pad pattern dataset; The exposure coordinates and aperture size are extracted by traversing the pad pattern dataset, and a set of pad geometric parameters is generated based on the exposure coordinates and aperture size; Extract the package name from the Gerber file and associate the package name with the pad coordinates to obtain the pad attribute dataset; Based on the pad attribute dataset, a detection box is generated and diagonal Mark points are identified to establish the detection box coordinate data in the device coordinate system.
3. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 2, characterized in that, The step of generating a detection box based on the pad attribute dataset and identifying diagonal Mark points to establish detection box coordinate data in the device coordinate system includes: The detection boxes are generated by traversing the pad attribute dataset and the vertex coordinates are recorded to obtain the geometric data of the detection boxes in the Gerber coordinate system. Identify the diagonal Mark points, calculate the proportionality coefficients and differences between the Gerber nominal distance and angle and the measured values, and obtain the coordinate mapping parameter set; An affine transformation matrix is constructed based on the coordinate mapping parameter set, and a coordinate transformation is performed on the detection box based on the affine transformation matrix to obtain the detection box coordinate data in the device coordinate system.
4. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 1, characterized in that, The process of acquiring Mark point images and converting them to the HSV color space, and creating Mark point matching contour templates, includes: Control the camera to move to the Mark point and acquire RGB image data of the Mark point; The RGB image of the Mark points is converted to HSV space, and foreground pixels that meet the threshold conditions are filtered and connected component analysis is performed to obtain the binary mask image of the Mark points; Contour tracking and polygon approximation processing are performed on the binary mask image of the Mark points to obtain the Mark point matching contour template.
5. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 1, characterized in that, The camera, guided by the Mark point coordinate mapping relationship, moves sequentially to the center coordinates of the target substrate, solder paste, and silkscreen area in a preset order, and completes high-resolution color image acquisition above each target area. It acquires images of the substrate, solder paste, and silkscreen areas respectively and calculates a set of color segmentation parameters, including: Based on the Mark point coordinate mapping relationship, the camera is guided to move sequentially to the center coordinates of the target substrate, solder paste and silk screen area in a preset order, and completes the high-resolution color image acquisition task above each target area. The images of the substrate, solder paste and silk screen area are acquired and converted to YCrCb color space to obtain multiple YCrCb images. Clustering is performed on the multiple YCrCb images to generate color statistical parameters; The upper and lower limits of the threshold for each component are calculated based on the color statistical parameters, and a color segmentation parameter group is generated based on the upper and lower limits of the threshold for each component.
6. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 5, characterized in that, The step of performing clustering on the multiple YCrCb images to generate color statistical parameters includes: Within the multiple YCrCb images, pixel coordinates are randomly generated and color vectors are extracted. K-means iterative clustering is then performed to select clusters. Based on the clusters, rectangular sampling frames are uniformly generated on each YCrCb image. The pixels within the frames are traversed to calculate the mean and standard deviation of each color component, thereby obtaining color statistical parameters.
7. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 1, characterized in that, The step of calculating the upper and lower limits of the tolerance value based on the pad attribute dataset, and generating a grouped tolerance value configuration table based on the upper and lower limits of the tolerance value, includes: The pad attribute dataset is traversed, grouped by package type, and the average area of the pads in each group is calculated to obtain the average area parameter. The unit area coefficient is obtained by querying the process standard database, and the unit area coefficient is multiplied by the average area parameter to obtain the allowable range of height and volume for each group. The upper and lower limits of the allowable values are calculated based on the allowable range of height and volume for each group, and a group allowable value configuration table is generated based on the upper and lower limits of the allowable values.
8. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 1, characterized in that, The control camera acquires RGB image sets of each pad, extracts solder paste contours, calculates centroid offset, corrects the detection frame center coordinates based on the centroid offset, and outputs a detection frame configuration file, including: The camera is moved to each pad position and RGB images are acquired by traversing the coordinate data of the detection frame to obtain a set of RGB images. The RGB image set is traversed and converted to the YCrCb color space. The maximum connected component boundary contour is extracted based on the solder paste binarization threshold to obtain the set of solder paste contour coordinates for each pad. The centroid offset between the centroid and the center of the detection frame is calculated by traversing the set of solder paste contour coordinates. When the centroid offset exceeds the threshold, the center coordinates of the detection frame are updated, and the detection frame configuration file is output.
9. The automatic configuration method for solder paste three-dimensional detection parameters based on Gerber files according to claim 8, characterized in that, The automatic configuration method for solder paste 3D inspection parameters based on Gerber files also includes: The control grating projection device projects sinusoidal stripe gratings onto the solder paste surface of each pad and continuously changes the phase shift angle. At each phase shift angle, it acquires images of deformed stripes on the solder paste surface to obtain a phase shift image sequence. Based on the gray values of corresponding pixels in the phase-shifted image sequence at different phase-shift angles, the phase value of the pixel is calculated, and the phase values of all pixels are subjected to phase unrolling processing to obtain a continuous phase distribution map. The phase value of each pixel in the continuous phase distribution map is converted into the measured value of solder paste volume. It is then determined whether the measured value of solder paste volume falls within the upper and lower limits of the volume tolerance value of the corresponding group in the group tolerance value configuration table, and the determination result is recorded.
10. An automatic configuration system for solder paste three-dimensional inspection parameters based on Gerber files, characterized in that, The method for automatically configuring solder paste 3D inspection parameters based on Gerber files as described in any one of claims 1-9 includes: The parsing module is used to parse the pad attribute dataset of the Gerber file and establish the detection box coordinate data in the device coordinate system based on the pad attribute dataset. Create a module to acquire Mark point images and convert them to the HSV color space, and create Mark point matching contour templates; The acquisition module is used to guide the camera to move sequentially to the center coordinates of the target substrate, solder paste and silkscreen area according to the Mark point coordinate mapping relationship, and to complete the high-resolution color image acquisition task above each target area, acquiring images of the substrate, solder paste and silkscreen area respectively and calculating the color segmentation parameter group; The calculation module is used to calculate the upper and lower limits of the tolerance value based on the pad attribute dataset, and generate a grouped tolerance value configuration table based on the upper and lower limits of the tolerance value; The output module is used to control the camera to acquire RGB image sets of each pad, extract the solder paste outline, calculate the centroid offset, correct the center coordinates of the detection frame based on the centroid offset, and output the detection frame configuration file.
Citation Information
Patent Citations
Automatic alignment method for bonding pads in coordinate file and Gerber file
CN113966084A
Method and system for generating jet printing data, electronic device, and storage medium
US20240237223A1