Dynamic compensation method for alignment accuracy of gilding nail stickers micro-letter stamping

By using adaptive binarization and topological fingerprint recognition technology, the deviation in hot stamping of microtext on nail stickers is decomposed into structural alignment and system distortion, which solves the problems of alignment accuracy and resource consumption in hot stamping of microtext on nail stickers, and realizes high-precision, low-latency automated production.

CN122425969APending Publication Date: 2026-07-21GUANGZHOU ZHENGXIANG PRINTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU ZHENGXIANG PRINTING CO LTD
Filing Date
2026-04-24
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing hot stamping technology for microtext on nail stickers suffers from poor alignment accuracy under complex lighting conditions, and the diversity of fonts makes recognition and compensation difficult. Reliance on deep learning models leads to high resource consumption and low flexible production efficiency, making it difficult to meet the needs of small and medium batch customized production.

Method used

By acquiring high-resolution grayscale images and performing adaptive binarization processing, the main topological skeleton is extracted, key nodes are sampled to generate topological fingerprint vectors, font types are identified by combining hash compression index tables, deviations are decomposed into structural alignment deviations and system distortion deviations for compensation, and system distortion is quantified and calculated using local affine distortion parameters.

Benefits of technology

It achieves high-precision alignment compensation under complex lighting and diverse font conditions, reduces computing resource consumption, improves production flexibility and response speed, and is suitable for high-precision, high-speed automated production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122425969A_ABST
    Figure CN122425969A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of dynamic compensation method for the alignment accuracy of gold-plated nail paste micro-text stamping, for the positioning error caused by gold-plated reflection uneven and imaging system distortion, propose a kind of high-precision alignment method combining adaptive image processing, structured topological fingerprint identification and deviation decoupling compensation.Core scheme includes: through local contrast dynamic threshold, realize the robust binarization and skeleton extraction of stamping area gray scale image, and then construct micro-text structure topological fingerprint vector;Based on multidimensional feature comparison matching standard font, orthogonal decomposition structure alignment and two kinds of deviation of system distortion, use the local affine distortion of multi-instance space distribution consistency fitting, comprehensive generation six degrees of freedom pose compensation quantity;Finally drive actuator to realize the accurate alignment of micro-text.The method effectively improves the stamping alignment accuracy and system robustness under the complex scene of reflection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of precision alignment and dynamic compensation for microtext hot stamping, and in particular to a method for dynamic compensation of alignment accuracy for microtext hot stamping on gold nail stickers. Background Technology

[0002] In the field of precision microtext hot stamping, especially in the rapid decorative manufacturing process represented by hot stamping nail stickers, extremely high technical requirements are placed on the alignment accuracy of microtext layout and hot stamping results. Currently, mainstream hot stamping alignment error compensation systems in the industry mainly rely on multimodal feature fusion based on visual detection and deep learning models. Through image acquisition, combined with multi-sensor fusion (such as mechanical position encoders, line scan cameras, 3D sensors, etc.), the real-time status of the device is perceived, and a specific deviation regression model is trained with large-scale labeled samples to achieve automatic estimation of structural distortion or displacement deviation. This type of method has a high recognition and alignment capability for typical standard fonts, common font sizes, and regularly arranged text, and is widely used in contemporary literature and engineering patents.

[0003] However, microtext hot stamping faces more variables in real-world scenarios. First, common hot stamping materials are highly reflective and prone to noise interference, making it easy for traditional global threshold binarization and edge detection to lose detailed information or misjudge character boundaries, making it difficult to reliably extract fine structures. Second, microtext objects are diverse, with significant differences in font structure, extremely small size, and non-fixed arrangement, easily exceeding the existing distribution range in the training set, thus limiting the generalization ability of deep regression models and feature matching. In particular, for unfamiliar samples such as serif fonts, handwritten fonts, variant symbols, and multi-size combinations, the variations in stroke connectivity and local geometric details cause traditional solutions that rely on overall image features or end-to-end neural network outputs to significantly decrease bias estimation under conditions of "unseen fonts" and "non-standard typesetting."

[0004] Common problems with existing technologies include: reliance on a single structural feature of the font itself, resulting in poor decoupling between topological and geometric semantics; difficulty in completely distinguishing between system distortion and structural misalignment, leading to error accumulation and compensation mismatch; high dependence on GPUs and large-scale model parameters for recognition and compensation, making it difficult to achieve millisecond-level real-time scheduling on low-power edge devices and high-speed lines; and the need to re-collect and annotate large amounts of data for each new layout or font update, severely impacting flexible production efficiency and equipment applicability. Furthermore, while multimodal sensor fusion, complex image enhancement, and attention mechanisms improve interference adaptability to some extent, they significantly increase system costs and maintenance complexity, making it difficult to meet the cost-effectiveness requirements of small-batch customized production and high-frequency font replacement processes. Summary of the Invention

[0005] This application provides a dynamic compensation method for the alignment accuracy of microtext hot stamping on hot stamping nail stickers, aiming to solve one of the problems or issues of the prior art mentioned in the background art above.

[0006] The method for dynamic compensation of alignment accuracy for microtext hot stamping on gold-stamped nail stickers provided in this application specifically includes: S1: Obtain a high-resolution grayscale image of the hot stamping area, and perform adaptive binarization processing on the high-resolution grayscale image by dynamically dividing the threshold range according to the local area contrast, so as to generate a binarized contour image that eliminates the interference of uneven hot stamping reflection.

[0007] S2: Based on the binarized contour image, perform connected component analysis and filter candidate character regions whose area is within the preset microtext pixel range, and perform skeleton thinning operation on the candidate character regions to extract the main topological skeleton.

[0008] S3: Sample endpoints, bifurcation points, inflection points, and curvature extrema points along the main topology skeleton path as key nodes, record the relative positional relationship of the key nodes, the connection topology sequence number, and the local curvature direction encoding to generate a real-time topology fingerprint vector.

[0009] S4: Based on the pre-stored font size combination hash compression index table in the standard font library, the minimum transformation cost of the real-time topological fingerprint vector and each font fingerprint vector is calculated using the graph edit distance processing method to identify the matching font type and target font size.

[0010] S5: Based on the matched font type and target font size, call the corresponding standard structural offset template, decompose the deviation into two orthogonal dimensions: structural alignment deviation and system distortion deviation, to establish a deviation decoupling model.

[0011] S6: Fit local affine distortion parameters using the spatial distribution consistency error of multiple identical structural units within the same character region, and quantify the system distortion deviation based on the local affine distortion parameters.

[0012] S7: Perform vector superposition operation on the structure alignment deviation and the system distortion deviation to generate a compensation vector containing six degrees of freedom pose information.

[0013] S8: Dynamic position adjustment is performed based on the compensation vector to complete a high-precision alignment compensation operation for microtext hot stamping.

[0014] The dynamic compensation method for alignment accuracy of microtext hot stamping on gold-stamped nail stickers provided in this application has the following beneficial effects: (1) To address the problems of poor adaptability of traditional hot stamping text alignment calibration methods in complex lighting, diverse fonts, and dynamic production line environments, as well as the weak generalization ability and high response latency caused by relying on a large amount of labeled data and deep model inference, this solution constructs a lightweight character structure representation system based on topological fingerprints to achieve high-precision decoupled recognition of font type and font size. Compared with the existing technology that generally uses end-to-end neural networks for image regression or classification, this invention abandons the dependence on large-scale training samples and GPU computing power, and instead starts from the geometric ontology of character contours. It uses skeleton refinement and key node sampling to extract highly discriminative "topological fingerprint" vectors, and combines hash compression to establish a local index table, which significantly improves matching efficiency and cross-font robustness. Especially when facing unseen uncommon fonts, non-standard typesetting, or low signal-to-noise ratio images, it can still achieve accurate retrieval through graph editing distance measurement, effectively overcoming the problem of actual deployment performance degradation caused by overfitting the training set in traditional methods.

[0015] (2) Furthermore, to address the problem that existing systems struggle to distinguish between inherent offsets caused by differences in the font's own structure and system deformations caused by external mechanical / optical factors during the correction process, leading to over- or under-compensation, this solution innovatively proposes a deviation decoupling mechanism. This mechanism decomposes the overall positioning error into two orthogonal dimensions: "structural alignment deviation" and "system distortion deviation," which are modeled and processed separately. The former uses a pre-stored standard structural offset template for lookup compensation, ensuring accurate correction of stroke layout differences between different fonts. The latter utilizes the spatial distribution consistency of multiple repeating structural units within the same character area, fitting pixel-level distortion parameters based on a local affine transformation model to achieve adaptive estimation of dynamic disturbances such as lens distortion and conveyor belt jitter. This dual compensation strategy not only avoids the semantic confusion problem caused by traditional single global displacement regression but also significantly improves the physical interpretability and spatial consistency of pose correction, making the final output six-degree-of-freedom compensation vector more accurate and stable, especially suitable for high-precision, high-speed automated production line scenarios.

[0016] (3) Furthermore, the entire processing flow is based entirely on the semantic structure of the character ontology and local geometric constraints, without the need to introduce additional sensor data, historical sample distribution, or online learning mechanisms, forming a closed-loop, self-contained real-time analysis framework. From image acquisition, adaptive binarization, connected component filtering to topology matching and deviation compensation, each module adopts deterministic algorithm design, ensuring that the processing time per cycle is consistently below 8ms, meeting the real-time requirements of industrial applications. At the same time, the system has good scalability and maintainability, requiring only an update to the local fingerprint database to support the rapid access of new fonts without retraining the model or adjusting hyperparameters. Compared with black-box solutions that rely on deep learning, this solution demonstrates significant advantages in terms of computational resource consumption, deployment flexibility, and operational reliability, effectively constructing an efficient, robust, and low-cost hot stamping character alignment calibration system, which is particularly suitable for intelligent manufacturing production line environments with multiple varieties, small batches, and high switching frequencies.

[0017] In summary, this solution achieves high-precision, strong generalization, and low-latency pose correction under conditions of no deep network, no external modality, and no historical dependency by using a topology fingerprint-driven font recognition mechanism and a two-dimensional deviation decoupling compensation architecture. This significantly improves the automation level and product quality consistency of hot stamping processes in complex real-world scenarios, combining technological advancement with engineering practicality. Attached Figure Description

[0018] Figure 1 This is the main flowchart of a dynamic compensation method for the alignment accuracy of microtext hot stamping on gold nail stickers.

[0019] Figure 2 This is a sub-flowchart of a method for dynamic compensation of alignment accuracy in hot stamping of microtext on nail stickers.

[0020] Figure 3 This is another sub-flowchart for the dynamic compensation method of alignment accuracy for hot stamping of microtext on nail stickers. Detailed Implementation

[0021] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0022] The following disclosure provides many different embodiments or examples for implementing different structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. Of course, these are merely examples and are not intended to limit the invention. Furthermore, reference numerals and / or letters may be repeated in different examples; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0023] like Figure 1 As shown, this application provides a dynamic compensation method for the alignment accuracy of microtext hot stamping on gold-stamped nail stickers, specifically including: S1: Obtain a high-resolution grayscale image of the hot stamping area, and perform adaptive binarization processing on the high-resolution grayscale image by dynamically dividing the threshold range according to the local area contrast, so as to generate a binarized contour image that eliminates the interference of uneven hot stamping reflection.

[0024] S2: Based on the binarized contour image, perform connected component analysis and filter candidate character regions whose area is within the preset microtext pixel range, and perform skeleton thinning operation on the candidate character regions to extract the main topological skeleton.

[0025] S3: Sample endpoints, bifurcation points, inflection points, and curvature extrema points along the main topology skeleton path as key nodes, record the relative positional relationship of the key nodes, the connection topology sequence number, and the local curvature direction encoding to generate a real-time topology fingerprint vector.

[0026] S4: Based on the pre-stored font size combination hash compression index table in the standard font library, the minimum transformation cost of the real-time topological fingerprint vector and each font fingerprint vector is calculated using the graph edit distance processing method to identify the matching font type and target font size.

[0027] S5: Based on the matched font type and target font size, call the corresponding standard structural offset template, decompose the deviation into two orthogonal dimensions: structural alignment deviation and system distortion deviation, to establish a deviation decoupling model.

[0028] S6: Fit local affine distortion parameters using the spatial distribution consistency error of multiple identical structural units within the same character region, and quantify the system distortion deviation based on the local affine distortion parameters.

[0029] S7: Perform vector superposition operation on the structure alignment deviation and the system distortion deviation to generate a compensation vector containing six degrees of freedom pose information.

[0030] S8: Dynamic position adjustment is performed based on the compensation vector to complete a high-precision alignment compensation operation for microtext hot stamping.

[0031] Step S1: Obtain a high-resolution grayscale image of the hot stamping area, and perform adaptive binarization processing on the high-resolution grayscale image by dynamically dividing a threshold range based on the local area contrast, so as to generate a binarized contour image that eliminates the interference of uneven hot stamping reflection. Specifically, this includes: S1.1: The high-resolution grayscale image of the hot stamping area is divided into blocks and meshed to generate a set of image sub-blocks containing local brightness distribution information, which serves as the original data source for subsequent local contrast calculation.

[0032] For the high-resolution grayscale image of the hot stamping area from the image acquisition module, when performing block meshing processing, the pixel matrix of the image is used as the input data object, and the entire image is uniformly divided in two dimensions using preset horizontal and vertical grid division parameters.

[0033] The pixel index position of each sub-grid obtained by segmentation is recorded in the grid mapping table to ensure that the original pixel value can be quickly located based on the index in subsequent brightness statistics operations.

[0034] For each sub-block element in the grid mapping table, the grayscale value reading interface is called to extract the grayscale intensity data of all pixels in the sub-block and form a local brightness dataset.

[0035] Perform a row and column index rearrangement operation on the local brightness dataset to arrange the pixel grayscale values ​​in a fixed order and construct a data sequence structure that is adapted to subsequent sliding window statistical operations.

[0036] Through the above block-based meshing process, a set of image sub-blocks containing local brightness distribution information is output, providing a structured data source for the subsequent calculation of the local contrast matrix, thereby improving the spatial positioning accuracy of the reflection unevenness preprocessing.

[0037] For example, for a high-resolution grayscale image with a size of 1920×1080 pixels, the image is divided into 32 grid units horizontally and 18 grid units vertically, with each grid sub-block measuring 60×60 pixels. During the division process, an index mapping is used to generate a mapping table containing 576 sub-block elements. For the sub-block numbered (5,7), integer data with grayscale values ​​ranging from 0 to 255 for its corresponding pixels are extracted and rearranged to form a brightness sequence of length 3600. This sequence is used as the input to a sliding window in subsequent local contrast calculations. By performing the difference operation between the maximum and minimum grayscale values, local contrast matrix elements characterizing the unevenness of hot stamping reflection are generated, achieving effective quantitative processing of reflective interference at the location of this sub-block.

[0038] S1.2: Perform sliding window statistical operations based on the image sub-block set to calculate the difference between the maximum and minimum gray values ​​in each sub-block, so as to generate a local contrast matrix that characterizes the degree of unevenness of hot stamping reflection.

[0039] Based on the image sub-block set containing local brightness distribution information generated in the previous step, a sliding window statistical process is performed on each image sub-block to determine gray-level extrema. The sliding window is moved row by row and column by column within the image sub-block range in single-pixel steps. The maximum and minimum gray-level values ​​of the region are determined by comparing the gray-level values ​​of all pixels within the window coverage area. The maximum and minimum gray-level values ​​are output as extremum pairs for each sub-block, and a gray-level difference calculation input dataset is constructed accordingly. The gray-level differences are mapped to the corresponding sub-block position indices to generate a two-dimensional matrix-like local contrast matrix. Through this processing method, the image sub-block set from the previous step is transformed into a local contrast matrix that can quantitatively characterize the degree of unevenness in hot stamping reflection, achieving accurate input for the subsequent dynamic thresholding method.

[0040] S1.3: Dynamically map the threshold range according to the numerical value of each element in the local contrast matrix, and use a nonlinear interpolation method to assign an independent binarized decision threshold to each pixel to generate an adaptive dynamic threshold map.

[0041] Using the local contrast matrix output by S1.2 as input data, a mapping index table between corresponding pixel positions and contrast values ​​is established to determine the dynamic adjustment basis for the threshold range for each pixel.

[0042] The values ​​of each element in the local contrast matrix are mapped to a preset threshold range between upper and lower limits through interval normalization, forming a basic threshold distribution vector. The normalization mapping formula is as follows: Where T is the base threshold of the current pixel, and C is the local contrast value of the sub-block where the pixel is located. min With T max These are the lower and upper limits of the global threshold interval, respectively, C. min With C max These are the minimum and maximum values ​​of the contrast matrix, respectively.

[0043] After generating the basic threshold vector, a polynomial interpolation method (non-linear interpolation) is used to continuously optimize the vector in the spatial coordinate domain to adapt to the non-uniform variation of the hot stamping reflection distribution between adjacent pixels. During interpolation calculation, a third-order polynomial is fitted to the threshold at each pixel position to ensure the smoothness and local sensitivity of the threshold variation curve.

[0044] Based on the interpolated and optimized threshold vector, an adaptive dynamic threshold map is constructed. This map is a two-dimensional matrix structure, with each element storing the decision threshold for the corresponding pixel. The generation of the threshold map must maintain the consistency of the original pixel coordinate system to facilitate subsequent pixel-by-pixel comparison processing.

[0045] Through the above normalization, nonlinear interpolation and matrix mapping processes, the local contrast matrix output in step S1.2 is transformed into an adaptive dynamic threshold map containing an independent binary decision threshold for each pixel, thus realizing a high-precision decision basis under the interference of uneven hot stamping reflection.

[0046] For example, in a hot stamping production line for microtext on nail stickers, the high-definition grayscale image resolution is set to 1920×1080 pixels, the size of the segmented grid unit is 16×16 pixels, and the local contrast matrix dimension is 120×68. The global threshold range is set to T. min =85 grayscale units, T max =170 grayscale units, local contrast range C min =5, C max =60. Normalize the local contrast matrix using the above formula to obtain the basic threshold vector. For example, the basic threshold of the sub-block containing a pixel with a contrast of 38 is calculated using the formula: The calculation result yielded T≈138. Subsequently, this threshold vector was optimized across the entire image using third-order polynomial interpolation, generating a 1920×1080 adaptive dynamic threshold map. Under different lighting conditions, this map significantly improved the binary decision-making ability to recognize low-contrast microtext edges. The optimized edge breakage rate was significantly reduced, and the system's decision consistency between low-reflectivity and high-reflectivity areas was significantly improved, meeting the high-speed inspection and hot stamping accuracy requirements of the production line.

[0047] S1.4: The high-definition grayscale image is compared pixel by pixel using the adaptive dynamic threshold map. Pixels above the corresponding position threshold are marked as foreground and pixels below the threshold are marked as background to generate a preliminary binarized mask image.

[0048] S1.5: Perform morphological opening and closing operations on the preliminary binarized mask image to remove isolated noise points caused by the scattering of hot stamping particles and fill in tiny holes, so as to finally generate a binarized contour image that eliminates the interference of uneven hot stamping reflection.

[0049] Step S2: Based on the binarized contour image, perform connected component analysis and filter candidate character regions whose area is within the preset microtext pixel range. Perform skeleton thinning operation on the candidate character regions to extract the main topological skeleton. Specifically, this includes: S2.1: Perform an eight-neighbor connected component labeling method on the binarized contour image to generate a connected component label matrix containing location information of independent closed regions and pixel area statistics.

[0050] The binarized contour image, which has undergone morphological denoising in step S1.5 and whose reflection interference has been eliminated, is used as the input object. The eight-neighbor connected component labeling execution module is loaded and pixel adjacency relationship determination rules are established to ensure that the boundaries of each independent closed region and background pixels can be accurately distinguished in subsequent connection recognition.

[0051] The pixel array of the binarized contour image is input into the connected component label queue in row and column scanning order. Foreground determination is performed on the current pixel and its eight neighboring pixels. If there are labeled neighbors that meet the foreground conditions, the labels are merged and the normalized label index is updated. If there are no neighbors that meet the conditions, a new label number is created and the coordinate position is recorded.

[0052] During the label numbering process, a disjoint-set data structure compression operation is performed on multiple label mapping relationships that appear in the same round of scanning to resolve merging conflicts between temporary labels and form a globally unique connected domain number table, ensuring the accuracy of subsequent area statistics and location calculations.

[0053] For each field in the established global connected component numbering table, the pixels are counted. An accumulator is used to summarize the absolute coordinates of all pixels in the field and calculate the pixel area, providing area statistics for further filtering of regions that meet the characteristics of microtext size.

[0054] The connected component number table and pixel area statistics are combined and stored to form a connected component label matrix containing the location information of independent closed regions and pixel areas. This matrix serves as the direct data source for the S2.2 interval filtering process.

[0055] By using the above-mentioned eight-neighbor labeling and tag matrix construction processing method, the binarized contour image of the previous step is transformed into structured connected component data that can be filtered by area threshold, thereby achieving accurate positioning of candidate character regions.

[0056] For example, an eight-neighbor connected component labeling is performed on a binarized contour image with a resolution of 1920×1080. The foreground determination threshold is set to a pixel value of 255. During row scanning, if the current pixel has no foreground neighbors, a label number is assigned and the coordinates are written into the label table. If foreground neighbors exist, the smallest label number is used as the current label, and the merging relationship is recorded. After scanning, a disjoint-set data structure is performed to unify all merged labels to the smallest number. In this process, the area corresponding to a certain label number is 124 pixels, and the centroid coordinates output by the accumulator are (325, 447). The area corresponding to another label is 980 pixels, and the centroid coordinates are (1088, 512). The area and centroid coordinates of all labels are written into the connected component label matrix, with the matrix rows as the data unit for each domain: column 1 is the label number, column 2 is the area, and columns 3 and 4 are the centroid X and Y coordinates, respectively. In the subsequent S2.2, the threshold range for the area of ​​the miniature text is set to 50 to 500 pixels. The 980-pixel field is filtered out according to the area column, and the 124-pixel candidate field is retained. This field will be further processed in the skeleton refinement. Its centroid coordinates and pixel distribution significantly improve the stability of connectivity recognition in skeleton extraction.

[0057] S2.2: Based on the pixel area statistics in the connected component label matrix, interval filtering is performed using a preset micro-text pixel range threshold to output a set of candidate character regions that eliminate noise interference and large background areas.

[0058] Using the eight-neighbor connected domain label matrix of the binarized contour image as the input data source, the pixel area statistics of each independent closed region in the matrix are read and stored as an area value sequence.

[0059] A quantitative comparison process is performed on the area value sequence. Each area value is compared with the preset lower and upper limits of the microtext pixel range threshold to determine the range. The set of region indexes within the range is then filtered out by logical conditions.

[0060] The selected region index set is mapped back to the connected component label matrix, the corresponding pixel coordinate set is extracted, and a preliminary set of candidate character regions is constructed to eliminate noise regions that are obviously too small and background regions that are obviously too large.

[0061] A boundary consistency check is performed on the initial set of candidate character regions. Secondary filtering is performed by calculating the aspect ratio of each region's boundary and comparing it with the preset microtext aspect ratio range to remove redundant regions that do not conform to the morphological features.

[0062] The candidate character region set after two-stage filtering is output, and the spatial location identifier and pixel distribution data of each region in the set are marked to provide accurate input for subsequent skeleton refinement operations.

[0063] By using dual interval filtering based on pixel area statistics and morphological features, the connected component label matrix result from the previous step is transformed into a set of candidate character regions that conform to the size and structural features of miniature text, thus achieving the technical effect of noise and background interference removal.

[0064] For example, for a connected component label matrix obtained after processing in S2.1, the pixel area values ​​of each region within the matrix fluctuate between 10 and 120. The preset threshold for the microtext pixel range is a lower limit of 15 and an upper limit of 100. After the first filtering, isolated noise points with an area less than 15 and background blocks with an area greater than 100 are removed, leaving 48 regions. Subsequently, boundary consistency verification is performed, setting the aspect ratio of the microtext to between 0.5 and 2.0. The aspect ratio of the retained regions is calculated, and excessively thin strip-shaped regions with an aspect ratio of 0.3 and excessively wide block-shaped regions with an aspect ratio of 2.5 are removed, leaving 42 regions. The set of pixel coordinates of these 42 regions is output to step S2.3. Actual verification shows that after this filtering process, false branches are significantly reduced during skeleton refinement, the continuity of the main branch is significantly improved, and the reliability of candidate character recognition in low signal-to-noise ratio conditions is greatly improved.

[0065] S2.3: Perform iterative morphological erosion on each independent closed region in the candidate character region set to remove redundant edge pixels and generate an initial thinned skeleton image with a single pixel width.

[0066] The input for each independent closed region in the candidate character region set is a subset of a binarized image after S2.2 interval filtering to remove noise interference and large background regions. Its pixel matrix contains the complete closed contour of the target character and the background pixel distribution. The first step of performing iterative morphological erosion on the input pixel matrix is ​​to set the geometry and size of the structuring element. A 3×3 or 5×5 square structuring element is preferred to ensure uniform thinning of the character strokes in all directions. The initial number of iterations is determined based on the thickness of the target character strokes and the range of miniaturized text pixels. The second step involves convolving the structuring element with the current binary image in each iteration. If continuous foreground pixels exist within the coverage area of ​​the structuring element, those pixels are removed, thus achieving layer-by-layer edge pixel stripping. The third step dynamically detects pixel connectivity during iteration to avoid character skeleton breakage due to excessive erosion. Erosion stops when the stroke width is detected to be close to a single pixel, and the current image is output as the initial thinning skeleton candidate. The fourth step is to perform connected component integrity verification on the eroded skeleton candidate images, calculating the total length and number of branches of the skeleton path for each character. If it is lower than a preset threshold, the process reverts to the previous iteration result to ensure skeleton continuity. The fifth step is to uniformly encode the skeleton candidate images that meet the single-pixel width and continuity requirements into an initial thinned skeleton image matrix for use in the subsequent S2.4 endpoint protection and deburring optimization strategy. Through the above iterative erosion and connectivity detection processing, the candidate character region images from the previous step are transformed into initial thinned skeleton data with minimized structural redundancy, a constant width of one pixel, and continuous paths, thus achieving stability and accuracy in the skeleton extraction process.

[0067] S2.4: Based on the initial thinned skeleton image, perform endpoint protection and deburring optimization strategies to eliminate false branches caused by binarization noise and obtain a structurally continuous main topological skeleton.

[0068] S2.5: Perform pixel coordinate serialization reconstruction on the backbone topology skeleton to generate a backbone topology skeleton data stream that records the skeleton path connectivity and geometric orientation for subsequent node sampling.

[0069] like Figure 2 As shown, step S3 involves sampling endpoints, bifurcation points, inflection points, and curvature extrema along the main topology skeleton path as key nodes, recording the relative positional relationships of the key nodes, the connection topology sequence number, and the local curvature direction encoding to generate a real-time topology fingerprint vector. Specifically, this includes: S3.1: Perform curvature extremum detection processing on the main trunk topology skeleton path to obtain initial key node spatial distribution data containing endpoint coordinate sets, bifurcation point coordinate sets, and inflection point coordinate sets.

[0070] The continuous skeleton pixel sequence in the backbone topology skeleton data stream is deconstructed, and the single pixel step size vector of each skeleton path is extracted as the basic data for curvature analysis.

[0071] For each skeleton path, perform tangent direction calculation on the single-pixel step vector, and set the direction angle. Arrange the path sequence to form a direction angle sequence.

[0072] The second derivative approximation calculation is performed on the direction angle sequence to generate a curvature change rate sequence, and a threshold filter is used to remove low curvature fluctuation segments.

[0073] Extremum retrieval is performed on the curvature change rate sequence. Curvature extremum identifiers are generated at the pixel index positions that meet the extremum conditions, and endpoints, bifurcation points and inflection points are distinguished according to the extremum type.

[0074] Topological classification is performed on extreme value type identifiers. Endpoint types are identified by determining that the number of neighboring pixel connections is 1, bifurcation point types are identified by determining that the number of neighboring pixel connections is ≥3, and inflection point types are identified by the change in curvature sign.

[0075] The classified key node indices are mapped back to the pixel coordinate system to generate initial key node spatial distribution data containing the endpoint coordinate set, the bifurcation point coordinate set, and the inflection point coordinate set.

[0076] By using curvature extremum detection and topology classification, the main topological skeleton path is transformed into spatial distribution data of key nodes with clear structural features, enabling precise positioning during the node sampling stage.

[0077] For example, for a backbone path of 120 pixels in length, the direction angle sequence of the single-pixel step vector is approximated by the second derivative to obtain the curvature change rate sequence. An extreme value detection threshold of 0.15 radians / pixel is set, and 12 curvature extreme points are selected, including 2 endpoint types, 3 bifurcation point types, and 7 inflection point types. The neighborhood connectivity is determined by counting connected pixels within a 3×3 pixel neighborhood; the endpoint connectivity is determined by 1, and the bifurcation connectivity is determined by 3 or more. These 12 node indices are mapped to the skeleton pixel coordinate system to obtain a precise set of node coordinates. For example, the endpoint coordinate set contains (15,8) and (132,96), and the bifurcation point coordinate set contains (48,23), etc. This dataset provides high-confidence key node input in the subsequent neighborhood connectivity analysis in S3.2, effectively improving the stability and accuracy of font topological fingerprint generation.

[0078] S3.2: Perform neighborhood connectivity analysis based on the initial key node spatial distribution data to construct a skeleton connection topology index matrix describing the connection order and branch level between each key node.

[0079] Based on the initial spatial distribution data of key nodes, the coordinate set of endpoints, bifurcation points, and inflection points is used as the input object for neighborhood connectivity analysis.

[0080] Perform an eight-neighbor pixel query on each key node to retrieve other key nodes within its neighborhood and record the pixel index relationships between them to generate a local connectivity lookup table.

[0081] Based on the local connectivity lookup table, directed link records are established from node to node according to the serialized coordinate order of the skeleton path. The main sequential linked list of the skeleton path is then derived from the link records.

[0082] Perform branch detection operations on the main sequential linked list to determine whether a node has multiple connected path exits. Mark nodes with multiple exits as fork nodes and generate branch level labels.

[0083] The main sequential linked list is merged with the branch level label matrix to form a skeleton connection topology index matrix containing node numbers, connection order, and branch level.

[0084] This connectivity analysis processing method transforms the spatial distribution data of key nodes obtained from curvature extremum detection into a quantitative topological index matrix, enabling the computationalization of structural relationships between nodes and the generation of parameterized inputs through downstream direction encoding.

[0085] For example, in a certain gold-plated character skeleton, the initial key node spatial distribution data includes 5 endpoints, 2 branching points, and 3 inflection points, with each node having a coordinate resolution of 0.01 mm. In the neighborhood connectivity analysis, the eight-neighbor search radius is set to 2 pixels, and the neighborhood index relationship of each node is calculated to obtain the node adjacency table, where endpoint 1 is connected to inflection point 3 and branching point 1. This neighborhood index table is mapped to the main chain list of serialized coordinates, with a length of 12 nodes. During the branch detection process, the number of exit paths for branching point 1 is 3, and the number of exit paths for branching point 2 is 2, generating branch level labels 1 and 2 respectively. The main chain list and branch level labels are fused to obtain the skeleton connection topology index matrix, where nodes 1 to 4 are the main level 0, nodes 5 to 7 are the branch level 1, and nodes 8 to 10 are the branch level 2. This matrix serves as the input for downstream tangent direction difference, enabling each skeleton connection segment to accurately locate the trunk relationship and branch level during directional encoding, significantly improving the stability and robustness of directional encoding.

[0086] S3.3: Using the skeleton connection topology index matrix, perform tangent direction difference operation on the skeleton line segments between each key node to generate a local bending direction encoding sequence that represents the local bending trend of the stroke.

[0087] Based on the key node sequence in the skeleton connection topology index matrix, the set of skeleton segment pixel coordinates for each pair of adjacent nodes is extracted as the input for tangent direction calculation. Vectorization modeling is performed on each skeleton segment, constructing a two-dimensional vector from the start and end pixel coordinates, and arranging them according to the skeleton connection order to form a direction vector sequence. The unit tangent direction of each direction vector is calculated using the coordinate difference method, obtaining the normalized tangent component by dividing the horizontal and vertical pixel differences between nodes by the Euclidean distance. Difference operations are performed on the direction vectors of each adjacent skeleton segment in the sequence to obtain the directional change representing the local stroke bending trend. The bending angle calculation formula is used: Where v and w are the unit direction vectors of two adjacent skeleton line segments, · represents the vector dot product, and |v| represents the vector magnitude. The obtained direction changes are stored in the local bending direction encoding sequence according to the skeleton topology index matrix, and a symbol is added to each change to distinguish the clockwise and counterclockwise bending trends. Through the above processing method, the node topology data of the previous step is transformed into a local direction encoding sequence that can quantify the bending trend of the strokes, realizing the accurate capture of the geometric features of the character skeleton.

[0088] For example, after binarization and skeleton extraction of the high-resolution grayscale image of the hot stamping area, the skeleton path of a certain character consists of five key nodes. The skeleton connection topology matrix shows that node 1 is connected to node 2, node 2 is connected to node 3, and so on. The coordinates of node 1 are (12,8), the coordinates of node 2 are (15,10), the direction vector between the nodes is (3,2), the Euclidean distance is 3.61, and the normalized tangent direction is (0.831,0.555). The difference in coordinates between node 2 and node 3 produces a direction vector (2,3), the Euclidean distance is 3.61, and the normalized tangent direction is (0.555,0.831). Substituting the two direction vectors into the bending angle formula: The result is arccos(0.923), meaning the direction change is approximately 22.5°. The direction sign is determined to be positive (counterclockwise) by the vector cross product. This change is serialized and input into the local bending direction encoding sequence. This encoding sequence will be used in subsequent S3.4 to calculate the relative positional relationship of key nodes, thereby realizing the trend capture and generalization feature extraction of the strokes of the miniature text skeleton.

[0089] S3.4: Calculate the relative Euclidean distance and angular deflection between key nodes based on the local bending direction encoding sequence and the skeleton connection topology index matrix, so as to establish the parameter set of relative positional relationship between key nodes.

[0090] For the skeleton connection topology index matrix and local bending direction encoding sequence, the input conditions are the known set of key node coordinates, their interconnection relationship and local tangent direction difference results.

[0091] Based on the node connection order recorded in the skeleton connection topology index matrix, the planar coordinate pairs of adjacent key nodes are extracted sequentially as calculation units.

[0092] Perform Euclidean distance calculation on each computing unit to obtain the geometric interval between nodes.

[0093] By combining the tangent direction difference values ​​of the corresponding skeleton line segments in the local bending direction encoding sequence, the vector angle is calculated to obtain the deflection amount of the node connection direction.

[0094] All Euclidean distances and deflections are associated by node index to form a parameter set of relative position relationships of key nodes, including length and angle parameters.

[0095] Through the above calculation and processing method, the skeleton geometry and orientation information of the previous step are transformed into quantitative structural parameters that can be used for font topology recognition, thereby realizing standardized modeling of the spatial relationship of key nodes.

[0096] S3.5: Based on the set of relative positional relationship parameters of the key nodes, the skeleton connection topology index matrix and the local bending direction encoding sequence, perform multi-dimensional feature vector concatenation and hash mapping processing to generate a real-time topological fingerprint vector for font matching.

[0097] like Figure 3 As shown, step S4 involves: based on the pre-stored font size combination hash compression index table in the standard font library, calculating the minimum transformation cost between the real-time topological fingerprint vector and each font fingerprint vector using the graph edit distance processing method, in order to identify the matching font type and target font size. Specifically, this includes: The standard font library serves as a benchmark data source for font recognition and alignment deviation compensation. Its core function is to perform skeleton extraction, key node sampling, topological fingerprint generation, and hash compression on standard hot stamping character images for each font (e.g., Song, Hei, Kai, etc.) and font size (e.g., 8pt, 10pt, 12pt, etc.) in the offline stage, forming a standardized data structure that can be quickly retrieved and compared. During online runtime, by calculating the minimum transformation cost (graph edit distance) between the real-time topological fingerprint vector and each standard fingerprint in the library, the font type and font size of the current hot stamping character are identified. Then, the corresponding standard structure offset template is called, providing a benchmark for subsequent deviation decoupling and compensation calculation.

[0098] The standard font library adopts a hierarchical index and hash compression storage architecture, and mainly consists of the following components: Font size combination hash compressed index table: Each combination is indexed by a unique key value (font type identifier + font size value). For example, ("SimHei", 12pt) corresponds to a 12-point SimHei font. The index table supports fast hash lookup.

[0099] Standard topology dataset: Each font-size combination stores the following data: Key node coordinate set: including two-dimensional coordinates (in pixels, normalized); Connection topology sequence matrix: describing the connection order and branch hierarchy (e.g., trunk, first-level branch, etc.) between nodes; Local bending direction encoding sequence: recording the change in tangent direction between adjacent skeleton segments (angle value and direction sign); Standard structure offset template: an ideal set of reference node coordinates for deviation decoupling (aligned with real-time characters).

[0100] Hash-compressed storage area: The standard topology dataset described above is compressed into fixed-length hash keys using hash mapping (such as MD5 or SHA-256) and stored in memory or SSD. Each hash key corresponds one-to-one with the original dataset and includes a checksum to prevent data corruption.

[0101] Font library metadata includes font name, font family classification (serif / sans-serif / handwriting, etc.), physical dimensions of font size (e.g., pixel height corresponding to 12pt), applicable hot stamping material types, etc., which are used to assist in matching or handling anomalies.

[0102] The process of building a standard font library: 1. Standard Character Image Generation: For predefined font types (such as 20 commonly used hot stamping fonts) and font sizes (such as 8pt, 10pt, 12pt, 14pt, 16pt, 18pt), a high-precision vector font rendering engine (such as FreeType) is used to generate distortion-free, high-resolution character images (resolution set to 300dpi or higher, pixel size covering the complete character strokes). Each character is generated independently and saved as a grayscale image.

[0103] 2. Binarization and Skeleton Extraction: Each standard character image is binarized using a fixed threshold (such as the Otsu algorithm) to obtain a clear outline. Then, the same skeleton thinning algorithm (iterative morphological erosion) as in online step S2 is executed to extract the main topological skeleton with a single pixel width, ensuring skeleton connectivity and burr-free operation.

[0104] 3. Key Node Sampling and Topology Generation: Following the method in step S3, extract endpoints, bifurcation points, inflection points, and curvature extrema points along the skeleton path as key nodes, and record their coordinates, connection topology numbers (adjacency relationships), and local curvature direction encoding (angle between adjacent line segments). This forms a standard topology dataset. The coordinates of each node are normalized with the top-left corner of the image as the origin (e.g., coordinate values ​​divided by image width / height, mapped to the [0,1] interval) to eliminate scale differences caused by font size.

[0105] 4. Construction of Standard Structural Offset Template: The normalized key node coordinate set obtained in step 3 is used as the "standard structural offset template" for this font-size combination and stored in a separate field. This template is used as a reference for subsequent deviation decoupling.

[0106] 5. Hash Compression and Index Table Generation: The standard topology dataset (node ​​coordinates, connection matrix, direction encoding, etc.) for each font-size combination is serialized into a byte stream, and a fixed-length hash value (e.g., 256 bits) is calculated using a hash function (e.g., SHA-256). The hash value is used as the key, and the corresponding standard topology dataset, template, and metadata are used as the value, stored in the font-size combination hash compression index table. Simultaneously, a forward mapping from "font type + font size" to hash key values ​​is established to quickly reconstruct the complete dataset using the key values.

[0107] 6. Storage and Deployment: The completed standard font library (font and size combination hash compression index table, hash data blocks, and template data) is packaged into a binary file and deployed to the local storage of the hot stamping equipment or a cloud database. During online operation, the system hashes the real-time topological fingerprint vector and then compares it with the standard data in the library through hash matching or graph editing distance calculation.

[0108] For example, taking the 12pt boldface font as an example, the skeleton of its standard character "A" contains 12 key nodes (3 endpoints, 2 bifurcation points, 4 inflection points, and 3 curvature extrema). The node coordinates are normalized and stored in a standard topology dataset. After hash compression, a 256-bit hash value "0x7F3A..." is obtained. In online detection, if the real-time topological fingerprint vector yields the same hash value after hash calculation, a direct match is achieved, and the font type "boldface" and font size "12pt" are output. If the hash does not match due to hot stamping distortion of the real-time character, the graph editing distance is calculated: the node coordinates and topological relationships of each combination are read from the standard font library, the minimum transformation cost with the real-time fingerprint is calculated, and ultimately, 12pt boldface is still selected as the matching result.

[0109] Through the standard font library constructed above, this invention achieves rapid and high-precision recognition of hot stamping character fonts and sizes, providing reliable benchmark data support for subsequent deviation decoupling and alignment compensation.

[0110] S4.1: Obtain the pre-stored font size combination hash compression index table in the standard font library, perform hash key-value parsing processing on each font fingerprint vector stored in the index table, and restore the standard topology dataset containing the relative positional relationships of endpoints, bifurcation points, inflection points and curvature extrema points and connection topology numbers.

[0111] The input conditions are the pre-stored font size combination hash compression index table in the standard font library and the relevant data output from the real-time topological fingerprint vector generation in the previous main step. For this sub-step, the index table is first traversed and read to extract the hash key-value set containing the font fingerprint vector into a parsable in-memory data structure to ensure the stability of subsequent structure reconstruction. During the parsing of each hash key-value, the hash string is expanded into the original multidimensional feature vector through a preset hash mapping inverse operation module. During the inverse operation, the feature fragments of endpoints, bifurcation points, inflection points, and curvature extrema points are restored according to the splicing order stored in the initialization stage. Structural segmentation is performed on the restored multidimensional feature vector, mapping the features of each geometric node to the corresponding spatial position matrix according to different categories, and separating the coordinate components, connection index components, and local curvature direction encoding components in the matrix to reduce matching interference caused by feature aliasing. For the spatial position matrix of each type of node, a topological connection reconstruction method based on integer index is adopted to reconstruct the connection relationship between nodes into a global skeleton connection graph according to the index matrix, ensuring that the topological indexes remain consistent and comparable during the reconstruction process. A geometric consistency check is performed on the global skeleton connection graph. Interpolation corrections are applied to segments with insufficient topological path continuity or inconsistent direction encoding to ensure that the generated standard topological structure dataset satisfies the complete consistency of node position relationships, connection topological indices, and local curvature direction encoding. Through the above processing method, the hash compressed vectors in the index table are converted into a standard topological structure dataset containing the relative position relationships of endpoints, bifurcation points, inflection points, and curvature extrema points, as well as connection topological indices, thus realizing the standard structural benchmark required for subsequent matching calculations.

[0112] For example, the standard font library stores 60 gold foil fonts, each of which has generated a topological fingerprint hash value at 14 font sizes. This hash value has a fixed length of 256 bits. Using a pre-defined inverse mapping table, the hash value is split into node feature segments: 12 endpoints, 5 bifurcation points, 8 inflection points, and 4 curvature extrema. Each feature segment includes a 3D coordinate component, a connection sequence component, and a local curvature direction encoding component. During the inverse operation, the node features of each category are restored sequentially according to the hash storage concatenation order and mapped to the corresponding spatial position matrix. For example, the endpoint matrix is ​​12×3, and the bifurcation point matrix is ​​5×3. In the node connection relationship reconstruction stage, a global skeleton connection graph is generated based on the connection sequence component. Each edge in the graph corresponds to the index positions of two nodes in the spatial matrix. During the geometric consistency check, for connection segments where the direction encoding difference exceeds 1 unit, interpolation correction is performed to adjust the direction encoding to the legal value range in the standard template. In the standard topology dataset obtained after execution, each font-size combination corresponds to a complete set of node position relationship parameters, connection topology sequence matrix, and local bending direction encoding sequence, providing an accurate and usable standard data foundation for the construction of the bidirectional node mapping matrix of S4.2.

[0113] S4.2: Based on the standard topology dataset and the real-time topology fingerprint vector generated in the previous step, construct a bidirectional node mapping matrix, and perform node attribute alignment operation on the key node sequence in the real-time topology fingerprint vector and the node sequence in each standard topology dataset to generate an initial set of node matching costs to be evaluated.

[0114] Using the parsed standard topology dataset and the real-time topology fingerprint vector generated in the previous step as input, a node correspondence construction operation is performed to form a bidirectional node mapping matrix. The key node set in the real-time topology fingerprint vector is categorized by endpoints, bifurcation points, inflection points, and curvature extrema points, and its attribute features are extracted sequentially with the corresponding node sets in the standard topology dataset. Attribute fields include node type identifier, node coordinates, connection sequence number with adjacent nodes, and local curvature direction encoding. For each node set, a bidirectional mapping rule is defined, establishing a forward mapping table from real-time nodes to standard nodes and a reverse mapping table from standard nodes to real-time nodes, ensuring bidirectional consistency in the node matching process. For the established forward and reverse mapping tables, the distance difference between node coordinates in the mapped pairs is quantified using the Euclidean distance calculation formula. The distance difference, direction encoding difference, and connection topology sequence number difference are combined into a comprehensive matching cost unit, with the direction encoding difference calculated using the vector angle formula. The comprehensive matching cost units of all mapping pairs are arranged according to the node sequence to generate an initial set of node matching costs to be evaluated. This set accurately describes the node correspondence and matching error characteristics between the real-time topological fingerprint vector and the standard topological structure dataset. Through the above chained processing method, the standard topological structure data and the real-time topological fingerprint vector from the previous step are transformed into initial node matching cost data that can be directly input into the graph edit distance iterative optimization, achieving high-precision topological similarity calculation.

[0115] For example, in comparing a set of real-time topological fingerprint vectors containing 8 key nodes with the corresponding node set in the standard topology, the precision of the real-time node coordinates is set to 0.01 pixels, and the direction encoding is an integer in the range of 0 to 360 degrees. During bidirectional mapping, the coordinates of the first endpoint node in the forward mapping table and the standard endpoint node are (12.34, 8.56) and (12.30, 8.60) respectively. Substituting these coordinates into the Euclidean distance formula yields a distance difference of 0.05 pixels. The corresponding direction encodings are 15 degrees and 17 degrees respectively, and substituting these coordinates into the vector angle formula yields a direction difference of approximately 2 degrees. The difference in the connection topology index is 0, and the comprehensive matching cost unit is {0.05, 2, 0}. An initial cost set is formed by sequentially calculating the costs for all 8 pairs of mapped nodes, such as the difference for the 3rd inflection point node being {0.12, 5, 1} and the difference for the 6th bifurcation point node being {0.08, 3, 0}. In the subsequent S4.3, the cost set was optimized and searched by the input graph editing distance processing method. In the final matching result, the cost set value was stably maintained in the range of 0.05~0.15 pixels, and the directional difference was maintained within 3 degrees. This verified the high robustness and low noise characteristics of the bidirectional node mapping and attribute alignment process, and significantly improved the stability and accuracy of the topology matching results.

[0116] S4.3: The graph editing distance processing method is used to iteratively optimize the initial set of node matching costs. By defining the weighted cost function of the three basic editing operations of node insertion, deletion and replacement, the path search is performed to minimize the topological difference between the real-time topological fingerprint vector and each standard topological structure dataset, so as to output the minimum transformation cost sequence corresponding to each font-size combination.

[0117] Based on the attribute data of each matching pair in the initial set of node matching costs, a state space model for node editing operations is established. Feasible path combinations for the three basic editing operations—node insertion, node deletion, and node replacement—are listed, and an independent weighted cost function is constructed for each operation.

[0118] The parameters of the weighted cost function are set as a weighted superposition of node geometric position error weights, connection topology hierarchy difference weights, and local bending direction encoding difference weights. The cost vectors of each editing operation are generated through parameter matrix operations.

[0119] Dynamic programming is used to traverse the initial set of node matching costs, and the state transition equations of node editing operations are mapped to the cost accumulation matrix. The matrix is ​​then iteratively updated row by row and column by column to ensure that the cost accumulation value of each state transition is the current minimum value.

[0120] We introduce the core formula for graph edit distance to calculate the path that minimizes the topological difference between the real-time topological fingerprint vector and the standard topological structure dataset. The formula for calculating graph edit distance is as follows: in, To minimize the transformation cost, This is the weighted cost function corresponding to the editing operation. This is the type identifier for the i-th operation.

[0121] During the iterative optimization process, a cost function call and cumulative update are performed for each editing operation to ensure the convergence and minimization of the global path cost, while eliminating redundant paths caused by repeated editing operations.

[0122] The minimum transformation cost of topological differences corresponding to all standard font-size combinations is organized into sequence data to serve as input for subsequent global extremum screening.

[0123] Through the above iterative optimization calculation method, the initial set of node matching costs from the previous step is transformed into a complete sequence of minimum transformation costs, realizing high-precision topological difference quantification based on graph edit distance, and providing accurate numerical basis for matching font type and target font size recognition.

[0124] S4.4: Perform global extreme value screening based on the minimum transformation value sequence, select the target value with the smallest value in the minimum transformation value sequence and its corresponding index position, so as to determine the matching font type identifier and estimated target font size parameter with the highest topological similarity to the real-time topological fingerprint vector.

[0125] The input conditions are the minimum transformation cost sequence output by S4.3 and the corresponding font-size combination index set.

[0126] The minimum transformation cost sequence is loaded into the global scanning module to establish a one-to-one mapping table between cost and index position for subsequent filtering processing.

[0127] Perform a global numerical comparison on the mapping table, and call the minimum value search operator to perform parallel comparison operations on all values ​​to lock the target value with the smallest value in the sequence.

[0128] The index position of the target cost value is read from the mapping table, and an index positioning signal is constructed to extract the font type identifier and estimated font size parameter corresponding to that position.

[0129] The font type identifier and the estimated font size parameter are combined into a matching information data packet, which is then submitted to the matching confirmation module as a trigger condition for the subsequent construction of the deviation decoupling model.

[0130] By using global extreme value filtering, the minimum transformation cost sequence from the previous step is transformed into a single matching font type identifier and estimated target font size parameter, thereby accurately determining the matching object with the highest topological similarity.

[0131] For example, in a certain production line scenario, the minimum transformation cost sequence length is 60, corresponding to 30 fonts and two font sizes for each font, with a sequence value range of 0.002 to 0.157. After loading the sequence, the global scanning module executes the minimum value search operator, sets the threshold comparison period to 2ns, and finally locks the cost value of 0.002 and obtains its mapping index position 15. The font type identifier corresponding to index position 15 is ST-09, and the estimated font size parameter is 16pt. The matching information data packet consists of the identifier ST-09 and the font size 16pt and is passed to the matching confirmation module to ensure that subsequent calls to the standard structure offset template are only for this specific font and font size, thereby significantly improving the recognition accuracy and the stability of compensation amount generation in the subsequent deviation decoupling process.

[0132] S4.5: Generate a font matching confirmation signal based on the matching font type identifier and the estimated target font size parameter, and input the font matching confirmation signal as a structured query instruction to the deviation decoupling model construction module to trigger the call of the standard structure offset template of the corresponding font type and font size and complete the orthogonal decomposition preparation of the deviation dimension.

[0133] Based on the matching font type identifier and the estimated target font size parameter as unique index key values, a structured query instruction signal containing two fields, "font type - font size", is constructed, and the signal is converted into a data encapsulation format that conforms to the input protocol of the deviation decoupling model construction module.

[0134] The structured query command signal is subjected to field integrity verification and byte order standardization to ensure that index parsing errors are avoided due to encoding differences during transmission under different computing architectures.

[0135] The query interface of the module is constructed using the deviation decoupling model. The standardized structured query command is used as the trigger condition input to perform a matching retrieval operation to locate and call the standard structure offset template pre-stored for the corresponding font type and font size.

[0136] During the invocation process, index positioning verification and node accuracy check are performed on the standard structure offset template to ensure that the loaded data is consistent with the baseline topology node set generated during the initialization phase, so as to avoid structural distortion introduced by the deviation decomposition process.

[0137] The verified standard structural offset template is cached in the local cache area of ​​the deviation decoupling model construction module, forming a reliable reference benchmark for subsequent orthogonal decomposition operations of structural alignment deviation and system distortion deviation.

[0138] Through the above data generation and calling processing methods, the font matching results of the previous step are transformed into standard template calling instructions that can directly drive the construction of the deviation decoupling model, thereby realizing the preparation for orthogonal decomposition of the deviation dimension.

[0139] Step S5: Based on the matched font type and target font size, the corresponding standard structural offset template is called to decompose the deviation into two orthogonal dimensions: structural alignment deviation and system distortion deviation, to establish a deviation decoupling model. Specifically, this includes: S5.1: Based on the matching font type and the target font size as index keys, retrieve and obtain the corresponding standard structure offset template from the standard font library to extract the set of reference topology node coordinates of the specific font in an ideal state as initial reference data.

[0140] Using the matching font type identifier and target font size parameter obtained in the previous steps as the index key, this index key is input into the retrieval interface of the standard font library. The font-size combination mapping function is called to locate the unique corresponding standard structure offset template entry. The retrieved template entry undergoes topology data decompression processing, restoring the compressed node coordinates, connection topology numbers, and local curvature direction encodings into a complete two-dimensional or three-dimensional coordinate matrix for subsequent spatial comparison. The restored node coordinate matrix undergoes consistency verification, using a tolerance threshold to filter out coordinate drift caused by storage quantization errors, ensuring that the baseline topology node set is completely consistent with the ideal font structure. To eliminate unit baseline differences between different font library versions, the baseline topology node set undergoes normalization scaling processing, mapping coordinate values ​​to a unified pixel scale and coordinate system origin position. A baseline topology path data stream is established based on the normalized node coordinate set, recording the connection order and geometric direction between nodes, forming initial reference data with high precision.

[0141] By using index retrieval based on matching font type and target font size, and topological data decompression, tolerance filtering, scaling normalization, and path data flow establishment processing methods, the matching results of the previous step are transformed into a set of benchmark topological node coordinates that can be directly used for spatial mapping comparison, thereby achieving structural precision at the input end of the deviation decoupling model.

[0142] For example, the matching font type is sans-serif A, the target font size is 12pt, and there is a unique entry key value (font A, font size 12) in the standard font library index table. After locating this entry by calling the search interface, the compressed hash entry is read and decompressed to obtain a set of 48 nodes containing endpoints, bifurcation points, inflection points, and curvature extrema, with coordinates ranging from 0 to 350 pixels. Three abnormal nodes are removed by a filtering function with a tolerance threshold set to 0.05 pixels, retaining 45 valid nodes. To unify the scale, the pixel coordinates of the 45 nodes are normalized by a mapping coefficient of 0.285, so that they all fall within the uniform pixel scale range of 0 to 100. When establishing the node path data flow, the nodes are arranged in order of connection topology number, and the direction angle of each stroke is recorded as ranging from 0° to 180° to generate high-precision initial reference data. When this reference data is input into the spatial comparison module, the alignment accuracy can be significantly improved in the subsequent deviation vector calculation. In actual production line testing, it is verified that the output structural alignment deviation vector has steady-state repeatability and can adapt to different batches of hot stamping tasks without performance degradation.

[0143] S5.2: Spatial mapping comparison is performed using the relative positional relationship between the reference topology node set and the key nodes in the real-time topology fingerprint vector to calculate the structural alignment deviation vector characterizing the inherent stroke offset and baseline tilt characteristics of the font.

[0144] Based on the relative positional relationship data of key nodes in the benchmark topological node set and the real-time topological fingerprint vector, a node coordinate comparison matrix is ​​constructed as the basic input for spatial mapping comparison. Euclidean distance is calculated between the two-dimensional coordinates of each real-time key node and the corresponding benchmark node. The translational deviation of each node is quantified through the difference matrix to achieve preliminary structural alignment deviation determination. Linear regression fitting is performed on the node pairs in the above difference matrix to extract the overall stroke direction tilt angle parameter for baseline tilt characteristic analysis. A matrix rotation transformation is used to rotate the benchmark node set to the overall attitude direction of the real-time node set. After eliminating the global tilt effect, the residuals of each node are recalculated to distinguish between inherent stroke offset and attitude error. This residual is encoded in vector form and stored in the structural alignment deviation vector dataset to achieve accurate representation of the deviation vector. The Euclidean distance deviation of a single node is calculated. Through spatial mapping and difference vector construction, the matching font and font size information from the previous step is transformed into a quantitative vector representing the inherent stroke offset and baseline tilt characteristics of the font, achieving data support for the structural alignment dimension of the deviation decoupling model.

[0145] For example, in a certain hot stamping batch, the matched font is a rounded font with a size of 12pt. The baseline topology node set contains 20 key nodes, with coordinates in pixels. The coordinates of these 20 nodes, acquired in real-time, are input into the Euclidean distance formula, resulting in translational deviation values ​​ranging from 0.5 to 2.8 pixels, with an average of 1.4 pixels. Linear regression fitting is performed on the node coordinates, yielding a tilt angle of approximately 3.5°. After performing a rotation transformation to eliminate this tilt, the residuals are recalculated, resulting in an average intrinsic stroke offset vector of 1.1 pixels. This vector serves as the input for the structural alignment deviation dimension, used for subsequent orthogonal decomposition of system distortion deviation. Verification results show that the compensated hot stamping stroke alignment accuracy is significantly improved, and the edge continuity and baseline straightness of the finished text are greatly enhanced.

[0146] S5.3: Based on the spatial distribution consistency error of multiple identical structural units within the same character region in the binarized contour image, and combined with lens distortion parameters and historical data of conveyor belt micro-vibration, a local affine transformation matrix is ​​constructed to characterize the physical cause of system distortion deviation.

[0147] For the candidate character region set in the binarized contour image, multiple repetitive character instances with the same topological structure confirmed in S4 and S5.2 within the same character region are selected as the system distortion analysis objects. The centroid coordinates and key structural unit coordinates of each instance are extracted to form a spatial distribution measurement dataset. The spatial distribution measurement dataset is differentially calculated with the ideal structural unit position reference of the font-size combination in the standard font library to obtain the spatial distribution consistency error set reflecting pixel coordinate offset. Based on the characteristics of the system imaging link, the pre-calibrated lens distortion parameter matrix and the historical time series data of conveyor belt micro-vibration are loaded. The physical causes and spatial error sets are integrated through a weighted fusion model to construct the distortion influence quantification coefficient. A local affine transformation modeling strategy is adopted to apply the distortion influence quantification coefficient to the ideal structural unit position reference, and the least squares fitting operation is performed to solve the affine matrix parameter set. Through the standardization and orthogonality properties of the affine matrix, the structural alignment deviation of the previous step and the distortion component corresponding to the matrix are orthogonally decomposed in the subsequent S5.4 to realize the construction of the deviation decoupling model.

[0148] By constructing a local affine transformation matrix, the results of the previous step are transformed into a quantifiable set of distortion cause parameters, thereby achieving the expected technical effect of modeling the physical source of system distortion bias and preparing for subsequent bias decoupling.

[0149] For example, in a hot-stamping nail sticker production line, the centroids of three repeating character instances (e.g., the same letter "O") identified in a binarized contour image are located. The measured values ​​are (102.4, 56.7), (152.9, 56.8), and (203.5, 57.1) pixels, respectively. The ideal reference positions of the standard font library are (100.0, 55.0), (150.0, 55.0), and (200.0, 55.0) pixels, respectively. The resulting spatial distribution consistency errors are (2.4, 1.7), (2.9, 1.8), and (3.5, 2.1) pixels, respectively. The lens distortion parameter matrix [0.0012, -0.0008; -0.0005, 0.0010] and the historical data peak value of the conveyor belt micro-vibration are 0.15 mm. The distortion influence coefficient is calculated on the error set, yielding a distortion influence quantization coefficient of 0.97. Least squares fitting is used to establish a mapping between the ideal reference position and the actual measured position, and the local affine transformation matrix is ​​calculated. [1.002, [0.001,2.5;0.0008,0.999,1.9;0,0,1], after verification of orthogonality, it was confirmed that the matrix can be decomposed into scale scaling components, rotation shearing components, and translation components. In subsequent orthogonal decomposition, these components are output independently of the structure alignment deviation vector, which effectively improves the accuracy of alignment compensation generation and system robustness.

[0150] S5.4: Perform orthogonal decomposition on the structure alignment deviation vector and the system distortion deviation represented by the local affine transformation matrix to generate a set of decoupled deviation components including translation components, rotation components and scaling components.

[0151] The input structural alignment deviation vector and the local affine transformation matrix are processed to unify the data structure, and each component of the structural alignment deviation vector is mapped to the same coordinate reference as the local affine transformation matrix to ensure the consistency of the vector space in subsequent operations.

[0152] The unified structural alignment deviation vector is treated as a special case of rigid body transformation. Matrix decomposition is performed on the local affine transformation matrix. Singular value decomposition (SVD) is used to extract the rotation matrix, scale factor, and shear component. Numerical noise is removed by orthogonalizing the rotation matrix.

[0153] The translation components in the structural alignment deviation vector and the translation components extracted from the local affine transformation matrix are differentially calculated to generate independent representations of the structural deviation translation and the system deviation translation, so as to ensure the orthogonality of the two types of offsets.

[0154] The rotation components are calculated using the following formula, where R is the rotation matrix and θ is the rotation angle: Where trace(R) represents the trace of the rotation matrix, and the calculated θ is used to quantify the rotation deviation and separate it from the structure alignment rotation vector.

[0155] The scaling components are extracted using the following formula, where S is the scaling matrix: Where A is an affine matrix containing rotation. The rotation effect is removed by matrix division to obtain a pure scale matrix to characterize the scaling properties of system distortion.

[0156] The translation, rotation, and scaling components are organized into a set of decoupled deviation components, and the orthogonality of the three types of components is maintained in the set so that the structural alignment deviation and the system distortion deviation do not interfere with each other in the parameter domain.

[0157] Through orthogonal decomposition, the structural alignment deviation vector and local affine transformation matrix generated in the previous step are transformed into independent and quantifiable translation, rotation, and scaling components, thereby achieving accurate construction of the deviation component set and clarifying its physical meaning.

[0158] For example, in a hot-stamping nail sticker production line, the matching font type is "serif A", the target font size is 14pt, and the structural alignment deviation vector, after unification, includes a translation of 0.12mm on the X-axis, a translation of -0.08mm on the Y-axis, and a rotation of 0.25° on the Z-axis. The local affine transformation matrix, after SVD decomposition, yields translation components of 0.05mm on the X-axis and -0.03mm on the Y-axis, and a rotation matrix trace of 2.95. The system rotation deviation is calculated to be 0.18° using a formula, and the scale matrix extraction results in 1.002 in the X direction and 0.998 in the Y direction, indicating a slight scaling distortion. The structural translation deviation is combined with the system translation deviation to form a translation component set, the structural rotation deviation is combined with the system rotation deviation to form a rotation component set, and the scale scaling deviation is independently formed into a third type of set. All of these are included in the decoupling deviation component set and then input into the decoupling model. In the actual production line, this set is used for compensation, which can significantly improve the alignment accuracy. No alignment error accumulation due to distortion failure occurred during 48 hours of continuous operation.

[0159] S5.5: Establish a deviation decoupling model based on the decoupling deviation component set, and define the structural alignment deviation and the system distortion deviation as two independent orthogonal dimension outputs, which will serve as the input basis for subsequent fitting of local affine distortion parameters and generation of six-degree-of-freedom pose compensation vectors.

[0160] For the decoupled bias component set generated by step S5.4, which includes translation, rotation, and scaling components, the input conditions for constructing the bias decoupling model are the numerical values ​​and corresponding physical meanings of each component in the set under a unified coordinate system. Using the structural alignment bias vector and the system distortion bias vector as two core input signals, their directional distribution and range of action in three-dimensional space are labeled, and each component is assigned to different dimension labels of matrix operations. An orthogonalized basis vector set is established, and the structural alignment bias component and the system distortion bias component are projected onto this basis vector set to ensure their independence in numerical space. Through orthogonality testing based on the covariance matrix, the correlation threshold of the two types of bias components is verified to be no more than a preset limit, and independent output channels are reconstructed using eigenvector decomposition. For the rotation component in the bias component set, matrix normalization is used to eliminate coupling errors caused by different scales, and constraint stripping is performed between the translation component subset and the scaling component subset to prevent system distortion correction from interfering with structural alignment correction. The two deviation dimensions, after orthogonalization, are defined as the first and second orthogonal outputs of the model, respectively. A standardized output interface is then generated within the model for subsequent local affine distortion parameter fitting and six-degree-of-freedom pose compensation. By binding orthogonalization with the output interface, the results of the previous step are transformed into deviation dimension data with clear physical meaning and numerical independence, achieving stable establishment and scalable invocation of the deviation-decoupled model.

[0161] Step S6: Fit local affine distortion parameters using the spatial distribution consistency error of multiple identical structural units within the same character region, and quantify the system distortion deviation based on the local affine distortion parameters. Specifically, this includes: S6.1: Perform isomorphic structural unit retrieval processing on the candidate character region set in the binarized contour image to extract a set of repeating character instances with the same topological fingerprint features as the original data source for spatial distribution analysis.

[0162] Given a set of candidate character regions in a binarized contour image as input, this set is used as the target for isomorphic structural unit retrieval processing. Based on the real-time topological fingerprint vector of each candidate character region, a feature matching index is constructed. The topological features of the current region are compared with the single-character topological templates of the corresponding fonts in the standard font library, and regions with a topological similarity higher than a preset threshold are selected as duplicate character candidates. For duplicate character candidates, morphological consistency verification is performed. By calculating the contour geometric similarity and verifying the skeleton path length ratio, pseudo-duplicate regions caused by noise, adhesion, or deformation are eliminated. The verified duplicate character instances are numbered to establish a set of duplicate character instances, and spatial feature parameters such as pixel coordinates, skeleton key node positions, and local bending direction encoding of each instance are recorded. The number and distribution of instances in this set provide the original data source for subsequent centroid localization and ideal spatial distribution matrix construction. Through the above isomorphic structural unit retrieval processing, the system distortion-related character instances in the previous deviation decoupling model are effectively extracted and transformed into a set of duplicate character instances that can be used for spatial distribution analysis, realizing the basic data preparation for accurate identification of duplicate structural units and subsequent distortion parameter fitting.

[0163] For example, in a hot stamping area image processed by adaptive binarization and skeleton extraction, the candidate character region set contains 152 connected components. Each connected component is generated using real-time topological fingerprinting, and a topological similarity threshold of 0.85 is set. After comparison with a single-character template of a matching font type in a standard font library, 42 duplicate character candidates are selected. Contour geometric similarity calculation is performed on these candidates using the area-normalized contour Hausdorff distance, with a distance threshold of 1.5 pixels. 12 pseudo-duplicate regions are removed, and the remaining 30 regions undergo skeleton path length ratio verification. The allowed range for the length ratio is ±3%, and 3 non-compliant regions are removed. Finally, 27 duplicate character instances are obtained. The centroid coordinates and key node information of these instances are recorded in the instance set as input data for the subsequent step S6.2. In this embodiment, the accuracy of duplicate character recognition is significantly improved, and the instance set contains a sufficient number of spatially distributed samples, which greatly improves the stability and accuracy of subsequent local affine distortion fitting.

[0164] S6.2: Perform centroid coordinate positioning and feature point matching operations based on the set of repeating character instances to construct an ideal spatial distribution matrix that represents the theoretical relative positional relationship between each repeating character instance.

[0165] Based on the set of repeated character instances extracted in step S6.1, the pixel coordinate point cloud of each instance and its feature point index data corresponding to the skeleton topological fingerprint are loaded as the input conditions for the operation.

[0166] For each instance of a repeating character, perform a centroid calculation, averaging the coordinates of all pixels within the instance in a two-dimensional Cartesian coordinate system to obtain the geometric center position of the instance; the centroid calculation formula is: Where N is the total number of pixels in this instance, x i With y i These are the horizontal and vertical coordinates of the pixel, respectively.

[0167] The centroid coordinates are stored in the instance feature parameter set, and feature point matching is performed based on the instance centroid. During the matching process, the relative position encoding of the skeleton topological fingerprint node is called and paired with the feature node of the corresponding structural unit in the standard font template using the minimum Euclidean distance, so as to obtain the correspondence matrix between each instance feature point and the standard template feature point.

[0168] Based on the centroid coordinates and paired feature point coordinates of all repeating character instances, an ideal spatial distribution matrix is ​​constructed. This matrix contains a set of vectors representing the theoretical relative positional relationships between instances. The theoretical positional relationships are generated by the arrangement rules of the standard font template under distortion-free conditions.

[0169] During matrix construction, the ideal distance vector and connection direction angle between each pair of instances are stored as matrix elements to form spatial distribution benchmark data that can be used for subsequent residual analysis.

[0170] By using centroid coordinate positioning and feature point matching, the original repeated character instance data is transformed into an ideal spatial distribution matrix that can accurately represent the theoretical relative positional relationship between them, thus realizing the benchmark structure required for system distortion.

[0171] For example, in a batch of high-resolution binary contour images of hot-stamped nail stickers, four identical structural units "o" were detected within the same character region. Each instance has 420 pixels. Using the centroid calculation formula, the x and y coordinates of each pixel are summed and divided by 420, resulting in centroid coordinates of (132.45, 256.82), (152.10, 257.05), (172.02, 256.97), and (192.33, 256.76). During the feature point matching stage, the endpoints of the skeleton closure loop of each instance are paired with the endpoints of the closure loop of the corresponding character in the standard template, with a maximum matching error of less than 0.8 pixels. When constructing the ideal spatial distribution matrix, the ideal centroid spacing between adjacent "o" characters is set to 20.00 pixels and the orientation angle is 0°, according to the distortion-free arrangement rules of the standard template. The matrix elements consist of the centroid spacing vector (20.00, 0) of each instance, forming a reference matrix. This matrix is ​​used in the subsequent S6.3 step to perform residual analysis with the actual detection matrix, which significantly improves the accuracy and stability of the distortion parameter fitting.

[0172] S6.3: Residual analysis is performed using the ideal spatial distribution matrix and the coordinates of the actual detected duplicate character instances to generate a spatial distribution consistency error vector sequence that characterizes the degree of nonlinear deformation of the imaging system.

[0173] When performing consistency residual analysis on the ideal spatial distribution matrix and the coordinates of the actually detected duplicate character instances, both are used as spatial references for the same character region and input into the residual calculation engine. A one-to-one correspondence matrix is ​​established based on the centroid coordinates of each character instance to ensure that the matching sequence is completely consistent in the number of nodes and sequence number. Based on the correspondence matrix, the difference vector between the theoretical centroid position and the actual centroid position is calculated, with its components corresponding to the offset values ​​of the horizontal and vertical coordinates, respectively. The overall offset of each matching instance is calculated using the Euclidean distance formula. The offset vectors of all matching instances are serialized to form a spatial distribution consistency error vector sequence. Deviation sign detection is performed on each component of the error vector to distinguish between positive and negative distortion trends, providing directional constraints for subsequent distortion matrix fitting. Through the above processing method, the ideal distribution and actual observation data of the previous step are transformed into a spatial distribution consistency error vector sequence that quantitatively characterizes the degree of nonlinear deformation of the imaging system, realizing the preliminary quantification of system distortion deviation.

[0174] S6.4: Perform least squares fitting operation on the spatial distribution consistency error vector sequence to calculate the local affine transformation matrix containing translation, rotation, scaling and shearing components as the local affine distortion parameter.

[0175] When inputting the spatial distribution consistency error vector sequence, it is clear that the sequence originates from the set of differences between the actual centroid coordinates and the ideal spatial distribution matrix coordinates of each repeating character instance output in the residual analysis processing stage.

[0176] The error vector sequence is split into four components according to coordinate components: translation residual, rotation residual, scaling residual, and shear residual. The corresponding affine transformation component coefficient matrix is ​​established as the set of unknown parameters for the fitting equation.

[0177] Construct an observation data matrix containing the ideal coordinates and corresponding actual coordinates of each repeating character instance, and use it as the input pair of independent and dependent variables for the least squares operation.

[0178] When using the least squares method for fitting, the mapping result of the affine transformation matrix applied to the ideal coordinates approximates the actual coordinates. The objective function is defined as minimizing the sum of squared residuals, and the positions of each unknown parameter in the affine matrix are clearly defined.

[0179] By solving matrix decomposition and normal equations, the local affine transformation matrix containing translation, rotation, scaling and shearing components is calculated. The parameters of each component are encoded with their corresponding physical meanings to ensure that subsequent steps can perform inverse mapping processing.

[0180] By using the above processing method, the spatial distribution consistency error vector sequence of the previous step is transformed into a local affine transformation matrix that can quantify the system distortion, thereby achieving high-precision restoration and solution of distortion deviation parameters.

[0181] For example, in a batch hot stamping verification scenario for a hot stamping nail sticker, the set of repeating character instances contains 12 repeating structural units "o". The centroid coordinates of the ideal spatial distribution matrix are (mm) values ​​in the mechanical design layout coordinate system, and the actual coordinates are measured by the visual inspection module. The fitting input matrix has a dimension of 12×4 (including homogeneous coordinate columns) and a dimension of 12×2. The least squares method is used for iterative fitting. The translation components in the affine matrix A are 0.032mm and -0.045mm, the rotation component corresponds to an angle of 0.14°, the scaling components are 1.002 and 0.998, and the shearing component is 0.0008. The system distortion deviation vector obtained after the subsequent inverse mapping of this matrix is ​​applied to the compensation amount synthesis. The verification results show that the character alignment accuracy is significantly improved after pose correction, and the hot stamping deviation is controlled within ±0.01mm, meeting the requirements of high-precision hot stamping production.

[0182] S6.5: Perform inverse mapping reconstruction based on the local affine transformation matrix to quantify and calculate the pure system distortion deviation vector after removing the influence of the font's inherent structure for subsequent compensation synthesis.

[0183] Based on the solved local affine transformation matrix, the affine distortion parameter set consisting of translation, rotation, scaling and shearing components is loaded as the input condition for the inverse mapping reconstruction operation.

[0184] The affine transformation matrix is ​​analytically inverted using matrix inversion to ensure that the physical dimensions of each parameter remain consistent during the inverse mapping process.

[0185] The rotation components of the inverse matrix are normalized to map the rotation axis parameters to the matching font reference coordinate system to eliminate the interference of the inherent geometric rotation features of the characters.

[0186] A benchmark ratio operation is performed on the scaling components of the inverse matrix. By dividing the scaling factor by the font size scaling factor in the standard structural template, a pure scaling component that only reflects the size distortion of the imaging system is obtained.

[0187] Orthogonal projection filtering is performed on the shearing components of the inverse matrix to remove inherent shearing features caused by font tilt and stroke connection, while retaining spatial distortion components caused by the imaging system.

[0188] The normalized translation, scaling, shearing, and rotation components are combined into a system distortion deviation vector, and then numerical quantization is used to generate accurate input data for subsequent compensation synthesis.

[0189] By combining matrix inversion with component normalization, the local distortion parameters obtained in the previous step are transformed into a pure system distortion deviation vector after removing the influence of the inherent structure of the font, thus achieving independent quantification of system error.

[0190] Step S7: Perform a vector superposition operation on the structural alignment deviation and the system distortion deviation to generate a compensation vector containing six degrees of freedom pose information. Specifically, this includes: S7.1: Perform coordinate system-to-mapping processing on the structure alignment deviation vector and the local affine transformation matrix in the system distortion deviation to eliminate the dimension mismatch problem caused by different reference bases and generate an isomorphic deviation component dataset.

[0191] S7.2: Perform a three-dimensional spatial rotation vector synthesis operation based on the isomorphic deviation component dataset, and use the Rodriguez rotation formula to merge the axial angle deflection into a single equivalent rotation vector to generate a rotation compensation component that characterizes the overall attitude correction requirements.

[0192] The input conditions include the isomorphic deviation component dataset output by step S7.1, which has uniformly mapped the structure alignment deviation vector and the system distortion deviation matrix in the same coordinate system, and contains independent angular deflection and translation components about the XYZ axes.

[0193] For the rotational components around each axis in the isomorphic deviation component dataset, the angular deflection around the X-axis, Y-axis, and Z-axis is selected as the initial rotational dataset.

[0194] The angular deflection of each axis in the initial rotation dataset is converted into a unit vector form of the axis, and the corresponding antisymmetric matrix is ​​constructed to represent the rotational direction relationship of each axis.

[0195] Based on the antisymmetric matrices of each axis and their corresponding angular deflections, the Rodriguez rotation formula is used to construct the single-axis rotation matrix, as follows: in, It is the identity matrix. It is the axial rotation angle. It is the antisymmetric matrix corresponding to the unit rotation axis.

[0196] The rotation matrices around each axis are multiplied in the order of XYZ axes to obtain the comprehensive rotation matrix in a unified coordinate system.

[0197] Perform rotation vector extraction operation on the comprehensive rotation matrix to transform the matrix form of attitude correction into an equivalent rotation vector form, so that it can be uniformly represented in the rigid body transformation matrix with the subsequent translation components.

[0198] By using rotation vector synthesis, the rotation angle data from the previous step is transformed into rotation compensation components that characterize the overall attitude correction requirements, thereby achieving the equivalence and unification of rotation errors in three-dimensional space.

[0199] S7.3: Perform a rigid body transformation matrix construction operation using the translation components in the rotation compensation component and isomorphic deviation component dataset. Integrate linear displacement and nonlinear deformation parameters into a four-dimensional spatial transformation matrix using the homogeneous coordinate transformation method to generate an intermediate compensation matrix containing complete pose adjustment information.

[0200] Using the rotation compensation components and translation components from the isomorphic deviation component dataset as inputs, the attitude and displacement basis data required to construct the rigid body transformation matrix are generated. Based on the coordinate-unified 3D rotation compensation vector, a corresponding rotation matrix is ​​generated. This matrix is ​​derived using the Rodrigues formula, with its input parameters being the rotation axis unit vector and the rotation angle. Translation vectors are constructed from the translation components extracted from the isomorphic deviation component dataset; these vectors are directly used as the translation part of the homogeneous coordinate transformation matrix. After the rotation matrix and translation vector are prepared, they are combined in homogeneous coordinate format, where the rotation matrix occupies the upper left three-row, three-column area, and the translation vector is filled into the upper right three-row, one-column area, with the bottom row set as... This process forms a complete four-dimensional homogeneous transformation matrix. Matrix decomposition is performed on the nonlinear deformation parameters (scaling, shearing) within the isomorphic deviation component dataset, appending them to appropriate positions in the rotation matrix according to their physical origins. This achieves a unified expression of linear displacement and nonlinear deformation within the same matrix. The constructed intermediate compensation matrix satisfies rigid body transformation constraints and can be directly passed to subsequent steps for six-degree-of-freedom parameter extraction. By combining rotation and translation components through homogeneous coordinate transformation, the deviation vector from the previous step is transformed into an intermediate compensation matrix that fully contains pose information, achieving a unified spatial expression of multi-source deviations.

[0201] S7.4: Perform six-degree-of-freedom parameter extraction processing on the intermediate compensation matrix, and analyze the displacement increment along the XYZ axis and the Euler angle increment around the XYZ axis according to the decomposition order of translation first and then rotation to generate a standardized six-dimensional pose compensation vector.

[0202] Using the four-dimensional spatial transformation structure data based on the intermediate compensation matrix as input, a homogeneous coordinate decomposition strategy is employed to sequentially decompose the matrix into translation and rotation component matrices. Coordinate reading operations are performed on the translation component matrix to extract displacement increment data along the X, Y, and Z axes, establishing a three-dimensional translation vector dataset. The rotation component matrix undergoes matrix-to-Euler angle conversion, with the rotation order set to a fixed sequence around the X, Y, and Z axes. Trigonometric function inversion operations are used to analyze each element of the rotation matrix, forming the corresponding three Euler angle increments. A parameter concatenation operation is then used to combine the three-dimensional translation vector dataset and the Euler angle increment dataset in a translation-then-rotation order, forming a standardized six-dimensional pose compensation vector containing six independent dimensions. Through this parameter extraction and concatenation process, the intermediate compensation matrix result from the previous step is transformed into six-degree-of-freedom pose vector data, enabling a unified precision format output suitable for motion control modules.

[0203] S7.5: Based on the six-dimensional pose compensation vector, perform safety threshold truncation and smoothing filtering optimization operations to eliminate abnormal components that exceed the mechanical travel limit and suppress high-frequency jitter noise, so as to finally generate a high-precision alignment compensation vector that can be directly input into the motion control module.

[0204] Step S8: Dynamic position adjustment based on the compensation vector to complete a high-precision alignment compensation operation for microtext hot stamping. Specifically, this includes: S8.1: Perform coordinate system mapping transformation on the input compensation vector containing six degrees of freedom pose information to convert the deviation data in the image pixel coordinate system into the target displacement increment and rotation angle increment in the robot body coordinate system.

[0205] S8.2: Perform multi-axis linkage interpolation based on the target displacement increment and rotation angle increment to generate a smooth, continuous reference trajectory sequence for each servo axis that conforms to dynamic constraints.

[0206] S8.3: The servo drive unit is fed forward and closed-loop feedback adjusted using the reference trajectory sequence of each servo axis to output a high-precision motor torque control signal and suppress backlash error in the transmission chain.

[0207] S8.4: Drive the linear motor module and the rotary platform to perform real-time pose correction actions according to the motor torque control signal, so as to drive the hot stamping head to the precise alignment coordinates after dynamic compensation.

[0208] S8.5: After confirming that the hot stamping head has reached the precise alignment coordinates, the pressure application mechanism is triggered to perform instant hot stamping operation in order to complete the high-precision alignment compensation and curing of microtext.

[0209] For those skilled in the art, various other corresponding changes and modifications can be made based on the technical solutions and concepts described above, and all such changes and modifications should fall within the protection scope of the claims of this invention.

[0210] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains. The terms “first,” “second,” “third,” and similar terms used in this patent application specification and claims do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a” and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms “comprising” or “including” and similar terms mean that the elements or objects preceding “comprising” or “including” encompass the elements or objects listed following “comprising” or “including” and their equivalents, and do not exclude other elements or objects. The “multiple” mentioned in the embodiments of this application refers to two or more. A and / or B indicate three possibilities: A; B; and A and B.

[0211] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and such modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A dynamic compensation method for the alignment accuracy of microtext hot stamping on gold-plated nail stickers, specifically including: S1: Obtain a high-resolution grayscale image of the hot stamping area, and dynamically divide the threshold range according to the local area contrast to adaptively binarize the high-resolution grayscale image to generate a binarized contour image that eliminates the interference of uneven hot stamping reflection. S2: Perform connected component analysis based on the binarized contour image and filter candidate character regions whose area is within the preset microtext pixel range. Perform skeleton refinement on the candidate character regions to extract the main topological skeleton. S3: Sampling endpoints, bifurcation points, inflection points and curvature extrema points along the main topology skeleton path as key nodes, recording the relative positional relationship of key nodes, connection topology sequence number and local bending direction encoding to generate real-time topology fingerprint vector. S4: Based on the font size combination hash compression index table in the standard font library, calculate the minimum transformation cost between the real-time topological fingerprint vector and the fingerprint vector of each font to identify the matching font type and target font size; S5: Based on the matching font type and target font size, call the corresponding standard structural offset template, decompose the deviation into two orthogonal dimensions: structural alignment deviation and system distortion deviation, to establish a deviation decoupling model; S6: Fit local affine distortion parameters using the spatial distribution consistency error of multiple identical structural units within the same character region, and quantify the system distortion deviation based on the local affine distortion parameters; S7: Perform vector superposition of structural alignment deviation and system distortion deviation to generate a compensation vector containing six degrees of freedom pose information.

2. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 1, characterized in that, The standard font library includes a hash-compressed index table for font size combinations, a standard topology dataset, a hash-compressed storage area, and font library metadata. The standard topology dataset includes a set of key node coordinates, a connection topology index matrix, a local bending direction encoding sequence, and a standard structure offset template.

3. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 1, characterized in that, Following S7, the following also includes: S8: Based on the compensation vector, dynamic position adjustment is performed to achieve high-precision alignment compensation for microtext hot stamping.

4. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 1, characterized in that, S3 specifically includes: The curvature extremum detection process is performed on the main topology skeleton path to obtain initial key node spatial distribution data containing the set of endpoint coordinates, the set of bifurcation point coordinates, and the set of inflection point coordinates. Based on the initial key node spatial distribution data, perform neighborhood connectivity analysis to construct a skeleton connection topology index matrix describing the connection order and branch hierarchy between each key node; The skeleton connection topology index matrix is ​​used to perform tangent direction difference operation on the skeleton line segments between each key node to generate a local bending direction encoding sequence that represents the local bending trend of the stroke. The relative Euclidean distance and angular deflection between key nodes are calculated based on the local bending direction encoding sequence and the skeleton connection topology index matrix to establish the parameter set of relative positional relationships of key nodes; Based on the set of relative positional relationship parameters of the key nodes, the skeleton connection topology index matrix, and the local bending direction encoding sequence, multidimensional feature vector concatenation and hash mapping are performed to generate a real-time topological fingerprint vector for font matching.

5. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 1, characterized in that, S4 specifically includes: Obtain the pre-stored font size combination hash compression index table in the standard font library, and perform hash key value parsing processing on each font fingerprint vector stored in the index table to restore the standard topology dataset containing the relative positional relationships of endpoints, bifurcation points, inflection points and curvature extreme points and connection topology numbers. An initial set of node matching costs is generated based on a standard topology dataset and real-time topology fingerprint vectors. Output the minimum transformation cost sequence based on the initial set of node matching costs; Global extreme value screening is performed based on the minimum transformation value sequence. The target value with the smallest value in the minimum transformation value sequence and its corresponding index position are selected to determine the matching font type identifier and estimated target font size parameter with the highest topological similarity to the real-time topological fingerprint vector. A font matching confirmation signal is generated based on the matching font type identifier and the estimated target font size parameter. The font matching confirmation signal is then input as a structured query instruction to the deviation decoupling model construction module to trigger the invocation of the standard structural offset template of the corresponding font type and font size and to complete the orthogonal decomposition preparation of the deviation dimension.

6. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 5, characterized in that, The process of generating an initial set of node matching costs based on the standard topology dataset and the real-time topology fingerprint vector involves constructing a bidirectional node mapping matrix based on the standard topology dataset and the real-time topology fingerprint vector generated in the previous step, and performing node attribute alignment operations on the key node sequences in the real-time topology fingerprint vector and the node sequences in each standard topology dataset to generate an initial set of node matching costs to be evaluated.

7. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 5, characterized in that, The method of outputting the minimum transformation cost sequence based on the initial set of node matching costs specifically involves iteratively optimizing the initial set of node matching costs. By defining weighted cost functions for three basic editing operations—node insertion, deletion, and replacement—the method performs a path search to minimize the topological differences between the real-time topological fingerprint vector and each standard topological structure dataset, thereby outputting the minimum transformation cost sequence corresponding to each font-size combination.

8. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 1, characterized in that, S5 specifically includes: Based on the matching font type and the target font size as index keys, the corresponding standard structure offset template is retrieved from the standard font library to extract the set of reference topology node coordinates of the specific font in an ideal state as initial reference data. Generate a structure alignment deviation vector based on the baseline topology node set and the real-time topology fingerprint vector; Based on the spatial distribution consistency error of multiple identical structural units within the same character region in the binarized contour image, and combined with lens distortion parameters and historical data of conveyor belt micro-vibration, a local affine transformation matrix is ​​constructed to characterize the physical cause of system distortion deviation. Generate a set of decoupling deviation components based on the structural alignment deviation vector and the local affine transformation matrix; A deviation decoupling model is established based on the set of decoupling deviation components. The structural alignment deviation and the system distortion deviation are defined as two independent orthogonal dimension outputs, which serve as the input basis for subsequent fitting of local affine distortion parameters and generation of six-degree-of-freedom pose compensation vectors.

9. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 8, characterized in that, The generation of the structural alignment deviation vector based on the benchmark topological node set and the real-time topological fingerprint vector specifically involves spatial mapping and comparison using the relative positional relationship between key nodes in the benchmark topological node set and the real-time topological fingerprint vector to calculate the structural alignment deviation vector characterizing the inherent stroke offset and baseline tilt of the font.

10. The method for dynamic compensation of alignment accuracy for microtext hot stamping on hot stamping nail stickers according to claim 8, characterized in that, The process of generating a set of decoupling deviation components based on the structural alignment deviation vector and the local affine transformation matrix specifically involves orthogonally decomposing the system distortion deviation represented by the structural alignment deviation vector and the local affine transformation matrix to generate a set of decoupling deviation components that includes translation components, rotation components, and scaling components.