An AI model-based art QR code and dot code fusion generation method and system
By integrating dot matrix codes with AI models, the contradiction between aesthetic expression and scannability of artistic QR codes has been resolved. This has enabled stable recognition and high fault tolerance of customized artistic QR codes in complex environments, enhancing their application value in brand communication and high-end scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN TIGER SHRIMP NETWORK TECH CO LTD
- Filing Date
- 2026-04-01
- Publication Date
- 2026-07-10
AI Technical Summary
In existing technologies, it is difficult to balance aesthetic expressiveness and scannability in artistic QR codes. The lack of structural constraints in the AI generation process leads to low customization. Furthermore, traditional QR codes have poor fault tolerance in complex environments and cannot meet the dual needs of high-end packaging and art exhibitions.
By introducing dot matrix codes as an intermediate constraint layer and combining them with AI models, a three-layer fusion logic is established, consisting of a standard binary matrix, a dot matrix mask, and AI-customized generation. This limits the effective drawing area and performs full-dimensional detection and local repair, ensuring the scannability and anti-interference capabilities of the artistic QR codes.
It achieves a balance between high customization and strong anti-interference capabilities for artistic QR codes, enhancing their practicality and application value in scenarios such as brand communication, cultural and creative design, and high-end packaging.
Smart Images

Figure CN122366487A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of QR code generation, specifically to a method and system for generating artistic QR codes and dot matrix codes based on an AI model. Background Technology
[0002] QR codes, as an important carrier of information storage and identification, are widely used in brand communication, product packaging, cultural and creative design, and many other fields. Traditional standard QR codes use a black and white solid square matrix as their basic encoding structure. While this ensures the stability of information recognition, its visual form is monotonous, its aesthetic expression is poor, and it is difficult to integrate into personalized design scenarios. To solve this problem, existing technologies have proposed artistic QR code generation schemes, which often involve post-processing by overlaying patterns, changing colors, or simply modifying the shape of modules on the QR code surface. However, such methods easily damage the core decoding areas of the QR code, such as positioning patterns and correction patterns, leading to a significant drop in the recognition rate of the artistically modified QR codes, or even making them undecoding.
[0003] Meanwhile, with the development of AI image generation technology, some solutions attempt to directly generate artistic QR codes through AI models. However, existing AI generation processes lack rigid structural constraints on QR code encoding rules, resulting in low matching between the generated patterns and the underlying binary matrix of the QR code. This leads to the industry pain point of "looking good but not being scannable," and it cannot accurately and adaptively integrate user-customized patterns into the QR code encoding structure, only achieving simple style transfer. It is difficult to balance customization and practicality. In addition, the solid square modules of traditional QR codes have weak resistance to occlusion and distortion, and poor fault tolerance in complex usage environments, failing to meet the dual requirements of high aesthetics and high practicality in high-end packaging, art exhibitions, and other applications. Summary of the Invention
[0004] To address the aforementioned technical issues, this paper provides a method and system for fusing artistic QR codes and dot matrix codes based on an AI model. This technical solution introduces dot matrix codes as an intermediate constraint layer between the QR code encoding structure and AI artistic generation, and establishes a three-layer fusion logic consisting of a standard binary matrix, a dot matrix mask, and AI-customized generation. This solves the problems in existing technologies where artistic modification destroys the encoding, AI generation is uncontrollable, and customized patterns cannot be accurately fused. This achieves a unified approach to highly customizable artistic QR codes, scannability, and strong anti-interference capabilities.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] A method for fusing and generating artistic QR codes and dot matrix codes based on an AI model includes:
[0007] The system obtains the target encoding information input by the user, generates a standard QR code binary matrix based on the international QR code encoding standard, and marks the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area.
[0008] The standard QR code binary matrix is converted into a dot matrix constraint mask to establish a mapping relationship between binary values and dot matrix units, while adaptively adjusting the size and spacing of the dot matrix units.
[0009] The dot matrix constraint mask is input as a structural guiding condition into the AI generation model with constraint branches. At the same time, user-customized patterns or style instructions are imported. The customized pattern is adaptively filled within the effective area defined by the dot matrix constraint mask to generate the initial artistic dot matrix QR code.
[0010] The initial artistic dot matrix QR code is decoded and its compliance is checked in all dimensions. For areas that fail the check, a partial rollback is performed to repair them and generate a compliant artistic dot matrix QR code.
[0011] The compliant art dot matrix QR code is optimized for dot matrix aesthetics, and the final integrated art QR code is output.
[0012] Preferably, the step of obtaining the target encoding information input by the user, generating a standard QR code binary matrix based on the international QR code encoding standard, and marking the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area includes:
[0013] Receive target encoding information input by the user, including but not limited to: text, URL, mini-program link and traceability information, and obtain the QR code version and error correction level selected by the user;
[0014] Based on the international QR code encoding standard, the target encoding information is encoded and converted to generate a standard QR code binary matrix unit that matches the selected version and error correction level;
[0015] The binary matrix unit refers to a discretized matrix unit composed of binary 0s and 1s;
[0016] Identify the corner loop pattern used for QR code positioning, the center pattern used for correction, and the format information area used for parsing encoded information in the binary matrix;
[0017] Mark the format information area as the core protection area, set the matrix units within the core protection area to be unmodifiable, and prohibit subsequent artistic modifications to them.
[0018] Preferably, the step of converting the standard QR code binary matrix into a dot matrix constraint mask, establishing a mapping relationship between binary values and dot matrix elements, and adaptively adjusting the size and spacing of the dot matrix elements includes:
[0019] Establish a one-to-one mapping relationship between the standard QR code binary matrix and the dot matrix unit, and set binary 1 to correspond to the effective display dot matrix unit in the dot matrix constraint mask, and binary 0 to correspond to the blank weakened dot matrix unit in the dot matrix constraint mask, to form the basic dot matrix mask.
[0020] Identify high-density, medium-density and low-density coding regions in the basic dot matrix mask. High-density regions are those where the proportion of effective display dot matrix units is greater than the first threshold, medium-density regions are those where the proportion is between the second threshold and the first threshold, and low-density regions are those where the proportion is less than the second threshold.
[0021] The dot matrix units in high-density areas are scaled down proportionally, the dot matrix units in low-density areas are scaled up proportionally, and the dot matrix units in medium-density areas are kept at their original size. At the same time, the spacing between the dot matrix units is kept to match the decoding threshold to generate the final dot matrix constraint mask.
[0022] Mark the lattice elements corresponding to the core protection area in the lattice constraint mask as fixed lattice elements, and set the shape, size, and spacing of the fixed lattice elements to be non-adjustable.
[0023] Preferably, the step of inputting the dot matrix constraint mask as a structural guiding condition into the AI generation model with constraint branches, while simultaneously importing user-customized patterns or style instructions, and completing the adaptive filling of the customized pattern within the effective area defined by the dot matrix constraint mask to generate the initial artistic dot matrix QR code includes:
[0024] An AI generative model with a structural constraint branch is constructed. The AI generative model includes a basic generative network and a ControlNet structural constraint branch. The ControlNet structural constraint branch is used to receive a dot matrix constraint mask and output a structure-guided feature map.
[0025] The lattice constraint mask is input into the ControlNet structural constraint branch, and a structural guided feature map matching the lattice structure is obtained through feature extraction.
[0026] The structure-guided feature map defines the effective drawing area generated by AI as the effective display dot matrix unit area in the dot matrix constraint mask;
[0027] Input the user-imported custom patterns or style instructions into the basic generation network;
[0028] The customized patterns include, but are not limited to: brand logos, artistic illustrations and cartoon characters; style instructions include, but are not limited to: ink painting, cyberpunk, pixel and gradient.
[0029] Based on the basic generative network and combined with the structure-guided feature map, the texture and details of the custom pattern are filled in the effective display dot matrix unit area, and the matching background is generated in the non-effective area to generate the initial artistic dot matrix QR code.
[0030] Preferably, the step of performing a full-dimensional compliance check on the initial art dot matrix QR code, and performing a partial rollback repair on areas that fail the check to generate a compliant art dot matrix QR code includes:
[0031] A decoding compliance testing index system is constructed, which includes four testing indicators: integrity of the core protection area, contrast of the dot matrix unit, connectivity of the dot matrix unit, and compliance of the blank area.
[0032] The initial artistic dot matrix QR code was tested in sequence for each detection index;
[0033] If all test indicators meet the standards, the initial art dot matrix QR code decoding is deemed compliant and it is directly used as a compliant art dot matrix QR code.
[0034] If any test indicator fails to meet the standard, the area corresponding to that indicator will be marked as an unqualified area, and a partial rollback repair will be performed on the unqualified area.
[0035] The local rollback repair refers to rolling back the artistic pattern in the unqualified area to the corresponding dot matrix constraint mask state of the area, and only calling the AI generation model again to fill the local pattern in the area.
[0036] Based on partial rollback repair, until the detection indicators of the area meet the standards, a compliant artistic dot matrix QR code is generated.
[0037] Preferably, the step of optimizing the dot matrix morphology of the compliant art dot matrix QR code to output the final fused art QR code includes:
[0038] An oversampling anti-aliasing algorithm is used to smooth the edges of the dot matrix units of the compliant artistic dot matrix QR code;
[0039] The supersampling anti-aliasing algorithm calculates sub-pixel level grayscale transition values after sampling the edge region of the dot matrix unit at multiple rates, replacing the original binarized edge.
[0040] Extract the color gradient distribution of the customized pattern in the neighborhood of the dot matrix unit, and perform linear interpolation of the color value of the dot matrix unit according to the position weight of its neighborhood pattern to optimize the gradient adaptation of the color of the dot matrix unit.
[0041] An unsharpened mask enhancement algorithm is used to improve the contrast of texture details in the dot matrix unit area, and bilateral filtering is used as an edge-preserving constraint to limit the adjustment range;
[0042] The optimized artistic dot matrix QR code is converted into a high-definition vector format, and PNG and JPG bitmap formats are output simultaneously to obtain the final integrated artistic QR code.
[0043] Furthermore, this solution proposes an AI-model-based system for fusing and generating artistic QR codes and dot matrix codes, to implement the aforementioned AI-model-based method for fusing and generating artistic QR codes and dot matrix codes, including:
[0044] The QR code generation module is used to acquire the target encoding information input by the user, generate a standard QR code binary matrix based on the international QR code encoding standard, and mark the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area; convert the standard QR code binary matrix into a dot matrix constraint mask, establish the mapping relationship between binary values and dot matrix units, and adaptively adjust the size and spacing of the dot matrix units; input the dot matrix constraint mask as a structural guidance condition into an AI generation model with constraint branches, and simultaneously import user-customized patterns or style instructions to complete the adaptive filling of the customized pattern within the effective area defined by the dot matrix constraint mask, generating an initial artistic dot matrix QR code;
[0045] The verification and optimization module is used to perform full-dimensional verification of the initial artistic dot matrix QR code for decoding compliance, perform local rollback repair on areas that fail the verification, generate compliant artistic dot matrix QR codes, and optimize the dot matrix morphology aesthetics of the compliant artistic dot matrix QR codes to output the final fused artistic QR code.
[0046] Preferably, the QR code generation module includes:
[0047] Binary matrix unit, the binary matrix unit is used to obtain the target encoding information input by the user, generate a standard QR code binary matrix based on the international QR code encoding standard, and mark the positioning pattern, correction pattern and format information area in the binary matrix as the core protection area;
[0048] The dot matrix constraint unit is used to convert the standard QR code binary matrix into a dot matrix constraint mask, establish a mapping relationship between binary values and dot matrix units, and adaptively adjust the size and spacing of the dot matrix units.
[0049] The QR code generation unit is used to input the dot matrix constraint mask as a structural guiding condition into the AI generation model with constraint branches, and at the same time import user-customized patterns or style instructions to complete the adaptive filling of the customized pattern within the effective area defined by the dot matrix constraint mask, thereby generating an initial artistic dot matrix QR code.
[0050] Preferably, the verification and optimization module includes:
[0051] The verification unit is used to perform a full-dimensional verification of the decoding compliance of the initial art dot matrix QR code, perform local rollback repair on areas that fail the verification, and generate a compliant art dot matrix QR code.
[0052] The optimization unit is used to optimize the dot matrix morphology of the compliant art dot matrix QR code and output the final fused art QR code.
[0053] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0054] This invention provides a solution for fusing artistic QR codes and dot matrix codes based on an AI model. It constructs a three-layer fusion architecture consisting of a standard binary matrix, a dot matrix mask, and AI-customized generation. Dot matrix codes are introduced as an intermediate constraint layer, transforming the QR code's encoded information into a discrete dot matrix structure. ControlNet structural constraint branches are used to rigidly control the AI generation process, limiting the effective drawing area to only the dot matrix unit regions carrying the encoded information. This achieves pixel-level adaptive filling of customized patterns and dot matrix encoding structures. Simultaneously, a full-dimensional decoding compliance detection and local rollback repair mechanism ensure the generated result is scannable. This approach effectively solves the technical problems of existing technologies, such as the conflict between aesthetics and scannability of artistic QR codes, the uncontrollable AI-generated structure, and poor adaptability of customized patterns. It achieves highly customized artistic visual effects while ensuring stable QR code recognition, thereby effectively enhancing the practicality and application value of artistic QR codes in brand communication, cultural and creative design, and high-end packaging. Attached Figure Description
[0055] Figure 1 This is a flowchart of a method for generating artistic QR codes and dot matrix codes based on an AI model according to the present invention.
[0056] Figure 2 The flowchart for generating a standard QR code binary matrix and marking the positioning pattern, correction pattern and format information area in the binary matrix as the core protection area is as follows:
[0057] Figure 3 This is a flowchart illustrating the process of converting a standard QR code binary matrix into a dot matrix constraint mask according to the present invention.
[0058] Figure 4 This is a flowchart illustrating the process of generating the initial artistic dot matrix QR code according to the present invention.
[0059] Figure 5 This is a flowchart of the full-dimensional compliance detection process for decoding the initial artistic dot matrix QR code according to the present invention;
[0060] Figure 6 This is a flowchart illustrating the optimization of the dot matrix morphology of compliant artistic dot matrix QR codes according to the present invention. Detailed Implementation
[0061] The following description is intended to disclose the invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious variations will occur to those skilled in the art.
[0062] Reference Figure 1 As shown, a method for fusing and generating artistic QR codes and dot matrix codes based on an AI model includes:
[0063] The system obtains the target encoding information input by the user, generates a standard QR code binary matrix based on the international QR code encoding standard, and marks the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area.
[0064] The standard QR code binary matrix is converted into a dot matrix constraint mask to establish a mapping relationship between binary values and dot matrix units, while adaptively adjusting the size and spacing of the dot matrix units.
[0065] The dot matrix constraint mask is input as a structural guiding condition into the AI generation model with constraint branches. At the same time, user-customized patterns or style instructions are imported. The customized pattern is adaptively filled within the effective area defined by the dot matrix constraint mask to generate the initial artistic dot matrix QR code.
[0066] The initial artistic dot matrix QR code is decoded and its compliance is checked in all dimensions. For areas that fail the check, a partial rollback is performed to repair them and generate a compliant artistic dot matrix QR code.
[0067] The compliant art dot matrix QR code is optimized for dot matrix aesthetics, and the final integrated art QR code is output.
[0068] This solution uses dot matrix codes as an intermediate constraint layer to establish a bridge between standard QR code encoding and AI art generation, achieving a triple unification of artistic QR code customization, scanability, and anti-interference, thus solving the core pain points of existing technologies.
[0069] Reference Figure 2 As shown, the process of generating a standard QR code binary matrix and marking the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area includes:
[0070] Receive target encoding information input by the user, including but not limited to: text, URL, mini-program link and traceability information, and obtain the QR code version and error correction level selected by the user;
[0071] Based on the international QR code encoding standard, the target encoding information is encoded and converted to generate a standard QR code binary matrix unit that matches the selected version and error correction level;
[0072] The binary matrix unit refers to a discretized matrix unit composed of binary 0s and 1s;
[0073] Identify the corner loop pattern used for QR code positioning, the center pattern used for correction, and the format information area used for parsing encoded information in the binary matrix;
[0074] Mark the format information area as the core protection area, set the matrix units within the core protection area to be unmodifiable, and prohibit subsequent artistic modifications to them.
[0075] This can be explained by the fact that this solution ensures the scannability of QR codes from the outset by constructing the underlying functional framework of the artistic QR code. Specifically:
[0076] The type of target encoded information does not affect the generation logic of the binary matrix; only the corresponding QR code version needs to be matched according to the information capacity. The error correction level is preferably the highest fault tolerance level, which can further improve the fault tolerance capability after subsequent artistic modifications, because a high error correction level allows the QR code to still be correctly decoded even when a larger area is modified or obscured. The core protected area is the key structure for the QR code decoding device to identify and parse information, including the three corner ring positioning patterns, several correction patterns, and the format information area used to parse the encoded information. Modification of these areas will directly lead to decoding failure. Setting them to an unmodifiable state can prevent subsequent dot matrix conversion and AI artistic generation from destroying the basic encoding structure of the QR code, ensuring that the decoding device can accurately identify the basic information of the QR code. This results in a standard QR code binary matrix with complete encoding function and a protected core area, providing a stable functional foundation for subsequent dot matrix conversion and artistic generation, and solving the problem in existing technologies where artistic modifications easily damage the core decoding area.
[0077] Reference Figure 3 As shown, the process of converting a standard QR code binary matrix into a dot matrix constraint mask includes:
[0078] Establish a one-to-one mapping relationship between the standard QR code binary matrix and the dot matrix unit, and set binary 1 to correspond to the effective display dot matrix unit in the dot matrix constraint mask, and binary 0 to correspond to the blank weakened dot matrix unit in the dot matrix constraint mask, to form the basic dot matrix mask.
[0079] Identify high-density, medium-density and low-density coding regions in the basic dot matrix mask. High-density regions are those where the proportion of effective display dot matrix units is greater than the first threshold, medium-density regions are those where the proportion is between the second threshold and the first threshold, and low-density regions are those where the proportion is less than the second threshold.
[0080] The dot matrix units in high-density areas are scaled down proportionally, the dot matrix units in low-density areas are scaled up proportionally, and the dot matrix units in medium-density areas are kept at their original size. At the same time, the spacing between the dot matrix units is kept to match the decoding threshold to generate the final dot matrix constraint mask.
[0081] Mark the lattice elements corresponding to the core protection area in the lattice constraint mask as fixed lattice elements, and set the shape, size, and spacing of the fixed lattice elements to be non-adjustable.
[0082] This solution works by constructing a rigid structural constraint boundary for AI-generated art, thereby improving the QR code's anti-interference capability and visual consistency. Specifically, the dot matrix constraint mask serves as the core intermediate layer connecting the standard binary matrix and the AI-generated art. Through the mapping between binary data and dot matrix units, it transforms the QR code's encoded information into a discrete dot matrix structure. After the discrete dot matrix replaces the traditional solid squares, the impact of local occlusion and wear on the overall encoding is reduced from destroying the entire module to affecting only a single dot matrix unit, effectively improving the QR code's fault tolerance.
[0083] The first and second thresholds are determined comprehensively based on the QR code version, error correction level, and recognition accuracy of the decoding device. In this embodiment, the first threshold is set to 70%, and the second threshold is set to 40%. That is, areas with more than 70% of the effective display dot matrix units per unit area are considered high-density areas, areas with less than 40% are considered low-density areas, and areas with a proportion between 40% and 70% are considered medium-density areas. By introducing medium-density areas and keeping their dot matrix unit size unchanged, abrupt processing changes caused by a single threshold division can be avoided, ensuring a smooth transition of the dot matrix mask between different density areas. Reducing the dot matrix unit size in high-density areas can prevent dot matrix unit overlap from causing inability to distinguish effective modules during decoding. Enlarging low-density areas can prevent insufficient contrast due to overly sparse dot matrix units. Maintaining the original size of medium-density areas can reduce unnecessary adjustments while ensuring decoding accuracy. The adjustment of the dot matrix unit spacing is constrained by the QR code decoding threshold, that is, ensuring that the distance between dot matrix units is not less than the minimum distance between standard QR code modules, ensuring that mainstream commercial decoders can recognize stably.
[0084] The fixed dot matrix units corresponding to the core protection area can further strengthen the protection of the core decoding structure of the QR code, ensuring that the dot matrix conversion process does not affect the basic recognition function of the QR code. Based on this, a dot matrix constraint mask with both encoding constraint function and visual adaptability can be obtained, which delineates a clear artistic modification area for subsequent AI generation, solving the problem of AI generation without structural constraints and easy destruction of encoding in existing technologies.
[0085] Reference Figure 4 As shown, generating the initial art dot matrix QR code includes:
[0086] An AI generative model with a structural constraint branch is constructed. The AI generative model includes a basic generative network and a ControlNet structural constraint branch. The ControlNet structural constraint branch is used to receive a dot matrix constraint mask and output a structure-guided feature map.
[0087] The lattice constraint mask is input into the ControlNet structural constraint branch, and a structural guided feature map matching the lattice structure is obtained through feature extraction.
[0088] The structure-guided feature map defines the effective drawing area generated by AI as the effective display dot matrix unit area in the dot matrix constraint mask;
[0089] Input the user-imported custom patterns or style instructions into the basic generation network;
[0090] The customized patterns include, but are not limited to: brand logos, artistic illustrations and cartoon characters; style instructions include, but are not limited to: ink painting, cyberpunk, pixel and gradient.
[0091] Based on the basic generative network and combined with the structure-guided feature map, the texture and details of the custom pattern are filled in the effective display dot matrix unit area, and the matching background is generated in the non-effective area to generate the initial artistic dot matrix QR code.
[0092] This can be explained by the fact that this solution ensures the precision and customization of the artistic transformation through the deep integration of customized patterns and dot matrix coding structures. Specifically:
[0093] The preferred AI generative model is Stable Diffusion combined with ControlNet structural constraint branches. Stable Diffusion is a generative AI based on a diffusion model that can generate high-quality images based on text or image prompts. It uses Stable Diffusion as the basic generative network, which is based on a diffusion model architecture and generates images that match the input prompts from random noise through progressive denoising. ControlNet is a technical module specifically used to control the generative structure of the diffusion model. By replicating the encoder weights of the basic generative network and introducing zero convolutional layers, it uses the lattice constraint mask as a conditional input, extracts its structural features, and injects them into each layer of the basic generative network, thereby achieving precise control over the spatial structure of the generated image.
[0094] The structure-guided feature map is essentially a high-dimensional representation of the dot matrix constraint mask in the ControlNet feature space. It limits the effective drawing area generated by AI to only the effective display dot matrix unit area. This means that the visual elements such as texture, color, and light and shadow of the customized pattern are only filled inside the dot matrix unit that carries the encoded information, rather than being covered on the surface of the QR code as in existing technologies. Since the dot matrix constraint mask precisely limits the position and size of the effective display dot matrix unit, the filling of the customized pattern is only carried out inside the unit, without changing the structural position of the unit and the encoding mapping relationship, thus ensuring that the encoded information of the QR code is completely preserved.
[0095] The import of customized patterns supports pixel-level feature extraction and fusion. The AI model analyzes the main color tone, texture features, and edge contours of the customized pattern and adaptively fits it into the limited space of the dot matrix units. Style instructions influence the output distribution of the basic generative network through conditional guidance, thereby optimizing the overall visual effect. Invalid dot matrix areas (i.e., blank areas corresponding to binary 0) generate background filling effects based on the main color tone or style instructions of the customized pattern, making the background and customized pattern visually coordinated and unified. This improves the overall visual coordination of the artistic QR code and avoids the problem of the pattern and background becoming disconnected. This process yields an initial artistic dot matrix QR code that combines customized artistic effects with a dot matrix encoding structure, solving the problems of poor adaptability of customized patterns and the inability to achieve only simple style transfer in existing technologies.
[0096] Reference Figure 5 As shown, the comprehensive compliance check of decoding the initial art dot matrix QR code includes:
[0097] A decoding compliance testing index system is constructed, which includes four testing indicators: integrity of the core protection area, contrast of the dot matrix unit, connectivity of the dot matrix unit, and compliance of the blank area.
[0098] The initial artistic dot matrix QR code was tested in sequence for each detection index;
[0099] If all test indicators meet the standards, the initial art dot matrix QR code decoding is deemed compliant and it is directly used as a compliant art dot matrix QR code.
[0100] If any test indicator fails to meet the standard, the area corresponding to that indicator will be marked as an unqualified area, and a partial rollback repair will be performed on the unqualified area.
[0101] The local rollback repair refers to rolling back the artistic pattern in the unqualified area to the corresponding dot matrix constraint mask state of the area, and only calling the AI generation model again to fill the local pattern in the area.
[0102] Based on partial rollback repair, until the detection indicators of the area meet the standards, a compliant artistic dot matrix QR code is generated.
[0103] This can be explained by the fact that this solution verifies the compliance of the initial artistic dot matrix QR code generated by the AI-generated model, ensuring that the final generated artistic QR code is scannable. Specifically, the four indicators in the detection index system are all key indicators for QR code decoding devices to recognize:
[0104] Integrity of the core protected area: The corner positioning pattern, several correction patterns, and the format information area used to parse the encoded information are the basis for decoding. Any modification may lead to decoding failure. This indicator compares the image of the core protected area in the initial artistic dot matrix QR code with the corresponding area in the dot matrix constraint mask pixel by pixel. The gray values of the two images are compared pixel by pixel. If the gray value difference of any pixel exceeds the preset tolerance threshold, it is determined that the area has been modified. The preset tolerance threshold is determined according to the noise level in the image acquisition and generation process. In this embodiment, the value is 5% gray value difference, which allows small color fluctuations caused by image compression or rendering, but prohibits any structural modifications.
[0105] Dot matrix unit contrast: Sufficient grayscale or color difference must be maintained between the effective display dot matrix units (areas corresponding to binary 1) and the blank weakened dot matrix units (areas corresponding to binary 0); otherwise, the decoding device cannot distinguish between 0 and 1. This indicator is determined by calculating the difference between the average grayscale value of the effective display dot matrix unit area and the average grayscale value of the blank weakened dot matrix unit area, and judging whether the difference is greater than a preset contrast threshold. The preset contrast threshold is set according to the general recognition requirements of the decoding device. In this embodiment, the value is 30% of the maximum grayscale level, that is, the brightness difference between the effective dot matrix unit and the blank area should be at least 30% of the maximum brightness difference.
[0106] Dot matrix unit connectivity: During the AI generation process, pattern filling may cause dot matrix units that should be independent to form meaningless connections, forming connected regions. Such connections may be misidentified by the decoding device as a single large module, causing the encoded information to be disordered. This detection uses a connected component analysis algorithm to extract the connected components of all valid display dot matrix units. If the area of a single connected component exceeds a preset connectivity threshold (in this embodiment, the value is 1.5 times the area of a single dot matrix unit), it is determined that there is meaningless connectivity.
[0107] Blank area compliance: The QR code standard stipulates that a certain width of blank area (quiet area) must be reserved around the QR code to help the decoding device locate the QR code boundary. This test uses an image edge detection algorithm to determine whether there are valid display dot matrix units or significant patterns in the blank area at the edge of the QR code. If so, the blank area is deemed non-compliant.
[0108] Local rollback repair differs from overall redrawing. It involves cropping a local image from the non-compliant area, using its corresponding original bitmask sub-region as a new constraint, and combining the surrounding pattern as contextual cues. The AI generation model is then invoked to perform local redrawing. After repair, the repaired area is seamlessly stitched into the original image, and compliance checks are performed again. This ensures that the decoding compliance is guaranteed while maximizing the preservation of the AI-generated artistic pattern and improving generation efficiency.
[0109] Reference Figure 6 As shown, the optimization of the dot matrix morphology of the compliant art dot matrix QR code includes:
[0110] An oversampling anti-aliasing algorithm is used to smooth the edges of the dot matrix units of the compliant artistic dot matrix QR code;
[0111] The supersampling anti-aliasing algorithm calculates sub-pixel level grayscale transition values after sampling the edge region of the dot matrix unit at multiple rates, replacing the original binarized edge.
[0112] Extract the color gradient distribution of the customized pattern in the neighborhood of the dot matrix unit, and perform linear interpolation of the color value of the dot matrix unit according to the position weight of its neighborhood pattern to optimize the gradient adaptation of the color of the dot matrix unit.
[0113] An unsharpened mask enhancement algorithm is used to improve the contrast of texture details in the dot matrix unit area, and bilateral filtering is used as an edge-preserving constraint to limit the adjustment range;
[0114] The optimized artistic dot matrix QR code is converted into a high-definition vector format, and PNG and JPG bitmap formats are output simultaneously to obtain the final integrated artistic QR code.
[0115] This solution, while ensuring the encoding functionality, further enhances the visual aesthetics of artistic QR codes, meeting the needs of high-end scenarios such as brand communication and cultural and creative design. Specifically:
[0116] The jagged edges of the dot matrix units are a common visual problem when fusing discrete dot matrix structures with AI-generated continuous patterns. The oversampling anti-aliasing algorithm increases the rendering resolution of the edge region of the dot matrix units to 2 or 4 times that of the original image, calculates the coverage of edge pixels at a higher resolution, and then downsamples the calculation results back to the original resolution, thereby obtaining a smooth edge transition at the subpixel level. This makes the boundary between the dot matrix units and the background pattern change from a hard switch to a soft transition, eliminating the visual abruptness.
[0117] Color gradient adaptation optimization is based on the color distribution characteristics of the customized pattern in the neighborhood of the dot matrix unit. By analyzing the main color direction and gradient change trend of the background pattern around the dot matrix unit, the color of the dot matrix unit is linearly interpolated according to the distance weight between the dot matrix unit and each reference point in the neighborhood. This adjustment only affects the color attribute of the dot matrix unit and does not change the spatial position and size of the dot matrix unit. Therefore, it will not affect the encoding structure of the QR code. For the dot matrix unit in the core protection area, its color adjustment range is limited by the color constraint of the original dot matrix constraint mask to ensure that the visual features of the core area maintain the recognizability of the standard QR code.
[0118] The fine-tuning of pattern details is only applied to the artistic expression layer. An unsharpened mask enhancement algorithm is used: high-frequency detail components are extracted from the original image, multiplied by the enhancement coefficient, and then superimposed back onto the original image. This improves the texture sharpness and detail of the customized pattern within the dot matrix unit area. To prevent over-enhancement from causing edge distortion, a bilateral filter is introduced as an edge-preserving constraint to ensure that the enhanced image does not produce new artifacts or change the boundary position of the dot matrix unit. This adjustment process does not change the position, size, spacing, or other coding structure parameters of the dot matrix unit, ensuring that the optimization process does not affect the scannability of the QR code.
[0119] Outputting in high-definition vector formats (such as SVG and EPS) allows the storage of dot matrix units and artistic patterns as mathematical curves and filled areas, ensuring that the artistic QR code maintains a clear visual effect at any scaling ratio, meeting the printing and display needs of different scenarios. It also outputs common bitmap formats such as PNG and JPG, making it easy to use directly in digital media.
[0120] Furthermore, based on the same inventive concept as the aforementioned AI-based method for fusing and generating artistic QR codes and dot matrix codes, this solution proposes an AI-based system for fusing and generating artistic QR codes and dot matrix codes, comprising:
[0121] The QR code generation module is used to acquire the target encoding information input by the user, generate a standard QR code binary matrix based on the international QR code encoding standard, and mark the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area; convert the standard QR code binary matrix into a dot matrix constraint mask, establish the mapping relationship between binary values and dot matrix units, and adaptively adjust the size and spacing of the dot matrix units; input the dot matrix constraint mask as a structural guidance condition into an AI generation model with constraint branches, and simultaneously import user-customized patterns or style instructions to complete the adaptive filling of the customized pattern within the effective area defined by the dot matrix constraint mask, generating an initial artistic dot matrix QR code;
[0122] The verification and optimization module is used to perform full-dimensional verification of the initial artistic dot matrix QR code for decoding compliance, perform local rollback repair on areas that fail the verification, generate compliant artistic dot matrix QR codes, and optimize the dot matrix shape aesthetics of the compliant artistic dot matrix QR codes to output the final fused artistic QR code.
[0123] The QR code generation module includes:
[0124] Binary matrix unit, the binary matrix unit is used to obtain the target encoding information input by the user, generate a standard QR code binary matrix based on the international QR code encoding standard, and mark the positioning pattern, correction pattern and format information area in the binary matrix as the core protection area;
[0125] The dot matrix constraint unit is used to convert the standard QR code binary matrix into a dot matrix constraint mask, establish a mapping relationship between binary values and dot matrix units, and adaptively adjust the size and spacing of the dot matrix units.
[0126] The QR code generation unit is used to input the dot matrix constraint mask as a structural guidance condition into the AI generation model with constraint branches, and at the same time import user-customized patterns or style instructions to complete the adaptive filling of the customized pattern within the effective area defined by the dot matrix constraint mask, thereby generating an initial artistic dot matrix QR code.
[0127] The verification and optimization module includes:
[0128] The verification unit is used to perform a full-dimensional verification of the decoding compliance of the initial art dot matrix QR code, perform local rollback repair on areas that fail the verification, and generate a compliant art dot matrix QR code.
[0129] The optimization unit is used to optimize the dot matrix morphology of the compliant art dot matrix QR code and output the final fused art QR code.
[0130] In summary, the advantages of this invention are: by using dot matrix codes as an intermediate constraint layer to achieve rigid structural control of the AI generation process, while ensuring scanability, it achieves pixel-level deep fusion of customized patterns and coding structures, thus solving the technical problem of artistic QR codes being aesthetically pleasing but unscannable.
[0131] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for fusing and generating artistic QR codes and dot matrix codes based on an AI model, characterized in that, include: The system obtains the target encoding information input by the user, generates a standard QR code binary matrix based on the international QR code encoding standard, and marks the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area. The standard QR code binary matrix is converted into a dot matrix constraint mask to establish a mapping relationship between binary values and dot matrix units, while adaptively adjusting the size and spacing of the dot matrix units. The dot matrix constraint mask is input as a structural guiding condition into the AI generation model with constraint branches. At the same time, user-customized patterns or style instructions are imported. The customized pattern is adaptively filled within the effective area defined by the dot matrix constraint mask to generate the initial artistic dot matrix QR code. The initial artistic dot matrix QR code is decoded and its compliance is checked in all dimensions. For areas that fail the check, a partial rollback is performed to repair them and generate a compliant artistic dot matrix QR code. The compliant art dot matrix QR code is optimized for dot matrix aesthetics, and the final integrated art QR code is output.
2. The method for fusing and generating artistic QR codes and dot matrix codes based on an AI model according to claim 1, characterized in that, The process of obtaining the target encoding information input by the user, generating a standard QR code binary matrix based on the international QR code encoding standard, and marking the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area includes: Receive target encoding information input by the user, including but not limited to: text, URL, mini-program link and traceability information, and obtain the QR code version and error correction level selected by the user; Based on the international QR code encoding standard, the target encoding information is encoded and converted to generate a standard QR code binary matrix unit that matches the selected version and error correction level; The binary matrix unit refers to a discretized matrix unit composed of binary 0s and 1s; Identify the corner loop pattern used for QR code positioning, the center pattern used for correction, and the format information area used for parsing encoded information in the binary matrix; Mark the format information area as the core protection area, set the matrix units within the core protection area to be unmodifiable, and prohibit subsequent artistic modifications to them.
3. The method for fusing and generating artistic QR codes and dot matrix codes based on an AI model according to claim 2, characterized in that, The process of converting a standard QR code binary matrix into a dot matrix constraint mask, establishing a mapping relationship between binary values and dot matrix elements, and adaptively adjusting the size and spacing of the dot matrix elements includes: Establish a one-to-one mapping relationship between the standard QR code binary matrix and the dot matrix unit, and set binary 1 to correspond to the effective display dot matrix unit in the dot matrix constraint mask, and binary 0 to correspond to the blank weakened dot matrix unit in the dot matrix constraint mask, to form the basic dot matrix mask. Identify high-density, medium-density and low-density coding regions in the basic dot matrix mask. High-density regions are those where the proportion of effective display dot matrix units is greater than the first threshold, medium-density regions are those where the proportion is between the second threshold and the first threshold, and low-density regions are those where the proportion is less than the second threshold. The dot matrix units in high-density areas are scaled down proportionally, the dot matrix units in low-density areas are scaled up proportionally, and the dot matrix units in medium-density areas are kept at their original size. At the same time, the spacing between the dot matrix units is kept to match the decoding threshold to generate the final dot matrix constraint mask. Mark the lattice elements corresponding to the core protection area in the lattice constraint mask as fixed lattice elements, and set the shape, size, and spacing of the fixed lattice elements to be non-adjustable.
4. The method for fusing and generating artistic QR codes and dot matrix codes based on an AI model according to claim 3, characterized in that, The process of inputting a dot matrix constraint mask as a structural guiding condition into an AI generation model with constraint branches, while simultaneously importing user-customized patterns or style instructions, and adaptively filling the customized pattern within the effective area defined by the dot matrix constraint mask to generate an initial artistic dot matrix QR code includes: An AI generative model with a structural constraint branch is constructed. The AI generative model includes a basic generative network and a ControlNet structural constraint branch. The ControlNet structural constraint branch is used to receive a dot matrix constraint mask and output a structure-guided feature map. The lattice constraint mask is input into the ControlNet structural constraint branch, and a structural guided feature map matching the lattice structure is obtained through feature extraction. The structure-guided feature map defines the effective drawing area generated by AI as the effective display dot matrix unit area in the dot matrix constraint mask; Input the user-imported custom patterns or style instructions into the basic generation network; The customized patterns include, but are not limited to: brand logos, artistic illustrations and cartoon characters; style instructions include, but are not limited to: ink painting, cyberpunk, pixel and gradient. Based on the basic generative network and combined with the structure-guided feature map, the texture and details of the custom pattern are filled in the effective display dot matrix unit area, and the matching background is generated in the non-effective area to generate the initial artistic dot matrix QR code.
5. The method for fusing and generating artistic QR codes and dot matrix codes based on an AI model according to claim 4, characterized in that, The process of performing a full-dimensional compliance check on the initial art dot matrix QR code, and performing partial rollback repair on areas that fail the check to generate a compliant art dot matrix QR code includes: A decoding compliance testing index system is constructed, which includes four testing indicators: integrity of the core protection area, contrast of the dot matrix unit, connectivity of the dot matrix unit, and compliance of the blank area. The initial artistic dot matrix QR code was tested in sequence for each detection index; If all test indicators meet the standards, the initial art dot matrix QR code decoding is deemed compliant and it is directly used as a compliant art dot matrix QR code. If any test indicator fails to meet the standard, the area corresponding to that indicator will be marked as an unqualified area, and a partial rollback repair will be performed on the unqualified area. The local rollback repair refers to rolling back the artistic pattern in the unqualified area to the corresponding dot matrix constraint mask state of the area, and only calling the AI generation model again to fill the local pattern in the area. Based on partial rollback repair, until the detection indicators of the area meet the standards, a compliant artistic dot matrix QR code is generated.
6. The method for fusing and generating artistic QR codes and dot matrix codes based on an AI model according to claim 5, characterized in that, The optimization of the dot matrix morphology of the compliant art dot matrix QR code to output the final fused art QR code includes: An oversampling anti-aliasing algorithm is used to smooth the edges of the dot matrix units of the compliant artistic dot matrix QR code; The supersampling anti-aliasing algorithm calculates sub-pixel level grayscale transition values after sampling the edge region of the dot matrix unit at multiple rates, replacing the original binarized edge. Extract the color gradient distribution of the customized pattern in the neighborhood of the dot matrix unit, and perform linear interpolation of the color value of the dot matrix unit according to the position weight of its neighborhood pattern to optimize the gradient adaptation of the color of the dot matrix unit. An unsharpened mask enhancement algorithm is used to improve the contrast of texture details in the dot matrix unit area, and bilateral filtering is used as an edge-preserving constraint to limit the adjustment range; The optimized artistic dot matrix QR code is converted into a high-definition vector format, and PNG and JPG bitmap formats are output simultaneously to obtain the final integrated artistic QR code.
7. A system for fusing and generating artistic QR codes and dot matrix codes based on an AI model, characterized in that, The method for fusing and generating artistic QR codes and dot matrix codes based on AI models as described in any one of claims 1-6 includes: The QR code generation module is used to acquire the target encoding information input by the user, generate a standard QR code binary matrix based on the international QR code encoding standard, and mark the positioning pattern, correction pattern, and format information area in the binary matrix as the core protection area; convert the standard QR code binary matrix into a dot matrix constraint mask, establish the mapping relationship between binary values and dot matrix units, and adaptively adjust the size and spacing of the dot matrix units; input the dot matrix constraint mask as a structural guidance condition into an AI generation model with constraint branches, and simultaneously import user-customized patterns or style instructions to complete the adaptive filling of the customized pattern within the effective area defined by the dot matrix constraint mask, generating an initial artistic dot matrix QR code; The verification and optimization module is used to perform full-dimensional verification of the initial artistic dot matrix QR code for decoding compliance, perform local rollback repair on areas that fail the verification, generate compliant artistic dot matrix QR codes, and optimize the dot matrix morphology aesthetics of the compliant artistic dot matrix QR codes to output the final fused artistic QR code.
8. The AI-based artistic QR code and dot matrix code fusion generation system according to claim 7, characterized in that, The QR code generation module includes: Binary matrix unit, the binary matrix unit is used to obtain the target encoding information input by the user, generate a standard QR code binary matrix based on the international QR code encoding standard, and mark the positioning pattern, correction pattern and format information area in the binary matrix as the core protection area; The dot matrix constraint unit is used to convert the standard QR code binary matrix into a dot matrix constraint mask, establish a mapping relationship between binary values and dot matrix units, and adaptively adjust the size and spacing of the dot matrix units. The QR code generation unit is used to input the dot matrix constraint mask as a structural guiding condition into the AI generation model with constraint branches, and at the same time import user-customized patterns or style instructions to complete the adaptive filling of the customized pattern within the effective area defined by the dot matrix constraint mask, thereby generating an initial artistic dot matrix QR code.
9. The AI-based artistic QR code and dot matrix code fusion generation system according to claim 8, characterized in that, The verification and optimization module includes: The verification unit is used to perform a full-dimensional verification of the decoding compliance of the initial art dot matrix QR code, perform local rollback repair on areas that fail the verification, and generate a compliant art dot matrix QR code. The optimization unit is used to optimize the dot matrix morphology of the compliant art dot matrix QR code and output the final fused art QR code.