Method, apparatus and device for generating artistic QR code, and medium
By integrating the fill data sequences of artistic images and QR code templates, the problems of uncertainty and low recognition success rate in the existing technology are solved, and higher aesthetics and recognition success rate are achieved.
Patent Information
- Application Number
- PCT/CN2024/118537
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-27
- Filing Date
- 2024-09-12
- Publication Date
- 2025-04-03
AI Technical Summary
There is uncertainty in the existing artistic QR code generation methods. The generated QR code may not meet business needs, have low recognition success rate and insufficient aesthetics.
By acquiring the first regional image in the art image to be fused, a fill data sequence is generated based on the binarized sequence value, an initial QR code image is generated, and it is fused with the second regional image of the art image to generate an art QR code.
The generation of art QR codes that meet business needs is realized, which improves the recognition success rate and aesthetics, so that art QR codes can not only meet users' personalized needs but also ensure the success of identification.
Smart Images

Figure CN2024118537_03042025_PF_FP_ABST
Abstract
Description
Method, device, equipment and medium for generating artistic QR code
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 27, 2023, with application number CN202311276380.7 and invention name “A method, device, equipment and medium for generating artistic QR codes”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer data processing technology, and in particular to a method, device, equipment and medium for generating an artistic two-dimensional code. Background Art
[0003] With the development of computer technology, QR code styles have diversified, and artistic codes are gaining increasing attention online. Existing artistic QR codes are mostly generated using pure AI (artificial intelligence) models based on user-entered QR code images and style descriptions. However, these artistic QR codes are subject to uncertainty and may not meet business needs.
[0004] Therefore, how to more stably generate artistic QR codes that meet business needs is a technical problem that needs to be solved urgently.
[0005] Summary of the Invention
[0006] The embodiments of this specification provide a method, apparatus, device, and medium for generating an artistic QR code to solve the uncertainty problem existing in existing artistic QR code generation methods.
[0007] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0008] The embodiments of this specification provide a method for generating an artistic QR code, including:
[0009] Acquire a first area image in the art image to be fused corresponding to a fill area in the QR code template; the fill area is an area in the QR code template used to place fill bit characters in the encoded data stream;
[0010] generating a filling data sequence in a filling bit area of a coded data stream corresponding to the two-dimensional code template based on the binarized sequence value corresponding to the first area image;
[0011] Based on the filling data sequence, generating an initial two-dimensional code image;
[0012] The initial two-dimensional code image is fused with a second region image of the art image to be fused to generate the art two-dimensional code image; the second region image is an image of the art image to be fused excluding the first region image.
[0013] The embodiments of this specification provide a device for generating an artistic QR code, including:
[0014] A first region image acquisition module is configured to acquire a first region image in the art image to be fused that corresponds to a fill region in the QR code template; the fill region is a region in the QR code template used to place fill characters in the coded data stream;
[0015] a filling data sequence generating module, configured to generate a filling data sequence in a filling bit area in the coded data stream corresponding to the two-dimensional code template based on the binarized sequence value corresponding to the first area image;
[0016] An initial two-dimensional code image generation module, configured to generate an initial two-dimensional code image based on the filling data sequence;
[0017] The art QR code image generation module is used to fuse the initial QR code image with the second region image of the art image to be fused to generate the art QR code image; the second region image is the image of the art image to be fused except the first region image.
[0018] The embodiments of this specification provide a device for generating an artistic QR code, including:
[0019] at least one processor; and,
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0022] Acquire a first area image in the art image to be fused corresponding to a fill area in the QR code template; the fill area is an area in the QR code template used to place fill bit characters in the encoded data stream;
[0023] generating a filling data sequence in a filling bit area of a coded data stream corresponding to the two-dimensional code template based on the binarized sequence value corresponding to the first area image;
[0024] Based on the filling data sequence, generating an initial two-dimensional code image;
[0025] The initial two-dimensional code image is fused with a second region image of the art image to be fused to generate the art two-dimensional code image; the second region image is an image of the art image to be fused excluding the first region image.
[0026] An embodiment of this specification provides a computer-readable medium having computer-readable instructions stored thereon. The computer-readable instructions can be executed by a processor to implement a method for generating an artistic QR code.
[0027] At least one embodiment in the present specification can achieve the following beneficial effects: by binarizing the first area image in the art image to be fused corresponding to the filled area in the QR code template, a filling data sequence is obtained; based on the filling data sequence, an initial QR code image is generated; the initial QR code image is fused with the second area image of the art image to be fused to generate an art QR code image, so that the generated art QR code can not only meet the user's personalized needs, but also ensure the recognition success rate of the art QR code, and can obtain an art QR code that meets business needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0029] FIG1 is a schematic diagram of an application scenario of a method for generating an artistic QR code provided by an embodiment of this specification;
[0030] FIG2 is a flow chart of a method for generating an artistic QR code according to an embodiment of this specification;
[0031] FIG3 is a schematic diagram of the structure of a coded data stream of a two-dimensional code in the prior art;
[0032] FIG4 is a schematic diagram of the structure of a coded data stream of a two-dimensional code provided in an embodiment of this specification;
[0033] FIG5 is a swim-lane diagram of a method for generating an artistic QR code provided in an embodiment of this specification;
[0034] FIG6 is a schematic diagram of the structure of a device for generating an artistic QR code according to an embodiment of this specification;
[0035] FIG7 is a schematic diagram of the structure of a device for generating an artistic QR code provided in an embodiment of this specification. DETAILED DESCRIPTION
[0036] To make the purpose, technical solutions, and advantages of one or more embodiments of this specification more clear, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of one or more embodiments of this specification.
[0037] The technical solutions provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0038] With the development of computer technology, QR code styles have diversified, with the rise of art codes gaining increasing attention online. QR codes are used by businesses to express their brands in a personalized way, while users also seek to attract traffic from art codes seeking novelty. However, existing art QR codes are mostly generated using pure AI (artificial intelligence) methods based on user-entered QR code images and style descriptions. This introduces uncertainty, and the generated art QR codes may differ significantly from business needs, such as a low probability of recognition and unattractive artistic images.
[0039] In order to solve the defects in the prior art, this solution provides the following embodiments:
[0040] FIG1 is a schematic diagram of an application scenario of a method for generating an artistic QR code provided in an embodiment of this specification.
[0041] As shown in Figure 1, the solution primarily includes: target data 1, an art image to be fused 2, a server 3, and an art QR code 4. The target data 1 can be a website, a link, or characters to be recognized, representing the content contained in the QR code. After the QR code is scanned, the code can be parsed and identified. The server 3 can select an appropriate QR code template based on the length of the target data 1, where the data capacity of the QR code template must be greater than the encoded data length of the target data. Based on the QR code template and the art image to be fused 2, the server 3 can determine the image portion of the art image to be fused that corresponds to the filled area of the QR code template. Based on the image features of this image portion, the server 3 can determine the placeholders within the filled area of the QR code template. Furthermore, data representing partial features of the art image can be directly incorporated into the encoded binary stream of the QR code to generate an initial QR code image. The server 3 can also fuse other portions of the art image to be fused 2 with the initial QR code. For example, as shown in Figure 1, the ECData and Data regions of the initial QR code image are fused with the portion of the image corresponding to the art image to be fused, generating the art QR code 4. The ECData region can represent error correction information, and the Data region can represent the encoded data corresponding to the target data. This is not specifically illustrated here.
[0042] Next, a method for generating an artistic QR code provided in the embodiment of the specification will be described in detail with reference to the accompanying drawings:
[0043] Figure 2 is a flow chart of a method for generating an artistic QR code according to an embodiment of this specification. From a program perspective, the execution subject of the process can be a program installed on an application server or an application client.
[0044] As shown in Figure 2, the process may include the following steps:
[0045] Step 202: Acquire a first area image in the art image to be fused that corresponds to the fill area in the QR code template; the fill area is the area in the QR code template used to place fill bit characters in the encoded data stream.
[0046] The art image to be fused in the embodiments of this specification can be a picture that the user likes, a trademark logo, or a user's head portrait, etc. It can also be some image description information, and the image can be generated by the model.
[0047] In practice, there are currently forty different QR code templates available. For example, version 1 is a 21 x 21 matrix, version 2 is a 25 x 25 matrix, and version 40 is a 177 x 177 matrix. The server can select an appropriate QR code template based on, for example, the length of the target data to be inserted into the QR code and the error correction level. Alternatively, the server can select an appropriate QR code template based on the characteristics of the art image to be integrated.
[0048] In actual applications, once the version and error correction level of the QR code template are determined, the data capacity of the QR code template can be determined. The specific data capacity corresponding to the QR code template can be referred to the existing rules or introductions about QR codes and will not be repeated here.
[0049] In the embodiment of this specification, the first area image can be an area in the art image to be fused that corresponds to the filled area position of the QR code template, or a partial image containing obvious features, or the entire image.
[0050] In the embodiment of the present specification, the coded data stream may be a data stream determined based on the target data and the QR code template and used to fill the QR code template in a certain filling order. The coded data stream may be a string of data consisting of 0s and 1s.
[0051] In the embodiments of this specification, the fill area can represent filler characters in the coded data stream, and can also be called a placeholder, a placeholder code, etc. The position area in the QR code template can be clustered or discretely distributed. Clustered distribution can be understood as the display positions of each character in the template are adjacent, continuous, or the number of continuous adjacent characters is greater than a preset number, and most characters are clustered together; discrete distribution can be understood as the display positions of each character in the template are scattered, and the display positions of most characters are not clustered together, or it can be understood as the number of continuous adjacent characters is relatively small.
[0052] Step 204: Based on the binarized sequence value corresponding to the first region image, generate a filling data sequence in the filling bit region of the encoded data stream corresponding to the two-dimensional code template.
[0053] The binarized sequence value can represent data obtained by binarizing the image of the first region of the art image to be fused. In practical applications, the order of the binarized characters in the binarized sequence value within the padded data sequence can be determined based on the filling order of the QR code, so that the image or image features of the first region of the art image to be fused can be presented in the QR code image generated using the encoded data stream containing the padded data sequence.
[0054] The filling order of the QR code can be to form a group of two units in the matrix, fill upwards in sequence, and after one column is filled, start filling downwards in sequence; the two units in one group can both be filled from right to left.
[0055] Step 206: Generate an initial two-dimensional code image based on the filling data sequence.
[0056] The initial QR code image in the embodiments of this specification may be an image obtained after the QR code template is filled. In practical applications, a coded data stream for filling the QR code template may be generated based on the filling data sequence, and the coded data stream may be used to fill the QR code template according to the QR code filling sequence to obtain the initial QR code image.
[0057] Step 208: Fusing the initial QR code image with the second region image of the art image to be fused to generate the art QR code image; the second region image is the image of the art image to be fused excluding the first region image.
[0058] In the embodiments of this specification, the second region image may represent part or all of the image in the region other than the first region image in the artistic image to be fused. Existing AI models, such as style transfer models, can be used to fuse the region of the initial QR code image corresponding to the second region image with the second region image of the artistic QR code to produce a fused QR code image.
[0059] In practical applications, the first area image in the art image to be fused can also be overlaid on the filled area in the QR code image before or after fusion, thereby improving the aesthetics of the art QR code while ensuring that the data will not be changed and will not affect the recognition of the art QR code, so that the generated art QR code can meet the user's business needs.
[0060] It should be understood that the order of some steps in the methods described in one or more embodiments of this specification can be interchanged according to actual needs, or some steps can be omitted or deleted.
[0061] The method in Figure 2 binarizes the first area image in the art image to be fused that corresponds to the filled area in the QR code template to obtain a filled data sequence, generates an initial QR code image based on the filled data sequence, and fuses the initial QR code image with the second area image of the art image to be fused to generate an art QR code image. The generated art QR code can not only meet the user's personalized needs, but also ensure the recognition success rate of the art QR code, and can obtain an art QR code that meets business needs.
[0062] In order to more clearly illustrate the difference between the QR code generated by the existing coded data stream and the artistic QR code generated by the coded stream used in the embodiment of this specification, Figure 3 is a structural diagram of the coded data stream of a QR code in the prior art; Figure 4 is a structural diagram of the coded data stream of a QR code provided in the embodiment of this specification.
[0063] As shown in Figures 3 and 4, the encoded data stream may include a template pattern portion, a length portion, a target data information portion, a terminator portion, an 8-bit alignment portion, a padding area portion, and an error correction information portion. In the prior art, for the padding bit region, 11101100 00010001 is repeated as the data sequence for the padding area. However, in the embodiments of this specification, in order to better reflect the artistic image in the QR code, the first region image corresponding to the padding area in the artistic image may be binarized to obtain a binary data sequence, which may be encoded into the padding bit region, so that the generated artistic QR code image can better present the characteristics of the artistic image. For example, for a certain merchant's trademark logo, the middle portion of which is the portion that can reflect the main characteristics of the trademark. According to the method in the embodiments of this specification, the image portion of the trademark logo corresponding to the padding area may be binarized, and the resulting binary data sequence may be filled into the padding area to facilitate the display of the trademark logo in the artistic QR code, thereby better reflecting the brand information in the artistic QR code.
[0064] Based on the method of FIG2 , the examples of this specification also provide some specific implementation plans of the method, which are described below.
[0065] In practical applications, a larger filled area is more conducive to reflecting the artistic image in the QR code. Optionally, the method described in the embodiment of this specification may further include:
[0066] Get target data;
[0067] Encoding the target data according to multiple encoding methods to obtain multiple data codes;
[0068] Selecting the data code with the shortest length from the plurality of data codes as the target data code;
[0069] Generating an initial two-dimensional code image based on the filling data sequence may specifically include:
[0070] An initial two-dimensional code image is generated based on the filling data sequence and the target data code.
[0071] In the embodiments of this specification, target data may include string data such as a URL, a link, or characters to be recognized. String data may include uppercase and lowercase letters, numbers, special characters, and the like. String data can be used to redirect to a target page after a successful scan. The target page may include a page for receiving payment codes, a page for user-run activities, or a page containing an image.
[0072] The encoding method may include Numeric mode (numeric encoding), Alphanumeric mode (character encoding), Byte mode (byte encoding) and Kanji mode (double-byte encoding). The Numeric mode encoding method can be used to encode numbers, with one character occupying 3.3 bits; the Alphanumeric mode encoding method can be used to encode numbers, uppercase letters and special symbols, etc., with one character occupying 5.5 bits; the Byte mode encoding method can be used to encode ASCII codes, with one character occupying 8 bits; the Kanji mode encoding method can be used to encode Chinese characters and Japanese, etc., with one character occupying 13 bits. In the embodiments of this specification, the target data can be encoded according to a variety of encoding methods, and then the shortest code is selected from the encoding results as the code for generating the QR code image.
[0073] In addition, when the encoding length corresponding to the target data is short, you can try to choose a QR code version with a lower version, which is also conducive to improving the recognition rate.
[0074] In actual applications, users can select the error correction level based on their actual needs, or the server or computer can automatically determine the error correction level based on the QR code's application scenario or business requirements. For example, to facilitate successful recognition of artistic QR codes or for services requiring lower security, a higher error correction level, such as H, can be selected. Alternatively, if the content redirected after scanning the code is sensitive and requires higher security, a lower error correction level, such as L, can be selected. This level can correct 7% of damage in the artistic QR code. If there is a high level of erroneous data, the page can be skipped to the target page, preventing data leakage on the target page and improving data security. The specific error correction level setting method and level can be set based on actual needs and are not specifically limited here.
[0075] The shortest length can indicate the fewest bits occupied, or the shortest data sequence obtained from various encoding methods. The matrix of the QR code template is fixed, and the total number of bits it contains is also fixed. The shorter the target data code, the larger the padding area can be, and the larger the area corresponding to the image to be fused. This allows more features of the image to be presented in the QR code image, resulting in a clearer display of the image to be fused.
[0076] To better meet user needs, in the embodiments of this specification, the user can directly provide the image to be fused, or provide some descriptive information, and the computer will generate an image that meets the user's needs based on the descriptive information. Optionally, the method described in the embodiments of this specification may also include:
[0077] Get image description information;
[0078] Based on the image description information, the art image to be fused is generated by using an image generation model;
[0079] or,
[0080] The art image to be fused is obtained, which is selected by a user from a preset image library.
[0081] In the embodiments of this specification, the image description information may be feature information used to represent the art image to be fused, such as: landscape, blue tones, opera, animation, animals, cartoon characters, games and other features or description information representing the style of the image. The server may generate a description interface where the user can select or fill in the image description information. The page may contain labels representing the image description information for the user to select, or may contain an area where the user can enter text so that the user can describe it according to his or her own needs for the fused art image; an AI image generation model may be used to generate an image based on the acquired image description information. The preset image library may be a database containing images pre-stored in the server for the user to select, or it may be a database used by the user to store images. It is understandable that in actual applications, the interface for selecting the art image to be fused may also jump to a web page for the user to search for images, so that the user can select a satisfactory art image to be fused.
[0082] In order to ensure that the generated artistic QR code image meets business needs or user needs, the above-mentioned artistic image to be fused can be at least a part of an image. Optionally, the method described in the embodiment of this specification may also include:
[0083] Obtaining the initial image to be fused;
[0084] Acquire the placement position information of the QR code; the placement position information is used to indicate the position where the QR code is placed in the initial image to be fused;
[0085] An image to be fused is selected from the initial images to be fused based on the placement position information; the image to be fused is a part of the initial images to be fused.
[0086] In the embodiments of this specification, the initial image to be fused can be an image generated by an AI image generation model based on image description information, or it can be an image selected by the user from a preset image library. The location of the QR code in the initial image to be fused can be selected by the user from the initial image to be fused, or it can be determined by the server based on the main features of the initial image to be fused. For example, if it is a human image, the location can be determined at the face. The image to be fused can also be the entire initial image to be fused, and the specific selection can be determined according to the user's needs.
[0087] Optionally, obtaining the QR code placement information in the embodiments of this specification may specifically include:
[0088] Determining the placement position information of the QR code based on a user's operation on an image selection frame; the image selection frame is a selection frame displayed in the initial art image to be fused and used to select the display position of the QR code;
[0089] or,
[0090] Acquire position information of a pile point in the initial image to be fused; the pile point is used to indicate the position of the center point of the initial two-dimensional code image in the initial image to be fused;
[0091] Determining an area within a preset distance from the stake point as an area for placing the QR code;
[0092] or,
[0093] Using a feature region selection model, determining a region where the depicted object is located in the initial art image to be fused;
[0094] The area is determined as an area for placing a QR code.
[0095] In practical applications, the size and position of the image selection box can be adjusted to select the display area of the QR code from the initial image to be fused. The preset distance can be a user-selected size or a custom size, such as 5cm or 7cm. The feature region selection model can be used to select the area within the image where the depicted object is located, such as an image, a building, an animal, or a logo. It is understood that the shape of the area where the QR code is placed can be customized by the user, such as square or circular.
[0096] The sizes of the art image to be fused and the QR code template can be adjusted so as to determine the positional correspondence between the art image to be fused and the QR code template. Optionally, in the embodiment of this specification, obtaining the first area image corresponding to the fill area in the art image to be fused may specifically include:
[0097] Adjusting the art image to be fused and the QR code template to the same size;
[0098] Based on the art image to be fused and the two-dimensional code template of the same size, the first region image is selected from the art image to be fused according to the position information of the filling region in the two-dimensional code template.
[0099] In the embodiments of this specification, adjustment can mean keeping the size of the art image to be fused unchanged and adjusting the entire QR code template to the same size as the art image to be fused; it can also mean keeping the size of the QR code template unchanged and adjusting the art image to be fused to the same size as the QR code template; it can also mean adjusting both the art image to be fused and the QR code template to a preset size according to the preset size.
[0100] The first region image may represent a region in the art image to be fused that is located at the same position as the filled region in the QR code template. For example, the art image to be fused and the QR code template, resized to the same size, may be established in a coordinate system with the same characteristics. The coordinate position of the filled region in the QR code template is determined, and then, based on the coordinate position, the image region corresponding to the coordinate position is selected from the art image to be fused.
[0101] As an implementation method, the server may select a sub-image corresponding to the filled area in the QR code template from the art image to be fused based on the position information of each unit rectangle in the QR code template. Optionally, in the embodiments of this specification, selecting the first area image from the art image to be fused based on the position information of the filled area in the QR code template may specifically include:
[0102] Obtaining position information of each unit rectangle in the filling area in the QR code template;
[0103] For any unit rectangle among the unit rectangles, a sub-image corresponding to the any unit rectangle is selected from the art image to be fused based on the position information of the any unit rectangle; the sub-image is consistent in size with the any unit rectangle; the first area image represents the sub-image corresponding to each unit rectangle.
[0104] In the embodiments of this specification, the unit rectangle can represent the size of the space required to render each data in the QR code template. For example, if the QR code template version 1 is a 17x17 matrix, it can represent that each column and row of the QR code template is divided into 17 small squares of equal size. These small squares of equal size can represent the size of the space required to render each data, and can be called a unit rectangle.
[0105] In actual applications, the unit rectangles in the QR code template can also be numbered in a preset order, for example, from left to right, from top to bottom, or from right to left, from bottom to top, etc., to obtain the numbering information of each unit rectangle; the art image to be fused with the same size as the QR code template can also be divided according to the size of the unit rectangle to obtain multiple sub-images, and each sub-image can be numbered according to the above-mentioned preset order. The numbering rule can be the same as the numbering rule in the QR code template, and the sub-image with the same unit rectangle number as the unit rectangle corresponding to the fill area can be selected from several sub-images to obtain the first area image.
[0106] As an implementation method, the server may perform binarization processing on the first region image to obtain a data sequence corresponding to the first region image. Optionally, the binarization processing on the first region image in the embodiment of this specification to obtain a binarized sequence value may specifically include:
[0107] The sub-images corresponding to the unit rectangles in the art image to be fused are binarized to obtain a binarized sequence value.
[0108] In the embodiments of this specification, the binarization process may be performed by determining the binarization value corresponding to each sub-image based on the color depth of each sub-image, thereby obtaining the binarization sequence value corresponding to the first region image. It is understood that binarization may represent various data as 0 or 1.
[0109] As an implementation manner, optionally, the method described in the embodiments of this specification may further include:
[0110] The first region image is binarized to obtain a binarized sequence value.
[0111] In the embodiment of this specification, a binarization process can be performed based on the RGB values of the first region image to obtain a binarized sequence. In practical applications, existing binarization processing methods can be used for processing, which is not specifically limited here.
[0112] As an implementation method, the server may first divide the first region image and then perform binarization processing to improve the accuracy of the obtained binary sequence value. Optionally, the binarization processing of the first region image in the embodiment of this specification to obtain the binary sequence value may specifically include:
[0113] Dividing the first region image into a plurality of sub-images according to the distribution and size of each unit rectangle in the filling region; one sub-image corresponds to one unit rectangle;
[0114] The plurality of sub-images are binarized to obtain the binarized sequence values.
[0115] In the embodiments of this specification, the first region image of the art image to be fused can be divided according to the distribution and size of each unit rectangle within the filled region of the QR code template. A sub-image in the first region image has the same size and position as a corresponding unit rectangle. Each sub-image can be binarized using existing binarization methods, and the binarized values can then be integrated based on the filling order of the QR code template to obtain a binarized sequence value.
[0116] As a real-time method, the server may first grayscale the first region image, and then perform binarization based on the grayscale processing result. Optionally, the binarization of the plurality of sub-images described in the embodiment of this specification may specifically include:
[0117] grayscale the plurality of sub-images to obtain grayscale images;
[0118] Based on the grayscale values of the grayscale images corresponding to the plurality of sub-images, binary values corresponding to the plurality of sub-images are determined.
[0119] The grayscale processing in the embodiments of this specification may be performed using at least one of the maximum value method, the average value method, or the weighted average method. In practical applications, the binarization value of the sub-image can be determined by judging whether the grayscale value corresponding to the sub-image is greater than the preset grayscale value. If the grayscale value of the sub-image is greater than the preset grayscale value, the binarization value of the sub-image can be determined as 1; if the grayscale value of the sub-image is less than or equal to the preset grayscale value, the binarization value of the sub-image can be determined as 0. For example, if the preset grayscale value is 158, and the grayscale value of a sub-image is 34, the binarization value of the sub-image can be determined as 0. It can be understood that sub-images greater than the preset grayscale value are brighter, and sub-images less than or equal to the preset grayscale value are darker. The existing grayscale processing method and binarization method can also be used to obtain the binarization result, which is not specifically limited here.
[0120] As an implementation manner, optionally, in the embodiments of this specification, generating a padding data sequence in a padding bit area in the encoded data stream corresponding to the QR code template based on the binarized sequence value corresponding to the first area image may specifically include:
[0121] Determine, based on the positions of characters that can be filled in each unit rectangle in the filling area in the coded data stream corresponding to the two-dimensional code template, the positions of the binarized values of the sub-images corresponding to each unit rectangle in the first area image in the filling bit area in the coded data stream;
[0122] Based on the position of the binarized value of each sub-image in the filling bit area in the encoded data stream, the binarized value of each sub-image is placed at the corresponding position to generate a filling data sequence in the filling bit area in the encoded data stream.
[0123] In practical applications, since the filling order of the binary code stream used to fill the QR code template is known, after determining the QR code template to be used, that is, the version and error correction level, the filling position of each character in the binary code stream in the QR code template can be determined based on the known filling order, and the position of each padding code in the filling area of the binary code stream in the QR code template can also be determined. Then, by reverse reasoning, the various characters in the filling area of the binary code stream can be determined based on the first area image in the art image to be fused.
[0124] In the embodiment of the present specification, the server can also establish a first coordinate system based on the QR code template to obtain the first coordinate information of each unit matrix. The first coordinate information can be the position of the center point of the unit matrix in the first coordinate system. The server can establish a second coordinate system in the image to be fused of the same size as the QR code template. The position of the coordinate origin of the second coordinate system can be corresponding to the position of the origin of the first coordinate system in the QR code template, and the positive directions of the horizontal axis and the vertical axis are also the same as the first coordinate system. For example, the QR code template uses the upper left corner as the coordinate origin, the right direction as the positive direction of the horizontal axis, and the downward direction as the positive direction of the vertical axis to establish the first coordinate system; then the art image to be fused can also use the upper left corner as the coordinate origin, the right direction as the positive direction of the horizontal axis, and the downward direction as the positive direction of the vertical axis to establish the second coordinate system. The server can determine the second coordinate information with the same value as the first coordinate information in the second coordinate system based on the first coordinate information of the unit rectangle corresponding to the filled area in the QR code template, and select a sub-image of the size of the unit rectangle based on the second coordinate information, so as to obtain the corresponding first area image and the corresponding relationship between the positions of the two. In actual applications, the server can fill the binary value obtained after binarizing the sub-image into the position in the filling area of the QR code template that is the same as the coordinate position of the sub-image, obtain the binary value corresponding to each unit rectangle in the filling area, and integrate the binary value to obtain a filling data sequence.
[0125] In practical applications, when filling the padded area of a QR code, a one-to-one correspondence can be established between the sub-images in the first region image and the matrix arrangement in the QR code template. Corresponding binary values are then filled in corresponding positions in the matrix of the QR code template to generate the initial QR code image. For padded areas with a clustered distribution, a complete first region image is obtained. This means that the positions of the individual code elements in the first region image are adjacent in the template. For padded areas with a discrete distribution, an area with gaps in the data stream but the outline of the first region image is obtained. This means that the positions of the code elements corresponding to the padded area are not all adjacent in the template. Code element information from the data region may be placed between two code elements. The resulting image shows that the display positions of the code elements in the padded area are relatively dispersed.
[0126] As described above, in the embodiments of this specification, multiple encoding methods can be used to encode the target data to obtain the shortest code, so as to reserve more characters for the padding area and improve the recognition rate. Optionally, the multiple encoding methods described in the embodiments of this specification may include encoding methods using a single encoding mode and / or encoding methods using a mixed encoding mode.
[0127] In the embodiments of this specification, a single encoding mode may represent an encoding mode in which one encoding mode is used to encode the target data; a mixed encoding mode may represent an encoding mode in which at least two encoding modes are used to encode the target data. The specific encoding mode to be adopted can be determined based on the length of the number of bits corresponding to a character in various encoding modes, and the type of characters that can be encoded by each encoding mode. The main purpose of both a single encoding mode and a mixed encoding mode is to reduce the number of bits occupied by the target data in the QR code template and increase the number of bits occupied by the filling area. Therefore, by reducing the length of the encoded data, more filling area can be reserved for filling the filling data sequence corresponding to the art image to be fused, making the generated art QR code more beautiful.
[0128] Of course, in actual applications, an encoding method can also be determined based on the character types contained in the target data, and the target data can be encoded using the determined encoding method. This encoding method can be a single encoding mode or a mixed encoding mode. The specific encoding method used can be determined based on actual needs.
[0129] As an implementation method, the server may select a corresponding encoding method based on the character type contained in the target data so as to obtain the shortest target data encoding. Optionally, the method described in the embodiment of this specification may further include:
[0130] If the target data contains numbers, the data is encoded using a first encoding rule;
[0131] If the target data includes uppercase letters, the uppercase letters are encoded using the second encoding rule.
[0132] The first encoding rule may represent a rule for encoding numbers, such as encoding numbers using the Numeric mode encoding method corresponding to the Numeric mode; the second encoding rule may represent a rule for encoding uppercase letters, such as encoding uppercase letters using the Alphanumeric mode encoding method corresponding to the Alphanumeric special character mode.
[0133] In actual applications, if the character data in the target data contains lowercase letters, the third encoding rule can also be used to encode the lowercase letters, such as using the Byte mode encoding method corresponding to the byte ASCII mode to encode the lowercase letters. When the target data contains multiple different types of character data, a mixed encoding mode can be used. For example, if the target data is HTTPS: / / 123.123.NET / COM, the target data can be encoded using both Numeric mode and Alphanumeric mode. It is also possible to use Byte mode alone to complete the encoding, obtain other encoding methods, and then select the encoding result with the shortest length for subsequent processing. In actual applications, since the length of the encoding result obtained using Byte mode encoding is usually longer than the length of the encoding result obtained using other modes, such as the mixed encoding method mentioned above, Byte mode encoding is not recommended for data that can be processed by other encoding methods. Of course, the encoding method can also be determined according to actual needs.
[0134] As an implementation method, in order to better reflect the main features of the art image to be fused, a suitable QR code template can be selected based on the main features so as to accommodate the main features of the art image to be fused. Optionally, the method described in the embodiment of this specification can also include:
[0135] According to the length of the data code corresponding to the target data, a first QR code template having a data capacity greater than the length of the data code is selected from the preset QR code templates; the data code is data obtained by encoding the target data according to the preset encoding method;
[0136] Determine a first filling area in the first two-dimensional code template for placing filling bit characters in the encoded data stream corresponding to the first two-dimensional code template;
[0137] Based on the first filling area, determining a sub-area in the art image to be fused corresponding to the first filling area;
[0138] determining whether the sub-region of the artistic image to be fused contains the depicted object of the artistic image to be fused;
[0139] If yes, determining the first two-dimensional code template as the two-dimensional code template for generating the initial two-dimensional code image;
[0140] If not, a second two-dimensional code template is selected from the preset two-dimensional code templates; the data capacity of the second two-dimensional code template is greater than that of the first two-dimensional code template.
[0141] In the embodiments of this specification, the data capacity can represent the number of codes that can be accommodated in the QR code template, usually expressed in bits. The preset QR code template can be a pre-existing QR code template, such as the existing 40 QR code templates; the first QR code template can be a template that can accommodate the coded data corresponding to the target data, determined based on the capacity of each preset QR code template. In actual applications, there may be multiple templates that can accommodate the coded data corresponding to the target data. The first QR code template can be one randomly selected from these multiple templates, or a QR code template determined according to certain rules. For example, the QR code template can be selected in order of the version of the QR code template from low to high, and the data capacity in the selected QR code template can be compared with the data coding length of the target data. If the data capacity in the QR code template is less than or equal to the data coding length of the target data, the next higher version is selected for comparison. If the data capacity in the QR code template of this version is greater than the data coding length of the target data, it can be determined as the first QR code template.
[0142] In the embodiments of this specification, the first fill region may represent a fill region within the first QR code for placing a fill data sequence generated based on the art image to be fused. The subregion may be determined by adjusting the art image to be fused and the first QR code template to the same size, and then determining the image region corresponding to the first fill region within the art image to be fused.
[0143] In the embodiments of this specification, the depicted object can be a primary feature of the art image to be fused, such as a portrait, a building, or an animal. The second QR code template can be a higher version than the first QR code template, or a QR code template with a lower error correction level. Subsequent determinations can be made to determine whether a subregion within the second QR code template contains the depicted object of the art image to be fused, and similar methods can be used until a QR code template containing the depicted object of the art image to be fused is obtained. The QR code template containing the depicted object of the art image to be fused can be one or more.
[0144] As an implementation manner, optionally, the determining whether the sub-region of the to-be-fused art image contains the depicted object of the to-be-fused art image in the embodiment of this specification may specifically include:
[0145] Obtaining an object region where an object is depicted in the art image to be fused;
[0146] Aligning the first QR code template with the art image to be fused and adjusting them to the same size;
[0147] Acquiring first position information of the object area in the art image to be fused;
[0148] Obtaining second position information of the filling area in the first QR code template;
[0149] It is determined whether the area indicated by the first location information is within the area indicated by the second location information.
[0150] The object area in the embodiments of this specification can be obtained by identification using a segmentation model, or it can be an area selected manually. The specific alignment method can adopt the method described in the size adjustment section above, which will not be repeated here. It is understood that the coordinates of each corresponding position in the QR code template and the art image are the same. The first position information can be expressed using coordinates in a coordinate system corresponding to the art image. The second position information can be expressed using coordinates in a coordinate system corresponding to the QR code template.
[0151] In order to ensure that the generated art QR code can fully reflect the characteristics of the art image, optionally, the fusion of the initial QR code image with the second region image of the art image to be fused as described in the embodiments of this specification may specifically include:
[0152] Acquire images of other regions of the initial two-dimensional code image except the filled region;
[0153] The other region images are fused with the second region image of the art image to be fused to generate the art QR code image.
[0154] In the embodiments of this specification, image fusion can also represent style transfer. Existing AI models can be used to perform image fusion on other regions and the second region. Existing AI models can include infrared and visible light image fusion models including supervised models, unsupervised / self-supervised models, LORA models, checkpoint models, ControlNet models, GAN models, saliency models, transformer / self-attention, task-driven, fusion models at different resolutions, guided filter-assisted models, and other models. For example, the ControlNet model can be used to control production factors, the generated QR code can be controlled, the checkpoint model can be used to save model parameters, and the LORA model can be combined to generate an artistic QR code image. When using the AI model for fusion, the fusion area can be set. For example, the initial QR code image and the art image to be fused can be used as the input of the model, and other areas in the initial QR code image and the corresponding areas in the art image to be fused can be set as fusion areas, so that the AI model processes based on the set area and outputs the art QR code image. Before performing AI model fusion, the initial QR code can be extracted to obtain other regional images; the corresponding regional images of the other regional images in the artistic image to be fused can also be extracted, and the extracted other regional images and the corresponding regional images can be used as inputs of the AI model to obtain the regional fusion image output by the AI model, and then the regional fusion image can be overlaid on the other regional images in the initial QR code to obtain the artistic QR code image.
[0155] In actual applications, the art image to be integrated may be a color image. In order to better integrate the generated art QR code with the art image and improve the user's experience, the following steps may be optionally included before generating the art QR code image in the embodiment of this specification:
[0156] The first area image is overlaid onto the filling area of the initial two-dimensional code image.
[0157] In the embodiments of the present specification, after the initial QR code is generated, the first area image can be overlaid on the filled area so that the image of the filled area has color. Before the initial QR code image is fused with the second area of the art image to be fused, the first area image can be overlaid on the filled area of the initial QR code image. Alternatively, after the initial QR code image is fused with the second area of the art image to be fused, and before the art QR code image is generated, the first area image can be overlaid on the filled area of the fused QR code image.
[0158] In actual applications, the server can determine the corresponding positions of each unit rectangle in the filled area of the initial QR code from the artistic image, obtain the color information of the corresponding position, and add the color information to the corresponding position in the QR code so that the filled area is displayed in color.
[0159] In order to make the overall integration of the artistic QR code higher and more beautiful, optionally, the artistic QR code image in the embodiment of this specification is a plurality of artistic QR code images, and the method may further include:
[0160] Use usability evaluation rules to evaluate each artistic QR code image and obtain a usability score;
[0161] Output the highest-rated art QR code image.
[0162] Among them, multiple initial QR code images can be obtained according to different QR code template versions, error correction levels, mask patterns, mirror and non-mirror processing, rotation processing, etc., and then each initial QR code image is processed with the art image to be fused to obtain multiple art QR code images.
[0163] In the embodiments of this specification, each artistic QR code image can be evaluated based on the error tolerance of the encoded data, the characteristics of the artistic image contained in the artistic QR code image, and the color information. Each artistic QR code image can be generated based on a QR code template of different versions or error correction levels.
[0164] In practical applications, the generated art QR code can also be one, and then the art QR code is evaluated. If the score of the art QR code is lower than the threshold, other QR code templates can be selected to regenerate the art QR code image and score it. When the score is higher than or equal to the threshold, the art QR code image can be output and displayed to the user as the target art QR code image.
[0165] In the embodiments of this specification, the recognizability of artistic QR codes can be evaluated. As an implementation method, optionally, the usability evaluation rules described in the embodiments of this specification are used to evaluate each artistic QR code image, which may specifically include:
[0166] For any one of the artistic two-dimensional code images, binarize the image to obtain a binarized image.
[0167] Acquire a plurality of sampling points in the binary image; one sampling point corresponds to a unit rectangle in the QR code template;
[0168] Determine a sampling binarization value of each sampling point in the binarized image;
[0169] Determine a preset binary value corresponding to each of the sampling points; the preset binary value is a binary value in the coded data stream used to generate the initial two-dimensional code image;
[0170] Determining an abnormal sampling point among the sampling points according to the sampling binarized value and the preset binarized value; the sampling binarized value of the abnormal sampling point is inconsistent with the corresponding preset binarized value;
[0171] Each artistic QR code image is evaluated based on the proportion of the abnormal sampling points.
[0172] The sampling points can represent the unit rectangles obtained by dividing the QR code template based on the matrix used to generate the artistic QR code. These unit rectangles can serve as sampling locations for sample data used to verify whether the artistic QR code image meets the requirements. The preset binary values corresponding to the sampling points can represent sample data obtained by sampling the artistic QR code based on the positions of the sampling points after determining the corresponding positions of the unit rectangles of the QR code template in the artistic QR code. It is understood that the sample data can be a binary value of 0 or 1 obtained after binarization processing in the artistic QR code.
[0173] In the embodiments of this specification, the position corresponding to the sampling point in the initial two-dimensional code image can be determined based on the position of the sampling point or the position of the sampling point in the two-dimensional code template. The corresponding binary value in the initial two-dimensional code can be determined based on the corresponding position of the sampling point in the initial two-dimensional code image, so that it can be determined whether the binary value in the initial two-dimensional code image is the same as the sampling data corresponding to the sampling point. If not, it can be regarded as an abnormal sampling point. The proportion of abnormal sampling points can also be calculated based on the arranged data sequence. The arrangement order of the sampling points can be arranged according to the preset filling rule of the two-dimensional code template. The binary data sequence corresponding to the arranged sampling points can be compared with the initial binary data sequence obtained by arranging the initial two-dimensional code image based on the preset filling rule to obtain the abnormal proportion.
[0174] The usability of the artistic QR code in the embodiments of this specification can also be reflected in its aesthetics. As an implementation method, the usability evaluation rules described in the embodiments of this specification can optionally be used to evaluate each artistic QR code image, which may specifically include:
[0175] Use the pre-trained beautification evaluation model to evaluate each artistic QR code image.
[0176] The degree of beautification in the embodiments of this specification can be determined based on the similarity between the artistic QR code image and the artistic image, or by comparing features in the artistic QR code image with features in the artistic image. The beautification evaluation model can be obtained by training a computer model, such as a neural network model, using preset training samples. The training samples can include multiple artistic QR codes with aesthetic rating labels, which can be obtained through expert labeling. The training samples can include samples of labeled artistic QR codes with different ratings to ensure sufficient training of the computer model.
[0177] To more clearly illustrate the method for generating an artistic QR code provided in the embodiments of this specification, Figure 5 is a swim-lane diagram of the method for generating an artistic QR code provided in the embodiments of this specification. As shown in Figure 5, the method may include an information acquisition phase, a data filling phase, and an artistic QR code generation phase, which may specifically include:
[0178] Step 502: The user inputs target data in the terminal.
[0179] In the embodiments of this specification, the target data may include at least one of a URL, a link, or a string of characters to be recognized. The terminal may include at least one operating interface for user operation. The user can enter the target data in the operating interface, and the user can also select the error correction level in the operating interface. In the operating interface, the error correction level is not a necessary option. The server can later set the error correction level to meet the requirements based on the QR code template and the security level of the information.
[0180] Step 504: The server obtains the target data, encodes the target data, and obtains encoded data.
[0181] The target data may be encoded by single encoding or mixed encoding using the above encoding method to obtain a variety of different data sequences, and the shortest data sequence among the multiple different data sequences may be used as the encoded data.
[0182] Step 506: The server determines a QR code template based on the encoded data.
[0183] The QR code template can be determined based on the data capacity of each version of the QR code template and the length of the target data. If the user sets the error correction level, the QR code template that can accommodate the encoded data can also be determined based on the length of the encoded data and the error correction level.
[0184] Step 508: The user selects an art image to be fused or inputs description information on the terminal.
[0185] In the embodiments of this specification, the terminal may include at least an interface for users to select art images. This interface may be the same as or different from the interface for users to input target data. In the interface for selecting art images, users may select or enter descriptive tags for the art images to be fused, such as people, animals, and landscapes. An AI model may then be used to generate the art images to be fused based on the descriptive tags. Users may also select an image from a library of preset images displayed in the interface for selecting art images as the art images to be fused. It is understood that the art images to be fused may be either dynamic or static images.
[0186] Step 510: The server obtains the art QR code to be fused, and determines a first area image corresponding to the filled area in the QR code template based on the QR code template and the obtained art image to be fused.
[0187] In the embodiments of this specification, a padding region within a QR code template can be determined based on the padding rules of a QR code to be used to fill in padding characters within a binary-coded data stream. The QR code template and the art image to be fused can be resized to the same size, and a first region image corresponding to the padding region within the QR code template can be determined from the art image to be fused.
[0188] Step 512: The server generates a filling data sequence corresponding to the filling area based on the first area image.
[0189] In the embodiment of this specification, the server may binarize the first region image, determine corresponding binarized values, and sort the binarized values to obtain a filling data sequence.
[0190] Step 514: The server generates an initial QR code template based on the filling data sequence and the QR code template.
[0191] Based on the target data encoding data, the QR code template version, the error correction level, the filling data sequence, etc., a binary data stream for filling into the QR code template can be generated. The binary data stream is then used to fill the QR code template according to the QR code filling rules, for example, starting from the lower right corner to obtain an initial QR code image. The first region image can also be overlaid into the filled region of the initial QR code image.
[0192] Step 516: The server may determine other image areas except the filling area from the initial two-dimensional code image.
[0193] In the embodiments of this specification, the "other image region" may include at least a portion of the area of the initial QR code image that is populated with data such as template pattern data, length data, target data, terminator data, 8-bit alignment data, and error correction data. It is understood that the "other image region" may represent at least a portion of the initial QR code image excluding the area populated with the data sequence corresponding to the art image to be fused.
[0194] Step 518: The server fuses the other region images with the second region image in the art image to be fused to generate an art QR code.
[0195] In the embodiments of this specification, the second region image can be an image of the remaining region of the art image to be fused, excluding the first region image. Based on the aforementioned existing AI model, style transfer can be performed on the other region images based on the second region image to generate an art QR code with the characteristics of the art image to be fused. This reduces the discrepancy between the coded data in the generated art QR code image and the actual coded data, improves the recognition success rate of the art QR code, and also makes the art QR code more beautiful and more in line with business needs. In actual applications, if the art image to be fused is a color image, the first region image of the art image to be fused can also be covered in the filling area of the initial QR code to obtain a color art QR code.
[0196] Step 520: The terminal displays the art QR code to the user.
[0197] In the embodiment of this specification, the server can generate multiple art QR codes, and can select the art QR code with the highest score from the multiple art QR codes based on the existing scoring model and send it to the display interface for displaying the generated art QR code contained in the terminal, so that the display interface can display the art QR code for the user to view. If the user is not satisfied with the generated art QR code, the user can re-operate and generate a new art QR code.
[0198] Through the above method, the overall appearance of the artistic QR code can be made more beautiful and have bright colors, which can bring a better visual experience to the user. At the same time, the recognition success rate of the artistic QR code is also improved, which can better meet business needs.
[0199] In practical applications, the server can also add a mask image during the QR code generation process. When adding the mask image, the mask image can be added to other areas, while the mask image is not added to the fill area. This ensures that the fill area can present an image that is generally consistent with the corresponding area of the art image.
[0200] In practical applications, for product brand images, the brand logo is usually located in the center area of the image. According to the principles of QR code generation, the padding code in the fill area will also be filled into the center area of the QR code template. The artistic QR code generated in the embodiments of this specification can better reflect the brand identity of the product. For example, for Merchant A's logo, the image data of the logo can be binarized, and the binarized sequence after binarization can be filled into the fill area of the QR code template to obtain an artistic QR code with Merchant A's logo displayed in the center. This artistic QR code can also be recognized by Merchant A's customers, who can jump to Merchant A's related pages, such as the official account, payment page, event page, shopping page, or app download page.
[0201] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 6 is a structural diagram of a device for generating an artistic QR code provided in the embodiments of this specification. As shown in Figure 6, the device may include:
[0202] A first region image acquisition module 602 is configured to acquire a first region image in the art image to be fused that corresponds to a fill region in the QR code template; the fill region is a region in the QR code template used to place fill characters in the encoded data stream;
[0203] A filling data sequence generating module 604 is configured to generate a filling data sequence in a filling bit region in the encoded data stream corresponding to the two-dimensional code template based on the binarized sequence value corresponding to the first region image;
[0204] An initial two-dimensional code image generating module 606 is configured to generate an initial two-dimensional code image based on the filling data sequence;
[0205] The art QR code image generation module 608 is configured to fuse the initial QR code image with the second region image of the art image to be fused to generate the art QR code image; the second region image is the image of the art image to be fused excluding the first region image.
[0206] Based on the same idea, the embodiments of this specification also provide devices corresponding to the above methods.
[0207] FIG7 is a schematic diagram of the structure of a device for generating an artistic QR code according to an embodiment of this specification. As shown in FIG7 , the device 700 may include:
[0208] at least one processor 710; and,
[0209] A memory 730 in communication with the at least one processor; wherein,
[0210] The memory 730 stores instructions 720 that can be executed by the at least one processor 710. The instructions are executed by the at least one processor 710 to enable the at least one processor 710 to:
[0211] Acquire a first area image in the art image to be fused corresponding to a fill area in the QR code template; the fill area is an area in the QR code template used to place fill bit characters in the encoded data stream;
[0212] generating a filling data sequence in a filling bit area of a coded data stream corresponding to the two-dimensional code template based on the binarized sequence value corresponding to the first area image;
[0213] Based on the filling data sequence, generating an initial two-dimensional code image;
[0214] The initial two-dimensional code image is fused with a second region image of the art image to be fused to generate the art two-dimensional code image; the second region image is an image of the art image to be fused excluding the first region image.
[0215] Based on the same idea, the embodiments of this specification also provide a computer-readable medium corresponding to the above method. The computer-readable medium stores computer-readable instructions, which can be executed by a processor to implement the above method of generating an artistic QR code:
[0216] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device shown in FIG7 is generally similar to the method embodiment, so the description is relatively simple. For relevant parts, refer to the description of the method embodiment.
[0217] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0218] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0219] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0220] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0221] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0222] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowcharts and / or one or more blocks in the block diagrams.
[0223] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0224] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0225] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0226] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0227] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0228] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0229] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0230] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0231] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A method for generating an artistic QR code, comprising: Acquire a first area image in the art image to be fused corresponding to the filled area in the QR code template; The filling area is an area in the two-dimensional code template used to place filling characters in the encoded data stream; Based on the binary sequence value corresponding to the first area image, generating a filling data sequence in a filling bit area in the coded data stream corresponding to the two-dimensional code template; Based on the filling data sequence, generating an initial two-dimensional code image; The initial two-dimensional code image is merged with the second region image of the art image to be merged to generate the art two-dimensional code image; the second region image is the image of the art image to be merged except the first region image.
2. The method according to claim 1, further comprising: Get target data; Encoding the target data according to multiple encoding methods to obtain a plurality of data codes; Selecting the data code with the shortest length from the plurality of data codes as the target data code; The generating an initial two-dimensional code image based on the filling data sequence specifically includes: An initial two-dimensional code image is generated based on the filling data sequence and the target data code.
3. According to the method of claim 1, the step of obtaining a first region image corresponding to the filling region in the art image to be fused comprises: Adjusting the art image to be fused and the QR code template to the same size; Based on the art image to be fused and the two-dimensional code template of the same size, the first region image is selected from the art image to be fused according to the position information of the filling region in the two-dimensional code template.
4. The method according to claim 1, further comprising: The first region image is binarized to obtain a binarized sequence value.
5. The method according to claim 4, wherein the binarization processing is performed on the first region image to obtain a binarization sequence value, specifically comprising: Dividing the first region image into a plurality of sub-images according to the distribution and size of each unit rectangle in the filling region; One sub-image corresponds to one unit rectangle; The plurality of sub-images are binarized to obtain the binarized sequence values.
6. The method according to claim 1, wherein generating a filling data sequence in a filling bit area in a coded data stream corresponding to the two-dimensional code template based on the binary sequence value corresponding to the first area image specifically comprises: According to the positions of characters that can be filled in each unit rectangle in the filling area in the coded data stream corresponding to the two-dimensional code template, determine the positions of the binarized values of the sub-images corresponding to each unit rectangle in the first area image in the filling bit area in the coded data stream; Based on the position of the binarized value of each sub-image in the filling bit area in the coded data stream, the binarized value of each sub-image is placed at the corresponding position to generate a filling data sequence in the filling bit area in the coded data stream.
7. According to the method of claim 2, the multiple encoding methods include an encoding method using a single encoding mode and / or an encoding method using a mixed encoding mode.
8. The method according to claim 2, further comprising: If the target data contains numbers, the data is encoded using a first encoding rule; If the target data includes uppercase letters, the uppercase letters are encoded using the second encoding rule.
9. The method according to claim 1, further comprising: According to the length of the data code corresponding to the target data, a first two-dimensional code template having a data capacity greater than the length of the data code is selected from the preset two-dimensional code templates; The data encoding is data obtained by encoding the target data according to a preset encoding method; Determine a first filling area in the first two-dimensional code template for placing filling bit characters in the encoded data stream corresponding to the first two-dimensional code template; Based on the first filling area, determining a sub-area in the art image to be fused corresponding to the first filling area; Determining whether the sub-region of the art image to be fused contains the depicted object of the art image to be fused; If yes, determining the first two-dimensional code template as the two-dimensional code template for generating the initial two-dimensional code image; If not, a second two-dimensional code template is selected from the preset two-dimensional code templates; the data capacity of the second two-dimensional code template is greater than that of the first two-dimensional code template.
10. The method according to claim 1, wherein fusing the initial two-dimensional code image with the second region image of the art image to be fused comprises: Acquire images of other regions in the initial two-dimensional code image except the filled region; The other region images are fused with the second region image of the art image to be fused to generate the art two-dimensional code image.
11. The method according to claim 1, before generating the artistic two-dimensional code image, further comprising: The first area image is overlaid onto the filling area of the initial two-dimensional code image.
12. The method according to claim 1, wherein the artistic two-dimensional code image is a plurality of artistic two-dimensional code images, and the method further comprises: Use usability evaluation rules to evaluate each artistic QR code image and obtain a usability score; Output the highest-rated art QR code image.
13. The method according to claim 12, wherein the use of usability evaluation rules to evaluate each artistic two-dimensional code image specifically comprises: For any one of the artistic two-dimensional code images, binarize the image to obtain a binary image; Acquire a number of sampling points in the binary image; One sampling point corresponds to a unit rectangle in the QR code template; Determine the sampled binary value of each of the sampling points in the binary image; Determine a preset binary value corresponding to each of the sampling points; The preset binary value is a binary value in the coded data stream used to generate the initial two-dimensional code image; According to the sampled binary value and the preset binary value, determining an abnormal sampling point among the sampling points; the sampled binary value of the abnormal sampling point is inconsistent with the corresponding preset binary value; Each artistic QR code image is evaluated according to the proportion of the abnormal sampling points.
14. The method according to claim 12, wherein the use of usability evaluation rules to evaluate each artistic two-dimensional code image specifically comprises: Use the pre-trained beautification evaluation model to evaluate each artistic QR code image.
15. A device for generating an artistic QR code, comprising: A first region image acquisition module, used to acquire a first region image in the art image to be fused corresponding to the filled region in the QR code template; The filling area is an area in the two-dimensional code template used to place filling characters in the encoded data stream; A filling data sequence generating module, used for generating a filling data sequence in a filling bit area in a coded data stream corresponding to the two-dimensional code template based on a binary sequence value corresponding to the first area image; An initial two-dimensional code image generation module, used to generate an initial two-dimensional code image based on the filling data sequence; The art QR code image generation module is used to fuse the initial QR code image with the second region image of the art image to be fused to generate the art QR code image; the second region image is the image of the art image to be fused except the first region image.
16. A device for generating an artistic QR code, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Acquire a first area image in the art image to be fused corresponding to the fill area in the two-dimensional code template; the fill area is an area in the two-dimensional code template used to place fill bit characters in the coded data stream; Based on the binary sequence value corresponding to the first area image, generating a filling data sequence in a filling bit area in the coded data stream corresponding to the two-dimensional code template; Based on the filling data sequence, generating an initial two-dimensional code image; The initial two-dimensional code image is merged with the second region image of the art image to be merged to generate the art two-dimensional code image; the second region image is the image of the art image to be merged except the first region image.
17. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method for generating an artistic two-dimensional code according to any one of claims 1 to 14.
Citation Information
Patent Citations
Image and two-dimensional code fusion method and device
CN104751410A
Generation method and device of artistic two-dimensional code fused with image
CN106778995A
Method and device for evaluating two-dimensional code information extraction accuracy
CN113658164A
Method and device for generating artistic two-dimensional code, equipment and medium
CN117454917A
Method of detecting two-dimensional codes
US20030009725A1
Cited By
Trademark graphic code typesetting method and system
CN120012811A
Personalized image synthesis method and system based on artificial intelligence
CN120953094A