Automatic locating and adding method and system for digital printing pattern two-dimensional code
By obtaining style identifiers and strain tensors from digital printing patterns, generating an initial spatial domain and performing difference operations, determining the safe zone and adding target areas, reconstructing it into a strip matrix and generating a mask layer, the problem of QR code destruction during cutting and stretching is solved, improving recognition stability and the range of additions.
Patent Information
- Application Number
- CN202611262736.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-06
AI Technical Summary
In existing technologies, the QR codes on digitally printed patterns are easily damaged during the cutting or stretching process, causing the recognition device to be unable to extract effective features and blocking the mapping link between the cut piece and the system data.
By acquiring the style identifier, strain tensor, and limit resolution of the print file, an initial spatial domain is generated, and a difference operation is performed to remove overlapping pixels. The safe zone and target zone are determined, and extreme value verification is performed according to the limit resolution. The data is then reconstructed into a strip matrix, and its minor axis is rotated to be parallel to the strain direction. A mask layer is then generated and superimposed on the print file.
It effectively avoids the damage to the code pattern structure caused by the cutting path and the distortion of the code pattern geometry caused by fabric stretching, improves the recognizability and stability of the QR code during the fabric transfer process, reduces the damage to the edge clarity of the QR code module caused by ink droplet diffusion, and expands the range of QR codes that can be added to complex printed patterns.
Smart Images

Figure CN123050469A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of digital printing, and in particular to a method and system for automatically finding and adding QR codes to digital printing patterns. Background Technology
[0002] In the on-demand printing garment customization production system, the fabric output from the digital printing stage carries the graphic data corresponding to the order. The batch printing process arranges the graphic data of multiple orders onto the same sheet for printing. Subsequent processes require separating the physical pieces along the outer boundary of the graphic and physically grouping them at sorting and sewing stations. The printed graphic surface lacks identification, and the workflow lacks a mechanism for binding the physical pieces to the underlying order data. Relying on external paper labels or handwritten numbers is prone to loss, damage, or misidentification during physical handling, leading to limited sorting and matching efficiency and an increased rate of incorrect shipments.
[0003] Chinese invention patent CN114345753B discloses a production method for integrating raw materials used in dye-sublimation printing of garments into the Internet of Things (IoT). This method pre-assigns different piece codes to each piece of fabric to be produced before the dye-sublimation order begins production. The system attaches the piece code to the corresponding printout of the piece and positions the code outside the piece's outline. During production, a code reader identifies the piece code corresponding to the processed piece, thus connecting the fabric to the IoT system in the relevant production stage.
[0004] The above scheme defines the position of the cut piece code based on the static two-dimensional graphic boundary. However, due to limitations in actual garment processing, the area immediately adjacent to the outer edge of the cut piece objectively corresponds to the physical cutting path and the pre-reserved sewing allowance area. During mechanical cutting or fabric sewing, the tool's trajectory and the seam's piercing action inevitably intrude into this outer area, causing the QR code placed there to physically break or have its pixels cut. During processing, the fabric is subjected to mechanical tension during sewing, and the static external matrix lacks a mechanism to adapt to the physical deformation field of the fabric, resulting in geometric distortion as the fabric stretches. Furthermore, if the QR code is forcibly miniaturized to avoid physical processing boundaries, its single-point pixel size easily exceeds the physical resolution limit of the piezoelectric printhead of the underlying printing equipment, causing adjacent ink droplets to physically stack and capillary ink bleeding. The aforementioned processing interference, tension deformation, and resolution exceeding limits objectively combine to destroy the original encoding structure of the two-dimensional matrix, preventing the recognition device from extracting effective features and disrupting the mapping link between the cut piece entity and system data. Summary of the Invention
[0005] To address the issue of easily damaged or stretched fabric pattern codes and to achieve reliable code addition, this application provides a method and system for automatically locating and adding QR codes to digital printed patterns.
[0006] Firstly, this application provides a method for automatically finding and adding QR codes to digital printed patterns, employing the following technical solution: A method for automatically finding and adding QR codes to digital printed patterns, comprising: Obtain the print file to establish a coordinate system, and obtain the corresponding style identifier, strain tensor, and limit resolution; Scan the print file, extract closed pixels whose grayscale variance meets the preset variance threshold, and generate an initial spatial domain in the coordinate system; The constraint template is invoked according to the style identifier, and the constraint template includes a cutting area and a deformation area; Perform a difference operation between the initial spatial region and the cropping region to remove overlapping pixels and obtain a safe region. Then, determine the target region to be added based on the overlap relationship between the safe region and the deformation region. Extract the original encoding of the QR code to be generated in the target area, and perform extreme value verification on the QR code to be generated based on the limit resolution: If a preset critical condition is triggered, the instruction to generate the QR code is intercepted, and the process is downgraded to adding target area overlay text information. If the preset critical condition is not triggered, and the added target area occupies the deformation area, the original code is reconstructed into a strip matrix with an aspect ratio greater than a preset ratio according to the strain tensor, and the strip matrix is rotated so that its minor axis is parallel to the principal strain direction of the strain tensor. Calculate the color density of the added target area. If the color density is greater than a preset density threshold, generate a mask layer at the bottom layer of the QR code, the text information, or the strip matrix and set the corresponding background pixels to zero. Finally, overlay the mask layer onto the print file and output it.
[0007] Optionally, the step of calling the constraint template based on the style identifier includes: Obtain the pattern-making data associated with the style identifier, and extract the three-dimensional boundary and stress features; Dimensional reduction projection is performed on the three-dimensional boundary to obtain the cutting path and seam allowance boundary. The cutting area is generated by expanding outward along the seam allowance boundary according to a preset tolerance. Calculate the deformation rate of each node in the stress feature, extract the node set whose deformation rate is greater than a preset threshold, perform contour extraction and two-dimensional mapping on the node set, and generate the deformation region; Align and encapsulate the cutting area and the deformation area within the coordinate system to generate the constraint template.
[0008] Optionally, before performing a difference operation between the initial spatial domain and the clipping region, the method further includes: Obtain the diffusion coefficient and ambient humidity of the fabric associated with the printed file; The anti-spray distance is calculated based on the diffusion coefficient and the ambient humidity. The initial airspace is equidistantly shrunken inward along its coordinate boundaries according to the anti-spray distance. The anti-spray quiet zone generated by the inward contraction is used as the updated initial airspace.
[0009] Optionally, determining the added target area based on the overlap relationship between the safe area and the deformed area includes: Extract discrete connected sub-regions within the safe area and calculate the pixel area of each connected sub-region; The connected sub-regions whose pixel area is greater than a preset area threshold are marked as candidate sub-regions; Calculate the overlap area where each of the candidate sub-regions intersects with the deformation region; If there exists a candidate sub-region with an overlap area of zero, then the region with the largest pixel area is selected as the added target region. If the overlapping area of each candidate sub-region is greater than zero, then the region with the smallest overlapping area is selected as the added target region.
[0010] Optionally, performing the extreme value verification on the QR code to be generated based on the added target area, based on the extreme resolution, includes: Based on the added target area, determine the dynamic scaling ratio, and calculate the single-point side length of the QR code under the dynamic scaling ratio; Obtain the droplet diameter corresponding to the limit resolution, and multiply the droplet diameter by a preset coefficient to generate the analytical critical value; If the side length of the single point is less than the analytical critical value, then the preset critical condition is triggered.
[0011] Optionally, the degradation of the text information overlaid on the added target area includes: Obtain the bounding rectangle of the text information and calculate the initial area of the bounding rectangle; Extract the coordinate intersection of the circumscribed rectangle and the added target area, and calculate the intersection area of the coordinate intersection; If the intersection area is less than the initial area, an overflow instruction is triggered, and the coordinate intersection is extracted to reconstruct the text information.
[0012] Optionally, reconstructing the original code into a strip matrix with an aspect ratio greater than the preset ratio based on the strain tensor includes: Intercept the matrix generation instruction and map the original encoding to a non-uniform length template with an aspect ratio greater than the preset ratio; Based on the non-equal-length template, a multi-segment matrix or a one-dimensional matrix is reconstructed, and the reconstruction result is determined as the strip matrix.
[0013] Optionally, generating the mask layer on the bottom layer of the QR code, the text information, or the strip matrix and setting the corresponding background pixels to zero includes: A stripping matrix is generated based on the QR code, the text information, or the outer contour of the strip matrix, and the pixel set of the stripping matrix is assigned as pure white pixels to construct the mask layer. Extract the absolute coordinate set of the mask layer within the coordinate system; Within the absolute coordinate set, the color channels of the printed file are erased, and the corresponding pixel values are overwritten to zero to generate a scan still area.
[0014] Optionally, before extracting the original encoding of the QR code to be generated for the added target area, the method further includes: Extract the traceability information and its feature fields associated with the printed document; The feature field and the style identifier are concatenated to generate a verification segment; The source information and the verification segment are converted into a matrix stream, and the matrix stream is determined as the original code.
[0015] Secondly, this application provides an automatic QR code location and addition system for digital printed patterns, which adopts the following technical solution: An automatic QR code location and addition system for digital printed patterns, comprising: The data acquisition module is used to acquire the print file to establish a coordinate system and to acquire the corresponding style identifier, strain tensor and limit resolution. The spatial domain scanning module is used to scan the printed file, extract closed pixels whose grayscale variance meets the preset variance threshold, and generate an initial spatial domain in the coordinate system. The positioning decision module is used to call the constraint template according to the style identifier. The constraint template includes a clipping area and a deformation area. The initial spatial domain and the clipping area are subjected to a difference operation to remove overlapping pixels to obtain a safe area. The target area to be added is determined based on the overlap relationship between the safe area and the deformation area. The verification and reconstruction module is used to extract the original encoding of the QR code to be generated in the added target area, and perform extreme value verification on the QR code to be generated based on the limit resolution: if a preset critical condition is triggered, the instruction to generate the QR code is intercepted and downgraded to the text information superimposed on the added target area; if the preset critical condition is not triggered, and the added target area occupies the deformation area, the original encoding is reconstructed into a strip matrix with an aspect ratio greater than a preset ratio according to the strain tensor, and the strip matrix is rotated so that its minor axis is parallel to the principal strain direction of the strain tensor; The mask output module is used to calculate the color density of the added target area. If the color density is greater than a preset density threshold, a mask layer is generated at the bottom layer of the QR code, the text information, or the strip matrix, and the corresponding background pixels are set to zero. Finally, the mask layer is superimposed on the printing file and output.
[0016] In summary, this application includes the following beneficial technical effects: 1. This application obtains the printing file and its style identifier, strain tensor, and limit resolution. Based on the grayscale variance in the printing file, it extracts the initial spatial domain. The initial spatial domain is then compared with the cutting area in the constraint template called by the style identifier to remove overlapping pixels and obtain a safe area. The target area is then determined based on the overlap relationship between the safe area and the deformation area. Furthermore, the limit resolution is used to perform extreme value verification on the QR code. When the critical condition is triggered, the text information is downgraded and superimposed. When the critical condition is not triggered and the target area occupies the deformation area, the original code is reconstructed into a strip matrix based on the strain tensor and rotated so that its minor axis is parallel to the principal strain direction. This avoids the destruction of the code image structure by the cutting path and the distortion of the code image geometry by fabric stretching at the physical level. It also avoids the code dot size exceeding the resolution limit of the printing equipment due to miniaturization, effectively improving the recognizability and stability of the QR code during the fabric transfer process.
[0017] 2. This application obtains the diffusion coefficient and ambient humidity of the fabric associated with the printing file, calculates the anti-bleeding distance based on the diffusion coefficient and ambient humidity, and performs equidistant shrinkage along the coordinate boundary of the initial spatial domain according to the anti-bleeding distance to generate an anti-bleeding quiet zone as the updated initial spatial domain. This creates a physical anti-bleeding isolation zone around the QR code, reducing the damage to the edge clarity of the QR code module caused by the diffusion and intrusion of ink droplets under the capillary action of the fabric, and further improving the edge sharpness and readability of the code image after inkjet printing and fixing.
[0018] 3. This application calculates the color density of the target area to be added. When the color density is greater than the preset density threshold, a mask layer is generated on the bottom layer of the QR code or text information and the corresponding background pixels are set to zero. This eliminates the interference of high-density background color on the reflection difference of the QR code module while preserving the integrity of the printed pattern. It avoids insufficient contrast of the code image caused by ink accumulation in the background color, so that the QR code can still meet the evaluation requirements of barcode symbol contrast in dark printed areas, effectively expanding the range of QR codes that can be added in complex printed patterns. Attached Figure Description
[0019] Figure 1 A flowchart illustrating an automatic QR code location and addition method for digital printing patterns provided in this application embodiment; Figure 2 This is a schematic diagram of the strip matrix and principal strain direction provided in an embodiment of this application. Detailed Implementation
[0020] The following combination Figures 1-2 This application will be described in further detail.
[0021] Example 1
[0022] This embodiment discloses a method and system for automatically locating and adding QR codes to digitally printed patterns, applied to the digital printing stage of cut pieces in POD (Print on Demand) garment customization production. After receiving an order, the POD production system generates a printing file for the corresponding cut piece. The printing file can be a TIFF, PNG, PDF, or a bitmap file that can be parsed by the garment printing RIP process. The printing file contains the designed pattern area and a background area that does not carry a valid pattern. This method uses machine vision to scan the blank areas in the printing file. Without changing the pixel data of the original printed pattern area, it overlays a QR code or text information generated from the order information onto the blank area that can accommodate the identifier, so that the printed cut piece carries the identification information bound to the underlying order data.
[0023] The system in this embodiment includes a virtual functional module architecture and a physical hardware architecture. The virtual functional module architecture includes a data acquisition module, a spatial domain scanning module, a positioning decision module, a verification and reconstruction module, and a masking output module. The data acquisition module takes the print file, style identifier, strain tensor, and limit resolution as input, and outputs a coordinate system and associated parameters. The spatial domain scanning module takes the print file and coordinate system as input, and outputs the initial spatial domain. The positioning decision module takes the initial spatial domain, style identifier, cutting area, and deformation area as input, and outputs a safe area and an added target area. The verification and reconstruction module takes the added target area, limit resolution, traceability information, feature fields, and strain tensor as input, and outputs a QR code, text information, or a strip matrix. The masking output module takes the added target area, QR code, text information, strip matrix, and print file as input, and outputs a print file with overlaid identifiers. The virtual functional modules and method steps form a one-to-one data flow relationship.
[0024] like Figure 1 As shown, when the automatic positioning and addition method is executed as a whole, it sequentially goes through the action steps of obtaining the printing file and constraint template, and determining the target area to be added through difference operation. Then it enters the dual condition verification branch of analyzing the critical value judgment and the deformation area occupancy status, and finally merges into the color density inspection and file output closed loop.
[0025] The physical hardware architecture includes a processor, memory, and communication interfaces. The processor can be an x86 server processor, an ARM industrial control processor, or an image processing workstation processor with a GPU acceleration unit. The memory stores printing files, constraint templates, plate-making data, traceability information, computer programs, and intermediate mask data. The communication interface connects to ERP systems, garment CAD systems, RIP servers, and digital printing equipment; the communication interface can include Ethernet, USB, RS-485, or industrial fieldbus interfaces. The aforementioned virtual functional modules are implemented by the processor reading and executing the computer programs stored in memory.
[0026] In this embodiment, the data acquisition module, as the sole physical execution entity of step S101, acquires the print file to establish a coordinate system and obtains the corresponding style identifier, strain tensor, and limit resolution. The coordinate system has the upper left pixel of the print file as the origin, the horizontal pixel number as the X-axis, and the vertical pixel number as the Y-axis, with the coordinate unit being pixels. The style identifier is used to associate the current garment piece with the garment style, the order information is used to generate QR code content, the strain tensor is used to describe the principal strain direction of the fabric or garment piece under sewing, stretching, or wearing stress, and the limit resolution is used to describe the physical analysis capability that the digital printing equipment can stably output under the current printhead, ink, and fabric combination. The print file, coordinate system, style identifier, strain tensor, and limit resolution together constitute the output of step S101 and serve as the input conditions for step S102.
[0027] The spatial domain scanning module, as the sole physical execution entity in step S102, scans the print file, extracts closed pixels whose grayscale variance meets a preset variance threshold, and generates an initial spatial domain in the coordinate system. Specifically, the spatial domain scanning module converts the print file into a grayscale matrix. Calculate the grayscale variance within the sliding window. When the grayscale variance within a closed pixel set is less than or equal to a preset variance threshold, the closed pixel set is identified as a blank area that does not carry a complex printed pattern. In engineering practice, the background of printed fabrics is not absolutely uniform, and there is background texture noise caused by the interlacing of fabric yarns. Therefore, the preset variance threshold is calibrated based on the scanning statistical characteristics of the fabric's void texture; taking an 8-bit grayscale image as an example, the preset variance threshold is set to a constant between 5 and 15. Using this calibration basis, it is possible to accurately distinguish between the inherent micro-texture noise of the fabric and the edge gradient of the effective printed pattern, avoiding misjudging light-colored patterns as blank areas and ensuring the physical accuracy of the initial spatial domain recognition. Closed pixels can be obtained through OpenCV's findContours contour extraction algorithm or through a connected component labeling algorithm; the connected component adopts the four-neighbor or eight-neighbor rule. The four-neighbor rule is suitable for patterns with clear boundaries, while the eight-neighbor rule is suitable for printed files with oblique boundaries or anti-aliased transition pixels. The initial spatial domain is one or more closed sets of pixels, each of which stores absolute coordinates, pixel area, bounding rectangle, aspect ratio, and boundary contour. This initial spatial domain serves as the input condition for step S103.
[0028] The positioning decision module, as the sole physical execution entity in step S103, invokes the constraint template based on the style identifier. The constraint template includes a cutting area and a deformation area. The constraint template is pre-generated from garment CAD pattern-making data, which can come from DXF, PLT, or AAMA / ASTM pattern data output by ET, Richpeace, or other pattern-making software. The positioning decision module acquires the pattern data associated with the style identifier, extracts the three-dimensional boundary and stress characteristics, performs dimensionality reduction projection on the three-dimensional boundary to obtain the cutting path and seam allowance boundary, and expands outward along the seam allowance boundary according to a preset tolerance to generate the cutting area. The preset tolerance can be from 2mm to 8mm, corresponding to the superimposed safety distance of the mechanical cutting tool's lateral oscillation, fabric placement offset, and sewing seam allowance; in regular T-shirt or sweatshirt pattern pieces, the preset tolerance can be 5mm. The positioning decision module calculates the deformation rate of each node in the stress characteristics, extracts the node set with a deformation rate greater than a preset threshold, performs contour extraction and two-dimensional mapping on the node set, and generates the deformation area. The preset threshold can be 15%, which corresponds to the normal stretch risk boundary of pure cotton, polyester, and spandex blended fabrics in the shoulder seam, armhole, waist, or knee / elbow fold areas. The cutting area and deformation area are aligned and encapsulated in the coordinate system to form a constraint template. This constraint template serves as the input condition for step S104.
[0029] In step S104, the positioning decision module performs a difference operation on the initial spatial domain and the clipping region to remove overlapping pixels and obtain a safe region. Based on the overlap relationship between the safe region and the deformation region, it determines the target region to be added. The difference operation can be implemented using a binary mask. The initial spatial domain corresponds to the set of pixels with a mask value of 1, the clipping region corresponds to the set of prohibited pixels with a mask value of 1, and the safe region corresponds to the set of pixels after performing an A AND NOT B operation on the initial spatial domain mask and the clipping region mask. The positioning decision module extracts discrete connected sub-regions within the safe region, calculates the pixel area of each connected sub-region, and marks connected sub-regions with pixel areas greater than a preset area threshold as candidate sub-regions. The preset area threshold is calculated and calibrated based on the physical limit area of the QR code required by the system. The logical rule is: the preset area threshold is equal to the minimum side length of a single point of the QR code to be generated multiplied by the number of rows and columns of the matrix module, and then the total area corresponding to the anti-bleeding distance is added. By introducing this area boundary restriction based on the physical size baseline, fragmented blank sub-regions that cannot fully accommodate the underlying data can be directly eliminated upstream, reducing the amount of redundant data in subsequent overlapping operations with the deformation area, and effectively reducing the system's computing power consumption. Subsequently, the positioning decision module calculates the overlapping area of each candidate sub-region and the deformation area. If there is a candidate sub-region with an overlapping area of zero, the positioning decision module selects the area with the largest pixel area as the target area to be added; if the overlapping area of each candidate sub-region is greater than zero, the positioning decision module selects the area with the smallest overlapping area as the target area to be added. Thus, the coordinates that are simply located in the visual blank area but enter the cutting path, seam allowance boundary, or high deformation area are excluded, solving the problem of the cut piece code being cut by the tool, punctured by the seam, or damaged by the stretching of the fabric when it is set outside the outline. The target area is added as the input condition for step S105.
[0030] As an optional implementation, before performing a difference operation between the initial spatial domain and the cutting area, the spatial domain scanning module obtains the diffusion coefficient and ambient humidity of the fabric associated with the printing file. Based on the diffusion coefficient and ambient humidity, it calculates the anti-bleeding distance and performs equidistant shrinkage along the coordinate boundary of the initial spatial domain according to the anti-bleeding distance. The anti-bleeding quiet area generated by the shrinkage is used as the updated initial spatial domain. The anti-bleeding distance can be based on the capillary diffusion approximation formula. To make an estimate, among which The equivalent diffusion coefficient of the fabric-ink system. This refers to the effective diffusion time of the ink droplet from ejection to fixation; the higher the ambient humidity, the lower the evaporation rate of the water-based ink. The larger the value, the greater the diffusion distance. For cotton knitted fabrics, the diffusion coefficient can be set to a value that corresponds to a distance that increases with diffusion. to When the ambient humidity is between 60%RH and 75%RH, the anti-bleeding distance can be between 0.2mm and 0.8mm. This inward treatment creates a blank quiet zone around the QR code, reducing the probability of capillary ink bleeding into the edge of the QR code module.
[0031] The verification and reconstruction module, as the sole physical execution entity in step S105, first extracts the traceability information and its feature fields associated with the printing file. It then concatenates the feature fields with the style identifier to generate a verification segment. The traceability information and verification segment are converted into a matrix stream, which is then used as the original code. Based on this, the verification and reconstruction module extracts the original code of the QR code to be generated for the target area and performs extreme value verification on the QR code based on the limit resolution. The QR code can follow the QR code encoding rules specified in ISO / IEC 18004. The traceability information may include order number, piece number, product SKU, size, color, batch number, and ERP query index. The verification segment can be calculated using CRC-16 / CCITT-FALSE or CRC-32 to avoid mapping to incorrect orders after scanning due to manual entry or data concatenation errors during piece transfer. As an optional implementation, the QR code content may not directly store complete order information, but only an HTTPS short link or ERP internal resource locator. Simultaneously, the order number and style identifier are written into the verification segment, reducing the QR code version number and increasing the unit module side length.
[0032] The verification and reconstruction module determines the dynamic scaling ratio based on the added target area, calculates the single-point side length of the QR code at the dynamic scaling ratio, obtains the droplet diameter corresponding to the limit resolution, and multiplies the droplet diameter by a preset coefficient to generate the resolution critical value. At a limit resolution of 600 DPI, the theoretical pixel pitch is 25.4 / 600 = 0.0423 mm. Considering the piezoelectric printhead droplet diffusion, fabric capillary absorption, and RIP halftone error, the preset coefficient can be 1.2, and the resolution critical value is 0.0508 mm. If the single-point side length of the miniaturized QR code is 0.04 mm, which is less than 0.0508 mm, the verification and reconstruction module determines that the preset critical condition has been triggered, intercepts the QR code generation instruction, and downgrades it to adding text information overlaid on the target area. The text information can include order number, cut piece number, or product SKU. The font should be a boldface or OCR-B type font that remains recognizable after printing. The character height can be no less than 1.8 mm, and the stroke width can be no less than twice the theoretical droplet diameter. The verification and reconstruction module obtains the bounding rectangle of the text information, calculates the initial area of the bounding rectangle, extracts the intersection of the bounding rectangle and the target area, and calculates the intersection area. If the intersection area is less than the initial area, the verification and reconstruction module triggers an overflow instruction and extracts the intersection to reconstruct the text information. Specifically, the bounding rectangle of the text information is confined within the intersection based on its boundaries, dynamically removing redundant characters that exceed the safe zone boundaries. This logical chain ensures that the text information falls completely within the target area, effectively preventing characters from being damaged by subsequent mechanical cutting and improving the reliability of identification flow and recognition. At the same time, the reconstruction action does not interfere with the overall output flow of the printing file, ensuring the continuity of mass production.
[0033] If the preset critical condition is not triggered, and the target area occupies the deformation region, the verification and reconstruction module reconstructs the original code into a strip matrix with an aspect ratio greater than a preset ratio based on the strain tensor, and rotates the strip matrix so that its minor axis is parallel to the principal strain direction of the strain tensor. Specifically, the verification and reconstruction module intercepts the matrix generation instruction and maps the original code to a non-uniform length template with an aspect ratio greater than a preset ratio. Based on the non-uniform length template, it reconstructs and generates a multi-segment matrix or a one-dimensional matrix, and determines the reconstruction result as a strip matrix. Figure 2 As shown, the strip matrix has a slender overall shape, with its short axis extending strictly parallel to the direction indicated by the force arrows in the principal strain direction. The preset ratio can be from 3:1 to 8:1. When the tensile rate corresponding to the principal strain direction of the fabric is high, the short axis of the strip matrix is parallel to the principal strain direction, making the deformable dimension in the principal strain direction shorter and reducing the cumulative distortion of a single module in the tensile direction. As an optional implementation, the strip matrix can use Micro PDF417, or a Code 128 one-dimensional matrix to carry the order index, or a segmented two-segment DataMatrix matrix to carry traceability information; DataMatrix can refer to ISO / IEC 16022, and Code 128 can refer to ISO / IEC 15417. All of the above alternatives use non-square matrices or segmented matrices to reduce the disruption of the geometric proportions of the code elements caused by anisotropic stretching of the fabric.
[0034] The mask output module, as the sole physical execution entity in step S106, calculates the color density of the target area to be added. If the color density exceeds a preset density threshold, a mask layer is generated on the underlying layer of the QR code or text information, and the corresponding background pixels are set to zero. This mask layer is then superimposed onto the printing file and output. The mask layer is sandwiched between the underlying basic printing pattern and the top-level QR code to forcibly erase the background color features within the corresponding projection coverage area. The color density can be calculated based on the total density of the CMYK channels, i.e. ;when When the density exceeds a preset threshold of 250%, the dark background image reduces the reflection difference of the QR code's black and white modules and produces four-color ink buildup. The mask output module generates a stripping matrix based on the outer contour of the QR code or text information, assigns the pixel set of the stripping matrix to pure white pixels to construct a mask layer, extracts the absolute coordinate set of the mask layer in the coordinate system, erases the color channels of the printing file within the absolute coordinate set, and overwrites the corresponding pixel values to zero to generate a scan still area. For CMYK files, setting the background pixels to zero means... All four channels are written to 0; for RGB files, the mask layer can be mapped to white background pixels with R=255, G=255, and B=255. As an optional implementation, when the background color of the added target area is very light but the local texture causes insufficient contrast, the mask output module can only perform brightness enhancement and saturation reduction on the background pixels within the stripping matrix, so that the QR code or text information and the background meet the minimum requirements for contrast evaluation of two-dimensional barcode symbols in ISO / IEC 15415, instead of completely overwriting pure white pixels.
[0035] In a series of engineering verifications, using traditional pure visual recognition methods to add QR codes to 1000 POD (Printed Object) fabric pieces, the proportion of QR codes that could not be scanned due to cutting, seam allowance coverage, or stretching distortion was 8.5%. After adopting the cutting area difference filtering, deformation area avoidance, limit resolution verification, and masking layer processing of this embodiment, the proportion of unscannable codes was reduced to 0.2%. This result corresponds to the three types of failure causes mentioned in the background technology: processing interference, tension deformation, and resolution exceeding limits, forming a closed loop from visual positioning to physical constraints and then to hardware rendering verification.
[0036] Example 2
[0037] This embodiment also discloses a method and system for automatically finding and adding QR codes to digital printing patterns. The difference between this embodiment and Embodiment 1 is that Embodiment 1 focuses on automatic QR code positioning, extreme value verification, deformation compensation, and masking output, while Embodiment 2 is designed for batch printing scenarios with higher production cycles and greater differences in fabric patterns. It postpones QR code generation to the RIP imposition stage before output from the digital printing equipment, and saves the target area, constraint template, and rendering parameters without pre-writing the printing file. The production system only overlays QR codes, text information, or strip matrices onto the target area after confirming the order, equipment, fabric, and environmental parameters in the printing queue. This difference allows the same printing file to be reused for different orders, different printhead resolution limits, and different workshop humidity levels, reducing the number of pre-processed files and avoiding the repeated generation of the entire printing file after order changes.
[0038] In this embodiment, the data acquisition module, as the sole physical execution entity of step S201, acquires the print file to establish a coordinate system and obtains the corresponding style identifier, strain tensor, and limit resolution. Unlike the direct generation of the superimposed print file in Embodiment 1, the data acquisition module also acquires the production queue number, RIP task number, fabric batch number, and equipment number, and establishes a key-value mapping relationship between the style identifier, strain tensor, limit resolution, and RIP task number. The print file can retain its original pixel matrix, and the coordinate system, style identifier, strain tensor, limit resolution, and RIP task number serve as the input conditions for step S202.
[0039] The spatial domain scanning module, as the sole physical execution entity in step S202, scans the print file, extracts closed pixels whose grayscale variance meets a preset variance threshold, and generates an initial spatial domain in the coordinate system. The spatial domain scanning module uses the original pixels of the print file as its object, without writing QR codes, text information, or compressing the original print pattern area. Grayscale variance calculation still uses... The algorithm combines CMYK or RGB channel alpha transparency, white point pixel ratio, and edge gradient to filter closed pixels. For PNG files with transparent backgrounds, closed pixels with an alpha channel less than or equal to a preset transparency threshold can be directly incorporated into the initial spatial domain. In the 8-bit alpha channel, 0 represents complete transparency, and 255 represents complete opacity. Considering that print design artworks often contain feathered transitions at brush edges or anti-aliased semi-transparent noise, the preset transparency threshold is calibrated as a tolerance constant between 5 and 15. This tolerance-based transparency parameter mechanism is compatible with non-ideal noise in feathered edge artworks, preventing the spatial domain recognition connectivity from being truncated by individual weak opaque pixels, and enhancing the robustness of the scanning algorithm to files with different design styles. For PDF vector imposition files, the spatial domain scanning module can first rasterize them into a pixel matrix according to the RIP target resolution, and then generate the initial spatial domain. The initial spatial domain does not represent the final printing position, but only the visual candidate space that can enter the subsequent physical constraint calculation.
[0040] The positioning decision module, as the sole physical execution entity in step S203, invokes the constraint template based on the style identifier. The constraint template includes a cutting area and a deformation area. Indexed by the style identifier, the constraint template contains the cutting path, seam allowance boundary, cutting area, stress nodes, deformation rate, and deformation area. The positioning decision module acquires the pattern-making data associated with the style identifier, extracts the 3D boundary and stress features, performs dimensionality reduction projection on the 3D boundary to obtain the cutting path and seam allowance boundary, and expands outward along the seam allowance boundary according to a preset tolerance to generate the cutting area. The 3D boundary can come from OBJ meshes, DXF 2D patterns, or CAD pattern outlines output by 3D garment simulation software; the dimensionality reduction projection can use orthogonal projection to map the 3D vertices (x, y, z) to pattern plane coordinates (u, v), and convert them to pixel coordinates according to the RIP rasterization ratio. The positioning decision module calculates the deformation rate of each node in the stress features, which can be obtained from engineering strain. Calculation, where Spacing between unloaded nodes The node spacing after stress is set; the node set with a deformation rate greater than the preset threshold is extracted and contour extraction and 2D mapping are performed to generate the deformation zone. For shoulder seams, armholes, waist and knee / elbow areas, the preset threshold can be 15%; for high-elastic spandex blended fabrics, the preset threshold can be lowered to 10% to 12% to avoid high-stretch areas in advance.
[0041] The positioning decision module, as the sole physical execution entity in step S204, performs a difference operation between the initial spatial domain and the clipping area, eliminates overlapping pixels to obtain a safe area, and determines the target area to be added based on the overlap relationship between the safe area and the deformation area. Unlike embodiment 1, this embodiment does not immediately write the QR code or text information into the print file, but instead generates a target area description file. The target area description file can use JSON or XML data format, recording the RIP task number, absolute coordinates of the target area, polygon outline, candidate sub-area area, overlap area with the deformation area, upper limit of dynamic scaling ratio, candidate rotation angle value, and reserved margin of the mask layer. For example, JSON fields may include taskId, styleId, targetPolygon, safeAreaMaskHash, strainOverlapArea, maxScaleRatio, maskPaddingPx, and renderMode. This target area description file serves as the input condition for step S205 and is stored separately from the original print file.
[0042] As an optional implementation, the target area description file can also include the hash values of the cutting area mask and the deformation area mask. Before outputting, the RIP server recalculates the constraint template hash value and compares it with the hash value in the description file. If the pattern-making data corresponding to the style identifier is modified, the positioning decision module regenerates the target area to avoid the old cutting path from being inconsistent with the new pattern outline, causing the QR code to enter the cutting area. Alternatively, the target area can be added without saving the complete pixel mask, only saving the polygon outline vertices and coordinate system conversion ratios. This is suitable for large-scale caching of repetitive styles in batch orders, reducing memory usage.
[0043] The verification and reconstruction module, as the sole physical execution entity in step S205, extracts the original encoding of the QR code to be generated for the target area when the RIP task enters the printing queue, and performs extreme value verification on the QR code to be generated based on the limit resolution. Specifically, the verification and reconstruction module reads the traceability information and its feature fields from the ERP system, concatenates the feature fields with the style identifier to calculate and generate a verification segment, converts the traceability information and the verification segment into a matrix stream, and determines the matrix stream as the original encoding. Verification is then performed based on the limit resolution. Since this embodiment renders before printing, the limit resolution can be the current setting of the actual digital printing equipment, rather than the default resolution during the design phase. For example, when the same print file is output on a 600 DPI device, the droplet diameter corresponds to 25.4 / 600 = 0.0423 mm. Multiplying this by a preset coefficient of 1.2 generates a resolution threshold of 0.0508 mm. When output on a 1200 DPI device, the theoretical pixel pitch is 0.0212 mm. However, if capillary diffusion in the fabric results in an effective droplet diameter of 0.035 mm, the resolution threshold should be calculated by multiplying the droplet diameter obtained from device calibration by a preset coefficient, rather than simply using the theoretical DPI pitch. If the side length of a single point is less than the resolution threshold, the verification and reconstruction module determines that a preset critical condition has been triggered, intercepting the instruction to generate a QR code and downgrading it to adding target area overlay text information. If the intersection area is less than the initial area, an overflow instruction is triggered, and the coordinate intersection is extracted to reconstruct the text information. Out-of-bounds characters are removed based on the coordinate intersection boundary to ensure the physical integrity of the label and to avoid blocking the queuing printing process. This verification and reconstruction mechanism incorporates hardware limits, fabric diffusion, and the actual rendering size of the order into the same closed loop, solving the problem of miniature QR codes exceeding the resolution limit of piezoelectric printheads.
[0044] If the preset critical condition is not triggered, and the added target area occupies the deformation region, the verification and reconstruction module reconstructs the original code into a strip matrix with an aspect ratio greater than the preset ratio based on the strain tensor, and rotates the strip matrix so that its minor axis is parallel to the principal strain direction of the strain tensor. The strain tensor can be represented as a two-dimensional matrix. The verification and reconstruction module calculates the eigenvalues and eigenvectors of the two-dimensional matrix, with the eigenvector corresponding to the largest eigenvalue pointing towards the principal strain direction. The minor axis of the strip matrix is parallel to the principal strain direction, while the major axis is orthogonal to it, thus reducing the number of consecutive symbols along the principal strain direction. If the original encoding uses the QR Code matrix structure specified in ISO / IEC 18004, the verification and reconstruction module intercepts the matrix generation instruction and maps the original encoding to a non-uniform length template with an aspect ratio greater than a preset ratio. Based on the non-uniform length template, it reconstructs and generates a multi-segment matrix or a one-dimensional matrix, and determines the reconstruction result as a strip matrix. The preset ratio can be 3:1; for armholes or waist areas with a local stretching rate exceeding 20%, the preset ratio can be increased to 5:1. The strip matrix can use Micro PDF417, Code 128, or a two-segment DataMatrix. The RIP server writes the target area into the rendering layer according to the rotation angle.
[0045] The mask output module, as the sole physical execution entity in step S206, calculates the color density of the target area to be added. If the color density is greater than a preset density threshold, a mask layer is generated on the underlying layer of the QR code or text information, and the corresponding background pixels are set to zero. This mask layer is then superimposed onto the printing file and output. In this embodiment, the mask layer is generated during the RIP stage and is inserted into the printing task as an independent layer, rather than being permanently written to the original printing file. The mask output module generates a stripping matrix based on the outer contour of the QR code or text information, assigns the pixel set of the stripping matrix to pure white pixels to construct the mask layer, extracts the absolute coordinate set of the mask layer in the coordinate system, erases the color channels of the printing file within the absolute coordinate set, and overwrites the corresponding pixel values to zero to generate a scan still area. If the original printing file is in CMYK mode... All values are set to 0; if the RIP process uses a spot color white ink channel, the mask layer can be mapped to a stacked structure where the white ink channel is printed first, followed by the black ink channel for the QR code. The color density threshold can be 250%. When the total channel density is 260%, the mask layer is triggered; when the background density is less than 250% but the symbol contrast in the ISO / IEC 15415 evaluation is insufficient, the mask output module can expand the stripping matrix by 1 to 3 module widths to form a wider scanning still area.
[0046] The system in this embodiment includes a virtual functional module architecture and a physical hardware architecture. The virtual functional module architecture includes a data acquisition module, a spatial domain scanning module, a positioning decision module, a verification and reconstruction module, and a mask output module. The data acquisition module takes the print file, style identifier, strain tensor, limit resolution, RIP task number, and device number as input, and outputs a coordinate system and task parameter mapping relationship. The spatial domain scanning module takes the print file and coordinate system as input, and outputs the initial spatial domain. The positioning decision module takes the initial spatial domain, style identifier, constraint template, cutting area, and deformation area as input, and outputs a safe area, added target area, and added target area description file. The verification and reconstruction module takes the added target area description file, limit resolution, traceability information, feature fields, and strain tensor as input, and outputs a RIP rendering layer containing a QR code, text information, or a strip matrix. The mask output module takes the RIP rendering layer, print file, added target area, and color density as input, and outputs a print task file containing a mask layer and a recognition information layer. Each virtual functional module interlocks with the input and output data fields. Adding a target area description file makes the absolute output of step S204 the input condition for step S205. The RIP rendering layer makes the absolute output of step S205 the input condition for step S206.
[0047] The physical hardware architecture includes a processor, memory, and communication interfaces. The processor includes a CPU deployed in an image processing server or RIP server, and may also include a GPU for mask difference operations and image rasterization. Memory includes a solid-state drive and RAM for storing original print files, target area description files, constraint templates, order traceability information, RIP cache files, and computer programs. Communication interfaces include an Ethernet interface for connecting to the ERP system, a data interface for connecting to the garment CAD system, a print control interface for connecting to the digital printing equipment, and an industrial communication interface for reading humidity sensors in the workshop environment. The aforementioned virtual functional modules are implemented by the processor reading and executing the computer programs in memory.
[0048] In this embodiment, the printing file remains in its original state during the design phase. Target areas and physical constraints are added and entered into the production queue as a description file. QR codes, text information, stripe matrices, and masking layers are generated before printing based on actual limit resolution, fabric batch, ambient humidity, and order traceability information. This processing method expands the automatic QR code positioning and addition process from simple image preprocessing to closed-loop control oriented towards physical printing tasks. It can simultaneously avoid cutting areas, reduce damage from deformation areas, prevent single-point side lengths from exceeding the ink droplet resolution threshold, and form a scannable still area on a high color density background.
[0049] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A method for automatically finding and adding QR codes to digital printing patterns, characterized in that, include: Obtain the print file to establish a coordinate system, and obtain the corresponding style identifier, strain tensor, and limit resolution; Scan the print file, extract closed pixels whose grayscale variance meets the preset variance threshold, and generate an initial spatial domain in the coordinate system; The constraint template is invoked according to the style identifier, and the constraint template includes a cutting area and a deformation area; Perform a difference operation between the initial spatial region and the cropping region to remove overlapping pixels and obtain a safe region. Then, determine the target region to be added based on the overlap relationship between the safe region and the deformation region. Extract the original encoding of the QR code to be generated in the target area, and perform extreme value verification on the QR code to be generated based on the limit resolution: If a preset critical condition is triggered, the instruction to generate the QR code is intercepted, and the process is downgraded to adding target area overlay text information. If the preset critical condition is not triggered, and the added target area occupies the deformation area, the original code is reconstructed into a strip matrix with an aspect ratio greater than a preset ratio according to the strain tensor, and the strip matrix is rotated so that its minor axis is parallel to the principal strain direction of the strain tensor. Calculate the color density of the added target area. If the color density is greater than a preset density threshold, generate a mask layer at the bottom layer of the QR code, the text information, or the strip matrix and set the corresponding background pixels to zero. Finally, overlay the mask layer onto the print file and output it.
2. The method for automatic location finding and adding of QR codes in a digital printing pattern according to claim 1, characterized in that, The step of calling the constraint template based on the style identifier includes: Obtain the pattern-making data associated with the style identifier, and extract the three-dimensional boundary and stress features; Dimensional reduction projection is performed on the three-dimensional boundary to obtain the cutting path and seam allowance boundary. The cutting area is generated by expanding outward along the seam allowance boundary according to a preset tolerance. Calculate the deformation rate of each node in the stress feature, extract the node set whose deformation rate is greater than a preset threshold, perform contour extraction and two-dimensional mapping on the node set, and generate the deformation region; Align and encapsulate the cutting area and the deformation area within the coordinate system to generate the constraint template.
3. The method for automatic location finding and adding of QR codes in a digital printing pattern according to claim 2, characterized in that, Before performing a difference operation between the initial spatial domain and the clipping region, the method further includes: Obtain the diffusion coefficient and ambient humidity of the fabric associated with the printed file; The anti-spray distance is calculated based on the diffusion coefficient and the ambient humidity. The initial airspace is equidistantly shrunken inward along its coordinate boundaries according to the anti-spray distance. The anti-spray quiet zone generated by the inward contraction is used as the updated initial airspace.
4. The method for automatically finding and adding QR codes to a digital printing pattern according to claim 3, characterized in that, Determining the added target region based on the overlap relationship between the safe region and the deformed region includes: Extract discrete connected sub-regions within the safe area and calculate the pixel area of each connected sub-region; The connected sub-regions whose pixel area is greater than a preset area threshold are marked as candidate sub-regions; Calculate the overlap area where each of the candidate sub-regions intersects with the deformation region; If there exists a candidate sub-region with an overlap area of zero, then the region with the largest pixel area is selected as the added target region. If the overlapping area of each candidate sub-region is greater than zero, then the region with the smallest overlapping area is selected as the added target region.
5. The method for automatically finding and adding QR codes to a digital printing pattern according to claim 4, characterized in that, The extreme value verification performed on the QR code generated based on the added target area, based on the extreme resolution, includes: Based on the added target area, determine the dynamic scaling ratio, and calculate the single-point side length of the QR code under the dynamic scaling ratio; Obtain the droplet diameter corresponding to the limit resolution, and multiply the droplet diameter by a preset coefficient to generate the analytical critical value; If the side length of the single point is less than the analytical critical value, then the preset critical condition is triggered.
6. The method for automatically finding and adding QR codes to a digital printing pattern according to claim 5, characterized in that, The downgrading of the text information superimposed on the added target area includes: Obtain the bounding rectangle of the text information and calculate the initial area of the bounding rectangle; Extract the coordinate intersection of the circumscribed rectangle and the added target area, and calculate the intersection area of the coordinate intersection; If the intersection area is less than the initial area, an overflow instruction is triggered, and the coordinate intersection is extracted to reconstruct the text information.
7. The method for automatically finding and adding QR codes to a digital printing pattern according to claim 1, characterized in that, The step of reconstructing the original code into a strip matrix with an aspect ratio greater than the preset ratio based on the strain tensor includes: Intercept the matrix generation instruction and map the original encoding to a non-uniform length template with an aspect ratio greater than the preset ratio; Based on the non-equal length template, a multi-segment matrix or a one-dimensional matrix is reconstructed, and the reconstruction result is determined as the strip matrix.
8. The method for automatically finding and adding QR codes to a digital printing pattern according to claim 1, characterized in that, The step of generating the mask layer on the bottom layer of the QR code, the text information, or the strip matrix and setting the corresponding background pixels to zero includes: A stripping matrix is generated based on the QR code, the text information, or the outer contour of the strip matrix, and the pixel set of the stripping matrix is assigned as pure white pixels to construct the mask layer. Extract the absolute coordinate set of the mask layer within the coordinate system; Within the absolute coordinate set, the color channels of the printed file are erased, and the corresponding pixel values are overwritten to zero to generate a scan still area.
9. The method for automatically finding and adding QR codes to a digital printing pattern according to claim 1, characterized in that, Before extracting the original encoding of the QR code generated in accordance with the added target area, the method further includes: Extract the traceability information and its feature fields associated with the printed document; The feature field and the style identifier are concatenated to generate a verification segment; The source information and the verification segment are converted into a matrix stream, and the matrix stream is determined as the original code.
10. A system for automatically locating and adding QR codes to digital printing patterns, characterized in that, A method for automatically finding and adding QR codes to a digital printed pattern as described in any one of claims 1-9 includes: The data acquisition module is used to acquire the print file to establish a coordinate system and to acquire the corresponding style identifier, strain tensor and limit resolution. The spatial domain scanning module is used to scan the printed file, extract closed pixels whose grayscale variance meets the preset variance threshold, and generate an initial spatial domain in the coordinate system. The positioning decision module is used to call the constraint template according to the style identifier. The constraint template includes a clipping area and a deformation area. The initial spatial domain and the clipping area are subjected to a difference operation to remove overlapping pixels to obtain a safe area. The target area to be added is determined based on the overlap relationship between the safe area and the deformation area. The verification and reconstruction module is used to extract the original encoding of the QR code to be generated in the added target area, and perform extreme value verification on the QR code to be generated based on the limit resolution: if a preset critical condition is triggered, the instruction to generate the QR code is intercepted and downgraded to the text information superimposed on the added target area; if the preset critical condition is not triggered, and the added target area occupies the deformation area, the original encoding is reconstructed into a strip matrix with an aspect ratio greater than a preset ratio according to the strain tensor, and the strip matrix is rotated so that its minor axis is parallel to the principal strain direction of the strain tensor; The mask output module is used to calculate the color density of the added target area. If the color density is greater than a preset density threshold, a mask layer is generated at the bottom layer of the QR code, the text information, or the strip matrix, and the corresponding background pixels are set to zero. Finally, the mask layer is superimposed on the printing file and output.
Citation Information
Patent Citations
Production method of connecting raw materials of printed clothing produced by thermal sublimation process to the Internet of Things
CN114345753B
