PCB board segmentation contour alignment method and system applied to AVI machine

CN122335529BActive Publication Date: 2026-09-08合肥九川智能装备有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610787811.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-03
Publication Date
2026-09-08
Estimated Expiration
2046-06-03

AI Technical Summary

Technical Problem

[0004]本发明的目的就在于提供PCB板分段轮廓对位方法及系统,以解决在线AVI机台对位方法中,整图对位耗时长与快速对位精度低之间的矛盾,以及分段后轮廓数据串行赋值校准环节耗时过高的问题

Benefits of technology

(1)本发明采用分段并行处理与三级递进对位的整体架构,通过对整板图像与Gerber数据进行分段切割,大幅缩减了单次匹配的数据量,并结合多线程并行处理机制,在保证对位精度的前提下,显著降低了算法整体耗时与赋值校准环节的耗时占比,能够完美适配在线AVI机台的产线快节拍需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122335529B_ABST
    Figure CN122335529B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of PCB detection, and particularly relates to a PCB board segmented contour alignment method and system applied to an AVI machine and an AVI machine. The application firstly performs segmented processing on collected images and Gerber design data to obtain a plurality of sub-images and sub-Gerber data; then performs coarse alignment and global fine alignment on each segment in turn to obtain a global translation parameter with the highest overall contour coincidence degree in the segment; then through a key-value pair storage structure and a multi-thread concurrent mechanism, the translation parameter of each segment is assigned to the Gerber contour data in the corresponding segment in parallel; finally, local eccentric fine alignment based on region growing is adopted for each independent pad to realize the center alignment of the single pad. Through segmented parallel processing and three-level progressive alignment strategy, the application effectively reduces the overall time consumption of the algorithm and the time consumption proportion of the assignment and calibration link, and improves the matching stability in the high-density and special-shaped pad scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of PCB automatic optical inspection technology, specifically relating to a PCB board segment contour alignment method and system applied to AVI machine. Background Technology

[0002] With the rapid development of PCBs (Printed Circuit Boards) towards high density and precision, AVI (Automated Visual Inspection) machines, as core equipment for PCB appearance defect detection, are divided into offline AVI and online AVI. Offline AVI is mostly used for PCB spot checks, with lower requirements for inspection cycle time. It can adopt a full-image high-precision alignment scheme, that is, to perform a one-time global alignment of the image of the entire PCB board with the Gerber design data. This scheme can guarantee high alignment accuracy, but the algorithm has a large amount of computation and is time-consuming. Online AVI directly connects to the PCB mass production line, and needs to complete the entire process of image acquisition, alignment calibration, and defect detection within a fixed cycle time of the production line. There are two main alignment schemes for existing online AVI machines: one is to adopt the full-image alignment scheme of offline AVI, but this scheme is too time-consuming and cannot meet the fast cycle time requirements of the production line; the other is to adopt a simplified fast alignment scheme, which reduces the time consumption by significantly reducing the feature matching range, but this scheme has insufficient alignment accuracy and is prone to missing small defects.

[0003] Regarding the alignment requirements of the aforementioned online AVI inspection equipment, existing technologies suffer from the following three main shortcomings: First, alignment accuracy and execution efficiency are mutually restrictive. High overall alignment accuracy is difficult to meet fast-paced inspection needs, while high-speed alignment is efficient but lacks precision. There is a lack of technical solutions that can simultaneously address both. Second, for complex PCB scenarios such as high-density, irregularly shaped pads, and dense text layers, traditional single-feature matching methods exhibit poor matching stability, easily leading to feature mismatches or alignment misalignments. Their generalization ability is insufficient to meet the online inspection needs of multiple PCB types. Third, in the value assignment and calibration stage after segmented alignment, existing technologies generally employ a serial traversal method to assign values ​​to the contour data one by one, without designing a dedicated data storage structure for segmented scenarios. This results in a high time consumption in this stage, becoming a key bottleneck restricting the online inspection cycle. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for aligning segmented contours of PCB boards, so as to solve the contradiction between the long time consumption of whole-image alignment and the low accuracy of fast alignment in the online AVI machine alignment method, as well as the problem of excessive time consumption in the serial assignment and calibration of contour data after segmentation.

[0005] The present invention achieves the above objectives through the following technical solutions: Firstly, the present invention proposes a PCB board segment contour alignment method for use in AVI machines, the method comprising: S1: The pre-acquired PCB board image data and corresponding Gerber design data are segmented to obtain multiple sub-images and sub-Gerber data; S2: Perform coarse alignment between the sub-image and the metal pad layer of the sub-Gerber data to obtain the sub-image after coarse alignment correction. S3: Perform global fine alignment between the coarsely aligned sub-image and the metal pad layer and text layer of the sub-Gerber data to obtain global translation parameters; S4: Based on the global translation parameters, assign the translation values ​​corresponding to each segment to the contour data in the sub-Gerber data within the corresponding segment in parallel; S5: Based on the assigned contour data, perform local eccentric fine alignment on each independent pad to obtain the final alignment result of each pad being centered and aligned.

[0006] Furthermore, step S2 includes: S21: Select representative pads from the periphery of the sub-Gerber data and the sub-image as feature matching points respectively; S22: Based on the selected feature matching point pairs, establish an affine transformation model: ;

[0007] Among them, (x) i y i ) represents the coordinates of a feature point in the sub-image, (u i ,v i ) represents the coordinates of the corresponding matching point in the sub-Gerber data, and s is the scaling factor. Let t be the rotation angle. x t y These are the translation coefficients in the X and Y directions, respectively; S23: Solve for the unknown parameters s in the affine transformation model using the least squares method. t x t y , thus obtaining the affine transformation parameters; S24: Perform a spatial transformation on the sub-image according to the affine transformation parameters. For any pixel (x, y) in the sub-image, calculate its corrected coordinates (x′, y′). The transformation relationship satisfies: ;

[0008] S25: Use bilinear interpolation to obtain the grayscale values ​​of each pixel in the corrected image to obtain the sub-image after coarse alignment correction.

[0009] Furthermore, step S3 includes: S31: Construct a multi-level pyramid structure corresponding to the coarsely aligned sub-image and the sub-Gerber data, wherein the number of pyramid layers is dynamically set according to the sub-image resolution and alignment accuracy requirements, the bottom pyramid is used for fast coarse matching, and the top pyramid is used for high-precision alignment adjustment. S32: Set the initial matching search range and search step size, slide the window within the current search range with the set step size, and calculate the similarity metric between the sub-image and the corresponding window of the sub-Gerber data for each translation position; S33: Select the translation position with the highest similarity as the matching result of the current level, and use this result as the search center for the next level of matching; S34: Repeat the above steps until the maximum resolution layer is searched to obtain the global translation parameters in the X and Y directions that maximize the overlap of the overall contour within the segment.

[0010] Furthermore, in each level of pyramid matching, normalized cross-correlation or phase correlation methods are used as similarity measurement criteria, or the number of pixels with the same pixel value at the same location is used as similarity measurement criteria.

[0011] Furthermore, step S4 includes: S41: Create a segmented data storage unit with a key-value pair structure, where the key is the segment index or segment coordinate range, and the value is a combined data object of the sub-image, sub-Gerber data and global translation parameters of the corresponding segment; S42: Create a multi-threaded concurrent processing mechanism based on thread pool management, where each thread independently processes one or more segmented assignment tasks; S43: In each concurrent thread, extract contour data from the sub-Gerber data, traverse all contour data within the segment, and assign the global translation parameter of the segment to each contour data one by one to complete the synchronous calibration of the contours of all segments.

[0012] Furthermore, step S5 includes: S51: For each independent pad, using the center point of the pad in the sub-Gerber data as the seed point, perform a region growing operation based on neighborhood distance within the corresponding region of interest in the sub-image. S52: Based on the region growing results, segment out the actual outline of the independent pad in the sub-image; S53: Calculate the X and Y direction eccentricity offsets between the geometric center of the actual contour and the theoretical center of the pad in the sub-Gerber data; S54: Based on the eccentric offset, perform center alignment compensation on the contour data corresponding to the independent pad to obtain the final alignment result of the pad center alignment.

[0013] Furthermore, the growth criteria for the region growth are based on the image gray-level gradient or edge distance threshold. When the gray-level gradient or edge distance of a neighboring pixel is less than the set threshold, the pixel is included in the growth region.

[0014] Furthermore, the segmentation process in step S1 is based on image resolution, pad distribution density, or a preset detection window size to perform adaptive or equally spaced division.

[0015] Secondly, the present invention proposes a PCB board segmented contour alignment system for implementing the PCB board segmented contour alignment method described above, the system comprising: The segmented preprocessing module is used to segment the pre-acquired PCB board image data and corresponding Gerber design data to obtain multiple sub-images and sub-Gerber data. The coarse alignment module is used to coarsely align the sub-image with the metal pad layer of the sub-Gerber data to obtain the coarsely aligned and corrected sub-image. The global fine alignment module is used to perform global fine alignment between the coarsely aligned sub-image and the metal pad layer and text layer of the sub-Gerber data to obtain global translation parameters. The parallel assignment module is used to assign the translation values ​​corresponding to each segment to the contour data in the sub-Gerber data within the corresponding segment in parallel according to the global translation parameters. The local eccentric fine alignment module is used to perform local eccentric fine alignment on each independent pad based on the assigned contour data, so as to obtain the final alignment result of each pad being centered and aligned.

[0016] Thirdly, this invention proposes an online AVI server, comprising: Image acquisition unit, used to acquire PCB board image data; Storage units are used to store processor-executable instructions; A processor configured to execute the executable instructions to implement the steps of the PCB board segmentation contour alignment method as described above.

[0017] The beneficial effects of this invention are as follows: (1) The present invention adopts a segmented parallel processing and three-level progressive alignment overall architecture. By segmenting the whole board image and Gerber data, the amount of data for a single matching is greatly reduced. Combined with the multi-threaded parallel processing mechanism, the overall time consumption of the algorithm and the time consumption of the assignment calibration link are significantly reduced while ensuring the alignment accuracy. It can perfectly adapt to the fast production line requirements of online AVI machine.

[0018] (2) The present invention adopts a three-level alignment strategy consisting of coarse alignment, global fine alignment, and local eccentric fine alignment. The global fine alignment adopts a multi-level pyramid matching method, and the local eccentric fine alignment adopts a positioning method based on region growth. This not only achieves the optimal alignment of the overall contour within the segment, but also ensures the centering alignment accuracy of each independent pad. At the same time, it effectively solves the feature mismatch problem in complex scenarios such as high density, irregular pads and dense text layers, and has strong generalization ability.

[0019] (3) In response to the core requirements of online segmented calibration, this invention designs a segmented data storage unit with key-value pair structure and a multi-threaded concurrent assignment mechanism based on thread pool, which breaks the time bottleneck of traditional serial traversal assignment, greatly reduces the time consumption of the assignment calibration process, and further compresses the overall algorithm execution time.

[0020] (4) The method of the present invention has strong compatibility and can be adapted to the PCB board inspection requirements of different resolutions, different categories and different pad densities. It does not require a lot of algorithm adaptation and adjustment for different PCB boards, which effectively reduces the debugging cost of online AVI machine and the difficulty of mass production. Attached Figure Description

[0021] Figure 1 This is a flowchart of a PCB board segment contour alignment method in an embodiment of the present invention; Figure 2 This is a schematic diagram of a process for coarse alignment of segmented subgraphs in an embodiment of the present invention; Figure 3 This is a schematic diagram of a global fine alignment process in an embodiment of the present invention; Figure 4 This is a schematic diagram of a process for assigning segmented values ​​to bit parameters in an embodiment of the present invention; Figure 5 This is a schematic diagram of a process for precise alignment of a single pad with local eccentricity in an embodiment of the present invention; Figure 6 This is a system block diagram of a PCB board segmented contour alignment system in an embodiment of the present invention; Figure 7 This is a system block diagram of an online AVI machine in an embodiment of the present invention; Figure 8 This is a schematic diagram illustrating the matching principle of the multi-level pyramid global fine alignment in an embodiment of the present invention; Figure 9 This is a schematic diagram illustrating the principle of local eccentric precise alignment based on region growth in an embodiment of the present invention. Detailed Implementation

[0022] The present application will now be described in further detail with reference to the accompanying drawings. It should be noted that the following specific embodiments are only used to further illustrate the present application and should not be construed as limiting the scope of protection of the present application. Those skilled in the art can make some non-essential improvements and adjustments to the present application based on the above application content.

[0023] It is worth noting that the segmented contour alignment method proposed in this invention is mainly applied to online AVI machines in PCB mass production lines. In actual production scenarios, online AVI machines need to complete the entire process of whole-board image acquisition, alignment calibration, and defect detection within a fixed fast cycle time of the production line. Among them, the time consumption and accuracy of the alignment calibration process directly determine the detection efficiency and detection rate of the entire machine.

[0024] However, as PCBs develop towards higher density and finer details, the image resolution of a single PCB board can reach tens of millions of pixels. If a traditional whole-image alignment scheme is used, a single alignment requires traversing all feature points of the image, which results in a large amount of computation and long processing time, making it difficult to meet the cycle time requirements of online production lines. If a simplified alignment scheme is used, feature mismatch is likely to occur in complex scenarios such as high density and irregularly shaped pads, leading to insufficient alignment accuracy.

[0025] To address the aforementioned issues, this disclosure provides a method for aligning segmented contours of a PCB board used in online AVI machines. Please refer to [link to relevant documentation]. Figures 1-4 The method can be applied to Figure 6 The online AVI machine shown Figure 5 The PCB board segment contour alignment system shown.

[0026] In this invention, Gerber data, also known as Gerber files or Gerber design data, is a standard vector format file commonly used in the PCB design field. It describes the geometric information of each layer of the PCB, such as the center coordinates of pads, their outline shape and size, and the position and font of text. Each PCB layer includes a metal pad layer, a text layer, and a solder mask layer. In this invention, Gerber data serves as a reference for online AVI (Image Inspection) equipment to detect visual defects. It needs to be aligned and calibrated with the actual PCB image acquired by the AVI equipment to obtain accurate alignment parameters.

[0027] Example 1

[0028] Please see Figure 1 This embodiment proposes a PCB board segment contour alignment method for AVI machine tools, the method including: S1: Image and Gerber Data Segmentation Preprocessing: The pre-acquired PCB board image data and corresponding Gerber design data are segmented to obtain multiple sub-images and sub-Gerber data; at the same time, the contour feature maps in the segmented sub-images are saved for subsequent alignment assignment and defect detection.

[0029] The PCB board image data is captured by the image acquisition unit of the online AVI machine, reflecting the actual appearance of the PCB board surface, including image information of graphic elements such as pads, circuits, and text.

[0030] In this embodiment, the segmentation process can employ adaptive or equally spaced partitioning. The partitioning criteria include one or more combinations of the resolution of the image under test, the density of pads on the PCB board, and the preset detection window size of the AVI machine. For example, when the PCB board is a high-density HDI mobile phone motherboard, the overall image resolution is 16384×2512 pixels. Dividing it into eight equally spaced sub-images of 2048×2512 pixels each, the number of pads within each sub-image is relatively balanced, meeting the computational power and alignment accuracy requirements of subsequent parallel processing. Through segmentation, the amount of data for a single matching operation is significantly reduced, facilitating subsequent parallel processing.

[0031] S2: Segmented Sub-image Coarse Alignment: Perform coarse alignment operation on the sub-images obtained after segmentation and the metal pad layer of the corresponding sub-Gerber to complete the initial pose correction.

[0032] Please see Figure 2 In a preferred embodiment, step S2 includes: S21: Select representative pads with high recognizability as feature matching points from the surrounding areas of the sub-Gerber data and the corresponding sub-image, such as the upper left and upper right corner areas. Taking this embodiment as an example, two regularly sized, unobstructed circular or square pads are selected, for a total of four feature points.

[0033] S22: Based on the matched feature point pairs, let the coordinates of the feature points in the sub-image be (x... i y i The coordinates of the corresponding matching point in the sub-Gerber are (u i ,v i The spatial mapping relationship between the two is described using an affine transformation model: ;

[0034] Where s is the scaling factor, Let t be the rotation angle. x t y These are the translation coefficients in the X and Y directions, respectively; S23: Solve for the unknown parameters s in the affine transformation model using the least squares method. t x t y , thus obtaining the affine transformation parameters; S24: Perform a spatial transformation on the sub-image according to the affine transformation parameters. For any pixel (x, y) in the sub-image, calculate its corrected coordinates (x′, y′). The transformation relationship satisfies: ;

[0035] S25: Based on the corrected coordinates (x′, y′), pixel grayscale sampling is performed in the original sub-image. Since (x′, y′) are usually non-integer coordinates and cannot directly correspond to integer pixel positions in the original image, a bilinear interpolation method is used. Weighted interpolation is performed using the grayscale values ​​of the four adjacent integer pixels surrounding (x′, y′) to obtain the grayscale value of that pixel in the corrected image. By traversing all pixels in the sub-image, a complete coarsely aligned and corrected sub-image can be obtained, completing the initial pose alignment.

[0036] S3: Global fine alignment: Perform global fine alignment operation on the sub-image after coarse alignment correction and the metal pad layer and text layer of the corresponding sub-Gerber to achieve optimal alignment of the overall contour within the segment.

[0037] Please see Figure 3 In a preferred embodiment, step S3 includes: S31: Construct a multi-level pyramid structure corresponding to the coarsely aligned sub-image and the sub-Gerber data, wherein the number of pyramid layers is dynamically set according to the sub-image resolution and alignment accuracy requirements, the bottom pyramid is used for fast coarse matching, and the top pyramid is used for high-precision alignment adjustment.

[0038] For example, please refer to Figure 8 In this embodiment, a four-level pyramid structure is constructed. The top level (L3) is a 1 / 8 downsampled image with the smallest image size, used for fast coarse matching; the bottom level (L0) is the original resolution image with the largest image size, used for high-precision fine-tuning. During step-by-step matching, the process progresses from the top level to the bottom level, with the matching result of each level serving as the search center for the next level, until the highest precision alignment parameters are obtained at the top level.

[0039] Preferably, in each level of pyramid matching, the number of pixels with the same pixel value at the same location is used as the similarity criterion. The edge contour features of the metal pad layer and silkscreen text layer of the sub-image and sub-Gerber are matched and iterated level by level. The specific steps are as follows: S32: Set the initial matching search range and search step size, slide the window within the current search range with the set step size, and calculate the similarity metric between the sub-image and the corresponding window of the sub-Gerber data for each translation position; S33: Select the translation position with the highest similarity as the matching result of the current level, and use this result as the search center for the next level of matching; S34: Repeat the above steps until the maximum resolution layer is searched to obtain the global translation parameters in the X and Y directions that maximize the overlap of the overall contour within the segment.

[0040] It should be noted that the number of layers in the multi-level pyramid can be dynamically adjusted according to the resolution and accuracy requirements of the sub-images: for PCBs with low resolution and low pad density, a serial search method can be adopted, which first detects the maximum overlapping position in the horizontal direction and then detects the maximum overlapping position in the vertical direction, to further reduce the matching time; for carrier PCBs with ultra-high accuracy requirements, a brute-force search method that searches simultaneously in the horizontal and vertical directions can be adopted to further improve the alignment accuracy.

[0041] S4: Segmented Alignment Parameter Assignment: The translation parameters obtained after global fine alignment of each segment are assigned to all contour data within the corresponding segment to complete the segmented calibration of standard Gerber data.

[0042] Please see Figure 4 In a preferred embodiment, step S4 includes: S41: Construct a dedicated data storage structure: Create segmented data storage units based on a key-value pair structure to store one-to-one corresponding segmented sub-images and sub-Gerber data. In the key-value pair structure, the key is the segment index or segment coordinate range, and the value is the corresponding sub-image and sub-Gerber data object, as well as the global translation parameter obtained through global precision alignment of the segment. This storage structure enables fast indexing and retrieval of segmented data. S42: Create a parallel processing mechanism: Create a multi-threaded concurrent processing mechanism based on thread pool management to execute multi-segment assignment operations in parallel. Each thread independently processes one or more segment assignment tasks, avoiding the time bottleneck of serial processing. In this embodiment, an 8-thread concurrent processing mechanism is created, with each thread independently processing one segment assignment task. S43: Parallel assignment execution: In each concurrent thread, all Gerber contour data in the corresponding segment are traversed, and the translation parameters obtained by global fine alignment of the segment are assigned one by one to the contour data in the corresponding segment to complete the synchronous calibration of the contours of all segments.

[0043] S5: Local Eccentric Fine Alignment of Single Pad: For each independent pad in the metal pad layer within each segment, a separate local eccentric fine alignment operation is performed to achieve precise centering and alignment of a single pad.

[0044] Please see Figure 5 and Figure 9 In a preferred embodiment, step S5 includes: S51: For each independent pad, using the center point of the pad in the sub-Gerber data as the seed point, perform a region growing operation based on neighborhood distance within the corresponding region of interest in the sub-image; specifically, the neighborhood distance can be preset according to the pad size and image resolution, for example, set to r0 pixels, to ensure that the region growing can cover the edge area of ​​the pad without excessive expansion.

[0045] S52: Based on the region growth results, the actual outline of the independent pad in the sub-image is segmented; during the region growth process, starting from the seed point, the growth is gradually expanded to the neighborhood according to the set growth criteria until the stopping condition is met, and finally the actual outline region of the pad is formed.

[0046] S53: Calculate the X and Y eccentricity offsets between the geometric center of the actual contour and the theoretical center of the pad in the sub-Gerber data.

[0047] Specifically, if the actual geometric center coordinates of the contour are (x1, y1) and the theoretical center coordinates of the pad in the sub-Gerber data are (x2, y2), then the eccentric offset (Δx, Δy) satisfies Δx = x1 - x2 and Δy = y1 - y2.

[0048] S54: Based on the eccentric offset, perform center alignment compensation on the contour data corresponding to the independent pad to obtain the final alignment result of the pad center alignment. Specifically, the Gerber contour data of the pad is translated in the opposite direction according to the eccentric offset, so that the theoretical contour and the pad contour in the actual image are precisely coincident, thereby achieving accurate center alignment of the pad.

[0049] In a preferred embodiment, the growth criteria for region growing are based on the image grayscale gradient or an edge distance threshold. Specifically, a pixel is included in the growth region when the grayscale gradient of a neighboring pixel is less than a set gradient threshold, or when the edge distance from a neighboring pixel to the seed point is less than a set distance threshold. These growth criteria effectively distinguish between pad regions and non-pad regions, avoiding over-growing or under-growing.

[0050] Through the aforementioned localized eccentric alignment, a high alignment accuracy can be achieved for a single pad, completely resolving the potential eccentricity deviation of a single pad after global alignment. This avoids the missed or false detection of minor defects caused by pad offset. It should be noted that the calculation and compensation of the eccentricity offset are performed separately for each individual pad, and different pads do not affect each other.

[0051] In one alternative approach, after completing the aforementioned local eccentricity fine alignment of a single pad, the final alignment result with each pad centered and aligned can be obtained. At this point, the contour feature maps in each saved sub-image can be compared pixel-by-pixel with the assigned Gerber contour data to identify appearance defects on the PCB board.

[0052] Specifically, for each pad or circuit area, the difference between the contour feature map in the actual image and the theoretical contour in the Gerber design data is compared. If the difference exceeds a preset threshold, a defect is determined to exist at that location, such as pad size deviation, circuit gaps or short circuits, scratches, etc. It should be noted that defect detection is not the core step of the alignment method of this invention, but the aforementioned saved contour feature map, as one of the outputs of the alignment method, can be directly used in subsequent defect detection steps without the need to re-extract features, thereby improving the efficiency of the overall detection process.

[0053] Example 2

[0054] Please see Figure 6 This embodiment proposes a PCB board segmented contour alignment system to implement the PCB board segmented contour alignment method as described in Embodiment 1. The system includes a segmented preprocessing module, a coarse alignment module, a global fine alignment module, a parallel assignment module, and a local eccentric fine alignment module.

[0055] The segmented preprocessing module is used to segment the pre-acquired PCB board image data and corresponding Gerber design data to obtain multiple sub-images and sub-Gerber data.

[0056] The segmentation process can employ either equal-interval or adaptive segmentation, with the segmentation criteria including one or more combinations of image resolution, pad distribution density, or a preset detection window size. Segmentation significantly reduces the amount of data required for a single match.

[0057] The coarse alignment module is used to coarsely align the sub-image with the metal pad layer of the sub-Gerber data to obtain a coarsely aligned and corrected sub-image. Specifically, the coarse alignment module selects representative pads from the periphery of both the sub-Gerber data and the sub-image as feature matching points, calculates rotation, scaling, and translation coefficients through affine transformation, and performs spatial transformation on the sub-image according to the affine transformation parameters to complete the initial pose correction.

[0058] The global fine alignment module is used to perform global fine alignment between the coarsely aligned sub-image and the metal pad layer and text layer of the sub-Gerber data to obtain global translation parameters. Specifically, the global fine alignment module constructs a multi-level pyramid structure, matching level by level from the bottom to the top of the pyramid. It uses normalized cross-correlation, phase correlation, or statistical analysis of whether the pixel values ​​at the same position are the same as similarity criteria, and iteratively calculates the global translation parameters that maximize the overall contour overlap within the segment.

[0059] The parallel assignment module is used to assign the translation values ​​corresponding to each segment to the contour data in the sub-Gerber data within the corresponding segment in parallel, based on the global translation parameters. Specifically, the parallel assignment module creates segmented data storage units with key-value pair structures, where the key is the segment index or segment coordinate range, and the value is a combined data object of the sub-Gerber data of the corresponding segment and the global translation parameters. Simultaneously, it creates a multi-threaded concurrent processing mechanism based on thread pool management, where each thread independently processes the assignment tasks for one or more segments, traversing all Gerber contour data within the corresponding segment, and assigning the global translation parameters to each contour data one by one, thus completing the synchronous calibration of all segment contours.

[0060] The local eccentricity fine alignment module is used to perform local eccentricity fine alignment on each independent pad based on the assigned contour data, obtaining the final alignment result of each pad being centered and aligned. Specifically, the local eccentricity fine alignment module uses the center point of the corresponding pad in the sub-Gerber data as the seed point, performs a region growing operation based on region growing in the corresponding region of interest of the sub-image, segments out the complete contour of the actual pad, calculates the eccentricity offset in the X and Y directions between the geometric center of the actual contour and the theoretical center of the pad in the sub-Gerber data, and performs center alignment compensation on the contour data of the corresponding pad based on the eccentricity offset.

[0061] It should be noted that each module in the above segmented contour alignment system corresponds to steps S1-S5 in implementing the above segmented contour alignment method. The instances and application scenarios implemented by multiple modules and their corresponding steps are the same, but are not limited to the content disclosed in the above embodiment 1.

[0062] Example 3

[0063] Please see Figure 7 This embodiment proposes an online AVI machine, including an image acquisition unit, a storage unit, and a processor.

[0064] The image acquisition unit is used to acquire PCB board image data; the image acquisition unit may include a line scan camera or an area scan camera, as well as corresponding optical lenses and a light source system, for acquiring high-resolution images of the PCB board's appearance. In this embodiment, the image acquisition unit may be configured with one or more cameras for collaborative image acquisition, depending on the PCB board size and detection accuracy requirements.

[0065] The storage unit is used to store processor-executable instructions; the processor is configured to execute the executable instructions to implement the steps of the PCB board segmented contour alignment method as in Embodiment 1.

[0066] In one specific implementation, the online AVI machine also includes a motion control unit for controlling the transmission and positioning of the PCB board, enabling the image acquisition unit to accurately acquire images of the entire board. The motion control unit is communicatively connected to the processor and drives the conveying mechanism according to the processor's control commands, achieving precise feeding and positioning of the PCB board under test.

[0067] It should be noted that the online AVI machine described in this embodiment can adapt to the inspection needs of PCB boards with different resolutions, product types, and pad densities. In actual mass production inspection scenarios, the processor executes the steps described in Embodiment 1, quickly and accurately aligning the PCB board image acquired by the image acquisition unit with the Gerber design data, and outputting the alignment result to the defect detection unit for subsequent appearance defect identification and judgment. Through time optimization in the alignment calibration process, the online AVI machine can perfectly adapt to the fast-paced requirements of production lines, significantly improving mass production efficiency.

[0068] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated.

[0069] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0070] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0071] In addition, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0072] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A PCB board segment contour alignment method applied to AVI machine tools, characterized in that, The method includes: S1: The pre-acquired PCB board image data and corresponding Gerber design data are segmented to obtain multiple sub-images and sub-Gerber data; S2: Perform coarse alignment between the sub-image and the metal pad layer of the sub-Gerber data to obtain the sub-image after coarse alignment correction. S3: Perform global fine alignment between the coarsely aligned sub-image and the metal pad layer and text layer of the sub-Gerber data to obtain global translation parameters; Step S3 includes: S31: Construct a multi-level pyramid structure corresponding to the coarsely aligned sub-image and the sub-Gerber data, wherein the number of pyramid layers is dynamically set according to the sub-image resolution and alignment accuracy requirements, the bottom pyramid is used for fast coarse matching, and the top pyramid is used for high-precision alignment adjustment. S32: Set the initial matching search range and search step size, slide the window within the current search range with the set step size, and calculate the similarity metric between the sub-image and the corresponding window of the sub-Gerber data for each translation position; S33: Select the translation position with the highest similarity as the matching result of the current level, and use this result as the search center for the next level of matching; S34: Repeat the above steps until the maximum resolution layer is searched to obtain the global translation parameters in the X and Y directions that maximize the overlap of the overall contour within the segment. S4: Based on the global translation parameters, assign the translation values ​​corresponding to each segment to the contour data in the sub-Gerber data within the corresponding segment in parallel; S5: Based on the assigned contour data, perform local eccentric fine alignment on each independent pad to obtain the final alignment result of each pad being centered and aligned. Step S5 includes: S51: For each independent pad, using the center point of the pad in the sub-Gerber data as the seed point, perform a region growing operation based on neighborhood distance within the corresponding region of interest in the sub-image. S52: Based on the region growing results, segment out the actual outline of the independent pad in the sub-image; S53: Calculate the X and Y direction eccentricity offsets between the geometric center of the actual contour and the theoretical center of the pad in the sub-Gerber data; S54: Based on the eccentric offset, perform center alignment compensation on the contour data corresponding to the independent pad to obtain the final alignment result of the pad center alignment.

2. The PCB board segment contour alignment method according to claim 1, characterized in that, Step S2 includes: S21: Select representative pads from the periphery of the sub-Gerber data and the sub-image as feature matching points respectively; S22: Based on the selected feature matching point pairs, establish an affine transformation model: ; Among them, (x) i y i ) represents the coordinates of a feature point in the sub-image, (u i ,v i ) represents the coordinates of the corresponding matching point in the sub-Gerber data, and s is the scaling factor. Let t be the rotation angle. x t y These are the translation coefficients in the X and Y directions, respectively; S23: Solve for the unknown parameters s in the affine transformation model using the least squares method. t x t y , thus obtaining the affine transformation parameters; S24: Perform a spatial transformation on the sub-image according to the affine transformation parameters. For any pixel (x, y) in the sub-image, calculate its corrected coordinates (x′, y′). The transformation relationship satisfies: ; S25: Use bilinear interpolation to obtain the grayscale values ​​of each pixel in the corrected image to obtain the sub-image after coarse alignment correction.

3. The PCB board segment contour alignment method according to claim 1, characterized in that, In each level of pyramid matching, normalized cross-correlation or phase correlation methods are used as similarity measurement criteria, or the number of pixels with the same pixel value at the same location is used as similarity measurement criteria.

4. The PCB board segment contour alignment method according to claim 1, characterized in that, Step S4 includes: S41: Create a segmented data storage unit with a key-value pair structure, where the key is the segment index or segment coordinate range, and the value is a combined data object of the sub-image, sub-Gerber data and global translation parameters of the corresponding segment; S42: Create a multi-threaded concurrent processing mechanism based on thread pool management, where each thread independently processes one or more segmented assignment tasks; S43: In each concurrent thread, extract contour data from the sub-Gerber data, traverse all contour data within the segment, and assign the global translation parameter of the segment to each contour data one by one to complete the synchronous calibration of the contours of all segments.

5. The PCB board segment contour alignment method according to claim 1, characterized in that, The growth criteria for the region growth are based on the image gray-level gradient or edge distance threshold. When the gray-level gradient or edge distance of a neighboring pixel is less than the set threshold, the pixel is included in the growth region.

6. The PCB board segment contour alignment method according to claim 1, characterized in that, The segmentation process in step S1 is based on image resolution, pad distribution density, or a preset detection window size, and is adaptively or equally spaced.

7. A PCB board segmented contour alignment system, used to implement the PCB board segmented contour alignment method as described in any one of claims 1-6, characterized in that, The system includes: The segmented preprocessing module is used to segment the pre-acquired PCB board image data and corresponding Gerber design data to obtain multiple sub-images and sub-Gerber data. The coarse alignment module is used to coarsely align the sub-image with the metal pad layer of the sub-Gerber data to obtain the coarsely aligned and corrected sub-image. The global fine alignment module is used to perform global fine alignment between the coarsely aligned sub-image and the metal pad layer and text layer of the sub-Gerber data to obtain global translation parameters. The parallel assignment module is used to assign the translation values ​​corresponding to each segment to the contour data in the sub-Gerber data within the corresponding segment in parallel according to the global translation parameters. The local eccentric fine alignment module is used to perform local eccentric fine alignment on each independent pad based on the assigned contour data, so as to obtain the final alignment result of each pad being centered and aligned.

8. An online AVI machine, characterized in that, include: Image acquisition unit, used to acquire PCB board image data; Storage units are used to store processor-executable instructions; A processor configured to execute the executable instructions to implement the steps of the PCB board segmented contour alignment method according to any one of claims 1-6.

Citation Information

Patent Citations

  • PCB image alignment method and device and computer storage medium

    CN110443777A

  • Alignment method, device and equipment of photoetching machine and storage medium

    CN120370642A