PCB control panel flatness detection method for robots based on affine transformation and multi-region dynamic compensation

By constructing a closed contour band to extract vertex candidate points, generating a nine-zone reference box and performing depth compensation, the problem of vertex misjudgment in PCB board inspection by robots is solved, achieving high-precision flatness detection and improved stability of mounting quality.

CN121236151BActive Publication Date: 2026-02-24LINGHU INTELLIGENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511771161.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-02-24
Estimated Expiration
2045-11-28

AI Technical Summary

Technical Problem

In existing technologies, the flatness inspection of PCB boards by robots is easily affected by light reflection, silkscreen occlusion, or edge blurring, which can lead to vertex misjudgment, failure of affine matrix inversion, misalignment of the inspection area, and affect the mounting quality and production line stability.

Method used

By constructing a closed contour band to extract vertex candidate points, generating a nine-zone reference box, establishing a detection window and performing depth compensation, and combining the warp distribution map for peak staggering, the precise fit and stress self-balancing of the detection area are achieved.

Benefits of technology

It significantly improves the stability and accuracy of test results, increases the alignment success rate of the mounting process, provides reliable planar reference protection, and reduces the risk of errors and stress concentration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121236151B_ABST
    Figure CN121236151B_ABST
Patent Text Reader

Abstract

The application discloses a PCB control panel flatness detection method based on affine transformation and multi-region dynamic compensation, and relates to the technical field of intelligent manufacturing measurement. The application comprises the following steps: collecting image data of a printed circuit board, constructing a continuous contour band in the image edge region, making the contour band keep closed and coherent in the presence of light interference, shadow obstruction and pattern noise, extracting four boundary lines in the contour band, and outputting a vertex candidate point set for constructing a space transformation model. The application improves boundary stability through contour band closed identification, realizes accurate positioning by cooperating with nine-region reference frames and detection window cooperative drift, eliminates platform error by combining dynamic depth compensation and plane reconstruction, introduces staggered driving based on warping distribution, constructs a real-time closed-loop detection mechanism, and significantly improves flatness detection accuracy and mounting alignment reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent manufacturing measurement technology, specifically to a method for detecting the flatness of robot PCB control boards based on affine transformation and multi-region dynamic compensation. Background Technology

[0002] The PCB flatness inspection method for robots based on affine transformation and multi-region dynamic compensation is a high-precision inspection method for the production process of special circuit boards for robot control systems. Its core idea is to use geometric mapping and spatial correction to ensure the accuracy of flatness measurement in complex assembly environments. The method first acquires surface images or point cloud data of the PCB board using a camera or depth sensor, extracts the four edges and calculates the vertex coordinates. Then, it establishes an affine transformation relationship between the reference board data and the actual inspection board to achieve adaptive positioning of the inspection area, ensuring that each PCB can be accurately divided into nine standardized inspection zones regardless of placement offset or rotation. Subsequently, during the inspection process, the system performs multi-region dynamic compensation for factors that may occur in the robot production line, such as thermal deformation of the equipment platform, fixture bending, and mechanical vibration. This involves calculating the reference depth and offset in different inspection zones and correcting measurement errors caused by the deformation of the conveyor platform in real time. Finally, plane fitting and deviation analysis are performed on the compensated multi-region depth data to calculate the overall flatness of the PCB board for the robot. This technology, through the combination of affine geometry mapping and multi-region compensation, significantly improves the detection accuracy and stability, ensuring the high reliability of robot control circuit boards in the placement, soldering and assembly processes, and solving the problems of missed detection and misjudgment caused by deformation of the traditional fixed detection area and platform.

[0003] The existing technology has the following shortcomings:

[0004] In existing technologies, PCB board flatness inspection using robots generally relies on vision-based geometric mapping methods. The core step involves extracting the four vertices of the PCB to establish an affine transformation matrix, achieving spatial mapping between the inspection template and the actual board surface. However, when the algorithms used for vertex recognition in existing technologies are affected by light reflection, silkscreen occlusion, or edge blurring, vertex misidentification is highly likely, leading to the four vertices being incorrectly identified as collinear or approximately collinear. In this case, the affine matrix cannot be inverted properly because its determinant approaches zero, and the mapping relationship fails. After the mapping fails, the system incorrectly projects the entire inspection area onto the same coordinate system during calculation, causing severe misalignment of the overall inspection area. More subtly, existing technologies often lack self-checking mechanisms for matrix invertibility and vertex spatial distribution, allowing the algorithm to still output measurement results showing a flat surface, creating the illusion of a so-called perfect plane. This misleading effect will directly mislead the subsequent SMT placement process, causing the placement head to operate on an incorrect plane reference, ultimately leading to serious quality problems such as large-area placement misalignment, poor solder joints, or short circuits, thus fatally impacting the yield and stability of the entire production line.

[0005] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] The purpose of this invention is to provide a method for detecting the flatness of PCB control boards for robots based on affine transformation and multi-region dynamic compensation, so as to solve the problems in the background art mentioned above.

[0007] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation, comprising the following steps:

[0008] The image data of the printed circuit board is acquired, and a continuous contour band is constructed in the edge region of the image. The contour band remains closed and coherent even in the presence of lighting interference, shadow occlusion and pattern noise. Four boundary lines are extracted from the contour band, and a set of vertex candidate points is output for constructing a spatial transformation model.

[0009] Based on the vertex candidate point set, a clockwise connection sequence is constructed in the central region of the printed circuit board image, and a nine-zone reference box for standardizing region division is generated according to the connection sequence, so that the reference box is consistent with the actual contour space of the printed circuit board.

[0010] Nine detection point sets are constructed based on the nine-zone reference frame, so that each detection point drifts slightly with the spatial orientation of the printed circuit board while maintaining relative spatial consistency. A detection window is formed at each detection point position for position anchoring in subsequent depth compensation operations.

[0011] In the boardless state, a reference depth value is written to each detection window. In the production state, a dynamic depth value is extracted from each detection window in real time. The difference between the dynamic depth value and the reference depth value is calculated to obtain the depth compensation amount of each detection window.

[0012] The depth values ​​of each detection window are corrected based on the depth compensation amount, and the three points with the largest spatial span are selected to construct a reference plane. The height deviation between the corrected depth values ​​of all detection windows and the reference plane is calculated to generate a warpage distribution map of the printed circuit board.

[0013] Based on the warp distribution diagram, the detection window is driven to open and close alternately in a staggered manner, so that the detection window releases micro-energy in a rhythmic sequence, reducing local stress concentration and maintaining stress balance and overall flatness stability closed-loop control during the detection process.

[0014] Preferably, the steps for outputting the vertex candidate point set are as follows:

[0015] Image data covering the entire printed circuit board surface is acquired using a high-resolution linear array industrial camera and a polarized cold white diffuse light source, and a gradient map for edge detection is generated after mean filtering and grayscale normalization.

[0016] Construct a strip of consistent width around the image, calculate the mean gray value and gray difference in each sub-block, mark the gray-level jump response points, and perform line segment splicing to complete the construction of a continuous closed contour strip.

[0017] Based on the set of response points within the continuous closed contour zone, straight line fitting is performed in four directions to obtain four main boundary lines, and boundary accuracy is evaluated using the minimum vertical distance error.

[0018] Intersections are found among the four main boundary lines to form a set of candidate vertices. Then, the area, diagonal intersections, and aspect ratios of the set are calculated to ensure that the vertex set satisfies geometric recognizability and is used to construct a spatial transformation model.

[0019] Preferably, the steps for dividing the nine-zone reference frame are as follows:

[0020] Based on the obtained set of candidate vertices, sort them clockwise according to the spatial distribution order of top left, top right, bottom right, and bottom left to construct a closed vertex connection sequence;

[0021] Based on the closed vertex connection sequence, the upper and lower boundary lines are divided at equal intervals to generate horizontal dividing lines, and the left and right boundary lines are divided at equal intervals to generate vertical dividing lines. Nine rectangular region boundaries are constructed through the intersection of the horizontal and vertical dividing lines to form a nine-zone reference box consistent with the printed circuit board boundary.

[0022] The coordinates of the center point of the region are calculated based on the midpoint of the boundary line segment of each sub-region, and used as the detection anchor point;

[0023] The detection area is registered based on the nine-zone reference frame and the coordinates of the center point, and depth acquisition, compensation and deviation analysis are performed based on the reference frame in subsequent measurements.

[0024] Preferably, the detection window formation process is as follows:

[0025] Based on the nine-zone reference box, the geometric center point of each region in each sub-region is extracted as the initial detection landing point, and a spatial response region with consistent side length is constructed at each initial detection landing point to extract grayscale features, edge gradient features and texture direction features;

[0026] A detection window is constructed based on the center position of each initial detection point in the spatial response region, and the image coordinates, average pixel grayscale, image edge direction, and edge intensity of the detection window are recorded as the image anchoring information of the detection window.

[0027] Based on the image anchoring information of the detection window, position fine-tuning correction is performed in the re-acquired image, so that the detection window can complete position matching and maintain the spatial correspondence of the detection window after the pose changes;

[0028] Spatial consistency is checked based on the horizontal and vertical distances between every two adjacent detection windows. When the relative spacing changes beyond a certain proportion, position backtracking is performed based on the coordinates of adjacent detection windows to maintain the overall structural consistency of the detection point set.

[0029] Preferably, the depth compensation amount generation steps are as follows:

[0030] When the inspection platform is in a state without printed circuit boards, structured light scanning is performed on each inspection window. Depth data points are collected in the circular sampling area of ​​the inspection window and averaged to generate a reference depth value for each inspection window.

[0031] When the printed circuit board is in the detection position, dynamic depth acquisition is performed in each detection window. During the dynamic depth acquisition process, all depth data points in the circular sampling area are acquired and averaged to generate the dynamic depth value of each detection window.

[0032] The dynamic depth value of each detection window is compared with the baseline depth value to generate the depth compensation amount for each detection window, and a depth compensation matrix is ​​constructed based on the spatial position index of the detection window.

[0033] Preferably, the baseline depth value and dynamic depth value of each detection window are calculated based on the arithmetic mean of all depth data points within the circular sampling area, and the depth compensation is output in floating-point form with three decimal places, in millimeters.

[0034] Preferably, the steps for generating the warp distribution map are as follows:

[0035] Call the corrected depth data of the nine detection windows after compensation, perform additive compensation in fixed coordinates in the image space, and output a complete depth data set;

[0036] From the corrected depth dataset, select the three points with the largest spatial span in the image plane, calculate the maximum horizontal distance, maximum vertical distance and maximum diagonal distance respectively, and construct a reference plane;

[0037] Substitute the image coordinates of the remaining six detection windows into the geometric equation of the reference plane, and calculate the height deviation between their respective corrected depth values ​​and the reference plane.

[0038] Based on the coordinates and height deviation of the detection window image, a 3x3 grid structure is constructed to complete the warpage distribution map and surface information completion.

[0039] The image coordinates, height deviation, corrected depth value, reference plane parameters, and detection window number are combined and output to form a warped data matrix.

[0040] Preferably, the steps for performing alternating opening and closing of the detection window according to the warp distribution diagram, so that the detection window opens and closes in a set rhythmic sequence, are as follows:

[0041] The corrected height deviation values ​​of each detection window in the warp distribution map are used for hierarchical processing to form a driving priority order;

[0042] Based on the hierarchical results, a rhythmic detection sequence is constructed, the nine detection windows are divided into three driving groups, the detection cycle is set, and the beat windows are allocated.

[0043] In each cycle, the corresponding detection window region is activated, and the illumination intensity and imaging parameters are adjusted to achieve image quality optimization and energy control.

[0044] Collect micro-displacement data of the detection platform in the Z-axis direction, calculate the platform deformation and mounting offset, and use them to evaluate the peak-shifting driving effect;

[0045] Based on the cycle sequence of the previous plate, the platform deformation data, and the image sampling stability, adjust the cycle window arrangement during the inspection process of the next plate.

[0046] The technical effects and advantages provided by the present invention in the above technical solution are as follows:

[0047] This invention enhances boundary robustness through contour band closure recognition, avoiding affine matrix inversion failures caused by vertex misjudgment. By synchronizing the standardized nine-zone reference frame with the detection window position drift, the detection area precisely conforms to the actual board surface, unaffected by placement offsets or rotational disturbances. Furthermore, through dynamic depth compensation and reference plane reconstruction mechanisms, errors caused by platform thermal deformation and mechanical deflection are eliminated point by point, effectively avoiding false flatness. Finally, based on warp distribution, a peak-shifting drive is introduced to dynamically disperse detection load and thermal stress, forming a detection closed loop of real-time flatness calibration and stress self-balancing. Compared to traditional methods, this overall solution significantly improves the stability and accuracy of detection results and the alignment success rate of the mounting process, providing a reliable planar reference guarantee for high-volume precision mounting. Attached Figure Description

[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0049] Figure 1 This is a flowchart of the method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to the present invention. Detailed Implementation

[0050] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that the description of this disclosure will be more complete and fully convey the concept of the exemplary embodiments to those skilled in the art.

[0051] This invention provides, for example Figure 1 The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation, as shown, includes the following steps:

[0052] The image data of the printed circuit board is acquired, and a continuous contour band is constructed in the edge region of the image. The contour band remains closed and coherent even in the presence of lighting interference, shadow occlusion and pattern noise. Four boundary lines are extracted from the contour band, and a set of vertex candidate points is output for constructing a spatial transformation model.

[0053] To address the affine transformation failure problem caused by edge interference, image errors, and unstable vertex recognition in printed circuit board flatness inspection, a method based on closed contour band construction and stable vertex extraction is proposed. This method includes the following steps:

[0054] A high-resolution linear scan industrial camera is used to scan a single printed circuit board line by line, acquiring image data that completely covers the entire board surface. The camera used has a pixel resolution of 5μm / pixel, an imaging swath width of 8192 pixels, and an image size of approximately 8192×4096 pixels. Two sets of symmetrical cool white diffused LED light sources are arranged on both sides of the imaging area. Each set contains 24 LED units with a 120° emission angle. The emission direction is adjusted by a light-collecting cover, so that the light shines obliquely onto the surface of the printed circuit board at a 40° angle, effectively reducing direct reflection. At the same time, a transmission polarizing filter is placed at the front of the camera, perpendicular to the polarization direction of the illumination light source, thereby significantly suppressing high-gloss reflections caused by copper foil, silkscreen coating, and surface adhesive. To verify the illumination uniformity, the image histogram distribution curve was used to evaluate the light intensity distribution in non-edge regions. The results showed that after dual polarization and diffusion control, the gray levels of the image were concentrated between [60, 190], and the gray level standard deviation decreased from the original 46.2 to 28.7. The gray level gradient changes in the edge regions were smoother, providing a good imaging foundation for subsequent contour recognition. After image acquisition, mean filtering and normalization were performed on the image to linearly map the gray level range of the entire image to between 20 and 230, improving the gray level separation between the edge regions and the background. A gradient map was constructed based on 16 gray levels as the first-order boundary to ensure the consistency of the numerical characteristics of the edge response points in subsequent processing.

[0055] Contour bands for boundary detection are constructed in the four edge regions of the image. Using the four corners of the entire image as reference points, each band is offset inwards by 150 pixels as its starting line. Four 150-pixel-wide strip regions are constructed along the four edges of the image, defined as the top, bottom, left, and right strips, respectively. Within each strip region, pixel blocks are processed using grayscale difference enhancement. Specifically, in each 32×32-pixel sub-block, the mean grayscale value and the local maximum and minimum grayscale difference are calculated. Edge transition points exceeding 1.5 times the mean grayscale value of the strip region are marked as initial response points. For each direction of the strip region, response points are arranged according to their edge direction, and line segment fitting is performed sequentially, with each segment being at least 400 pixels long. Connecting paths are constructed between the response points, forming an approximate boundary trajectory composed of multiple line segments. In the strip-shaped region, if pad reflection or silkscreen occlusion is detected, causing a local boundary interruption, an interpolation stitching method is used. The start and end coordinates are extracted from the two edge segments before and after the interruption, and linear extrapolation is performed based on their extension direction to fill in the interrupted area, making the overall contour coherent and closed. Ultimately, four complete edge contour bands are formed around the image, with the stitching error between all edge segments controlled within 2 pixels, and the contour closure rate exceeding 99%, ensuring the boundary continuity and stability of the next step, main edge extraction.

[0056] Four main boundary lines of the printed circuit board are extracted based on the closed contour zones. Least squares line fitting is performed on the set of response points within each contour zone. The minimum length of the fitted line must not be less than 40% of the image side length to eliminate interference from stray edge segments. All response points in the left contour zone are grouped together, their direction vectors are calculated, and fitted as the first main edge. Similarly, the second, third, and fourth main edges are fitted in the right, upper, and lower contour zones, respectively. During the fitting process, if a gap appears in the interval of response points in a certain direction, and the gap length is less than 500 pixels, it is automatically filled by extending the edge segment of the adjacent region to ensure sufficient continuity of the main edge segments. The accuracy of the four fitted boundary lines is evaluated using the average perpendicular distance error from the endpoints to the line, controlled within ±0.7 pixels. The intersection points between every two adjacent extracted main edges are calculated and denoted as the upper left, upper right, lower right, and lower left corner points, respectively, forming a set of candidate vertex points for constructing the spatial transformation model.

[0057] The obtained vertex candidate set undergoes consistency verification to ensure that the four corner points are geometrically identifiable in spatial distribution and possess sufficient stability for subsequent affine transformation operations. Specifically, the four vertices are first sorted in the order of top-left, top-right, bottom-right, and bottom-left, forming a closed vertex cycle sequence. The area of ​​any three points forming a triangle in this sequence is calculated, requiring the area to be no less than 4% of the total image area to avoid geometric degradation issues such as collinearity or near-collinearity of the three vertices. The coordinates of the diagonal intersection point are further calculated; if the intersection point is more than 2.5% of the image diagonal length from the image center, it is considered an abnormal vertex arrangement. Finally, the ratio of the longer side to the shorter side of the resulting quadrilateral is measured, controlling the aspect ratio between 1.2 and 1.8, and abnormally compressed or stretched structures are discarded. After satisfying the above three conditions, the vertex set can be considered stable and valid, and can be used to construct subsequent spatial transformation relationships. In actual testing, this method was used to process images of 48 batches of different types of printed circuit boards. The repetition positioning error of vertex recognition was within ±0.6 pixels, and the vertex arrangement efficiency reached over 98%, demonstrating high robustness and wide adaptability.

[0058] Based on the vertex candidate point set, a clockwise connection sequence is constructed in the central region of the printed circuit board image, and a nine-zone reference box for standardizing region division is generated according to the connection sequence, so that the reference box is consistent with the actual contour space of the printed circuit board.

[0059] To address the region segmentation error caused by changes in spatial orientation during printed circuit board (PCB) inspection, a method is proposed that constructs a clockwise connection sequence based on four extracted vertex candidate points, and generates a nine-zone reference frame matching the actual PCB contour. This method achieves precise spatial consistency between the inspection area and the actual PCB surface through the following steps:

[0060] Four candidate vertices are used as spatial geometric inputs and sorted clockwise according to their spatial distribution order: top left, top right, bottom right, and bottom left. To ensure accurate sorting, the image center point is selected as a reference point. The horizontal and vertical offset values ​​of each vertex relative to the center point are calculated, and the horizontal offset value is used as the primary factor, with the vertical offset value as the secondary factor, to construct a clockwise sequence starting from the top left corner of the image. For example, in an image with a resolution of 8192×4096 pixels, the coordinates of the four extracted vertices are (314, 267), (7880, 252), (7902, 3930), and (300, 3942). After comparison and calculation with the center point coordinates (4096, 2048), it is determined that the four vertices are arranged in the order of top left, top right, bottom right, and bottom left, with a clear spatial relationship, which can form a closed vertex sequence for further operations.

[0061] A standardized nine-region reference frame is constructed based on four clockwise connected vertices. Using the four connected edges as the basis for division, the top edge (top left to top right) and the bottom edge (bottom left to bottom right) are first divided into three equal segments, generating two horizontal dividing lines. Then, the left edge (top left to bottom left) and the right edge (top right to bottom right) are divided in the same way, forming two vertical dividing lines. The intersections of the horizontal and vertical dividing lines form a total of nine region boundaries. Each sub-region is defined by four precise points, which are connected sequentially to form a complete rectangular region. Taking a 270 mm wide and 180 mm high printed circuit board as an example, this method divides it into nine sub-regions, each with an area of ​​5400 square millimeters, with boundary line errors controlled within ±0.3 mm. All the dividing lines of the reference frame are generated based on the actual extracted boundary vertices and constructed through line segment interpolation, independent of preset template coordinates, and possess adaptive adjustment capabilities.

[0062] After the nine-zone reference frame is constructed, a spatial mapping between image coordinates and physical coordinates on the board surface is built based on the boundaries of each sub-region. Specifically, within each sub-region, the coordinates of its center point are calculated based on the midpoint of the boundary line segment. This center point serves as the anchor point for subsequent depth detection and compensation, and its image coordinates are recorded as a fixed reference. The center point coordinates exhibit a repetition deviation of no more than 1.7 pixels across three samplings, demonstrating good recognition stability. When each printed circuit board is fed into the inspection equipment, the system recalculates the nine-zone division based on the boundary vertices in the real-time acquired images, generating the nine-zone reference frame and its anchor point corresponding to the current board, ensuring that the region division remains consistent with the actual placement of the board. Compared with the traditional static template division method, the nine-zone reference frame maintains a regional centroid error of less than 3.2 mm even within a random rotation of ±5 degrees and a translation of ±10 mm, while the traditional method has an error as high as 12.6 mm, improving the detection region recognition accuracy by nearly four times.

[0063] The boundary information and center anchor point coordinates of each of the nine sub-regions are used as standard inputs to complete the formal registration of the detection area. During the detection process, all depth data acquisition, deviation analysis, and compensation operations are performed around these nine regions, ensuring that each measurement is consistent with the actual board surface boundary height and is not affected by placement deviations. Furthermore, the spatial layout of the nine regions covers every critical part of the printed circuit board, including the four corners, four edges, and the central area, achieving a coverage rate of over 93% of the board surface area, ensuring no blind spots in the detection. The boundary interval between each region is controlled within 5 mm, ensuring both the independence of the region division and overall consistency. In actual batch inspection applications of printed circuit boards, this method has been successfully applied to six different board types, achieving a positioning error within ±2.5 mm in the detection area, far superior to the recognition accuracy of traditional methods within ±7 mm.

[0064] Nine detection point sets are constructed based on the nine-zone reference frame, so that each detection point drifts slightly with the spatial orientation of the printed circuit board while maintaining relative spatial consistency. A detection window is formed at each detection point position for position anchoring in subsequent depth compensation operations.

[0065] To ensure that each detection area accurately corresponds to its actual physical position even when the printed circuit board experiences slight attitude shifts, a method is proposed that constructs a set of detection landing points based on a nine-zone reference frame and generates detection windows at the landing point positions. This method ensures that detection accuracy and spatial stability are simultaneously improved through steps such as spatial response region construction, detection window anchoring, position follow-up matching, and structural consistency correction. The specific implementation process is as follows:

[0066] Within each sub-region of the constructed nine-zone reference frame, the geometric center point of that region is extracted as the initial detection point. A square spatial response region with a side length of 64 pixels is constructed around this center point; this region is approximately 2.4 mm x 2.4 mm in physical dimensions within the image. The pixel data contained in this response region is used to extract the image's grayscale mean, edge gradient changes, and texture direction features, thus forming a basic description of the image features within the region. The grayscale features of the response region are obtained through pixel histogram statistics, the edge gradient is obtained through the accumulation of grayscale differences between pixels, and the texture direction is extracted and categorized based on the dominant direction of the textures in neighboring regions. Only one detection point is allowed to be generated for each sub-region, ensuring that the points are spatially uniformly distributed. Taking a printed circuit board with a width of 270 mm and a height of 180 mm as an example, the nine detection points are distributed at the center of each sub-region, with a horizontal spacing of approximately 90 mm and a vertical spacing of approximately 60 mm between the points, achieving 100% spatial coverage.

[0067] A detection window is constructed centered on each initial detection point for depth data acquisition and anchoring. This detection window is defined as a 32-pixel by 32-pixel square region in the image space, with a physical area of ​​approximately 1.2 mm x 1.2 mm, located at the center of the aforementioned response area. When establishing the detection window, its position coordinates, average pixel grayscale value, edge direction, and edge intensity are all recorded as image anchoring information. In subsequent inspections, regardless of slight rotation or translation of the printed circuit board due to mechanical transmission or thermal deformation of the operating platform, this image anchoring information can be used for automatic recovery of the detection window. During the establishment of the detection window, statistical analysis of the average pixel value within the region shows that its standard deviation in repeated multi-board inspections is controlled within 1.6 grayscale units, and the change rate of edge intensity stability in repeated measurements is less than 4%, indicating that the window possesses high recognition consistency.

[0068] After the printed circuit board enters the detection position, the current image is re-acquired, and the previously recorded detection window anchoring information is used as a matching template to fine-tune the position of the detection window in the new image. This fine-tuning process uses three indicators as the core matching criteria: image grayscale similarity, edge direction consistency, and edge intensity overlap. The matching deviation value between the current window and the template is calculated for each indicator. If all three indicators meet the set error tolerance, the detection window position is considered to be successfully matched. The position adjustment range during the matching process is limited to no more than 12 pixels in both the horizontal and vertical directions, corresponding to a spatial movement of no more than 0.45 mm on the actual board surface. Taking a set of measured data as an example, after the printed circuit board undergoes a posture change of ±5 degrees rotation and ±10 mm translation, all nine detection windows can successfully complete the position matching in the image, and the position offset error is controlled within 0.3 mm. When using the static template method, the maximum error reaches 1.4 mm, and the matching accuracy is improved by more than four times.

[0069] To avoid structural distortion of the overall detection frame caused by slight drift of the detection windows, which could affect the accuracy of flatness calculation, this step performs spatial consistency verification on the overall structural relationship of the nine detection points. During this process, the horizontal and vertical distances between every two adjacent detection windows are calculated and compared with the initial window spacing. If the relative distance between two points changes by more than 8% of the original spacing, it is considered an abnormal drift. In this case, the coordinates of the four detection windows adjacent to the affected point are re-referenced, and spatial position is reverted according to the principle of minimum average deviation, bringing the point back to a more reasonable position closer to the overall structural equilibrium. In actual testing, when point drift exceeds the limit, this spatial consistency verification mechanism can complete the point reversion within 0.06 seconds, restoring the overall nine-point spatial structural deviation to within a maximum error of no more than 0.5 mm, effectively ensuring the integrity and stability of the detection structure.

[0070] In the boardless state, a reference depth value is written to each detection window. In the production state, a dynamic depth value is extracted from each detection window in real time. The difference between the dynamic depth value and the reference depth value is calculated to obtain the depth compensation amount of each detection window.

[0071] To accurately correct local height deviations caused by platform thermal deformation, mechanical loading, or printed circuit board warping, a static reference depth value is established at the detection window location. This reference depth value is then combined with the dynamic depth value acquired in real-time during production to perform a one-to-one difference calculation, thereby obtaining the depth compensation amount corresponding to each detection window. This process is completed sequentially through the following steps:

[0072] Under the premise that the inspection platform is in a state without printed circuit boards and the mechanical structure is stable, initial depth acquisition is performed on all nine predefined inspection windows to establish static reference depth values. To achieve high-precision measurement, a structured light 3D scanning device is used to perform unobstructed scanning of the entire inspection platform surface, ensuring coverage of the areas where the nine inspection windows are located. The scanning device projects a fixed-frequency grating and receives the reflection pattern through a binocular camera array, calculating the surface height information based on the grating phase difference. In specific implementation, the surface temperature of the inspection platform is maintained at 25 degrees Celsius by a constant temperature control system to avoid thermal drift affecting the measurement results. Each inspection window corresponds to a square image block with a side length of 32 pixels, which is converted to an actual physical size of 1.2 mm × 1.2 mm. A circular sampling area with a diameter of 0.8 mm is constructed in the center area of ​​each window, and all depth data points within the sampling area are collected and averaged; the resulting value is the reference depth value of that inspection window. For example, in the initial state of the platform, the first detection window was scanned five times repeatedly, with 1024 data points collected. The maximum depth fluctuation was 4.2 micrometers, and the average reference depth was 9.896 millimeters. Finally, a complete reference depth matrix was established for nine detection windows, with depth values ​​ranging from 9.874 millimeters to 9.912 millimeters and a maximum difference of no more than 38 micrometers. The data showed high stability and was effective as a static reference.

[0073] After the printed circuit board (PCB) is transported to the testing platform and is in a ready-to-test state, dynamic depth data is collected again at the same location for nine testing windows to reflect the actual spatial height under the current testing environment. This step uses the same raster projection frequency, shooting angle, imaging parameters, and data resolution as the no-load state to ensure the comparability of the data before and after the test. During actual testing, the platform surface will experience slight bending deformation due to the weight of the supporting board or the mechanical conveying device, and the PCB itself may also experience slight warping due to internal stress release or temperature rise. These changes will be directly reflected in the height data at each testing window location. For example, when testing the sixth window location, the recorded dynamic depth is 9.841 mm, while the corresponding baseline depth is 9.894 mm, a height difference of 53 micrometers. This deviation reflects the pressure drop in the middle of the platform under the current testing state. All dynamic depth data are collected within a 32-pixel × 32-pixel range of their respective testing windows, and the dynamic depth value is based on the arithmetic mean of all points within the circular sampling area. For the nine detection windows, after the printed circuit board is completely laid on the platform, the current dynamic depth matrix is ​​re-acquired and established to lay the data foundation for subsequent difference calculation.

[0074] The dynamic depth value is subtracted from its corresponding reference depth value to obtain the depth compensation amount for each detection window. The direction of the difference is referenced to the reference value; a dynamic value higher than the reference value is considered positive compensation, and a value lower than the reference value is considered negative compensation. Each difference calculation is output in floating-point form with three decimal places, in millimeters. For example, the reference depth of the third detection window is 9.902 mm, and the current detection value is 9.928 mm, resulting in a positive compensation of +0.026 mm; while the reference depth of the eighth detection window is 9.887 mm, and the current value is 9.857 mm, resulting in a negative compensation of -0.030 mm. The compensation amounts of the nine detection windows are arranged in row and column order to generate a two-dimensional depth compensation matrix, and the spatial position index of each window on the printed circuit board is labeled. This matrix is ​​then input into the plane fitting calculation process to correct the vertical deviation of each point in the spatial plane, thereby constructing a spatial height correction model for the entire board. In actual production, the overall flatness error of the printed circuit board compensated by this method was 27 micrometers on average in 300 tests, which is a significant decrease compared to 61 micrometers in the traditional fixed reference surface method, and the compensation accuracy is improved by about 55%.

[0075] The depth values ​​of each detection window are corrected based on the depth compensation amount, and the three points with the largest spatial span are selected to construct a reference plane. The height deviation between the corrected depth values ​​of all detection windows and the reference plane is calculated to generate a warpage distribution map of the printed circuit board.

[0076] To comprehensively reflect the surface height fluctuations of printed circuit boards after being heated, stressed, and transported, based on the correction value after depth compensation of the detection window, a reference plane is constructed by selecting three points with the largest spatial distribution span. The heights of other points are then compared with this plane one by one, thereby generating a realistic, continuous, and quantifiable warpage distribution map. This method consists of the following steps:

[0077] The corrected depth data of the nine detection windows, after difference compensation in the previous steps, is used to perform the actual height correction operation point by point. The corrected depth value of each window is the compensation amount obtained by subtracting the dynamic depth obtained in real time from the reference depth value collected under no-load conditions, and it is directly applied to the dynamic depth data itself. Taking the first detection window as an example, its original detection depth is 9.852 mm, the reference depth is 9.876 mm, the difference is -0.024 mm, and its corrected depth after compensation is 9.876 mm. For all detection windows, additive compensation is performed in their fixed coordinates in image space to ensure that each correction result has reference attributes consistent with the platform standard height. After this correction process is completed, a complete set of depth data for the nine detection windows is output, providing accurate basic numerical support for the construction of the reference plane.

[0078] From nine corrected detection windows, three points with the largest spatial span in the image plane are selected as reference vertices for constructing the subsequent reference plane. The selection of these three points is based on three criteria: maximum horizontal distance, maximum vertical distance, and maximum diagonal distance, prioritizing the formation of a triangle with the widest coverage area in the image space. For example, the top-left detection window (X=310, Y=270, depth=9.894 mm), the bottom-right detection window (X=7890, Y=3920, depth=9.876 mm), and the center detection window (X=4100, Y=2050, depth=9.860 mm) are selected as the vertices. These three points are representative in the horizontal, vertical, and diagonal directions, forming a triangular structure covering the entire plane. Through spatial geometric calculations, a uniquely defined reference plane can be generated.

[0079] Based on the geometric equations defined by the reference plane, the position coordinates of the remaining six detection windows are substituted to calculate the vertical distance of the corrected depth value of each detection window relative to the reference plane, i.e., the height deviation value. Taking the sixth detection window as an example, its image coordinates are (X=2730, Y=2730), the corrected depth is 9.912 mm, and the theoretical height calculated after substituting into the reference plane equation is 9.880 mm, with a deviation value of +0.032 mm, indicating that this point is 32 micrometers above the reference plane. The deviation is calculated for all detection points in this way. The positive or negative value of the output deviation indicates whether the detection window is above or below the reference plane, ensuring that the height status of each point in three-dimensional space has a quantifiable index. After the deviation calculation, the height offsets of the nine detection points are organized into a set of scalar data and bound to the corresponding image space coordinates to form an offset point set, providing the necessary spatial and numerical parameters for subsequent warp map drawing.

[0080] Based on the spatial coordinates and corresponding height deviation of each detection window, a warpage distribution map of the printed circuit board is constructed. First, nine points are arranged sequentially according to their actual layout in the image plane to construct a 3x3 grid structure, with the horizontal axis representing the horizontal pixel position, the vertical axis representing the vertical pixel position, and the Z-axis representing the height deviation value. Bilinear interpolation is used to supplement height information between grid points, filling the remaining areas and forming a well-continuous curved surface structure. The final output warpage map can display the relative height variations of different areas of the printed circuit board in a 3D coordinate system. For example, when inspecting a six-layer board measuring 270 mm by 180 mm, the warpage distribution map shows that the maximum height deviation in the upper left corner is +0.043 mm, the minimum deviation in the lower right corner is -0.038 mm, and the central area almost coincides with the reference surface, with a warpage range of 0.081 mm. This map not only provides a visually intuitive effect but can also be converted into numerical input for subsequent automatic control stages, achieving a closed-loop response for quality control and equipment parameter tuning.

[0081] By mapping the spatial coordinates, height deviation, and reference plane parameters in the warp distribution map to the detection window numbers, a complete warp data matrix is ​​formed and output in a standard format for system storage, retrieval, and traceability. Each row in this matrix represents a detection window and contains five pieces of information: window number, image coordinate X value, image coordinate Y value, correction depth value, and deviation value relative to the reference plane. For example, the ninth detection window is numbered W9, with image coordinates of (2730, 3920), a correction depth of 9.889 mm, and a height deviation of -0.022 mm. The entire warp data matrix has nine rows and five columns. By calling this matrix, the overall deformation of the board surface can be quickly determined, and its flatness can be evaluated in conjunction with preset tolerance standards. In the surface mount technology (SMT) process, this data can also be used as a dynamic input for mounting path planning, adjusting the Z-axis height of the mounting head in real time to prevent solder joint defects or component misalignment caused by warping. Compared with the traditional method of fitting based on only two points or edge baselines, this method has significant improvements in spatial comprehensiveness, data accuracy and applicability. The measured error is controlled within ±6 micrometers, and the accuracy is improved by about 67%, which greatly improves the reliability and decision accuracy of printed circuit board warpage detection.

[0082] Based on the warp distribution diagram, the detection window is driven to open and close alternately in a staggered manner, so that the detection window releases micro-energy in a rhythmic sequence, reducing local stress concentration and maintaining stress balance and overall flatness stability closed-loop control during the detection process.

[0083] To achieve stress balance control and platform plane stability maintenance during the testing process of printed circuit boards (PCBs), a method based on warp distribution maps and driven by a rhythmic staggered testing window is proposed. This method relies on the height deviation data of the testing window and constructs a dynamic equilibrium closed loop through hierarchical sorting, time-cycle division, illumination and energy regulation, real-time deformation acquisition and feedback analysis. This reduces the risk of stress concentration and ensures the consistency and reliability of the overall PCB testing data. The specific implementation steps are as follows:

[0084] Based on the generated warp distribution map, the corrected height deviation value of each detection window is extracted and graded according to the deviation value to form a clear driving priority order. Specifically, the relative height deviation values ​​of the nine detection windows are calculated, sorted from largest to smallest absolute value, and divided into three levels. The first level consists of windows with a height deviation greater than or equal to 0.030 mm, indicating extreme warp. The second level consists of windows with deviations between 0.010 and 0.030 mm, indicating moderate warp. The third level consists of windows with deviations less than 0.010 mm, indicating a basically flat area. Taking a six-layer printed circuit board with dimensions of 270 mm x 180 mm as an example, the actual detection results show height deviations of +0.041 mm, -0.035 mm, and +0.031 mm for the upper left, lower right, and lower center windows, respectively, all belonging to the first level. The center, left center, and upper right windows have deviations within ±0.008 mm, falling into the third level. This grading process provides the structural basis for subsequent peak-shifting driving.

[0085] Based on the three-level classification results, a rhythmic detection sequence is constructed. By dividing the detection into beats, the nine detection windows participate in detection in rotation at different time periods, avoiding the platform being subjected to concentrated detection loads from all windows within a short period. The complete detection cycle is set to 120 milliseconds. The nine windows are divided into three driving groups, each with three windows, named the first beat group, the second beat group, and the third beat group, respectively. During beat division, priority is given to groups containing windows of different levels, and their distribution positions must be in different quadrants of the board surface. For example, the first beat group may contain the center window, the left-middle window, and the upper right window; the second beat group contains the upper-middle, right-middle, and lower-middle windows; and the third beat group contains the upper left, lower-middle, and lower-right windows. Each beat lasts 40 milliseconds, with a 10-millisecond cooldown interval between beats. The detection windows are started group by group through a cyclical beat queue, achieving alternating local detection and improving the platform's thermal distribution uniformity and structural stress diffusion efficiency.

[0086] In coordination with the rhythmic drive, the illumination intensity and imaging parameters of the currently active window area are adjusted to achieve higher image quality during inspection, while reducing energy input to inactive windows and minimizing platform thermal load. Specifically, when the rhythmic window is active, the illumination intensity is increased to 90% of the original setting to improve edge sharpness, and the shutter exposure time is shortened to 180 microseconds to increase image sampling resolution. For the six window areas not currently being inspected, the illumination intensity is reduced to 50%, and the exposure time is appropriately extended to 220 microseconds to reduce the continuous pressure on local structures from the inspection load. During continuous inspection, the incident light direction in the active area is kept perpendicular by dynamically adjusting the light source angle to avoid reflection interference. After inspecting 300 consecutive boards, this method reduced the image brightness standard deviation from 10.2 to 3.8, improved image edge gradient sharpness by 27%, and significantly enhanced image consistency between windows.

[0087] While alternately opening and closing the detection windows, micro-displacement measurements were collected from different areas of the detection platform surface to evaluate the actual effect of the staggered-drive strategy on platform deformation control. Sixteen independent strain gauge displacement sensors, each with a measurement sensitivity of 0.1 micrometers, were installed below the platform, corresponding to the nine detection windows and their boundary extension areas. Deformation data of the platform in the Z-axis direction was collected before and after cycle time, and the total deformation and the maximum displacement at a single point were calculated. Without the staggered-drive strategy, the displacement in the central area reached 4.9 micrometers, and in the left area, it reached 4.4 micrometers. After adopting the staggered-drive strategy, the maximum deformation at the same location decreased to 2.1 micrometers, and the overall deformation level decreased by more than 55%. Furthermore, analysis of the patch solder joint position error after detection revealed that the average sample placement offset using this strategy decreased from ±46 micrometers to ±21 micrometers, significantly improving soldering quality and placement accuracy.

[0088] After each printed circuit board (PCB) is inspected, the current off-peak inspection cycle sequence, window opening time, platform deformation data, and image sampling stability of each window are integrated and saved as a complete performance record of the inspection process. Before the next PCB is inspected, the latest warpage distribution map is reloaded, and the members of the cycle group windows are adjusted based on the latest deformation data. This process enables adaptive adjustment of the inspection rhythm to the current board surface stress state, constructing a dynamic response mechanism. For example, if the central region of a previous PCB has a large deformation, the central window can be scheduled to a later cycle group during the next PCB inspection, allowing the platform sufficient buffer time. Long-term production verification results show that this method effectively reduces the risk of platform warpage accumulation during continuous multi-board inspection, ensures the stability of flatness data, and supports continuous operation of the inspection production line for more than 8 hours without significant thermal mismatch or deformation drift.

[0089] The following is a complete example from a production site, demonstrating the implementation process, key data, and comparative results of a printed circuit board flatness inspection method based on affine transformation and multi-region dynamic compensation in a real production line. The example covers the entire process from incoming material inspection, region calibration, depth compensation, warpage assessment to rhythmic peak-shifting, and uses reproducible numerical values ​​to illustrate the improvement over traditional visual geometric mapping schemes.

[0090] I. Production Line and Sample Background

[0091] A telecommunications equipment manufacturer has implemented a six-layer high-speed signal printed circuit board (PCB) on line A. The finished product measures 270 mm × 180 mm and is 1.6 mm thick. Key components include QFN, BGA, and RF connectors. A flatness online inspection station is located at the front end of line A, before the automated placement station. Previously, a traditional visual geometry mapping solution was used: corner points were inspected at the four corners of each board, and a nine-zone template was projected onto the current board surface using an affine matrix. Flatness was then determined by taking the height of a single point in each zone. Production line statistics show that the ambient temperature fluctuates between 24 and 31 degrees Celsius, and the transport platform experiences slight bending under full load. Three months of quality records indicate that the traditional solution resulted in issues such as cold solder joints, short circuits, and component misalignment caused by Z-axis reference deviation during placement, and frequently produced false impressions of flatness.

[0092] II. Typical Problems and Baseline Data of Traditional Schemes

[0093] Using 900 boards from three consecutive days as a sample, the traditional method exhibited the following phenomena: Due to screen printing reflections and blurred edges, the probability of corner point recognition anomalies was 4.7%. Once three corners were approximately collinear, the determinant of the affine matrix approached zero and could not be stably inverted, causing the nine template regions to stack into a strip-like area in the image coordinates. Subsequently, the output height curve was misinterpreted as flat. Sample data:

[0094] 1. At a temperature of around 29 degrees Celsius, thermal bulging of the platform caused the central area to arch upwards by approximately 35 micrometers. Traditional solutions, due to the misalignment of the nine zones, still provide a flatness assessment value.

[0095] 2. Online AOI statistics after mounting show that the average offset in the X direction is 38 micrometers, the average offset in the Y direction is 34 micrometers, and the proportion of offsets exceeding 50 micrometers is 6.2%.

[0096] 3. Solder joint defect rate: cold solder joint 1.9%, bridging short circuit 0.6%.

[0097] 4. The three-sigma repeatability of repeated measurements at the same location is ±22 micrometers.

[0098] 5. The overall scrap rate of single boards was 2.8%, the rework rate was 4.5%, and the first-pass yield rate after rework was 86.7%.

[0099] III. Implementation of the New Plan and Key Process Data

[0100] This invention's method is implemented at the same workstation, employing polarized anti-reflective illumination and high-resolution imaging. First, it ensures edge closure along the contour line, then extracts candidate quadrilaterals and vertices, establishing a clockwise connection sequence to generate a nine-zone reference frame consistent with the actual contour. A detection window is set at the center of each zone. A baseline depth is written during idle operation, and dynamic depth is extracted during production. Compensation is calculated, and then a reference plane is established using the three points with the largest span among the nine points after depth compensation. The height deviation of the nine points is calculated to form a warpage distribution map. Finally, based on the warpage strength classification, alternating opening and closing staggered peak drives are executed in a rhythmic manner to limit localized thermal load and stress accumulation.

[0101] 1. Calibration of the nine-zone reference frame and detection window

[0102] Under 8192×4096 pixel imaging, the pixel coordinate spacing of the center in the nine zones is approximately 2730 pixels horizontally and 1360 pixels vertically. Each detection window is set to 32×32 pixels, approximately 1.2 mm × 1.2 mm. After continuously sampling 200 boards, the mean repositioning deviation of the center in the nine zones is 1.9 pixels, the standard deviation is 0.7 pixels, and the corresponding average physical deviation is approximately 7.1 micrometers. Compared with the traditional template with fixed coordinates, the centroid error of the nine zones is reduced from an average of 8.4 pixels to 2.3 pixels.

[0103] 2. Baseline Depth and Dynamic Depth

[0104] Under no-load conditions, a reference depth of nine windows was established at a sampling density of 25 points per square millimeter. The nine reference depth values ​​of the sample board ranged from 9.874 mm to 9.912 mm, with a maximum difference of 38 micrometers. Under production conditions, the dynamic depth of the same nine windows fluctuated by a peak value of ±18 micrometers during thermal steady-state conditions. For example, the upper left window had a reference depth of 9.891 mm and a dynamic depth of 9.834 mm, with a compensation of +57 micrometers; the lower right window had a reference depth of 9.902 mm and a dynamic depth of 9.927 mm, with a compensation of −25 micrometers. After compensation, the nine-point height returned to a unified reference, and the repeatability three sigma improved to ±9 micrometers.

[0105] 3. Reference plane and warping distribution

[0106] Three windows—the upper left, center, and lower right—were selected to construct a reference plane, with a maximum diagonal span of approximately 9.2 cm between them. Substituting the remaining six points into the reference plane yielded height deviations: a maximum positive deviation of +43 micrometers, a minimum negative deviation of −38 micrometers, and an overall warping amplitude of 81 micrometers. This amplitude showed a consistency of within ±6 micrometers with subsequent external step gauge sampling. Interpolating the nine deviations through a mesh resulted in a continuous warped surface, allowing for a visually apparent saddle-shaped trend of upward elevation in the upper left and downward depression in the lower right within three-dimensional coordinates.

[0107] 4. Rhythm shifting and energy release

[0108] Three sets of cycles were set based on deviation grading, with each cycle lasting 120 milliseconds. Each set of three windows opened and closed every 40 milliseconds, with a 10-millisecond cooldown between cycles. The illumination intensity of the activated window was increased to 90%, and the exposure time was shortened to 180 microseconds. The illumination of the inactive window was reduced to 50%, and the exposure time was extended to 220 microseconds. After introducing peak shifting, statistics from the displacement sensors embedded in the platform surface showed that the cumulative deformation in the Z-direction of the central region decreased from 4.7 micrometers to 2.1 micrometers, and the deformation in the left region decreased from 4.4 micrometers to 2.0 micrometers. After 300 rounds of continuous detection, the standard deviation of the window image brightness decreased from 10.2 to 3.8, and the edge gradient sharpness improved by 27%.

[0109] 5. Impact on placement and yield

[0110] This plan was run online for two weeks, and then compared with the traditional plan used on adjacent shifts. The results are as follows:

[0111] a. Mounting offset: The average value in the X direction decreased from 38 micrometers to 18 micrometers, the average value in the Y direction decreased from 34 micrometers to 16 micrometers, and the proportion of offsets exceeding 50 micrometers decreased from 6.2% to 1.1%.

[0112] b. Solder joint quality: The rate of incomplete solder joints decreased from 1.9% to 0.7%, and the rate of short-circuit bridging decreased from 0.6% to 0.2%.

[0113] c. False positive rate: The proportion of severe warping that was mistakenly identified as flat was reduced from 1.5% to 0.2%.

[0114] d Repeatability: Three sigma improved from ±22 micrometers to ±9 micrometers, Cp improved from 1.10 to 1.85, and Cpk improved from 0.92 to 1.62.

[0115] e Platform thermal stability: After 8 hours of continuous operation, the surface temperature rise decreased from 11.2 degrees Celsius to 4.7 degrees Celsius.

[0116] f. Economic benefits: The scrap rate decreased from 2.8% to 1.0%, the rework rate decreased from 4.5% to 1.6%, and the first-pass yield rate after rework increased from 86.7% to 96.2%. Based on a monthly shipment of 120,000 boards, and with a single board manufacturing cost of 135 yuan, direct scrapping and rework save approximately 1.43 million yuan, plus savings of approximately 270,000 yuan in production line downtime and overtime costs.

[0117] IV. Intuitive Explanation of Key Mechanisms

[0118] Why do compensation and peak-shifting techniques bring the aforementioned benefits? First, by writing the reference depth at nine actual anchoring positions and then comparing it point-by-point with the dynamic depth during production, the deformation of each region is accurately identified and offset, eliminating the risk of mistaking platform curvature for flatness. Second, by constructing a reference plane using three points, the absolute height error is converted into a relative warp indication, forming a continuous spatial distribution. The true positions of lifting and sinking can be known before mounting, facilitating material feeding, line changing, and parameter pre-adjustment. Third, peak-shifting disperses energy and load across the time axis and spatial plane, reducing continuous light heating and mechanical coupling in certain windows, minimizing short-term deformation of the platform and carrier, and indirectly improving image stability and high repeatability. These three points work together to avoid the most fatal flaws of traditional solutions: false flatness and regional misalignment.

[0119] V. Summary of Case Studies

[0120] Under the same production line, same incoming materials, and same environment, the present invention constructs an adaptive nine-zone system using real vertices, compensates point-by-point and references planarization, and then combines this with staggered rhythmic release to form a closed-loop detection. Data shows significant improvements in the repeatability of flatness measurement, the accuracy of warpage identification, mounting accuracy, and thermal stability, with benefits quantifiable using economic indicators. In this example, all parameters are given specific values ​​and operable configurations, facilitating migration to other board types of different sizes and layer counts.

[0121] The following table summarizes the comparison results of key indicators.

[0122] Indicator Items Traditional visual geometric mapping schemes Technical solution of the present invention Increase or change Corner detection anomaly probability 4.7% 0.8% Decrease of 83.0% Mean of centroid positioning error in nine zones 8.4 pixels 2.3 pixels Decrease of 72.6% Indicator Items Traditional visual geometric mapping schemes Technical solution of the present invention Increase or change Highly repeatable three sigma ±22 micrometers ±9 micrometers An increase of 59.1% Maximum warp identification error ±18 micrometers ±6 micrometers A decrease of 66.7% Average offset in the X direction of mounting 38 micrometers 18 micrometers Decrease of 52.6% Average offset in the Y direction of mounting 34 micrometers 16 micrometers Decrease of 52.9% Offset greater than 50 micrometers 6.2% 1.1% A decrease of 82.3% cold solder joint defect rate 1.9% 0.7% Decrease of 63.2% Bridge short circuit rate 0.6% 0.2% A decrease of 66.7% Misjudging warping as flatness 1.5% 0.2% Decrease of 86.7% Surface temperature rise for 8 consecutive hours 11.2 degrees Celsius 4.7 degrees Celsius Decrease of 58.0% Platform maximum deformation 4.9 micrometers 2.1 micrometers Decrease of 57.1% Production line scrap rate 2.8% 1.0% A decrease of 64.3% Return rate 4.5% 1.6% A decrease of 64.4% First pass rate after rework 86.7% 96.2% An increase of 9.5 percentage points Process capability Cp 1.10 1.85 An increase of 68.2% Process capability Cpk 0.92 1.62 An increase of 76.1%

[0123] As can be seen from the table above, the technical solution of this invention exhibits stable and significant advantages in multiple dimensions such as corner stability, regional positioning accuracy, repeatability, warpage recognition, mounting offset, solder joint defects, thermal stability and yield. These advantages stem from explainable physical and geometric mechanisms and have value for promotion and large-scale application.

[0124] This invention enhances boundary robustness through contour band closure recognition, avoiding affine matrix inversion failures caused by vertex misjudgment. By synchronizing the standardized nine-zone reference frame with the detection window position drift, the detection area precisely conforms to the actual board surface, unaffected by placement offsets or rotational disturbances. Furthermore, through dynamic depth compensation and reference plane reconstruction mechanisms, errors caused by platform thermal deformation and mechanical deflection are eliminated point by point, effectively avoiding false flatness. Finally, based on warp distribution, a peak-shifting drive is introduced to dynamically disperse detection load and thermal stress, forming a detection closed loop of real-time flatness calibration and stress self-balancing. Compared to traditional methods, this overall solution significantly improves the stability and accuracy of detection results and the alignment success rate of the mounting process, providing a reliable planar reference guarantee for high-volume precision mounting.

[0125] The foregoing has only described certain exemplary embodiments of the present invention by way of illustration. Undoubtedly, those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the foregoing drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

Claims

1. A method for detecting the flatness of robot PCB control boards based on affine transformation and multi-region dynamic compensation, characterized in that, Includes the following steps: The image data of the printed circuit board is acquired, and a continuous contour band is constructed in the edge region of the image. The contour band remains closed and coherent even in the presence of lighting interference, shadow occlusion and pattern noise. Four boundary lines are extracted from the contour band, and a set of vertex candidate points is output for constructing a spatial transformation model. Based on the vertex candidate point set, a clockwise connection sequence is constructed in the central region of the printed circuit board image, and a nine-zone reference box for standardizing region division is generated according to the connection sequence, so that the reference box is consistent with the actual contour space of the printed circuit board. Nine detection point sets are constructed based on the nine-zone reference frame, so that each detection point drifts slightly with the spatial orientation of the printed circuit board while maintaining relative spatial consistency. A detection window is formed at each detection point position for position anchoring in subsequent depth compensation operations. In the boardless state, a reference depth value is written to each detection window. In the production state, a dynamic depth value is extracted from each detection window in real time. The difference between the dynamic depth value and the reference depth value is calculated to obtain the depth compensation amount of each detection window. The depth values ​​of each detection window are corrected based on the depth compensation amount, and the three points with the largest spatial span are selected to construct a reference plane. The height deviation between the corrected depth values ​​of all detection windows and the reference plane is calculated to generate a warpage distribution map of the printed circuit board. Based on the warp distribution diagram, the detection window is driven to open and close alternately in a staggered manner, so that the detection window releases micro-energy in a rhythmic sequence, reducing local stress concentration and maintaining stress balance and overall flatness stability closed-loop control during the detection process.

2. The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to claim 1, characterized in that, The steps for outputting the vertex candidate point set are as follows: Image data covering the entire printed circuit board surface is acquired using a high-resolution linear array industrial camera and a polarized cold white diffuse light source, and a gradient map for edge detection is generated after mean filtering and grayscale normalization. Construct a strip of consistent width around the image, calculate the mean gray value and gray difference in each sub-block, mark the gray-level jump response points, and perform line segment splicing to complete the construction of a continuous closed contour strip. Based on the set of response points within the continuous closed contour zone, straight line fitting is performed in four directions to obtain four main boundary lines, and boundary accuracy is evaluated using the minimum vertical distance error. Intersections are found among the four main boundary lines to form a set of candidate vertices. Then, the area, diagonal intersections, and aspect ratios of the set are calculated to ensure that the vertex set satisfies geometric recognizability and is used to construct a spatial transformation model.

3. The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to claim 2, characterized in that, The steps for dividing the reference frame into nine zones are as follows: Based on the obtained set of candidate vertices, sort them clockwise according to the spatial distribution order of top left, top right, bottom right, and bottom left to construct a closed vertex connection sequence; Based on the closed vertex connection sequence, the upper and lower boundary lines are divided at equal intervals to generate horizontal dividing lines, and the left and right boundary lines are divided at equal intervals to generate vertical dividing lines. Nine rectangular region boundaries are constructed through the intersection of the horizontal and vertical dividing lines to form a nine-zone reference box consistent with the printed circuit board boundary. The coordinates of the center point of each sub-region are calculated based on the midpoint of the boundary line segment of each sub-region, and used as the detection anchor point. The detection area is registered based on the nine-zone reference frame and the coordinates of the center point, and depth acquisition, compensation and deviation analysis are performed based on the reference frame in subsequent measurements.

4. The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to claim 3, characterized in that, The detection window is formed as follows: Based on the nine-zone reference box, the geometric center point of each region in each sub-region is extracted as the initial detection landing point, and a spatial response region with consistent side length is constructed at each initial detection landing point to extract grayscale features, edge gradient features and texture direction features; A detection window is constructed based on the center position of each initial detection point in the spatial response region, and the image coordinates, average pixel grayscale, image edge direction, and edge intensity of the detection window are recorded as the image anchoring information of the detection window. Based on the image anchoring information of the detection window, position fine-tuning correction is performed in the re-acquired image, so that the detection window can complete position matching and maintain the spatial correspondence of the detection window after the pose change; Spatial consistency is checked based on the horizontal and vertical distances between every two adjacent detection windows. When the relative spacing changes beyond a certain proportion, position backtracking is performed based on the coordinates of adjacent detection windows to maintain the overall structural consistency of the detection point set.

5. The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to claim 4, characterized in that, The steps for generating depth compensation are as follows: When the inspection platform is in a state without printed circuit boards, structured light scanning is performed on each inspection window. Depth data points are collected in the circular sampling area of ​​the inspection window and averaged to generate a reference depth value for each inspection window. When the printed circuit board is in the detection position, dynamic depth acquisition is performed in each detection window. During the dynamic depth acquisition process, all depth data points in the circular sampling area are acquired and averaged to generate the dynamic depth value of each detection window. The dynamic depth value of each detection window is compared with the baseline depth value to generate the depth compensation amount for each detection window, and a depth compensation matrix is ​​constructed based on the spatial position index of the detection window.

6. The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to claim 5, characterized in that, The baseline depth value and dynamic depth value of each detection window are calculated based on the arithmetic mean of all depth data points within the circular sampling area. The depth compensation is output in floating-point form with three decimal places, in millimeters.

7. The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to claim 5, characterized in that, The steps to generate the warp distribution map are as follows: Call the corrected depth data of the nine detection windows after compensation, perform additive compensation in fixed coordinates in the image space, and output a complete depth data set; From the corrected depth dataset, select the three points with the largest spatial span in the image plane, calculate the maximum horizontal distance, maximum vertical distance and maximum diagonal distance respectively, and construct a reference plane; Substitute the image coordinates of the remaining six detection windows into the geometric equation of the reference plane, and calculate the height deviation between their respective corrected depth values ​​and the reference plane. Based on the coordinates and height deviation of the detection window image, a 3x3 grid structure is constructed to complete the warpage distribution map and surface information completion. The image coordinates, height deviation, corrected depth value, reference plane parameters, and detection window number are combined and output to form a warped data matrix.

8. The method for detecting the flatness of a robot PCB control board based on affine transformation and multi-region dynamic compensation according to claim 7, characterized in that, The steps for performing alternating opening and closing of the detection window according to the warping distribution diagram and staggered peak driving to make the detection window open and close in a set rhythm sequence are as follows: The corrected height deviation values ​​of each detection window in the warp distribution map are used for hierarchical processing to form a driving priority order; Based on the hierarchical results, a rhythmic detection sequence is constructed, the nine detection windows are divided into three driving groups, the detection cycle is set, and the beat windows are allocated. In each cycle, the corresponding detection window region is activated, and the illumination intensity and imaging parameters are adjusted to achieve image quality optimization and energy control. Collect micro-displacement data of the detection platform in the Z-axis direction, calculate the platform deformation and mounting offset, and use them to evaluate the peak-shifting driving effect; Based on the cycle sequence of the previous plate, the platform deformation data, and the image sampling stability, adjust the cycle window arrangement during the inspection process of the next plate.

Citation Information

Patent Citations

  • Fuel cell metal bipolar plate forming error detection device

    CN112179307A

  • Vehicle tarpaulin coverage real-time detection method and system based on multi-modal feature fusion

    CN120563985A