PCB board pad flatness online detection method and system based on machine vision
By using machine vision technology and utilizing multi-directional, multi-polarization, and multi-wavelength optical response data sequences, combined with optical acquisition equipment and height relationship models, real-time and accurate detection of PCB board pad flatness was achieved, solving the problem of inaccurate detection in existing technologies.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-11
- Publication Date
- 2026-03-10
AI Technical Summary
Existing PCB board pad inspection technologies cannot provide real-time, accurate flatness assessments and are easily affected by human error and equipment wear.
A machine vision-based detection method is adopted. By connecting optical acquisition equipment, multiple positioning light sources in different directions are triggered in a unified coordinate system to obtain optical response data sequences with multiple directions, multiple polarizations, and multiple wavelengths. The pads are divided into multiple sub-regions, and surface reflection characteristics and brightness change feature data are extracted. Flatness detection is performed by combining the regional features with the height relationship model.
It enables real-time and accurate detection of PCB board pad flatness, solving the technical problem that existing technologies cannot accurately assess this issue.
Smart Images

Figure CN120907472B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of online inspection technology, specifically to a method and system for online inspection of PCB board pad flatness based on machine vision. Background Technology
[0002] In modern electronics manufacturing, PCBs (printed circuit boards) are a crucial basic component in electronic devices, and the flatness of the solder pads directly affects the soldering quality and the assembly and performance of subsequent components. However, existing PCB solder pad inspection technologies have several problems. Traditional solder pad flatness inspection methods mostly rely on manual inspection or mechanical contact measurement, which cannot provide real-time and accurate flatness assessments and are easily affected by human error and equipment wear. Summary of the Invention
[0003] This application provides a machine vision-based online detection method and system for PCB board pad flatness, which is used to address the technical problem that existing technologies cannot accurately and in real time detect the surface flatness of PCB board pads.
[0004] In view of the above problems, this application provides a method and system for online detection of PCB board pad flatness based on machine vision.
[0005] The first aspect of this application provides a machine vision-based online detection method for the flatness of PCB board pads, the method comprising:
[0006] Connecting an optical acquisition device, multiple positioning light sources in different directions are sequentially triggered under a unified coordinate system. Each light source has a preset polarization direction and wavelength combination, obtaining a multi-directional, multi-polarization, and multi-wavelength encoded optical response data sequence. Based on the geometric center and shape of the pads, each pad is divided into multiple pad regions corresponding to the incident direction of the light source. Within each pad region, feature data reflecting the surface reflection characteristics and brightness variation trend of the region are extracted based on the acquired optical response data sequence. The feature data of each pad region is input into a pre-established regional feature and height relationship model to obtain the relative height estimate of the region. Based on the positional relationship of the pad regions, the relative height estimate is positioned and stitched together to obtain the flatness detection index.
[0007] A second aspect of this application provides a machine vision-based online inspection system for the flatness of PCB board pads, the system comprising:
[0008] The data acquisition module connects to the optical acquisition device and sequentially triggers multiple positioning light sources in different directions under a unified coordinate system. Each light source has a preset polarization direction and wavelength combination, obtaining a multi-directional, multi-polarization, and multi-wavelength encoded optical response data sequence. The segmentation module divides each pad into multiple pad regions corresponding to the incident directions of the light sources, based on the geometric center and shape of the pads. The feature extraction module extracts feature data reflecting the surface reflection characteristics and brightness variation trend of each pad region based on the acquired optical response data sequence. The height estimation module inputs the feature data of each pad region into a pre-established regional feature-height relationship model to obtain a relative height estimate of the region. The positioning and stitching module performs positioning and stitching of the relative height estimate based on the positional relationship of the pad regions to obtain a flatness detection index.
[0009] One or more technical solutions provided in this application have at least the following technical effects or advantages:
[0010] This application connects to an optical acquisition device, sequentially triggering multiple positioning light sources in different directions under a unified coordinate system. Each light source has a preset polarization direction and wavelength combination, obtaining a multi-directional, multi-polarization, and multi-wavelength encoded optical response data sequence. Based on the geometric center and shape of the pads, each pad is divided into multiple pad regions corresponding to the incident directions of the light sources. Within each pad region, feature data reflecting the surface reflection characteristics and brightness variation trend of the region is extracted based on the acquired optical response data sequence. The feature data of each pad region is input into a pre-established regional feature-height relationship model to obtain a relative height estimate of the region. Based on the positional relationship of the pad regions, the relative height estimate is positioned and stitched together to obtain a flatness detection index. This invention solves the technical problem of existing technologies being unable to accurately and in real-time detect the surface flatness of PCB board pads. By utilizing multi-directional, multi-polarization, and multi-wavelength optical response data sequences, combined with machine vision technology, surface reflection characteristics are extracted and height is estimated, achieving the technical effect of real-time and accurate detection of pad flatness. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A schematic diagram of the online detection method for PCB board pad flatness based on machine vision provided in the embodiments of this application;
[0013] Figure 2 This is a schematic diagram of the structure of the online detection system for PCB board pad flatness based on machine vision provided in the embodiments of this application.
[0014] Figure labeling: Data acquisition module 11, segmentation module 12, feature extraction module 13, height estimation module 14, localization and stitching module 15. Detailed Implementation
[0015] This application provides a machine vision-based online detection method and system for PCB board pad flatness, addressing the technical problem that existing technologies cannot accurately and in real-time detect the surface flatness of PCB board pads. By utilizing multi-directional, multi-polarization, and multi-wavelength optical response data sequences, combined with machine vision technology, surface reflection characteristics are extracted and height is estimated, achieving the technical effect of real-time and accurate detection of pad flatness.
[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0017] It should be noted that any variation of the terms "comprising" and "having" is intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0018] Example 1, as Figure 1 As shown, this application provides a machine vision-based online detection method for PCB board pad flatness, the method comprising:
[0019] Step S100: Connect the optical acquisition device and trigger multiple positioning light sources in different directions in sequence under a unified coordinate system. Each light source has a preset polarization direction and wavelength combination to obtain an optical response data sequence with multi-directional, multi-polarization, and multi-wavelength encoding.
[0020] In this embodiment, a pre-prepared optical acquisition device is first connected. This device sequentially triggers multiple light sources positioned at different locations within a unified coordinate system. Each light source has a specific polarization direction and wavelength combination, acquiring optical response data of the pads. Each time a light source is triggered, its orientation, polarization direction, and wavelength parameters are recorded in real time, forming an optical response data sequence containing multi-directional, multi-polarization, and multi-wavelength information.
[0021] Furthermore, the method provided in the application embodiments also includes:
[0022] The optical acquisition equipment includes: a telecentric lens, an area array camera, and a multi-directional light source for control triggering.
[0023] In this embodiment, the optical acquisition device includes a telecentric lens, an area array camera, and a multi-directional light source for control and triggering. The area array camera is responsible for capturing optical images of the pad surface, while the telecentric lens ensures image acquisition accuracy at different light source angles, avoiding parallax problems caused by changes in the light source. The multi-directional light source for control and triggering is arranged in different orientations and has preset polarization directions and wavelength combinations. Each time it is triggered, the light source illuminates the pad surface, and the area array camera records the corresponding optical response data according to the illumination conditions of the light source.
[0024] Furthermore, the method provided in the application embodiments, in obtaining the pad optical response data sequence encoded with multiple directions, multiple polarizations, and multiple wavelengths, further includes:
[0025] Multiple light sources arranged at different locations are sequentially triggered in a unified coordinate system. Each light source has a preset combination of polarization direction and wavelength. When a light source is triggered, the optical response data of the pad corresponding to the illumination conditions of that light source is collected, and the orientation, polarization direction and wavelength parameters of the light source are recorded in real time. The optical response data collected under different light source illumination are geometrically registered and aligned at the pixel level to eliminate parallax offset caused by light source switching. Based on a standard reflector or reference pad, the brightness of the optical response data is normalized and the spectral response is corrected. Each registered and corrected optical response data is combined with its corresponding light source orientation, polarization direction and wavelength to form a coded optical response data sequence that can be used for subsequent feature extraction.
[0026] In this embodiment, when the optical acquisition device acquires optical response data of the pad surface using an area array camera and a telecentric lens, it sequentially triggers multiple light sources arranged in different orientations under a unified coordinate system. Each light source has a specific polarization direction and wavelength combination; for example, one light source is set to a horizontal polarization direction and a 450nm blue wavelength, while another light source uses a vertical polarization direction and a 650nm red wavelength.
[0027] Each time a light source is triggered, a planar array camera, in conjunction with a telecentric lens, acquires optical response data of the pad surface. At this time, the optical response image of the pad is recorded, and the illumination parameters of each light source, such as azimuth, polarization direction, and wavelength, are recorded in real time. For example, light source A has an azimuth of 30 degrees, a horizontal polarization direction, and a wavelength of 450 nm; light source B has an azimuth of 60 degrees, a vertical polarization direction, and a wavelength of 650 nm.
[0028] Subsequently, to eliminate parallax shift that may occur due to light source switching, a feature matching method is used to perform pixel-level geometric registration and alignment of optical response data acquired under different light source illumination. Specifically, firstly, feature detection algorithms (such as SIFT) are used to identify feature points in the image; these feature points are corners or edges in the image. Next, feature matching algorithms (such as nearest neighbor matching) are used to match feature points from different images one-to-one, thereby determining the relative positional relationship between the images. Then, the least squares method or RANSAC algorithm is used to calculate the transformation matrix between the images, which describes how one image is aligned with another image through transformations such as translation, rotation, and scaling. Finally, an interpolation algorithm (such as bilinear interpolation) is used to transform the image, rearranging each pixel in the image according to the position of the transformation matrix, ensuring that the images can be aligned in a unified coordinate system and eliminating parallax shift caused by light source switching.
[0029] After registration, the acquired optical response data is normalized for brightness and corrected for spectral response using a standard reflector or reference pads. Brightness normalization aims to eliminate brightness differences caused by different light sources or environmental factors (such as variations in light intensity). By comparing the acquired data with the known reflectance values of the standard reflector, the brightness of different images is adjusted to conform to a unified standard, ensuring consistency in brightness across all data. Simultaneously, spectral response correction eliminates errors caused by differences in device or light source wavelengths by comparing the known reflectance characteristics of the reference pads, ensuring consistent response across different wavelength conditions.
[0030] Finally, after completing geometric registration, brightness normalization, and spectral response correction, a combined identifier is created for each optical response data point, along with its corresponding light source orientation, polarization direction, and wavelength. These identifiers clearly indicate the illumination conditions for each data point. For example, the identifier for light source A might be "30° horizontal polarization 450nm," and the identifier for light source B might be "60° vertical polarization 650nm." In this way, a corresponding identifier is created for each optical response data point, ultimately forming a coded optical response data sequence containing all the necessary information.
[0031] Step S200: Based on the geometric center and shape of the pad, divide each pad into multiple pad regions corresponding to the incident direction of the light source.
[0032] In this embodiment, when dividing the pads according to their geometric center and shape, the center position of the pads is first located and its outline is determined. Then, based on the direction of the light source incident, the pads are divided into multiple pad regions corresponding to each light source incident direction.
[0033] Furthermore, in the method provided in the application embodiments, each pad is divided into multiple pad regions corresponding to the incident direction of the light source, based on the geometric center and shape of the pad, and further includes:
[0034] On any acquired reference optical response data, the geometric center and contour shape of the pad are automatically located using edge detection; based on the direction of the light source incident, combined with the geometric center and contour shape, each pad is divided into multiple pad regions corresponding to the direction of the light source; the partitioning results are subjected to boundary smoothing and morphological processing to ensure that the pixel range of each pad region is continuous and non-overlapping.
[0035] In this embodiment, an edge detection algorithm (such as Canny edge detection) is first applied to the acquired reference optical response data to automatically locate the geometric center and contour shape of the pad. Canny edge detection identifies edges in the image, thereby extracting the outline of the pad. Then, based on the extracted pad contour shape, the geometric center of the pad is determined using a centroid calculation method. This process first decomposes the contour into multiple discrete edge points, then calculates the average position of these edge points on the X and Y axes, thus obtaining the coordinates of the pad's geometric center.
[0036] Then, based on the incident direction of the light source, combined with the geometric center and contour shape of the pad, each pad is divided into multiple pad regions corresponding to the direction of the light source. During this process, different incident angles of the light source are mapped onto the pad coordinate system, and the pad is divided into several sub-regions according to each light source direction. Each sub-region corresponds to the illumination direction of the light source, ensuring that each region reflects the reflective characteristics of the pad surface under light illumination.
[0037] After region segmentation, each pad region undergoes boundary smoothing and morphological processing. Boundary smoothing uses algorithms such as Gaussian blur to remove irregular jagged edges from region boundaries, making the boundaries smoother and more continuous. Morphological processing then follows, including erosion and dilation operations. Erosion removes noise from region boundaries, shrinking them. Dilation expands region boundaries, filling gaps caused by noise or morphological irregularities. These processing steps ensure that the pixel range of each sub-region is continuous and non-overlapping, improving the accuracy and stability of region segmentation.
[0038] Furthermore, in the method provided in the application embodiment, based on the incident direction of the light source and in conjunction with the geometric center and contour shape, each pad is divided into multiple pad regions corresponding to the direction of the light source, and the method further includes:
[0039] The algorithm acquires the geometric center coordinates, outline, and principal axis direction of the pads, and establishes a pad coordinate system with the geometric center as the origin and the principal axis direction as the rotation reference. It maps the incident orientation of the light source to the pad coordinate system, determining the basic sector regions corresponding to each light source direction. Based on historical failed detection samples, it maps the relative position of defects in the pad geometric coordinate system to the current pad shape, and independently divides high-defect areas within the basic sectors. It analyzes the brightness response patterns under different light source orientations, and calculates the angle between the light incident angle and the edge normal by combining the pad outline and principal axis direction, detecting the cross-influence area between the light and the pad structure, identifying insufficient areas. It merges the basic sectors, high-defect areas, and insufficient areas according to a preset priority, generating a comprehensive partition mask, and establishes association labels between the partition mask and the light source orientation, performing region segmentation according to the association labels.
[0040] In this embodiment, the geometric center coordinates, outline, and principal axis direction of the pad are first obtained using optical response data. The geometric center is the center point of the pad surface, the outline is the boundary shape of the pad, and the principal axis direction is the main symmetry direction of the pad. This information is automatically extracted using image processing techniques (such as edge detection algorithms). Based on this data, a pad coordinate system is established with the geometric center as the origin and the principal axis direction as the rotation reference.
[0041] Next, based on the incident orientation of each light source, the light source direction is mapped onto the coordinate system of the pads. Specifically, the incident angle of each light source is converted into a relative angle in the pad coordinate system. For example, if the incident direction of light source A is 45 degrees, relative to the principal axis of the pad coordinate system, it is converted into a relative orientation in the pad coordinate system, ensuring that the illumination angle of each light source is accurately reflected in the pad coordinate system. Based on these mapping results, the pads are divided into multiple basic sectors, each sector corresponding to the incident direction of a light source.
[0042] Then, using historical failed inspection samples, the relative positions of defects in the historical failed inspection samples in the pad's geometric coordinate system are mapped to the shape of the current pad. In the historical samples, certain areas may frequently exhibit defects due to insufficient reflection or uneven pad surfaces. By mapping the relative positions of these historical defective areas to the geometric coordinate system of the current pad, areas where defects are likely to occur in the current pad are identified. Finally, these high-incidence defect areas are independently divided within each base sector.
[0043] The reflection characteristics of the pads were then evaluated by analyzing the brightness response patterns under different light source orientations. Each light source affects the reflected brightness of the pad surface, and this reflection data was used to evaluate the brightness response pattern. Combining the pad's contour and principal axis direction, the angle between the incident angle of the light ray and the edge normal was calculated. The edge normal is the direction perpendicular to the edge of the pad surface, and the angle between the incident angle and the edge normal reflects the interaction between the light ray and the pad surface. If the incident angle is small, the light ray is almost perpendicular, resulting in a strong reflection signal; if the incident angle is large, the light ray deviates from the normal, resulting in a weak reflection signal. Specifically, the angle between the light ray and the pad edge normal vector was first calculated using the light source direction vector and the pad edge normal vector. For example, assuming the incident direction of the light ray is L=(1,0,0) and the edge normal direction of the pad is N=(0,1,0), then the dot product between the light ray and the normal is... By calculating the dot product and vector magnitude, an angle of 90° is obtained, indicating a significant deviation between the light ray and the normal, resulting in a weak reflection signal. This calculation identifies which areas on the pad surface are blocked from light and which areas have insufficient reflection due to large incident angles. These identified areas are marked as insufficient areas, i.e., areas with poor lighting quality. Insufficient areas refer to areas where light reflection is poor under certain light source directions, resulting in lower brightness response. The optical data quality of these areas is poor, and if not individually identified, it will affect the overall pad flatness calculation.
[0044] Finally, based on preset priorities, the basic sector, high-defect areas, and insufficient areas are merged to generate a comprehensive partitioned mask. Each region is assigned a different priority according to its importance and quality in flatness inspection, ensuring that high-quality areas are processed first, while low-quality areas are specially identified and processed. Each partitioned mask is associated with the light source orientation to ensure that each region is correctly evaluated and analyzed according to the incident direction of the light source.
[0045] Step S300: Within each pad area, feature data reflecting the surface reflection characteristics and brightness variation trend of the area are extracted based on the acquired optical response data sequence.
[0046] In this embodiment, within each solder pad area, feature data reflecting the surface reflectivity and brightness variation trend of that area are extracted based on the acquired optical response data sequence. Specifically, firstly, by reading the optical response data sequence, each optical response data frame is matched with its acquisition parameters according to the combination of light source orientation, polarization direction, and wavelength. Then, under the same light source orientation, the response difference under different polarization directions is calculated to identify specular reflection areas. Next, under the same light source orientation, the response difference under different wavelengths is calculated to identify potential material differences or contamination areas. Furthermore, brightness variation patterns under different light source orientations are fused to extract directional brightness difference features reflecting local tilt or warping. Finally, all these polarization-related features, wavelength-related features, and directional brightness difference features are combined into a feature vector for the solder pad area. This feature vector is the feature data reflecting the surface reflectivity and brightness variation trend of that area.
[0047] Furthermore, in the method provided in the application embodiments, extracting feature data reflecting the surface reflection characteristics and brightness change trends of the region based on the collected optical response data sequence further includes:
[0048] Read the optical response data sequence and match each optical response data with its acquisition parameters based on the combination of light source orientation, polarization direction, and wavelength. Under the same light source orientation, calculate the response difference for different polarization directions to identify specular reflection areas. Under the same light source orientation, calculate the response difference for different wavelengths to identify areas of material difference or contamination. Fuse the brightness variation patterns under different light source orientations to extract directional brightness difference features that reflect local tilt or warping. Combine the polarization-related features, wavelength-related features, and directional brightness difference features to form the feature vector of the solder pad region.
[0049] In this embodiment, an optical response data sequence is first read. This sequence is derived from illumination by light sources under multi-directional, multi-polarization, and multi-wavelength conditions. Each optical response data frame records the reflection information of the pad surface under specific light source illumination conditions. Each frame is matched with its corresponding acquisition parameters based on the combination of light source orientation, polarization direction, and wavelength. This ensures that each data frame is precisely correlated with the specific conditions at the time of acquisition (such as light source angle, polarization state, and wavelength).
[0050] Subsequently, the response differences under different polarization directions were calculated under the same light source orientation. Specifically, the reflection intensity of the pad surface varies with the polarization state of the light. In this process, the differences in reflection intensity of the pad surface under different polarization directions (e.g., 0°, 45°, 90° polarization angles) were calculated. Specular reflection areas exhibit significant differences in reflection intensity at different polarization angles because the reflection of light in these areas is very strong and directional, while the reflection in diffuse reflection areas is relatively uniform, and the polarization direction has less influence on the reflection intensity. By calculating the changes in reflection response under different polarization angles, specular reflection areas—regions with significant differences in reflection intensity—are identified; these areas typically have smooth surfaces.
[0051] Simultaneously, under the same light source orientation, the response differences at different wavelengths are calculated to identify material differences or contamination areas. The reflection intensity of the solder pad surface varies under light illumination of different wavelengths because different materials have different reflection characteristics for different wavelengths of light. Furthermore, contaminants or surface impurities can also cause changes in the reflection signal at different wavelengths. Therefore, by calculating the response differences of the reflection signal at different wavelengths (such as red, green, and blue light), potential material differences or contamination areas can be identified. For example, some materials may reflect weakly at a certain wavelength but strongly at others, while contamination areas may exhibit abnormal reflection intensity at specific wavelengths.
[0052] Then, the reflective brightness variation patterns under different light source orientations are fused to extract directional brightness difference features. These features help identify local tilting or warping. Unevenness on the pad surface (such as tilting or warping) causes significant changes in reflective brightness under different light source orientations. By calculating the brightness response differences under different light source orientations (e.g., 0°, 45°, 90°, etc.), directional brightness difference features reflecting local surface tilting or warping are extracted. For example, in tilted areas, the brightness difference under different light source orientations may be larger, while in flat areas, the brightness difference is smaller. This process identifies areas of surface unevenness.
[0053] Finally, the polarization-related features, wavelength-related features, and directional brightness difference features are combined to form the feature vector of the pad region. These feature vectors integrate the reflection characteristics of the pad surface, brightness variation trends, material differences, and surface morphology variations.
[0054] Step S400: Input the feature data of each pad area into the pre-established regional feature and height relationship model to obtain the relative height estimate of the area.
[0055] In this embodiment, the feature vector of each pad region is input into a pre-calibrated region feature-height relationship model. This model is trained using known height data from a standard template and can map each feature vector to a relative height estimate for that region. Height mapping analysis is performed based on this feature data, outputting a relative height estimate for each pad region. These data are then bound to spatial location labels of the pad regions, thereby achieving accurate evaluation of the pad surface flatness.
[0056] Furthermore, in the method provided in the application embodiments, the method further includes inputting the feature data of each solder pad region into a pre-established region feature and height relationship model to obtain a relative height estimate of the region, and also includes:
[0057] The feature vector of each solder pad region is input into a pre-calibrated region feature and height relationship model, which is trained from the known height data of the standard template and can map the feature vector to the relative height estimate of the region. Height mapping analysis is performed based on the feature data of the solder pad region, and the relative height data of the solder pad region is output and bound to the spatial location label of the solder pad region.
[0058] In this embodiment, the feature vector of each pad region is input into a pre-calibrated region feature-height relationship model. The training process of this model is based on a known standard template, i.e., a precisely measured pad sample. The relative heights of each region on the standard template are obtained using precise measurement tools (such as laser scanners or contact measuring instruments). During training, the known relative height of each region on the standard template is matched with the region's feature data (such as reflection intensity, brightness difference, polarization response, etc.). Through these data comparisons, the region feature-height relationship model learns how each feature vector affects the relative height of the region. Specifically, this training data is processed using regression analysis or machine learning algorithms (such as support vector machines) to establish a mapping relationship from feature vectors to relative heights.
[0059] By inputting the feature vector of each solder pad region into a pre-calibrated region feature and height relationship model for processing, the relative height data of the solder pad region is obtained, which is the relative height estimate of the region.
[0060] Next, the relative height estimate of each pad area is bound to its spatial location label. The spatial location label is an identifier associated with the specific location of the pad area, ensuring that the height data of each area corresponds to the actual location, so that the height estimate of each area can be accurately mapped to the three-dimensional spatial location of the pad surface.
[0061] Step S500: Based on the positional relationship of the solder pad area, the estimated relative height is positioned and spliced to obtain the flatness detection index.
[0062] In this embodiment, when locating and stitching the relative height estimates based on the positional relationship of the pad regions, firstly, a weight is assigned to the relative height estimate of each region according to the characteristic stability of each pad region, and the height data at the boundary of adjacent regions is smoothed to obtain pad height distribution data. Then, based on the processed height distribution data, a reference plane for the entire board is fitted to remove the influence of overall warping. Next, through positioning and stitching, the height distribution data of the pads after removing the warping influence is compared with the height neighborhood according to the spatial positional relationship. Finally, the height data of each region is integrated to obtain the flatness detection index of the entire pad.
[0063] Furthermore, the method provided in the application embodiments, in order to obtain the flatness detection index, further includes:
[0064] Weights are assigned to the height estimates based on the characteristic stability of each pad region, and smoothing is performed at the region boundaries based on the relative height estimates to obtain complete pad height distribution data. Based on the processed pad height distribution data, a whole board reference plane is fitted to remove the influence of overall warping. After removing the influence of overall warping, the height neighborhood comparison and splicing are performed according to the positional relationship of the pad height distribution data to obtain the flatness detection index.
[0065] In this embodiment, firstly, different weights are assigned to the relative height estimates of each pad region based on its characteristic stability. Characteristic stability refers to whether the reflection data of the region is consistent and reliable; regions with higher stability are assigned higher weights, and vice versa. The sum of the weights of all regions is 1 to ensure the reasonable weighting of the data. By assigning weights to each region, it is ensured that more stable regions contribute more to the flatness detection. Next, based on the relative height estimates, smoothing is performed at the boundaries of each region. Smoothing is achieved by weighting the height data of adjacent regions according to the assigned weights, eliminating discontinuities and abrupt changes at the boundaries, allowing the height data to transition smoothly. For example, when a region has high reflection stability and a weight of 0.7, while the adjacent region has a weight of 0.3, the relative height estimates of the two regions at the boundary are weighted according to the ratio of these two weights, ensuring a more natural data transition. Through this process, complete pad height distribution data is obtained.
[0066] Then, a whole-board reference plane is fitted based on the processed pad height distribution data. This process aims to eliminate the influence of overall pad surface warpage. A theoretical reference plane is calculated using a fitting algorithm (such as least squares or higher-order polynomial fitting), which represents the ideal pad surface height distribution and removes the effects caused by pad surface warpage or overall tilt. Through this process, the influence of overall warpage is eliminated, and pad height distribution data after removing the warpage effect is obtained.
[0067] After removing the influence of overall warping, the data is compared and stitched together based on the pad height distribution data and spatial position relationship. By positioning and stitching, the height data of each region is seamlessly integrated to obtain the neighborhood height distribution.
[0068] Finally, based on the neighborhood height distribution, key indicators such as peak-valley difference, root mean square ripple, or array coplanarity are calculated. These calculation methods are used to quantify the height variation and unevenness of the pad surface. Next, the peak-valley difference, root mean square ripple, or array coplanarity are used as flatness detection indicators and compared with preset thresholds to obtain the final detection results.
[0069] Furthermore, in the method provided in the application embodiments, obtaining the flatness detection index further includes:
[0070] Based on the neighborhood height distribution, the peak-valley difference, root mean square undulation, or array coplanarity are calculated; the peak-valley difference, root mean square undulation, or array coplanarity are used as the flatness detection index, and the flatness detection index is compared with a preset threshold to obtain the detection result.
[0071] In this embodiment of the application, several key flatness indicators are first calculated based on the neighborhood height distribution, including peak-to-valley difference, root mean square undulation, and array coplanarity.
[0072] In calculating the peak-to-valley difference, the height difference between the highest and lowest points of each pad region is first calculated. This metric quantifies the maximum degree of surface unevenness within a region. For example, if the highest point of a region is 5 μm and the lowest point is -3 μm, then the peak-to-valley difference for that region is 8 μm. In calculating the root mean square (RMS) ripple, the standard deviation of the pad surface height values relative to the average height of the region is used to quantify minute surface undulations. RMS ripple reflects the overall degree of surface fluctuation. For example, if the height data for a pad region is {2 μm, 3 μm, 4 μm}, and its average value is 3 μm, then the calculated RMS ripple is 0.82 μm, indicating that the surface of that region has moderate minute undulations.
[0073] Array coplanarity assesses whether multiple pad regions lie on the same plane. By calculating the height differences between these regions and fitting a reference plane, the flatness of the height distribution of each region is determined. For example, if the height differences between multiple regions are small, it indicates that the pad surface is relatively flat; otherwise, unevenness or warping may exist.
[0074] Next, peak-to-valley difference, root mean square ripple, and array coplanarity will be used as flatness detection indicators to quantify the flatness status of the pad surface.
[0075] Finally, the obtained flatness test indicators are compared with preset thresholds. These preset thresholds are values set based on pad flatness requirements, industry standards, or engineering specifications. If the calculated test indicators exceed the preset thresholds, the pad surface is judged to have unevenness, warping, or other defects. For example, if the peak-to-valley difference exceeds 10μm, the area is considered to have significant unevenness; if the root mean square undulation exceeds 1μm, the surface undulation is large, affecting the quality of the pad. By comparing these flatness indicators with the preset thresholds, the final test results are obtained, indicating whether the PCB board pad flatness meets the preset requirements.
[0076] In summary, the embodiments of this application have at least the following technical effects:
[0077] This application connects to an optical acquisition device, sequentially triggering multiple positioning light sources in different directions under a unified coordinate system. Each light source has a preset polarization direction and wavelength combination, obtaining a multi-directional, multi-polarization, and multi-wavelength encoded optical response data sequence. Based on the geometric center and shape of the pads, each pad is divided into multiple pad regions corresponding to the incident directions of the light sources. Within each pad region, feature data reflecting the surface reflection characteristics and brightness variation trend of the region is extracted based on the acquired optical response data sequence. The feature data of each pad region is input into a pre-established regional feature-height relationship model to obtain a relative height estimate of the region. Based on the positional relationship of the pad regions, the relative height estimate is positioned and stitched together to obtain a flatness detection index. This invention solves the technical problem of existing technologies being unable to accurately and in real-time detect the surface flatness of PCB board pads. By utilizing multi-directional, multi-polarization, and multi-wavelength optical response data sequences, combined with machine vision technology, surface reflection characteristics are extracted and height is estimated, achieving the technical effect of real-time and accurate detection of pad flatness.
[0078] Example 2, based on the same inventive concept as the online detection method for PCB board pad flatness based on machine vision in the previous examples, such as... Figure 2 As shown, this application provides an online inspection system for the flatness of PCB board pads based on machine vision. The system and method embodiments in this application are based on the same inventive concept. The system includes:
[0079] The data acquisition module 11 is used to connect to the optical acquisition device and sequentially trigger multiple positioning light sources in different directions under a unified coordinate system. Each light source has a preset polarization direction and wavelength combination to obtain a multi-directional, multi-polarization, and multi-wavelength encoded optical response data sequence. The segmentation module 12 is used to divide each pad into multiple pad regions corresponding to the incident direction of the light source according to the geometric center and shape of the pad. The feature extraction module 13 is used to extract feature data reflecting the surface reflection characteristics and brightness change trend of each pad region based on the acquired optical response data sequence. The height estimation module 14 is used to input the feature data of each pad region into a pre-established regional feature and height relationship model to obtain the relative height estimate of the region. The positioning and stitching module 15 is used to perform positioning and stitching of the relative height estimate based on the positional relationship of the pad regions to obtain the flatness detection index.
[0080] Furthermore, the system is also used to implement the following functions:
[0081] Weights are assigned to the height estimates based on the characteristic stability of each pad region, and smoothing is performed at the region boundaries based on the relative height estimates to obtain complete pad height distribution data. Based on the processed pad height distribution data, a whole board reference plane is fitted to remove the influence of overall warping. After removing the influence of overall warping, the height neighborhood comparison and splicing are performed according to the positional relationship of the pad height distribution data to obtain the flatness detection index.
[0082] Furthermore, the system is also used to implement the following functions:
[0083] Based on the neighborhood height distribution, the peak-valley difference, root mean square undulation, or array coplanarity are calculated; the peak-valley difference, root mean square undulation, or array coplanarity are used as the flatness detection index, and the flatness detection index is compared with a preset threshold to obtain the detection result.
[0084] Furthermore, the system is also used to implement the following functions:
[0085] Read the optical response data sequence and match each optical response data with its acquisition parameters based on the combination of light source orientation, polarization direction, and wavelength. Under the same light source orientation, calculate the response difference for different polarization directions to identify specular reflection areas. Under the same light source orientation, calculate the response difference for different wavelengths to identify areas of material difference or contamination. Fuse the brightness variation patterns under different light source orientations to extract directional brightness difference features that reflect local tilt or warping. Combine the polarization-related features, wavelength-related features, and directional brightness difference features to form the feature vector of the solder pad region.
[0086] Furthermore, the system is also used to implement the following functions:
[0087] The optical acquisition equipment includes: a telecentric lens, an area array camera, and a multi-directional light source for control triggering.
[0088] Furthermore, the system is also used to implement the following functions:
[0089] On any acquired reference optical response data, the geometric center and contour shape of the pad are automatically located using edge detection; based on the direction of the light source incident, combined with the geometric center and contour shape, each pad is divided into multiple pad regions corresponding to the direction of the light source; the partitioning results are subjected to boundary smoothing and morphological processing to ensure that the pixel range of each pad region is continuous and non-overlapping.
[0090] Furthermore, the system is also used to implement the following functions:
[0091] The algorithm acquires the geometric center coordinates, outline, and principal axis direction of the pads, and establishes a pad coordinate system with the geometric center as the origin and the principal axis direction as the rotation reference. It maps the incident orientation of the light source to the pad coordinate system, determining the basic sector regions corresponding to each light source direction. Based on historical failed detection samples, it maps the relative position of defects in the pad geometric coordinate system to the current pad shape, and independently divides high-defect areas within the basic sectors. It analyzes the brightness response patterns under different light source orientations, and calculates the angle between the light incident angle and the edge normal by combining the pad outline and principal axis direction, detecting the cross-influence area between the light and the pad structure, identifying insufficient areas. It merges the basic sectors, high-defect areas, and insufficient areas according to a preset priority, generating a comprehensive partition mask, and establishes association labels between the partition mask and the light source orientation, performing region segmentation according to the association labels.
[0092] Furthermore, the system is also used to implement the following functions:
[0093] Multiple light sources arranged at different locations are sequentially triggered in a unified coordinate system. Each light source has a preset combination of polarization direction and wavelength. When a light source is triggered, the optical response data of the pad corresponding to the illumination conditions of that light source is collected, and the orientation, polarization direction and wavelength parameters of the light source are recorded in real time. The optical response data collected under different light source illumination are geometrically registered and aligned at the pixel level to eliminate parallax offset caused by light source switching. Based on a standard reflector or reference pad, the brightness of the optical response data is normalized and the spectral response is corrected. Each registered and corrected optical response data is combined with its corresponding light source orientation, polarization direction and wavelength to form a coded optical response data sequence that can be used for subsequent feature extraction.
[0094] Furthermore, the system is also used to implement the following functions:
[0095] The feature vector of each solder pad region is input into a pre-calibrated region feature and height relationship model, which is trained from the known height data of the standard template and can map the feature vector to the relative height estimate of the region. Height mapping analysis is performed based on the feature data of the solder pad region, and the relative height data of the solder pad region is output and bound to the spatial location label of the solder pad region.
[0096] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are possible or may be advantageous.
[0097] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0098] This specification and accompanying drawings are merely illustrative examples of this application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from its scope. Therefore, if such modifications and modifications fall within the scope of this application and its equivalents, this application intends to include such modifications and modifications.
Claims
1. A PCB pad flatness online detection method based on machine vision, characterized in that, The method comprises the following steps: connecting an optical acquisition device, triggering a plurality of positioning light sources in different directions in turn under a unified coordinate system, each light source in a direction having a preset polarization direction and wavelength combination, and obtaining a multi-direction, multi-polarization and multi-wavelength coded optical response data sequence; dividing each pad into a plurality of pad sub-regions corresponding to the light source incident direction according to the geometric center and shape of the pad; extracting feature data reflecting the surface reflection characteristics and brightness change trend of each pad sub-region based on the acquired optical response data sequence; inputting the feature data of each pad sub-region into a pre-established region feature-height relationship model to obtain the relative height estimate value of the region; positioning and splicing the relative height estimate value based on the positional relationship of the pad sub-regions to obtain the flatness detection index; obtaining the flatness detection index, comprising: assigning a weight to the height estimate value according to the feature stability of each pad sub-region, and performing smoothing processing on the relative height estimate value at the region boundary to obtain complete pad height distribution data; fitting a whole plate reference plane based on the processed pad height distribution data to remove the influence of overall warping; after removing the influence of overall warping, performing height neighborhood comparison and splicing according to the positional relationship of the pad height distribution data to obtain the flatness detection index; obtaining the flatness detection index, comprising: calculating the peak-valley difference, root mean square fluctuation or array coplanarity based on the neighborhood height distribution; taking the peak-valley difference, root mean square fluctuation or array coplanarity as the flatness detection index, and comparing the flatness detection index with a preset threshold to obtain a detection result. 2.The method of claim 1, wherein, extracting feature data reflecting the surface reflection characteristics and brightness change trend of each pad sub-region based on the acquired optical response data sequence, comprising: reading the optical response data sequence, and matching each optical response data with its acquisition parameters according to the combination of light source direction, polarization direction and wavelength; under the same light source direction, calculating the response difference of different polarization directions for identifying the specular reflection region; under the same light source direction, calculating the response difference of different wavelengths for identifying the material difference or contaminated region; fusing the brightness change mode under different light source directions to extract the directional brightness difference feature for reflecting local tilt or warping; combining the polarization-related features, wavelength-related features and directional brightness difference features to form the feature vector of the pad sub-region. 3.The method of claim 1, wherein The optical acquisition device comprises a telecentric lens, a face array camera and a multi-direction light source control trigger.
4. The method for online detecting flatness of PCB pad based on machine vision according to claim 1, characterized in that, Dividing each pad into a plurality of pad sub-regions corresponding to the light source incident direction according to the geometric center and shape of the pad, comprising: automatically positioning the geometric center and contour shape of the pad on any reference optical response data collected by edge detection; dividing each pad into a plurality of pad sub-regions corresponding to the light source direction according to the geometric center and contour shape; performing boundary smoothing and morphological processing on the division result to ensure that the pixel range of each pad sub-region is continuous and has no overlap.
5. The method according to claim 4, wherein, According to the direction of the light source, combined with the geometric center and the contour shape, each pad is divided into a plurality of pad sub-regions corresponding to the direction of the light source, including: Obtain the geometric center coordinates, contour shape and principal axis direction of the pad, and establish a pad coordinate system with the geometric center as the coordinate origin and the principal axis direction as the rotation reference; Map the incident direction of the light source to the pad coordinate system to determine the basic sector partition corresponding to each light source direction; Based on the historical detection failure samples, map the relative position of the defect in the pad geometric coordinate system to the current pad shape, and independently divide the high-defect area in the basic sector; Analyze the brightness response mode under different light source directions, and calculate the angle between the light incident angle and the edge normal based on the pad contour and the principal axis direction to detect the intersection area of the light and the pad structure, wherein the insufficient area is determined; Merge the basic sector, high-defect area and insufficient area according to the preset priority, generate a comprehensive partition mask, and associate the partition mask with the light source direction to establish a label, and perform region segmentation according to the associated label.
6. The method of claim 1, wherein the method further comprises: Obtain a multi-direction, multi-polarization, and multi-wavelength encoded pad optical response data sequence, including: Trigger a plurality of light sources arranged in different directions in a unified coordinate system, each light source having a preset polarization direction and wavelength combination; When each light source is triggered, collect the pad optical response data corresponding to the illumination conditions of the light source, and record the light source direction, polarization direction and wavelength parameters in real time; Align the optical response data collected under different light source illuminations at the pixel level to eliminate the parallax offset caused by light source switching; Based on a standard reflector or a reference pad, perform brightness normalization and spectral response correction on the optical response data, and establish a combined identifier for each aligned and corrected optical response data and its corresponding light source direction, polarization direction and wavelength to form an encoded optical response data sequence that can be used for subsequent feature extraction.
7. The method of claim 1, wherein the method further comprises: Input the feature data of each pad sub-region into the pre-established region feature and height relationship model to obtain the relative height estimate value of the region, including: Input the feature vector of each pad sub-region into the pre-calibrated region feature and height relationship model, wherein the region feature and height relationship model is trained by the known height data of the standard template, and can map the feature vector to the relative height estimate value of the region; Perform height mapping analysis based on the feature data of the pad sub-region, output the relative height data of the pad sub-region, and bind it with the spatial position label of the pad sub-region.
8. A PCB pad flatness online detection system based on machine vision, characterized in that, The system is used to perform the machine vision-based PCB pad flatness online detection method as claimed in any one of claims 1-7, and the system comprises: A data acquisition module is used to connect an optical acquisition device, trigger a plurality of positioning light sources in different directions in a unified coordinate system, each light source in a direction having a preset polarization direction and wavelength combination, and obtain a multi-direction, multi-polarization, and multi-wavelength encoded optical response data sequence; A division module is used to divide each pad into a plurality of pad sub-regions corresponding to the incident direction of the light source according to the geometric center and shape of the pad. The feature extraction module is configured to extract feature data reflecting surface reflection characteristics and brightness change trend of each sub-pad area based on the collected optical response data sequence; The height estimation module is configured to input the feature data of each sub-pad area into a pre-established area feature-height relationship model to obtain a relative height estimation value of the area; The positioning and splicing module is configured to position and splice the relative height estimation values based on the positional relationship of the sub-pad areas to obtain the flatness detection index.
Citation Information
Patent Citations
Intelligent mobile phone defect detection method and system
CN120558973A
Solder paste defect detection method based on machine vision
CN120726016A