A PCB multi-parameter synchronous detection method, electronic equipment and storage medium
By fusing 2D images and 3D point cloud data to generate PCB elevation maps, and combining them with design files to compare the height and contour of component mounting positions, this method solves the problem that existing 2D vision inspection methods cannot comprehensively evaluate PCB board quality, and achieves efficient and accurate multi-parameter inspection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIANJIN BONUO ZHICHUANG ROBOT TECH CO LTD
- Filing Date
- 2025-12-04
- Publication Date
- 2026-05-15
AI Technical Summary
Existing 2D vision inspection methods cannot comprehensively assess the production quality of PCB boards and are insufficient to meet the installation quality inspection requirements of high-density, miniaturized PCB boards.
By fusing 2D image data and 3D point cloud data to generate PCB elevation maps, and combining the standard height and contour information in the design files, the height and contour of component mounting positions are simultaneously compared and detected.
It enables simultaneous multi-parameter detection of PCB boards, improving the coverage and accuracy of detection, reducing the risk of missed detections, and increasing detection efficiency and PCB assembly yield.
Smart Images

Figure CN121258992B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual inspection technology, specifically to a method for simultaneous multi-parameter inspection of PCB boards, an electronic device, and a storage medium. Background Technology
[0002] As the core carrier of electronic devices, the component mounting quality and physical structural stability of printed circuit boards (PCBs) directly determine the reliability and lifespan of end products. With the rapid development of the electronics and information industry towards high density, miniaturization, and integration, the mounting density of components on PCBs is constantly increasing, and the pin spacing is continuously shrinking, placing stringent demands on the accuracy, efficiency, and multi-dimensional coverage of mounting quality inspection. Currently, in the PCB manufacturing process, post-component mounting quality inspection has become a crucial step in ensuring product yield.
[0003] In related technologies, traditional 2D vision inspection methods are mainly relied upon. This method analyzes information from acquired planar images. Due to the limited number of parameters, it cannot comprehensively assess the production quality of PCBs and fails to meet the current industry's high requirements for defect detection rates. Summary of the Invention
[0004] The main objective of this invention is to provide a method for simultaneous multi-parameter inspection of PCB boards, an electronic device, and a storage medium, aiming to solve the technical problem that existing 2D vision inspection methods cannot comprehensively evaluate the production quality of PCBs.
[0005] To achieve the above objectives, in a first aspect, embodiments of this application provide a method for simultaneous detection of multiple parameters on a PCB board, comprising:
[0006] Two-dimensional and three-dimensional detection data of the target PCB board are acquired respectively to obtain 2D image data and 3D point cloud data;
[0007] The 2D image data and 3D point cloud data are spatiotemporally aligned and fused according to the transformation matrix to obtain the PCB elevation map of the target PCB board, wherein the pixel value of the pixel in the PCB elevation map represents the height value of the corresponding pixel.
[0008] Obtain the design file of the target PCB board, and determine the position coordinates of all preset component mounting positions on the target PCB board, as well as the height threshold range and standard 2D contour of the corresponding standard components.
[0009] Based on the location coordinates, traverse the pixel regions corresponding to all preset component mounting positions in the PCB elevation map, extract the pixel values of each mounting position pixel region, and convert the actual height value of each mounting position according to the mapping relationship between the pixel values and the height values.
[0010] The actual height value of each mounting position is compared with the height threshold range of the corresponding standard component to obtain the height matching result;
[0011] Extract the actual contour corresponding to each mounting position in the PCB elevation map, and match it with the standard 2D contour of the corresponding mounting position in the design file to obtain the contour matching result. Based on the contour matching result and the height matching result, perform synchronous detection to obtain the first detection result.
[0012] In one possible implementation, the step of spatiotemporally aligning and fusing the 2D image data and 3D point cloud data according to a transformation matrix to obtain the PCB elevation map of the target PCB board includes:
[0013] Using a transformation matrix, each 3D point in the 3D point cloud data is mapped to the image coordinate system corresponding to the 2D image data, thus obtaining the 2D pixel coordinates corresponding to each 3D point;
[0014] Based on the resolution of 2D image data, a two-dimensional grid is constructed that corresponds one-to-one with the pixels of the 2D image, and each 3D point is assigned to the corresponding grid cell according to its 2D pixel coordinates.
[0015] For each grid cell, if multiple 3D points fall into it, the average height value of all 3D points is calculated as the final height value of the grid cell; if no 3D points fall into the grid cell, the missing data is filled using a preset filling rule.
[0016] According to the preset height-pixel value mapping rules, the final height value of each grid cell is converted into the corresponding pixel value to generate the PCB elevation map of the target PCB board.
[0017] In one possible implementation, the step of extracting the actual contour corresponding to each mounting position in the PCB elevation drawing and matching it with the standard 2D contour of the corresponding mounting position in the design file to obtain the contour matching result includes:
[0018] The pixel region corresponding to the mounting position in the PCB elevation map is binarized to extract the edge information of the actual contour.
[0019] The similarity between the actual contour and the standard 2D contour is calculated based on the edge information;
[0020] Based on the comparison between the aforementioned similarity and a preset contour similarity, a 2D contour matching result is obtained, indicating whether the contours match or do not match.
[0021] In one possible implementation, the edge information includes edge contour lines and multiple key edge points, and the step of calculating the similarity between the actual contour and the standard 2D contour based on the edge information includes:
[0022] The area is matched by calculating the ratio between the area enclosed by the actual contour and the area enclosed by the standard 2D contour based on the edge contour lines.
[0023] In the case of area matching, multiple vector pairs are determined based on multiple key edge points;
[0024] Contour similarity is determined based on the angle between each vector pair in a plurality of vector pairs.
[0025] In one possible implementation, determining multiple vector pairs based on multiple key edge points includes:
[0026] Affine transformation correction is performed on the key edge points of the actual contour to compensate for the rotation and translation deviation of the PCB board during the imaging process. The affine transformation correction is based on the centroid alignment and principal axis alignment of the actual contour and the standard 2D contour.
[0027] Extract N key edge points from the edge information of the actual contour after affine transformation correction, and sort them in a clockwise or counterclockwise direction;
[0028] Extract N corresponding standard key points from the standard 2D contour and sort them using the same order rules as the actual contour;
[0029] For the sorted actual contour key points, connect adjacent two points in sequence to construct N contour vectors;
[0030] For the sorted standard contour key points, perform the same operation to construct N standard vectors, so that the N contour vectors and the N standard vectors form N vector pairs.
[0031] In one possible implementation, determining the contour similarity based on the angle value between each vector pair in a plurality of vector pairs includes:
[0032] Based on the cosine value of the vector, the angle between each vector pair is obtained, resulting in N angle values;
[0033] Calculate the length of each standard vector, and determine the weight of each vector pair based on the length of the standard vector. The longer the standard vector, the greater the corresponding weight.
[0034] Calculate the weighted average angle value based on the included angle value of each vector pair and its corresponding weight;
[0035] The similarity value is determined based on the weighted average angle value.
[0036] In one possible implementation, the step of simultaneously detecting based on the contour matching result and the height matching result to obtain the first detection result includes:
[0037] If the contour matches and the height matches, it is determined that the corresponding mounting position is a normal installation of the component;
[0038] If the outline and height do not match, it is determined that the corresponding mounting position is a missing component.
[0039] If the contours do not match but the heights do, it is determined that the corresponding mounting position is due to incorrect component mounting.
[0040] If the contour matches but the height does not, it is determined that the corresponding mounting position is a dummy component.
[0041] In one possible implementation, the method further includes:
[0042] If the first test result indicates that all mounting positions are where the components are installed normally, the target PCB board is divided into M×N grid areas on a two-dimensional plane based on the PCB elevation map.
[0043] Calculate the average height value of all pixels within each grid region, and use it as the representative height of that grid region;
[0044] A reference plane is fitted based on the representative heights of all grid regions and their two-dimensional planar coordinates.
[0045] Calculate the distance from the representative height of each grid region to the reference plane to obtain the local warping value of each region;
[0046] Based on the local warpage values of all regions, the overall warpage assessment value of the target PCB board is calculated.
[0047] The overall warpage assessment value is compared with a preset warpage threshold to generate a second detection result, which is used to determine whether the physical structure of the target PCB board is qualified.
[0048] Secondly, embodiments of this application also provide an electronic device, including: a memory and a processor, wherein the memory is used to store program code; and the processor is used to call the program code to execute the method as described in the first aspect.
[0049] Thirdly, embodiments of this application also provide a storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0050] Unlike existing technologies, this application provides a multi-parameter synchronous inspection method for PCB boards. This method generates a PCB elevation map by fusing 2D images and 3D point cloud data. Combined with standard height and contour information from the design documents, it performs synchronous comparison and analysis of the height and contour of component mounting positions, achieving integrated inspection. This method compensates for the lack of depth information in 2D inspection by introducing an elevation map generated from 3D point cloud data. Simultaneously, the spatiotemporal alignment and fusion of 2D and 3D data preserves the high-resolution details of the 2D image while adding height dimension information, significantly improving the coverage and accuracy of the inspection. Furthermore, through multi-parameter synchronous analysis, this method achieves simultaneous height and contour matching in a single inspection process, improving inspection efficiency and effectively reducing the risk of missed detections caused by multiple separate inspections. This provides a reliable technical guarantee for improving PCB assembly yield and product reliability. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0052] Figure 1 This is a flowchart illustrating the multi-parameter synchronous detection method for PCB boards in some embodiments of this application;
[0053] Figure 2 This is a flowchart illustrating step S200 of the PCB board multi-parameter synchronous detection method in some embodiments of this application;
[0054] Figure 3 This is a flowchart illustrating step S600 of the PCB board multi-parameter synchronous detection method in some embodiments of this application;
[0055] Figure 4 This is a schematic diagram of the hardware structure of an electronic device in some embodiments of this application.
[0056] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0058] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.
[0059] Furthermore, the use of terms such as "first" and "second" in this invention is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the term "and / or" throughout the text includes three solutions; taking A and / or B as an example, it includes technical solution A, technical solution B, and a technical solution that simultaneously satisfies A and B. Furthermore, the technical solutions of various embodiments can be combined with each other, but this must be based on the ability of a person skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0060] As the core carrier of electronic devices, the component mounting quality and physical structural stability of printed circuit boards (PCBs) directly determine the reliability and lifespan of end products. With the rapid development of the electronics and information industry towards high density, miniaturization, and integration, the mounting density of components on PCBs is constantly increasing, and the pin spacing is continuously shrinking, placing stringent demands on the accuracy, efficiency, and multi-dimensional coverage of mounting quality inspection. Currently, in the PCB manufacturing process, post-component mounting quality inspection has become a crucial step in ensuring product yield.
[0061] In related technologies, traditional 2D vision inspection methods are mainly relied upon. This method analyzes information from acquired planar images. Due to the limited number of parameters, it cannot comprehensively assess the production quality of PCBs and fails to meet the current industry's high requirements for defect detection rates.
[0062] To address the aforementioned technical problems, this application provides a method for simultaneous multi-parameter inspection of PCB boards. This method can be applied to electronic devices, where the electronic device can be an inspection system. This inspection system may include an inspection placement platform, a 2D inspection instrument, and a 3D inspection instrument, etc. Figures 1-3 As shown, the following explanation uses an electronic device executing a multi-parameter synchronous detection method for this PCB board as an example. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order. Please refer to the appendix. Figure 1 The method includes the following steps S100-S600:
[0063] Step S100: Obtain the two-dimensional detection data and three-dimensional detection data of the target PCB board respectively to obtain 2D image data and 3D point cloud data;
[0064] Specifically, 2D image data can be acquired through an RGB camera, and 3D point cloud data can be acquired through an RGB-D camera or LiDAR.
[0065] For example, the PCB board to be inspected is placed on the inspection stage, and the RGB camera and RGB-D camera or LiDAR are activated to simultaneously acquire 2D image data and 3D point cloud data.
[0066] Step S200: Perform spatiotemporal alignment and fusion of the 2D image data and 3D point cloud data according to the transformation matrix to obtain the PCB elevation map of the target PCB board, wherein the pixel value of the pixel in the PCB elevation map represents the height value of the corresponding pixel.
[0067] Specifically, a transformation matrix is a mathematical transformation matrix used to spatially map the 3D coordinate system (such as the depth coordinate system of an RGB-D camera) containing 3D point cloud data to the 2D image coordinate system (such as the pixel coordinate system of an RGB camera) containing 2D image data. It includes key parameters such as rotation and translation vectors, enabling precise alignment of the two types of data in space. The transformation matrix can be determined by the installation positions of the RGB and RGB-D cameras and their corresponding intrinsic parameters. Intrinsic parameters include parameters reflecting the imaging characteristics of the devices, such as the camera's focal length and principal point coordinates. The installation positions determine the relative spatial orientation between the two devices (such as translation distance and rotation angle). After determining the installation positions and intrinsic parameters of the RGB and RGB-D cameras, the transformation matrix can be determined based on coordinate system transformation principles (such as calculating the rotation and translation relationship between the coordinate systems of the two devices through camera calibration algorithms), ensuring that spatial points in the 3D point cloud data can be accurately mapped to the corresponding pixel positions in the 2D image.
[0068] Therefore, after acquiring the 2D image data and 3D point cloud data of the target PCB board in step S100, a pre-determined transformation matrix can be used to perform spatiotemporal alignment and fusion processing on the two types of data. By eliminating differences in device coordinate systems and acquisition timing deviations through the transformation matrix, the height information of the 3D point cloud data is precisely correlated with the pixel positions of the 2D image data, ultimately generating a PCB elevation map of the target PCB board. In this elevation map, the pixel value of each pixel forms a unique mapping with the height value of its corresponding physical location, achieving unified carrying of "planar position-height information" within a single data source.
[0069] In one embodiment, please refer to the appendix. Figure 2Step S200: Performing spatiotemporal alignment and fusion of the 2D image data and 3D point cloud data according to the transformation matrix to obtain the PCB elevation map of the target PCB board, including:
[0070] S210. Using a transformation matrix, map each 3D point in the 3D point cloud data to the image coordinate system corresponding to the 2D image data to obtain the 2D pixel coordinates corresponding to each 3D point.
[0071] S220. Based on the resolution of the 2D image data, construct a two-dimensional grid that corresponds one-to-one with the pixels of the 2D image, and assign each 3D point to the corresponding grid cell according to its 2D pixel coordinates.
[0072] S230. For each grid cell, if multiple 3D points fall into it, calculate the average height value of all 3D points as the final height value of the grid cell; if no 3D points fall into the grid cell, fill in the missing data using a preset filling rule.
[0073] S240. According to the preset height-pixel value mapping rule, the final height value of each grid cell is converted into the corresponding pixel value to generate the PCB elevation map of the target PCB board.
[0074] Specifically, firstly, using a pre-calibrated transformation matrix, the three-dimensional spatial coordinates (e.g., X, Y, Z) of each 3D point in the 3D point cloud data are mapped to the image coordinate system corresponding to the 2D image data, and the pixel coordinates (e.g., u, v) of each 3D point in the 2D image are calculated. The transformation matrix eliminates coordinate system differences between the two types of data (e.g., installation position deviations between RGB and RGB-D cameras), ensuring a precise spatial correspondence between 3D points and 2D pixels, laying the foundation for subsequent data fusion. Next, using the resolution of the 2D image data (e.g., pixel size, number of rows and columns) as a benchmark, a two-dimensional grid is constructed that corresponds one-to-one with the pixels of the 2D image. Each grid cell corresponds to a pixel position in the 2D image. Then, based on the 2D pixel coordinates obtained in S210, all 3D points are assigned to their corresponding grid cells, thus initially associating the height information of the 3D points with their 2D planar positions. Then, height value processing is performed on each grid cell to ensure data validity: if multiple 3D points fall within the same grid cell (due to point cloud data density or detection viewpoint), the average height value (Z coordinate) of these 3D points is calculated as the final height value of the grid cell, avoiding the influence of single-point noise; if no 3D points fall within the grid cell (e.g., incomplete point cloud data coverage), a preset filling rule (e.g., neighboring grid height interpolation, default baseline height assignment, etc.) is used to fill in the missing data, ensuring the integrity of the overall height information of the elevation map. Finally, according to a preset height-pixel value mapping rule (e.g., linearly converting height values to grayscale values, or mapping to RGB values through color encoding), the final height value of each grid cell is converted into the corresponding pixel value. For example, it can be set that the higher the height, the brighter the pixel value, and the lower the height, the darker the pixel value, so that the PCB elevation map maintains the planar positional accuracy of the 2D image and can intuitively reflect the height information of the corresponding position through pixel values, ultimately generating a target PCB board elevation map that integrates two-dimensional and three-dimensional features.
[0075] Thus, this embodiment of the application achieves spatiotemporal alignment and fusion of 2D image data and 3D point cloud data by implementing coordinate mapping, mesh allocation, height processing and pixel conversion in steps. The generated PCB elevation map can serve as a unified data carrier to provide planar contour and height information simultaneously, laying a data foundation for subsequent efficient inspection, thereby improving the accuracy and efficiency of multi-parameter inspection of PCB boards.
[0076] Step S300: Obtain the design file of the target PCB board, and determine the position coordinates of all preset component mounting positions on the target PCB board, as well as the height threshold range and standard 2D contour of the corresponding standard components.
[0077] After generating the PCB elevation map of the target PCB board in step S200, the design documents of the PCB board (such as CAD design drawings or BOM list) can be further obtained, and key information can be extracted from them: First, the precise position coordinates of all preset component mounting positions on the board (such as the pixel coordinate range in the image coordinate system) can be determined; second, the standard component parameters corresponding to each mounting position can be obtained, including its height threshold range (i.e., the upper and lower limits of height under qualified mounting conditions) and standard 2D contour (i.e., the planar shape and size defined by the design). This information will serve as the benchmark data for subsequent comparison of the actual contour with the standard contour and verification of the actual height with the standard height range, providing a reliable basis for accurately determining the component mounting status.
[0078] Step S400: Traverse the pixel regions corresponding to all preset component mounting positions in the PCB elevation map according to the position coordinates, extract the pixel values of each mounting position pixel region, and convert the actual height value of each mounting position according to the mapping relationship between the pixel values and the height values.
[0079] After obtaining the reference information (position coordinates of the preset component mounting positions, the corresponding height threshold range of standard components, and the standard 2D outline) of the target PCB board in step S300, data extraction and conversion can be performed on the generated PCB elevation map based on this information. First, according to the position coordinates of each preset component mounting position, the pixel area corresponding to each mounting position is accurately located and traversed in the PCB elevation map to ensure that no area to be inspected is missed. Next, the pixel values of all pixels within each located pixel area are extracted; these pixel values are the raw data reflecting the physical height of that area. Finally, using the pre-established mapping relationship between pixel values and height values, the extracted pixel values are converted one by one into the corresponding actual height values. These actual height values will be used for subsequent comparison with the standard height threshold range and are the core data for determining whether the component height is qualified.
[0080] It should be noted that the actual height of a mounting position can be determined by the average pixel value of the pixel area of each mounting position, or by other methods.
[0081] Step S500: Compare the actual height value of each mounting position with the height threshold range of the corresponding standard component to obtain the height matching result;
[0082] After obtaining the actual height value of each mounting position in step S400, these actual data can be compared with the benchmark data. Specifically, the actual height value corresponding to each preset component mounting position is compared with the standard component height threshold range (i.e., the upper and lower limits of the height under qualified installation conditions) determined in step S300: if the actual height value is within the threshold range, the height matching result is qualified (matched); if the actual height value exceeds the threshold range (too high or too low), the height matching result is unqualified (mismatched). This height matching result is the direct basis for determining whether the component installation meets the height requirements, providing a key reference for subsequent comprehensive judgment of the component installation status.
[0083] Step S600: Extract the actual contour corresponding to each mounting position in the PCB elevation map, and match it with the standard 2D contour of the corresponding mounting position in the design file to obtain the contour matching result. Perform synchronous detection based on the contour matching result and the height matching result to obtain the first detection result.
[0084] After obtaining the height matching result in step S500, the contour information of the components can be further detected and comprehensively judged. First, the actual contour corresponding to each preset component mounting position is extracted from the PCB elevation map. This actual contour reflects the planar shape and size characteristics of the component after installation. Next, the extracted actual contour is matched and compared with the standard 2D contour of the corresponding mounting position obtained from the design file in step S300 (i.e., the planar shape and size defined by the design). The contour matching result (e.g., qualified or unqualified) is obtained based on the contour similarity, size deviation, and other indicators. Finally, the height matching result and the contour matching result are combined for synchronous detection: when both are qualified, the first detection result is that the component is installed successfully; if either is unqualified, the first detection result is that the component is installed unqualified. This first detection result integrates the detection information from both height and contour aspects, providing a comprehensive basis for accurately determining the component installation status.
[0085] In one embodiment, please refer to the appendix. Figure 3 Step S600: Extract the actual contour corresponding to each mounting position in the PCB elevation drawing, and match it with the standard 2D contour of the corresponding mounting position in the design file to obtain the contour matching result, including:
[0086] S610. Binarize the pixel region corresponding to the mounting position in the PCB elevation map to extract the edge information of the actual contour.
[0087] S620. Calculate the similarity between the actual contour and the standard 2D contour based on the edge information;
[0088] S630. Based on the similarity, compare it with the preset contour similarity to obtain a 2D contour matching result of contour matching or contour mismatch.
[0089] Specifically, firstly, the pixel region corresponding to each mounting position in the PCB elevation map is binarized. By setting an appropriate pixel value threshold, the pixels in this region are divided into effective pixels corresponding to the target component (such as pixels higher than the PCB reference surface) and background pixels (such as pixels on the PCB reference surface). This highlights the edge features of the actual contour and extracts edge information that reflects the planar shape of the component, laying the foundation for subsequent contour comparison. Then, based on the extracted edge information, the similarity between the actual contour and the corresponding standard 2D contour of the mounting position obtained in step S300 is calculated. This similarity can be quantified using indicators such as the overlap of edge point sets and the degree of deviation of shape geometric parameters (such as perimeter, area, inflection point position, etc.) to obtain a similarity value representing the degree of shape matching between the two. Finally, this similarity is compared with a preset contour similarity threshold: if the similarity is greater than or equal to the threshold, it is determined to be a contour match; if the similarity is less than the threshold, it is determined to be a contour mismatch, thus obtaining the 2D contour matching result.
[0090] Thus, by processing the pixel area of the mounting position in the PCB elevation map, calculating similarity, and comparing thresholds, this embodiment of the application can accurately obtain the matching result between the actual contour and the standard 2D contour, providing a reliable contour detection basis for subsequent comprehensive judgment of the component mounting status.
[0091] In one embodiment, the edge information includes an edge contour line and multiple key edge points. The step of calculating the similarity between the actual contour and the standard 2D contour based on the edge information includes: calculating the ratio between the area enclosed by the actual contour and the area enclosed by the standard 2D contour based on the edge contour line, and performing area matching; in the case of area matching, determining multiple vector pairs based on the multiple key edge points; and determining the contour similarity based on the angle value between each vector pair in the multiple vector pairs.
[0092] Specifically, the ratio between the area enclosed by the actual contour and the area enclosed by the standard 2D contour can be calculated first based on the edge contour lines. The area matching degree between the two can be judged by this ratio. If the area ratio is within a preset reasonable range (such as close to 1), the area is considered to match, which provides a premise for subsequent more refined contour comparison. If the area deviation is too large, the contour can be directly judged to be mismatched.
[0093] In the case of area matching, similarity can be further calculated using key edge points. First, affine transformation correction is performed on the key edge points of the actual contour. This correction is based on centroid alignment (adjusting the centroid coordinates of both to coincide) and principal axis alignment (ensuring their principal directions remain consistent) between the actual contour and the standard 2D contour. This compensates for positional deviations such as rotation and translation that may occur during the imaging process of the PCB board, ensuring that the actual contour and the standard contour are comparable in the same coordinate system. Next, N key edge points (such as inflection points, endpoints, and other representative feature points) are extracted from the affine transformation-corrected edge information of the actual contour and arranged in a clockwise or counterclockwise order. Simultaneously, N corresponding standard key points are extracted from the standard 2D contour and sorted using the same order rule (clockwise or counterclockwise) as the actual contour, ensuring the correspondence of the points. Subsequently, for the sorted key points of the actual contour, adjacent points are connected sequentially to construct N contour vectors. The same adjacent point connection operation is performed on the sorted key points of the standard contour to construct N standard vectors, thus creating a one-to-one correspondence between the N contour vectors of the actual contour and the N standard vectors of the standard contour, forming N vector pairs. Finally, the contour similarity is determined based on the angle between each of these N vector pairs; for example, the average deviation of the angles between all vector pairs is calculated, with a smaller deviation indicating a higher similarity.
[0094] Thus, this embodiment of the application uses area matching for preliminary screening and combines the corrected key points to construct vector pairs to calculate the included angle deviation, which can accurately quantify the similarity between the actual contour and the standard 2D contour, providing a scientific basis for the determination of contour matching results and improving the accuracy of PCB board component installation and inspection.
[0095] To further improve the accuracy of contour matching, in one embodiment, the step of determining contour similarity based on the angle between each vector pair in multiple vector pairs includes: obtaining the angle between each vector pair based on the vector cosine value, resulting in N angle values; calculating the length of each standard vector, and determining the weight corresponding to each vector pair based on the length of the standard vector, wherein the longer the standard vector, the greater the corresponding weight; calculating a weighted average angle value based on the angle value of each vector pair and its corresponding weight; and determining a similarity value based on the weighted average angle value.
[0096] Specifically, firstly, the angle between each pair of vectors is calculated based on the cosine value of the vectors, and then the angle is determined using the vector dot product formula (…). The included angle θ is derived by reversing the steps above. For each of the N vector pairs formed, N corresponding included angle values are calculated, directly reflecting the degree of directional deviation for each vector pair. Then, the length of each standard vector is calculated. Taking the N standard vectors constructed in the standard 2D contour as objects, their magnitude is calculated using coordinate differences. The weight of each vector pair is determined based on the length of the standard vector, following the rule that "the longer the standard vector, the greater the corresponding weight." This is because longer vectors usually represent more critical structural features in the contour and have a greater impact on the overall shape of the contour; assigning higher weights increases the contribution of key features to the matching results. Next, based on the included angle value and its corresponding weight for each vector pair, a weighted average included angle value is calculated. Each included angle value is multiplied by its corresponding weight, summed, and then divided by the sum of all weights to obtain a weighted average included angle value that comprehensively reflects the directional deviation of all vector pairs. This value is closer to the actual feature importance of the contour than the ordinary average included angle value. Finally, the similarity value is determined based on the weighted average angle value, and a mapping relationship between the weighted average angle value and the similarity is set (e.g., the smaller the angle value, the higher the similarity; when the angle value is 0, the similarity is 100%). Through this mapping relationship, the quantified angle deviation is transformed into an intuitive similarity result, providing an accurate basis for contour matching judgment.
[0097] Thus, by introducing vector length weights to calculate the weighted average angle value, this embodiment of the application can highlight the influence of key contour features on the matching results, effectively reduce the interference of minor feature deviations (such as deviations in the short side) on the judgment, thereby further improving the accuracy of contour matching and providing stronger support for the reliability of PCB board component installation and inspection.
[0098] In one embodiment, the step of simultaneously detecting based on the contour matching result and the height matching result to obtain a first detection result includes:
[0099] If the contour matches and the height matches, it is determined that the corresponding mounting position is a normal installation of the component;
[0100] If the outline and height do not match, it is determined that the corresponding mounting position is a missing component.
[0101] If the contours do not match but the heights do, it is determined that the corresponding mounting position is due to incorrect component mounting.
[0102] If the contour matches but the height does not, it is determined that the corresponding mounting position is a dummy component.
[0103] This application embodiment makes judgments on different combinations of contour matching results and height matching results. Specifically, when contour matching and height matching are determined, it means that the actual planar shape and size of the component are consistent with the standard 2D contour, and the actual height is within the standard height threshold range. Therefore, the component at the corresponding mounting position is judged to be installed normally, i.e., it meets the design installation requirements. When contour mismatch and height mismatch are determined, it means that no actual contour matching the standard 2D contour was detected at the mounting position, and its height does not reach the standard component height threshold range (usually manifested as the height being close to the PCB board reference surface). Therefore, the corresponding mounting position is judged to be missing a component, i.e., no component is installed at the mounting position. When contour mismatch and height matching are determined, it means that although a component is installed at the mounting position (the height meets the standard range), the actual contour differs significantly from the standard 2D contour. This indicates that the installed component is not the model or specification specified in the design. Therefore, the corresponding mounting position is judged to be incorrectly installed. When the outline is determined to match but the height does not, it means that the planar shape and size of the component meet the standard, but the actual height exceeds the standard threshold range (too high or too low). This is usually caused by the component not being firmly attached to the PCB board during installation or by situations such as warping or offset. Therefore, it is determined that the corresponding mounting position is a false mounting of the component.
[0104] Thus, by simultaneously detecting and combining the contour matching results and height matching results, the embodiments of this application can accurately distinguish different installation states such as normal installation, missing installation, incorrect installation, and false installation of components, providing a clear and reliable first detection result for the comprehensive detection of the installation quality of PCB board components, and improving the accuracy and precision of the detection.
[0105] After performing a first detection on each mounting position of the target PCB board and obtaining a first detection result, the PCB board multi-parameter synchronous detection method of this application further includes:
[0106] If the first test result indicates that all mounting positions are where the components are installed normally, the target PCB board is divided into M×N grid areas on a two-dimensional plane based on the PCB elevation map.
[0107] Calculate the average height value of all pixels within each grid region, and use it as the representative height of that grid region;
[0108] A reference plane is fitted based on the representative heights of all grid regions and their two-dimensional planar coordinates.
[0109] Calculate the distance from the representative height of each grid region to the reference plane to obtain the local warping value of each region;
[0110] Based on the local warpage values of all regions, the overall warpage assessment value of the target PCB board is calculated.
[0111] The overall warpage assessment value is compared with a preset warpage threshold to generate a second detection result, which is used to determine whether the physical structure of the target PCB board is qualified.
[0112] In this embodiment, the physical warpage of the target PCB board is only detected after the first detection result indicates that all mounting positions are properly installed, thus avoiding interference from abnormal component installation on the board warpage assessment. Based on the generated PCB elevation map, the two-dimensional plane is divided into M×N grid regions according to preset dimensions (such as a fixed pixel side length set according to the PCB board size), so that each grid region can uniformly cover the PCB board surface, ensuring the comprehensiveness of subsequent detection.
[0113] Then, the average height value of all pixels within each grid region is calculated, and this average value is used as the representative height of that grid region. By averaging the pixel heights within a region, noise interference that may exist from individual pixels can be eliminated, more accurately reflecting the actual height level of the local area and providing reliable local height data for subsequent baseline plane fitting.
[0114] Next, based on the representative height of all grid regions and their corresponding two-dimensional plane coordinates (i.e., the position coordinates of each grid on the two-dimensional plane of the PCB board), a reference plane is fitted using a plane fitting algorithm (such as the least squares method). This reference plane can be regarded as the theoretical plane of the PCB board in an ideal warp-free state, serving as a reference benchmark for measuring the degree of warp in each region of the board.
[0115] Next, calculate the distance from the representative height of each grid area to the reference plane. The absolute value of this distance is the local warp value of each area. The larger the local warp value, the more serious the deviation of the area from the ideal plane, which intuitively reflects the local warp of the PCB board.
[0116] Then, based on the local warp values of all regions, the overall warp evaluation value of the target PCB board is calculated through preset calculation rules (such as taking the maximum value, average value or variance of all local warp values), and the scattered local warp data is transformed into a quantitative index that can characterize the overall warp state of the board.
[0117] Finally, the overall warpage assessment value is compared with a preset warpage threshold (a pass / fail threshold set according to the PCB board's application scenario, material requirements, etc.): if the assessment value is less than or equal to the threshold, the second test result is that the PCB board's physical structure is qualified; if the assessment value is greater than the threshold, the second test result is that the PCB board's physical structure is unqualified. This second test result can determine whether the PCB board's own physical structure meets the usage requirements, filling the gap in only testing the component installation status.
[0118] Thus, this embodiment of the application, while ensuring the normal installation of components, further detects the overall warpage of the PCB board, realizing dual detection of component installation status and board physical structure, comprehensively ensuring the quality of the target PCB board, and improving the completeness and practicality of the detection scheme.
[0119] Based on this, the PCB board multi-parameter synchronous inspection method of this application generates a PCB elevation map by fusing 2D images and 3D point cloud data. Combined with the standard height and contour information in the design file, it performs synchronous comparison and analysis of the height and contour of component mounting positions, achieving integrated inspection. This method compensates for the lack of depth information in 2D inspection by introducing an elevation map generated from 3D point cloud data. Simultaneously, the spatiotemporal alignment and fusion of 2D and 3D data preserves the high-resolution details of the 2D image while adding height dimension information, significantly improving the coverage and accuracy of the inspection. Furthermore, through multi-parameter synchronous analysis, this method achieves simultaneous height and contour matching in a single inspection process, improving inspection efficiency and effectively reducing the risk of missed detections caused by multiple separate inspections. In addition, while ensuring proper component mounting, this application further inspects the overall warpage of the PCB board, achieving dual inspection of component mounting status and board physical structure, comprehensively ensuring the quality of the target PCB board and improving the completeness and practicality of the inspection solution.
[0120] like Figure 4 As shown, Figure 4 The diagram below shows the hardware structure of an electronic device in some embodiments of this application. The electronic device provided in the embodiments of this application includes a memory 1000 and a processor 2000. The memory 1000 is used to store computer-readable instructions, and the processor 2000 is used to call the computer-readable instructions to execute the PCB board multi-parameter synchronous detection method as described above.
[0121] The processor 2000 provides computing and control capabilities to control the electronic device to perform corresponding tasks, such as controlling the electronic device to perform the PCB board multi-parameter synchronous detection method in any of the above method embodiments. The method includes: acquiring two-dimensional and three-dimensional detection data of the target PCB board to obtain 2D image data and 3D point cloud data; performing spatiotemporal alignment and fusion of the 2D image data and 3D point cloud data according to a transformation matrix to obtain a PCB elevation map of the target PCB board, wherein the pixel value of a pixel in the PCB elevation map represents the height value of the corresponding pixel; acquiring the design file of the target PCB board and determining the positions of all preset component mounting locations on the target PCB board. The system identifies the standard component's height threshold range and standard 2D contour; it traverses the pixel regions corresponding to all preset component mounting positions in the PCB elevation map based on the position coordinates, extracts the pixel values of each mounting position pixel region, and converts the pixel values to height values to obtain the actual height value of each mounting position; it compares the actual height value of each mounting position with the height threshold range of the corresponding standard component to obtain a height matching result; it extracts the actual contour corresponding to each mounting position in the PCB elevation map and matches it with the standard 2D contour of the corresponding mounting position in the design file to obtain a contour matching result; it performs synchronous detection based on the contour matching result and the height matching result to obtain a first detection result.
[0122] The processor 2000 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0123] The memory 1000, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the PCB board multi-parameter synchronous detection method in the embodiments of this application. The processor 2000 can implement the PCB board multi-parameter synchronous detection method in any of the above method embodiments by running the non-transitory software programs, instructions, and modules stored in the memory 1000.
[0124] Specifically, memory 1000 may include volatile memory (VM), such as random access memory (RAM); memory 1000 may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), solid-state drive (SSD), or other non-transitory solid-state storage devices; memory 1000 may also include combinations of the above types of memory.
[0125] In summary, the electronic device of this application adopts the technical solution of any of the above-described embodiments of the PCB board multi-parameter synchronous detection method. Therefore, it has at least the beneficial effects brought about by the technical solutions of the above embodiments, which will not be elaborated here.
[0126] This application also provides a computer-readable storage medium, such as a memory including program code, which can be executed by a processor to complete the PCB board multi-parameter synchronous detection method described above. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0127] This application also provides a computer program product, which includes one or more lines of program code stored in a computer-readable storage medium. The processor of the early warning system reads the program code from the computer-readable storage medium and executes the program code to complete the steps of the PCB board multi-parameter synchronous detection method provided in the above embodiments.
[0128] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0129] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0131] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention's specification and drawings under the inventive concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.
Claims
1. A method for simultaneous detection of multiple parameters on a PCB board, characterized in that, include: Two-dimensional and three-dimensional detection data of the target PCB board are acquired respectively to obtain 2D image data and 3D point cloud data; The 2D image data and 3D point cloud data are spatiotemporally aligned and fused according to the transformation matrix to obtain the PCB elevation map of the target PCB board, wherein the pixel value of the pixel in the PCB elevation map represents the height value of the corresponding pixel. Obtain the design file of the target PCB board, and determine the position coordinates of all preset component mounting positions on the target PCB board, as well as the height threshold range and standard 2D contour of the corresponding standard components; Based on the location coordinates, traverse the pixel regions corresponding to all preset component mounting positions in the PCB elevation map, extract the pixel values of each mounting position pixel region, and convert the actual height value of each mounting position according to the mapping relationship between the pixel values and the height values. The actual height value of each mounting position is compared with the height threshold range of the corresponding standard component to obtain the height matching result; Extract the actual contour corresponding to each mounting position in the PCB elevation map and match it with the standard 2D contour of the corresponding mounting position in the design file to obtain the contour matching result. Specifically, this includes: binarizing the pixel area corresponding to the mounting position in the PCB elevation map to extract the edge information of the actual contour, which includes edge contour lines and multiple key edge points; calculating the ratio between the area enclosed by the actual contour and the area enclosed by the standard 2D contour based on the edge contour lines, and performing area matching; in the case of area matching, determining multiple vector pairs based on multiple key edge points; obtaining the angle between each vector pair based on the vector cosine value, resulting in N angle values; calculating the length of each standard vector and determining the weight corresponding to each vector pair based on the length of the standard vector, where the longer the standard vector, the greater the corresponding weight; calculating the weighted average angle value based on the angle value of each vector pair and its corresponding weight; determining the similarity value based on the weighted average angle value; and comparing the similarity value with a preset contour similarity to obtain a 2D contour matching result indicating contour matching or contour mismatch. Based on the contour matching result and the height matching result, a first detection result is obtained by synchronous detection. The first detection result includes the detection results of normal installation, missing installation, incorrect installation, and false installation of components.
2. The PCB board multi-parameter synchronous detection method as described in claim 1, characterized in that, The step of performing spatiotemporal alignment and fusion of the 2D image data and 3D point cloud data according to the transformation matrix to obtain the PCB elevation map of the target PCB board includes: Using a transformation matrix, each 3D point in the 3D point cloud data is mapped to the image coordinate system corresponding to the 2D image data, thus obtaining the 2D pixel coordinates corresponding to each 3D point; Based on the resolution of 2D image data, a two-dimensional grid corresponding one-to-one with the pixels of the 2D image is constructed, and each 3D point is assigned to the corresponding grid cell according to its 2D pixel coordinates; For each grid cell, if multiple 3D points fall into it, the average height value of all 3D points is calculated as the final height value of the grid cell; if no 3D points fall into the grid cell, the missing data is filled using a preset filling rule. According to the preset height-pixel value mapping rules, the final height value of each grid cell is converted into the corresponding pixel value to generate the PCB elevation map of the target PCB board.
3. The PCB board multi-parameter synchronous detection method as described in claim 1, characterized in that, The determination of multiple vector pairs based on multiple key edge points includes: Affine transformation correction is performed on the key edge points of the actual contour to compensate for the rotation and translation deviation of the PCB board during the imaging process. The affine transformation correction is based on the centroid alignment and principal axis alignment of the actual contour and the standard 2D contour. Extract N key edge points from the edge information of the actual contour after affine transformation correction, and sort them in a clockwise or counterclockwise direction; Extract N corresponding standard key points from the standard 2D contour and sort them using the same order rules as the actual contour; For the sorted actual contour key points, connect adjacent two points in sequence to construct N contour vectors; For the sorted standard contour key points, perform the same operation to construct N standard vectors, so that the N contour vectors and the N standard vectors form N vector pairs.
4. The PCB board multi-parameter synchronous detection method as described in claim 1, characterized in that, The step of simultaneously detecting based on the contour matching result and the height matching result to obtain the first detection result includes: If the contour matches and the height matches, it is determined that the corresponding mounting position is a normal installation of the component; If the outline and height do not match, it is determined that the corresponding mounting position is a missing component. If the contours do not match but the heights do, it is determined that the corresponding mounting position is due to incorrect component mounting. If the contour matches but the height does not, it is determined that the corresponding mounting position is a dummy component.
5. The PCB board multi-parameter synchronous detection method as described in claim 4, characterized in that, The method further includes: If the first test result indicates that all mounting positions are where the components are installed normally, the target PCB board is divided into M×N grid areas on a two-dimensional plane based on the PCB elevation map. Calculate the average height value of all pixels within each grid region, and use it as the representative height of that grid region; A reference plane is fitted based on the representative heights of all grid regions and their two-dimensional planar coordinates. Calculate the distance from the representative height of each grid region to the reference plane to obtain the local warping value of each region; Based on the local warpage values of all regions, the overall warpage assessment value of the target PCB board is calculated. The overall warpage assessment value is compared with a preset warpage threshold to generate a second detection result, which is used to determine whether the physical structure of the target PCB board is qualified.
6. An electronic device, characterized in that, include: Memory and processor, wherein the memory is used to store program code; The processor is used to call the program code to perform the method as described in any one of claims 1 to 5.
7. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.