Two-dimensional code generation method and system of customized positioning pattern, and storage medium
By using the 'structured adaptation processing' method, the target logo graphic is adapted to the functional sub-region of the QR code positioning pattern, which solves the problem of deep visual customization of the QR code positioning pattern, realizes deep customization and universal compatibility of the QR code, improves visual expressiveness and obtains patent protection.
Patent Information
- Application Number
- CN202511934680.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-02
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies struggle to achieve in-depth and flexible visual customization of positioning patterns without compromising machine readability, especially when integrating complex brand logos or graphic elements into the internal structure of the positioning pattern.
The 'structured adaptation processing' method is adopted, which adapts the target logo graphic to the functional sub-region of the QR code positioning pattern through contour matching and contrast protection. This includes contour matching and contrast adjustment, ensuring that the visual customization of the QR code is compatible with machine recognition.
It enables in-depth and complex visual customization of QR code positioning patterns without affecting machine recognition capabilities. The generated QR codes can be stably read on general scanners, improving visual performance and providing patent protection.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of information coding and digital image processing. Specifically, it relates to a technology for generating and visually customizing two-dimensional codes, and particularly to a method, system, computer-readable storage medium, and two-dimensional code product generated thereby for deeply visually customizing the positioning pattern of a two-dimensional code while ensuring standard machine readability. Background Art
[0002] Two-dimensional codes, especially QR codes, have been widely used in various fields such as logistics, payment, advertising, anti-counterfeiting, etc. due to their advantages such as large information capacity, high reliability, and low cost. A standard QR code is composed of black and white modules, and the "square with a small square in the center" positioning patterns at the upper left, upper right, and lower left corners are the key for scanners to quickly identify and locate the two-dimensional code. This positioning pattern has strict proportional relationships (1:1:3:1:1) and a "concentric ring" topological structure.
[0003] However, the visual form of standard two-dimensional codes is monotonous and it is difficult to deeply integrate with brand images or artistic designs. Existing two-dimensional code beautification technologies mainly focus on embedding Logos in the center of the two-dimensional code, modifying the shape of data modules, or changing the overall color. These methods deliberately avoid making substantial changes to the positioning pattern because any destruction of the positioning pattern structure is extremely likely to cause mainstream scanners to fail to recognize. A few methods that attempt to visually change the positioning pattern only stay at the level of simple color replacement and cannot integrate complex brand logos and graphic elements into the internal structure of the positioning pattern.
[0004] The fundamental reason is that existing technologies lack a technical solution that can balance the freedom of graphic design and the rigid constraints of machine recognition. How to achieve deep and flexible visual customization of the positioning pattern without destroying the machine readability of the two-dimensional code (especially its positioning pattern) has become a long-standing technical problem in this field. Summary of the Invention
[0005] The present invention aims to overcome the above-mentioned defects of the prior art and provides a method, system, medium, and product for generating two-dimensional codes with customized positioning patterns. The core inventive concept is to creatively propose a "structured adaptation processing" method, which applies contour matching constraints and dynamic contrast guarantee constraints to the target identification graphic, "translates" it, and safely adapts it to the rigid functional structure of the two-dimensional code positioning pattern, thus achieving the unity of deep customization and perfect compatibility for the first time technically.
[0006] In the first aspect of the present invention, there is provided a method for generating a two-dimensional code with a customized positioning pattern, which is characterized by including the following steps: Step S1: Obtain the original data to be encoded and the target identification pattern; Step S2: According to the original data, generate a standard two-dimensional code data matrix according to the international standard of QR code (ISO / IEC 18004), which contains three positioning pattern area data with standard "loop" structure; Step S3: Perform a structured adaptation process on the target identification pattern, which includes customizing changes to the visual representation of at least one area of the "loop" structure and adapting the target identification pattern according to the outline of the "loop" structure; the goal of the structured adaptation process is to make the processed pattern meet two inseparable core conditions: (i) Outline matching: its effective display outline functionally matches the outline of the standard "loop" structure, which is functionally divided into three functional sub-areas: outer ring area (A), middle ring area (B) and inner ring area (C); the "functional sub-area" emphasizes its logical position divided by the standard structure for realizing the positioning function, and its final visual representation can be continuous or discontinuous; (ii) Contrast guarantee: the visual color attribute (such as brightness) of the middle ring area (B) has a contrast with at least one of the outer ring area (A), the inner ring area (C) and the two-dimensional code background area (D), which reaches the preset recognition threshold set according to the QR code standard, which is the basis for ensuring that the standard scanner can reliably distinguish different functional areas and perform binaryzation processing; Step S4: Draw the target identification pattern after the structured adaptation process to the corresponding position specified by the two-dimensional code data matrix in the positioning pattern area data, to generate the final two-dimensional code image with customized positioning pattern.
[0007] Preferably, the structured adaptation process can be achieved by adapting the whole or part of the visual elements of the target pattern into the three functional sub-areas (corresponding to claim 2).
[0008] To achieve contrast guarantee, the process can include dynamically adjusting the pixel color in one or more functional sub-areas, and the specific technical operations can include but are not limited to color quantization, brightness mapping, region segmentation and recoloring, or contrast enhancement, etc. (corresponding to claims 3 and 4). Among them, the "region segmentation and recoloring" is a key technical means for the application to realize the adaptation of complex patterns, which refers to identifying different parts of the pattern through image segmentation algorithm and independently assigning colors that meet the contrast requirements to them.
[0009] One prominent advantage of the present invention is that it allows for extremely rich internal visual design of functional sub-regions. For example, at least one of the outer ring region (A), the middle ring region (B), and the inner ring region (C) can be rendered as being composed of color blocks of two or more different visual colors (corresponding to claim 5). These color blocks are arranged in geometric units, and the arrangements may include bar segmentation, symmetric distribution, circular segmentation, grid-like distribution, or dot distribution, etc. (corresponding to claim 6). To ensure readability, when the outer ring region (A) or the inner ring region (C) is rendered as multiple color blocks, the color contrast between various color blocks constituting this region and the middle ring region (B) must meet the standards (corresponding to claim 7). The color composition of the color blocks can be static or dynamically change according to preset rules (such as periodically switching between several high-contrast color combinations, responding to changes in ambient light sensor data), and the purpose of this rule is to continuously ensure machine readability during the dynamic process (corresponding to claim 8).
[0010] The drawing method can be replacement drawing (completely covering the standard module) or overlay / fusion drawing (corresponding to claims 9, 10). The standard "hui" character structure is a concentric ring structure with a ratio relationship of 1:1:3:1:1 (corresponding to claim 11). The finally generated QR code must pass the reading verification by a general scanner that complies with the QR code international standard (such as a smartphone camera, WeChat Scan) (corresponding to claim 12).
[0011] In the second aspect of the present invention, a system for implementing the above method is provided (corresponding to claims 13, 14).
[0012] In the third aspect of the present invention, a computer-readable storage medium storing a computer program for implementing the above method is provided (corresponding to claim 15).
[0013] In the fourth aspect of the present invention, a QR code product with a customized positioning pattern generated by the above method is provided (corresponding to claim 16). Beneficial effects
[0014] Compared with the prior art, the present invention has the following remarkable beneficial effects: 1. Pioneeringly solve the contradiction between deep customization and general compatibility: Through the theoretical framework of "structured adaptation processing" (profile matching + contrast guarantee), for the first time, the deep and complex visual customization of the QR code positioning pattern is technically realized, while ensuring that it can be stably and quickly read by any general scanner that complies with international standards (without a dedicated APP), overcoming the long-existing technical bottleneck in this field; 2. The technical solution is rigorous, reliable and verifiable: the proposed constraint conditions (contour, contrast) are derived from the international standard of QR code, which changes the customization process from experience-dependent "art design" to computable, quantifiable and verifiable "technical process", providing a solid foundation for industrial application; 3. The visual expression is revolutionarily improved and protected by the patented method: it supports various advanced visual effects such as multi-color blocks, irregular fragmentation design, dynamic changes and complex graphics integration. More importantly, these visual effects are achieved through specific technical means (such as region segmentation and recoloring) protected by the invention, thus incorporating aesthetic design into the strong protection scope of the patent; 4. The application prospect is extremely wide: it can be widely used in high-end brand anti-counterfeiting and traceability, luxury product labels, digital art collections, interactive marketing advertisements and personalized cultural and creative products, which have high requirements for visual uniqueness and functional reliability, and have great commercial value; BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 The flowchart of the two-dimensional code generation method provided by an embodiment of the present application is shown.
[0016] Figure 2 The "h" character structure of the standard QR code positioning pattern and its functional sub-area division are shown.
[0017] Figure 3a and Figure 3b are schematic diagrams of structural adaptation processing of the target identification pattern.
[0018] Figure 4 The customized positioning pattern with a multi-color block outer ring area provided by an embodiment of the present application is shown.
[0019] Figure 5 The complete two-dimensional code product example with a customized positioning pattern provided by an embodiment of the present application is shown.
[0020] Figure 6 The module composition schematic diagram of the two-dimensional code generation system provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0021] The present application will be further described in detail below in combination with the drawings and specific embodiments. The following embodiments are only used to explain the present application, but not to limit the present application. Any modification or variation based on the core concept of the present application falls within the protection scope of the present application.
[0022] Embodiment 1: basic method and process This embodiment mainly corresponds to the process framework shown in Figure 1 In combination with Figure 1 and Figure 2, the user inputs the website "https: / / www.example.com" through the system interface and uploads the brand "Flying Bird" totem pattern. The standard coding module calls the open source library to generate version 5, error correction level H standard QR code data matrix. The graphic adaptation processing module performs structured adaptation processing on the "Flying Bird" pattern: first, analyze its contour, and through geometric transformation, make the key feature points such as the wing tip and tail feathers of the bird roughly aligned with the boundaries of the "Hanzi" shape contour (proportion 1:1:3:1:1), realize contour matching. Second, calculate the average brightness of each part of the pattern, and through the brightness mapping algorithm, lighten the bird body part falling into the middle ring area (B), and darken the background part falling into the outer ring area (A) and the inner ring area (C), to ensure that its brightness contrast is greater than 60% (preset threshold), realize contrast guarantee. Finally, the image rendering synthesis module fills the processed pattern into the top-left positioning pattern position in the form of replacement drawing, generates a two-dimensional code. Through the test of various general scanning tools such as WeChat, Alipay and mobile phone camera, the two-dimensional code can be correctly identified and jumped instantly.
[0023] Example 2: Multi-color block and geometric arrangement design The rule multi-color block design described in this embodiment has an effect as shown in Figure 4 In the embodiment shown in Figure 4 , a luxury brand hopes that its two-dimensional code positioning pattern presents a sense of seniority. The system divides the outer ring area (A) into 8 sectors (annular segmentation) and alternately fills the brand's signature blue (#0000FF) and red (#FF0000). The graphic adaptation processing module calculates the contrast of these two colors with the preset white middle ring area (B), confirms that they both meet the threshold, and then performs rendering. The inner ring area (C) is filled with blue. Thus, a customized two-dimensional code with high brand recognition and 100% recognition is generated.
[0024] Example 3: Application of irregular fragmentation art design and area segmentation technology The technical effect shown in this embodiment can be referred to Figure 3bUnderstand the form of the graph after adaptive processing. In this embodiment, to achieve advanced artistic effects such as "cracked glaze" or "abstract splashed ink", the target identification graph is composed of a series of irregularly shaped and sized color blocks or texture areas. The system uses the core "re-coloring after regional segmentation" technical means of the present invention for processing: First, use an image segmentation algorithm (such as edge detection-based, color clustering, or semantic segmentation) to automatically identify and divide these irregular visual element sub-regions. Subsequently, according to the expected position of each sub-region in the "square frame" structure (that is, belonging to the functional sub-region of the outer ring region (A), the middle ring region (B), or the inner ring region (C)), independently assign it a color that meets the contrast constraint. For example, all irregular sub-regions mainly falling into the position of the middle ring region (B) are re-colored with a high-light color (such as white), while the sub-regions mainly falling into the positions of the outer ring region (A) and the inner ring region (C) are re-colored with dark colors (such as black). The system independently guarantees the contrast of each sub-region. Finally, the positioning pattern visually presents as an artistic irregular jigsaw puzzle, but because the color distribution of all sub-regions strictly obeys the contrast rules of the functional sub-regions, its machine recognition performance is no different from that of a standard QR code. This embodiment proves the powerful adaptability of the method of the present invention to any complex graph.
[0025] Embodiment 4: Customized positioning pattern with contrast-enhanced border The functional border described in this embodiment can be used as Figure 4 A variant or supplementary feature of the shown positioning pattern. In this embodiment, to improve the clarity of the visual structure and actively enhance machine readability, a functional border is added to the rendering of the outer ring region (A) and / or the inner ring region (C). This border is part of the "structured adaptation process", and is specifically implemented as: rendering an annular band with a specific width at the inner or outer boundary of the corresponding functional sub-region. The color of this border is forced to form the highest level of contrast with the adjacent middle ring region (B) (for example, if area B is white, the border is pure black). This border can be presented as a solid line ring of a single color, or as a decorative ring band composed of multiple high-contrast color blocks. Its technical purpose is to provide a redundant and highly reliable contrast boundary reference for the scanning algorithm in scenarios with uneven illumination or poor printing quality, thereby improving the overall recognition robustness. This embodiment shows that any visual element added for the purpose of ensuring or enhancing the recognition function belongs to a reasonable extension and specific implementation of the "contrast guarantee" step of the present invention.
[0026] Embodiment 5: Dynamic change and rule guarantee The dynamic effect described in this embodiment is embodied in the static figure in the form of a textual description. In an interactive advertising application, the inner ring area (C) of the positioning pattern is designed as two color blocks of red and blue. According to a preset rule, the two color blocks are displayed alternately at a frequency of 1 Hz. The core of the rule is to ensure that in any frame of picture, the color block currently displayed and the middle ring area (B) maintain high contrast. Therefore, even if the picture dynamically changes, each frame of static image is a positioning pattern that can be recognized by a standard algorithm and meets the contrast requirement, thereby realizing the unity of dynamic beauty and stable reading.
[0027] Embodiment 6: System architecture implementation The system architecture corresponding to this embodiment is shown in Figure 6 As shown in Figure 6 , the system of the present application can be specifically implemented as software or cloud service containing the following modules: a data acquisition module (providing a graphical user interface and receiving input); a standard encoding module (integrating standard encoding libraries such as Zxing and QRCodeLib); a graphics adaptation processing module (as a core algorithm engine, performing contour analysis, color space conversion, contrast calculation and optimization, region segmentation, etc.); an image rendering synthesis module (synthesizing the final image based on drawing API such as Canvas and Core Graphics, and providing real-time preview and recognition verification functions). These modules can work together and be packaged as SDK, API or independent application programs.
[0028] Embodiment 7: Complete product example This embodiment shows a complete two-dimensional code product integrated with a customized positioning pattern, and the overall appearance effect is shown in Figure 5 In Figure 5 , a complete two-dimensional code is shown, and the positioning pattern in the upper left corner adopts a customized design as shown in Figure 4 , the central area can contain a brand logo, and the whole embodies the final form of the present application in actual application.
[0029] Obviously, those skilled in the art can make various modifications and changes without departing from the spirit and scope of the present application defined by the appended claims. These modifications and changes are all considered to fall within the protection scope of the present application.
Claims
1. A method for generating a QR code with a customized positioning pattern, characterized in that, Comprising: Obtaining the original data to be encoded and the target identification graphic for at least one positioning pattern; Generating a standard QR code data matrix according to the original data, the matrix including data of three positioning pattern regions with a standard "return" shape structure; Performing a structured adaptation process on the target identification graphic, the structured adaptation process including customizing and changing the visual representation of at least one region in the "return" shape structure, and adapting the target identification graphic according to the outline of the "return" shape structure, so that the processed graphic satisfies: (i) Its effective display outline matches the outline of the standard "return" shape structure, and the "return" shape structure is functionally divided into three functional sub-regions: an outer ring region (A), a middle ring region (B), and an inner ring region (C); (ii) The contrast between the visual color attribute of the middle ring region (B) and at least one of the outer ring region (A), the inner ring region (C), and the QR code background region (D) reaches a preset recognition threshold; Drawing the target identification graphic after the structured adaptation process to the position specified by the corresponding positioning pattern region data in the QR code data matrix to generate the final QR code image.
2. The method according to claim 1, characterized in that, The structured adaptation process for the target identification graphic includes: adapting the whole or part of the visual elements of the target identification graphic to the functional sub-regions of the outer ring region (A), the middle ring region (B), and the inner ring region (C).
3. The method according to claim 1 or 2, characterized in that, The structured adaptation process includes: adjusting the pixel colors in one or more functional sub-regions of the outer ring region (A), the middle ring region (B), and the inner ring region (C) so that the contrast between the middle ring region (B) and at least one of the outer ring region (A), the inner ring region (C), and the background region (D) meets the preset recognition threshold.
4. The method according to any one of claims 1 to 3, characterized in that, The operation of adjusting the pixel colors includes one or more of color quantization, brightness mapping, recoloring after region segmentation, or contrast enhancement.
5. The method according to claim 1, characterized in that, When drawing to generate the final QR code image, at least one functional sub-region of the outer ring region (A), the middle ring region (B), and the inner ring region (C) is rendered as composed of color blocks of two or more different visual colors.
6. The method according to claim 5, characterized in that, The color blocks are arranged in units of geometric shapes, and the arrangement manner of the color blocks includes at least one or a combination of bar segmentation, symmetric distribution, circular segmentation, or grid-like distribution; and the color contrast between various color blocks constituting the outer frame region (A) and the middle ring region (B) reaches the preset recognition threshold.
7. The method according to claim 5 or 6, characterized in that, When the outer ring region (A) or the inner ring region (C) is rendered as multi-color blocks, the color contrast between various color blocks constituting the functional sub-region and the middle ring region (B) reaches the preset recognition threshold.
8. The method according to any one of claims 5 to 7, characterized in that, The color composition of the color blocks is static or changes dynamically according to a preset rule.
9. The method according to claim 1, characterized in that, The drawing step is replacement drawing: using the processed target identification graphic to completely cover the original module pattern of the standard positioning pattern.
10. The method according to claim 1, characterized in that, The drawing step is superimposed drawing: After image fusion of the processed target identification graphic and the original module graphic of the standard positioning pattern, it is displayed.
11. The method according to claim 1, characterized in that, The standard "return" shaped structure is a concentric ring structure with a ratio relationship of 1:1:3:1:
1.
12. The method according to claim 1, characterized in that, The method further includes: After generating the final QR code image, use a general scanner compliant with the QR code international standard to read and verify it, and the general scanner can directly parse out the original data.
13. A QR code generation system with customized positioning patterns, characterized in that, It includes: A data acquisition module, configured to acquire the original data to be encoded and the target identification graphic for at least one positioning pattern; A standard encoding module, configured to generate a standard QR code data matrix according to the original data; A graphic adaptation processing module, configured to perform the structured adaptation processing on the target identification graphic as described in any one of claims 1-4; An image rendering and synthesis module, configured to draw the adapted graphic to the positioning pattern area of the QR code data matrix to generate the final QR code image.
14. The system according to claim 13, characterized in that, The image rendering and synthesis module is configured to be able to render the functional sub-areas of the positioning pattern as described in any one of claims 5 to 8.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the method as described in any one of claims 1 to 12.
16. A QR code product, characterized in that, The QR code is generated by the QR code generation method with customized positioning patterns as described in any one of claims 1 to 12; one, two or three positioning pattern areas of the QR code are displayed as target identification graphics that have undergone structured adaptation processing, and the functional sub-areas of the "return" shaped structure of the positioning pattern meet the preset recognition contrast requirements.
