Method, apparatus and device for generating artistic QR code, and medium
Through multi-step processing and evaluation, the method of generating art QR codes solves the problem of uncertainty in art QR codes in the prior art, and improves the availability and matching of the generated art QR codes.
Patent Information
- Application Number
- PCT/CN2024/118529
- 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 art QR code generation methods, and the generated art QR code may not meet business needs.
By obtaining the target data, determining the QR code template, using multiple mask patterns to process the initial QR code image, integrating the QR code image with the art image, and using preset evaluation rules to evaluate the availability of the art QR code, and output the art QR code image with the highest evaluation score.
It improves the availability of generated art QR codes, ensures that the generated art QR codes are more in line with business needs, and enhances recognition rate and aesthetics.
Smart Images

Figure CN2024118529_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 202311272261.4 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 QR codes are gaining increasing attention online. Existing artistic QR codes are often based on a user-entered QR code image and an artistic image, directly fusing the two images using a pure AI (artificial intelligence) model. However, these artistic QR codes are inherently uncertain, and the resulting artistic QR codes may not meet business needs.
[0004] Summary of the Invention
[0005] 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.
[0006] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0007] The embodiments of this specification provide a method for generating an artistic QR code, including:
[0008] Obtaining target data to be carried in a QR code image;
[0009] Determine a QR code template according to the length of the coded data corresponding to the target data;
[0010] processing an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns including a plurality of different mask patterns;
[0011] fusing the multiple two-dimensional code images with the art images to be fitted, respectively, to obtain multiple art two-dimensional code images;
[0012] Using preset usability evaluation rules, performing usability evaluation on the plurality of artistic QR code images to obtain an evaluation score corresponding to each artistic QR code image;
[0013] Output the artistic QR code image with the highest evaluation score.
[0014] The embodiments of this specification provide a device for generating an artistic QR code, including:
[0015] A target data acquisition template, used to acquire target data carried in a QR code image;
[0016] A two-dimensional code template determination module, used to determine the two-dimensional code template according to the length of the encoded data corresponding to the target data;
[0017] a mask processing module, configured to process an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns including a plurality of different mask patterns;
[0018] a fusion module, configured to fuse the plurality of two-dimensional code images with the art image to be fitted, respectively, to obtain a plurality of art two-dimensional code images;
[0019] a scoring module, configured to perform usability evaluation on the plurality of artistic QR code images using preset usability evaluation rules, and obtain an evaluation score corresponding to each artistic QR code image;
[0020] The image output module is used to output the artistic QR code image with the highest evaluation score.
[0021] The embodiments of this specification provide a device for generating an artistic QR code, including:
[0022] at least one processor; and,
[0023] a memory communicatively connected to the at least one processor; wherein,
[0024] 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:
[0025] Obtaining target data to be carried in a QR code image;
[0026] Determine a QR code template according to the length of the coded data corresponding to the target data;
[0027] processing an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns including a plurality of different mask patterns;
[0028] fusing the multiple two-dimensional code images with the art images to be fitted, respectively, to obtain multiple art two-dimensional code images;
[0029] Using preset usability evaluation rules, performing usability evaluation on the plurality of artistic QR code images to obtain an evaluation score corresponding to each artistic QR code image;
[0030] Output the artistic QR code image with the highest evaluation score.
[0031] 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.
[0032] At least one embodiment of this specification can achieve the following beneficial effects: determining a corresponding QR code template based on the encoding length corresponding to target data, generating multiple QR code images based on the QR code template, target data, and a first number of mask patterns, fusing the multiple QR code images with the art image to be fitted to obtain multiple art QR code images, scoring each art QR code image, and outputting the highest-scoring art QR code image. This allows users to obtain highly usable art QR code images, meeting business needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] 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.
[0034] 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;
[0035] FIG2 is a flow chart of a method for generating an artistic QR code according to an embodiment of this specification;
[0036] FIG3 is a swim-lane diagram of a method for generating an artistic QR code provided in an embodiment of this specification;
[0037] FIG4 is a schematic diagram of the structure of a device for generating an artistic QR code according to an embodiment of this specification;
[0038] FIG5 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
[0039] 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.
[0040] The technical solutions provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0041] With the development of computer technology, QR code styles have diversified. Artistic QR codes are gaining increasing attention online. QR codes are used by businesses to express their brands in a personalized way, while users are also seeking to attract traffic from artistic codes. However, existing artistic QR codes are mostly based on user-entered QR code images and artistic images. These images are simply fused using pure AI (artificial intelligence) to generate an artistic QR code. This creates uncertainty, and the generated artistic QR codes may differ significantly from business needs, such as a low probability of recognition and a less than aesthetically pleasing artistic image.
[0042] In order to solve the defects in the prior art, this solution provides the following embodiments. For ease of understanding, some concepts are first explained here:
[0043] Mask: A mask can represent a string of binary codes that performs a bitwise AND operation on the target field to shield the current input bit. It can process data code elements and error correction code elements to avoid excessive black or white blocks in the QR code. The existing technology includes eight different mask patterns.
[0044] Error correction level: The error correction level can indicate the size of the error tolerance rate. Different error correction levels have different ratios of the maximum area allowed to be blocked when the QR code can be scanned normally to the total area.
[0045] QR code mirroring: Flip the QR code image horizontally or vertically so that the mirrored QR code image is visually symmetrical with the original image.
[0046] QR code rotation: Rotate the QR code image at a certain angle, for example, you can rotate it clockwise or counterclockwise by a certain angle, such as 30 degrees, 45 degrees, 90 degrees, 180 degrees, etc.
[0047] QR code version: The QR code version can represent the basic image used to generate the QR code. Different QR code templates have different data capacities. The higher the version, the larger the data capacity. The existing QR code version can include forty versions with different data capacity sizes.
[0048] Style transfer: Provide a style image and convert any image into this style, while preserving the content of the image as much as possible.
[0049] FIG1 is a schematic diagram of an application scenario of a method for generating an artistic QR code according to an embodiment of this specification.
[0050] As shown in Figure 1, the solution primarily includes: target data 1, an art image to be fused 2, a server 3, and a target art QR code image 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, it can be parsed and recognized. The server 3 can select an appropriate QR code template based on the length of the target data 1. The data capacity of the QR code template must be greater than the encoded data length of the target data. The error correction level in the QR code template can be set by the user or a security level selected by the server 3 based on the intended use of the target data. The server 3 can fill the QR code template with data based on the target data to obtain an initial QR code image. The server 3 can then perform masking, mirroring, and other processing on the initial QR code image to generate multiple QR code images for the same target data. The server 3 can then fuse the individual QR code images based on the obtained art image to be fused 2 to obtain multiple art QR code images. Each art QR code image is then scored for usability using pre-set scoring rules. The art QR code image with the highest score can be output as the target art QR code image 4, thereby generating an art QR code image with a high usability.
[0051] 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:
[0052] 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.
[0053] As shown in Figure 2, the process may include the following steps:
[0054] Step 202: Obtain target data for carrying in a two-dimensional code image.
[0055] In the embodiments of this specification, the target data may include at least one of uppercase letters, lowercase letters, numbers, Chinese characters, and special characters. The target data may be a string of characters that supports functions such as payment, collection, information acquisition, website redirection, and event push notifications. Specifically, the target data may be a website address, a link, or characters to be recognized. The server may process the character data in the target data and insert the processed results into a QR code image so that the corresponding function can be completed when the user scans the QR code image.
[0056] Step 204: Determine a QR code template according to the length of the coded data corresponding to the target data.
[0057] In the embodiments of this specification, the server can encode the target data based on preset rules to obtain the encoded data length corresponding to the target data. The QR code template can include forty different versions, each with different data capacities. Higher-version QR code templates have larger data capacities. For example, version 1 of the QR code template has a 21 x 21 matrix, version 2 has a 25 x 25 matrix, and version 40 has a 177 x 177 matrix. Based on the data capacities of each version of the QR code template, the server can select a QR code template that can accommodate the encoded data length corresponding to the target data, thereby determining the QR code template to be used for subsequent generation of the artistic QR code.
[0058] Step 206: Processing the initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain multiple two-dimensional code images; the first number of mask patterns includes multiple different mask patterns.
[0059] In the embodiments of this specification, the mask pattern may be an existing QR code mask pattern. The first number may represent a number greater than 1, such as 3, 4, or 5 mask patterns. The initial QR code image may represent an image obtained by filling a QR code template with an encoded binary stream obtained based on the target data. The server may mask the initial QR code image based on each mask image to obtain multiple QR code images.
[0060] Step 208: Fusing the multiple two-dimensional code images with the art image to be fitted respectively to obtain multiple art two-dimensional code images.
[0061] In the embodiments of this specification, the art image to be fitted can be a picture or some descriptive information, wherein the user can select the image to be fused, provide some feature description information, and the AI image generation model generates an image based on the feature information. The server can use a preset image fusion method to fuse each QR code image with the art image to be fused. For example, an existing AI model can be used to fuse each QR code image with the art image to be fitted, and output multiple art QR code images. The existing AI model can include infrared and visible light image fusion, including supervised models, unsupervised / self-supervised models, GAN, saliency models, transformer / self-attention, task-driven, fusion models at different resolutions, guided filter-assisted models, and other models. The art QR code image can contain some or all of the features of the art image to be fitted, and can be an image that can be successfully recognized. The art QR code image can be a static image or a dynamic image. Other methods can also be used for fusion, which are not specifically limited here.
[0062] Step 210: Using preset usability evaluation rules, perform usability evaluation on the plurality of artistic QR code images to obtain an evaluation score corresponding to each artistic QR code image.
[0063] The usability evaluation rules preset in the embodiments of this specification can represent rules for evaluating the usability of artistic QR code images, where usability can include aspects such as recognition rate and aesthetics. For example, it can represent comparing the features contained in the artistic QR code with the features contained in the artistic image to be fitted, and obtaining an evaluation score for each artistic QR code image based on the degree of feature inclusion. It can also represent evaluating each artistic QR code based on its aesthetics. It can also represent comparing the data sequence contained in the artistic QR code image with the data sequence used to generate the artistic QR code, and evaluating each artistic QR code based on the content of abnormal data, and so on.
[0064] Step 212: Output the artistic QR code image with the highest evaluation score.
[0065] In the embodiments of this specification, the various art QR code images can be sorted by evaluation score, with the highest-scoring art QR code image being output. In practical applications, a single art QR code image with the highest evaluation score can be output, or multiple art QR code images with the highest evaluation scores can be output. For example, multiple art QR code images with evaluation scores above a preset threshold can be output. The specific number of art QR code images output is not limited.
[0066] In practical applications, when scoring multiple art QR code images, the scoring can be performed in a pre-set order, and the bubble method can be used to determine the art QR code image with the highest evaluation score and output it; if scoring multiple art QR code images, all art QR codes are evaluated at once, then the art QR code images can be arranged from high to low according to the evaluation scores, and the art QR code image ranked first can be output, thereby outputting an art QR code with higher usability.
[0067] 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.
[0068] The method in Figure 2 determines the corresponding QR code template based on the encoding length corresponding to the target data. Based on the QR code template, the target data, and a first number of mask patterns, multiple QR code images are generated. These multiple QR code images are then fused with the art image to be fitted to obtain multiple art QR code images. Each art QR code image is scored, and the highest-scoring art QR code image is output. This allows users to obtain highly usable art QR code images that meet business needs.
[0069] Based on the method of FIG2 , the examples of this specification also provide some specific implementation plans of the method, which are described below.
[0070] In order to improve the quality of the output artistic QR code, the QR code image can be mirrored to obtain more artistic QR codes for screening. Optionally, the method described in the embodiment of this specification can also include:
[0071] Mirroring the initial two-dimensional code image to obtain a mirrored initial two-dimensional code image;
[0072] Processing the mirrored initial two-dimensional code image according to a second number of mask patterns to obtain a plurality of mirrored two-dimensional code images; the second number of mask patterns includes one or more different mask patterns;
[0073] The step of fitting the plurality of two-dimensional code images with the art images to be fitted specifically includes:
[0074] The multiple two-dimensional code images and the plurality of mirrored two-dimensional code images are respectively fitted with the art image to be fitted.
[0075] In the embodiments of this specification, the initial QR code image can be processed using existing mirroring methods. The second number can be greater than or equal to 1 and can be the same as or different from the first number. The second number of mask patterns can be selected from the first number of mask patterns or from all existing mask patterns. In the embodiments of this specification, the mirrored and unmirrored QR code images can be processed separately with the art image to be fused, resulting in a larger number of art QR code images to be evaluated.
[0076] In practical applications, mask processing can be performed first and then mirror processing. Specifically, part or all of the multiple QR code images obtained by processing the initial QR code image of the target data based on the QR code template according to the first number of mask patterns can be mirrored.
[0077] As a way to expand the code base, the embodiments of this specification can also obtain multiple code images by rotating the QR code image, which is also more conducive to generating artistic QR code images with high usability. Optionally, the method in the embodiments of this specification can also include:
[0078] Rotating the initial two-dimensional code image to obtain a rotated initial two-dimensional code image;
[0079] Processing the rotated initial two-dimensional code image according to a third number of mask patterns to obtain a plurality of rotated two-dimensional code images; the third number of mask patterns includes one or more different mask patterns;
[0080] The step of fitting the plurality of two-dimensional code images with the art images to be fitted specifically includes:
[0081] The multiple two-dimensional code images and the several rotated two-dimensional code images are respectively fitted with the art image to be fitted.
[0082] The image can be rotated according to a preset rotation rule, which may include information such as a rotation angle and a rotation direction. For example, the initial QR code image can be rotated according to a preset rotation direction and angle. For an initial QR code image to be rotated, it can be rotated once or multiple times according to a preset unit rotation angle and a preset rotation direction. For example, it can be rotated in units of 45 degrees. If rotated once, the QR code is rotated 45 degrees. If rotated twice, the QR code is rotated 90 degrees. And so on. The rotation angle can also be set to perform a one-time rotation. For example, setting the rotation angle to 30 degrees will rotate the image 30 degrees clockwise.
[0083] One or more rotated QR code images can be generated for an initial QR code image. If there are multiple initial QR code images, some of them can be rotated, and different rotation rules can be used to process the same or different initial QR code images. This is not specifically limited here.
[0084] In actual applications, there may be multiple QR code templates that can accommodate the target data. As an implementation method, in the embodiments of this specification, multiple different QR code templates can be selected to process the data to obtain multiple initial QR code images, which facilitates the subsequent selection of artistic QR code images that meet business needs, providing greater selectivity. Optionally, the QR code templates in the embodiments of this specification include multiple QR code templates whose capacity is greater than the length of the encoded data corresponding to the target data;
[0085] The processing of the initial two-dimensional code image for the target data generated based on the two-dimensional code template according to the first number of mask patterns specifically includes:
[0086] For any two-dimensional code template among the plurality of two-dimensional code templates, an initial two-dimensional code image for the target data generated based on the any two-dimensional code template is processed according to a first number of mask patterns.
[0087] A QR code template can include information such as the QR code version and error correction level. The error correction level can be selected by the user or determined by the server based on factors such as the target data's purpose. In practical applications, the data capacity of each QR code version and the corresponding QR code templates with different error correction levels is known. Based on the encoded data length of the target data, a QR code template that exceeds the encoded data length can be selected.
[0088] In practical applications, a preset number of QR code templates capable of accommodating the coded data corresponding to the target data can be randomly selected; alternatively, a preset number of QR code templates capable of accommodating the coded data corresponding to the target data can be selected in ascending order of QR code version. Alternatively, the QR code template can be selected based on the application scenario or function of the artistic QR code image. For example, if the artistic QR code is used for payment, recognition rate can be prioritized, and one or more QR code versions with lower versions that can accommodate the coded data corresponding to the target data can be selected from the QR code version list. If the artistic QR code is used for promotional purposes, aesthetics can be prioritized, and one or more QR code versions with higher versions that can accommodate the coded data corresponding to the target data can be selected from the QR code version list.
[0089] In practical applications, once the QR code template and the encoding data corresponding to the target data are determined, the initial QR code image can be determined. In the embodiments of this specification, multiple initial QR code images based on different QR code templates are obtained, and each different initial QR code image is masked to obtain multiple QR code images. It is understood that when there are M QR code templates and the first number of mask patterns is N, N*M QR code images can be obtained.
[0090] Optionally, the multiple QR code templates described in the embodiments of this specification may include QR code templates of different versions and / or QR code templates of different error correction levels.
[0091] The error correction levels of a QR code can include four types, namely H, Q, M and L. In the embodiment of this specification, different versions of QR code templates may include multiple QR code templates with the same error correction level but different QR code versions. For example, there are two different versions of QR code templates. The QR code version of QR code template 1 is version 10, and the error correction level is H; the QR code version of QR code template 2 is version 15, and the error correction level is also H. Different versions of QR code templates may also include multiple QR code templates with different QR code error correction levels but the same QR code version. For example, the QR code version of QR code template 1 is version 10, and the error correction level is H; the QR code version of QR code template 3 is version 10, and the error correction level is L. In this way, a variety of different combinations of QR code templates can be obtained, and a variety of different artistic QR codes can be obtained, so that the output artistic QR codes can be made more in line with business needs.
[0092] In practice, higher QR code versions have greater data capacity. Higher error correction levels also increase the amount of data contained within the code, leaving less room for additional data. If the user doesn't set an error correction level, the server can determine the QR code's error correction level based on the user's needs and the QR code's intended purpose. It's understood that higher error correction levels reduce the requirements for successful QR code recognition. If the user sets an error correction level, processing can be performed based on the user's set error correction level.
[0093] In the embodiment of this specification, a suitable encoding method can be selected according to the character type of the target data so that the generated encoded data can meet the requirements. Optionally, the method described in the embodiment of this specification can also include:
[0094] Determining an encoding method according to the character type contained in the target data;
[0095] The target data is encoded according to the encoding method to obtain the encoded data.
[0096] The character types contained in the target data may include at least one character type such as uppercase letters, lowercase letters, numbers and special symbols. The encoding method may include encoding methods such as Numeric mode (numeric encoding), Alphanumeric mode (character encoding), Byte mode (byte encoding) and Kanji mode (double-byte encoding). Different encoding methods can encode different character types, and the number of bits occupied by a character is also different. For example, the Numeric mode encoding method can only be used to encode numbers and cannot encode characters of other character types. However, a character occupies 3.3 bits, which is the shortest number of bits occupied among the above encoding methods. In the embodiments of this specification, the encoding method that makes the obtained encoded data the shortest can be selected according to the character types contained in the target data.
[0097] In the embodiments of this specification, the target data can be encoded using multiple encoding methods, and the shortest code from the resulting encoding can be selected as the code used to generate the QR code image. Furthermore, when the target data corresponds to a shorter code length, a QR code with a lower version can be selected to improve recognition rates.
[0098] Optionally, in the embodiments of this specification, the method may further include:
[0099] Encoding the target data according to multiple encoding methods to obtain a plurality of candidate encoding data;
[0100] The encoding data with the shortest length is selected from the plurality of candidate encoding data as the encoding data corresponding to the target data.
[0101] Different encoding methods can encode the same character, and the resulting encoded data bit lengths can be different. In the embodiments of this specification, the data lengths of the alternative encoded data obtained using different encoding methods can be different. The data length can represent the amount of binary data contained in the encoded data, and the shortest encoded data can be determined as the encoding data used as the target data when generating a two-dimensional code image. This can reduce the proportion of binary data corresponding to the target data in the two-dimensional code template, and can reduce the impact on the target data when the two-dimensional code image is fused with the art image to be fitted. In addition, the shortest encoding is also conducive to selecting a lower version of the two-dimensional code template, which is conducive to improving the recognition rate.
[0102] The server can select a plurality of encoding methods that can be encoded to encode the target data based on the character type in the target data, and select the shortest encoded data. Taking the target data 01aaaED as an example, since Numeric mode (digital encoding) and Alphanumeric mode (character encoding) cannot encode lowercase letters, the server cannot use these two encoding methods alone to encode the target data containing lowercase letters, but can use Byte mode (byte encoding) to encode the target data containing lowercase letters. Byte mode (byte encoding) can be used alone to encode the above target, or at least one of Numeric mode (digital encoding) and Alphanumeric mode (character encoding) can be combined with Byte mode (byte encoding) to encode the above target data, and the encoded data with the shortest length can be selected from them.
[0103] As an implementation manner, optionally, encoding the target data in the embodiment of this specification may include:
[0104] If the target data contains numbers, the data is encoded using a first encoding rule;
[0105] If the target data includes uppercase letters, the uppercase letters are encoded using the second encoding rule.
[0106] Among them, the first encoding rule can represent a rule that can encode numbers, such as using the Numeric mode encoding method corresponding to the numeric mode to encode numbers; the second encoding rule can represent a rule that can encode uppercase letters, such as using the Alphanumeric mode encoding method corresponding to the alphanumeric special character mode to encode uppercase letters.
[0107] 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. If the target data contains multiple different character types, the fourth encoding rule can also be used to encode each character in the target data. When the target data contains multiple different types of character data, a mixed encoding mode can be used. The mixed encoding mode can be determined based on the correspondence between the character type and the encoding length in the target data. For example: the target data is H: / 3.M, where, based on the correspondence between the character type and the encoding length, for numbers, the encoding length corresponding to the Numeric mode encoding method is the shortest, and for uppercase letters and special symbols, the encoding length corresponding to the Alphanumeric mode encoding method is the shortest. The number-character mixed encoding mode can be selected so that after encoding H: / 3.M, the encoding length obtained is the shortest.
[0108] In practical applications, you can also select different encoding rules based on the character types in the target data to encode the target data. For example, you can use byte mode to complete the encoding alone, or obtain other encoding methods and then select the encoding result that meets the user's needs for subsequent processing. In practical applications, because the encoding result obtained by byte mode encoding is usually longer than the encoding result obtained by 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 based on actual needs.
[0109] As an implementation manner, optionally, the multiple encoding methods described in the embodiments of this specification may include an encoding method using a single encoding mode for encoding and / or an encoding method using a mixed encoding mode for encoding.
[0110] In the embodiments of this specification, a single encoding mode may represent an encoding mode in which a single 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. For example, if the target data is 10Aa, the byte mode encoding method corresponding to the single encoding mode may be used to encode 10Aa to obtain the encoded data; or the numeric mode, alphanumeric mode, and byte mode encoding methods corresponding to the mixed encoding mode may be used to encode the numeric characters, uppercase characters, and lowercase characters in the target data, respectively, to obtain the encoded data corresponding to the target data.
[0111] The specific encoding mode used in the embodiments of this specification can be determined based on the number of bits corresponding to a character in each encoding method and the character types that can be encoded by each encoding method. 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 improve the recognition rate of the QR code.
[0112] As an implementation method, the artistic QR code can be evaluated based on the abnormal binary values present in the artistic QR code image. Optionally, in the embodiment of this specification, the usability evaluation of the plurality of artistic QR code images is performed using preset usability evaluation rules, which may specifically include:
[0113] For any one of the plurality of artistic two-dimensional code images, obtaining binary values of a plurality of sampling points in the any one of the artistic two-dimensional code images;
[0114] Determining, based on the binarized values of the plurality of sampling points, abnormal sampling points among the plurality of sampling points; the binarized values of the abnormal sampling points are inconsistent with preset binarized values; the preset binarized values are binarized values in the coded data stream used to generate the initial two-dimensional code image;
[0115] The recognizability of each artistic two-dimensional code image is evaluated according to the number of the abnormal sampling points.
[0116] In the embodiments of this specification, the sampling points can represent a matrix based on a QR code template used to generate an artistic QR code. The unit rectangles obtained by dividing the QR code template can serve as sampling locations for sample data to verify whether the artistic QR code image meets the requirements. The binary values can be obtained by binarizing the artistic QR code. The preset binary values can represent the binary values filled in each unit rectangle during the generation of the artistic QR code image. An abnormal sampling point can indicate that the binary value corresponding to the sampling point is different from the binary value filled in during the generation of the artistic QR code. The encoded data stream can represent a string of binary data obtained by arranging the binary values corresponding to each unit rectangle in the initial QR code image in the order of filling. The recognizability assessment can represent the proportion of abnormal sampling points to the total number of sampling points, and the artistic QR code image can be scored based on this proportion. For example, if there are 200 sampling points and 4 abnormal sampling points, the proportion can be 2%, and the artistic QR code image can be evaluated as 98 points.
[0117] In order to make the binary values corresponding to the sampling points more accurate, the method described in the embodiments of this specification may optionally further include:
[0118] Binarizing any one of the artistic two-dimensional code images to obtain a binary image;
[0119] Acquire a plurality of sampling points in the binary image; one sampling point corresponds to a unit rectangle in the QR code template;
[0120] Determine a binarized value of each sampling point in the binarized image.
[0121] In the embodiments of this specification, the binarization process for the art QR code can be grayscale processing of the art QR code to obtain a grayscale art QR code image; the mask pattern contained in the grayscale art QR code can be removed to obtain a first QR code image; it can be determined whether the art QR code image has been mirrored; if the art QR code image has been mirrored, the first QR code image can be reversely mirrored to obtain a second QR code image; the binarization value corresponding to each unit rectangle in the second QR code image can be determined based on the brightness corresponding to each unit rectangle, to obtain a binarization image containing the binarization value.
[0122] As an implementation method, the aesthetics of the artistic QR code images may also be evaluated. Optionally, in the embodiments of this specification, a usability evaluation is performed on the plurality of artistic QR code images using preset usability evaluation rules, which may specifically include:
[0123] Use the pre-trained beautification evaluation model to evaluate each artistic QR code image.
[0124] The beautification evaluation model in the embodiments of this specification can be obtained by training an existing model using labeled samples. The labeling can be manual or model-based, and the existing model can include classification models, image recognition models, etc. In practical applications, the score can also be calculated based on the features of the image contained in the art QR code and the weights of the features. The positional relationship between each feature and the art QR code can also be used to determine whether the art QR code contains the main features and determine the score. The score can also be calculated based on the clarity and completeness of each feature.
[0125] In practical applications, the server can perform a weighted summation based on the aesthetic evaluation, recognizability evaluation, and feature evaluation to obtain a total evaluation score. The server can then select the artistic QR code image with the highest overall score as the target artistic QR code image. For example, the artistic QR code can be comprehensively evaluated using both the recognizability and aesthetic evaluations, with the recognizability evaluation weighted at 0.7 and the aesthetic evaluation weighted at 0.3. Artistic QR code image 1 has a recognizability evaluation score of 98 and a beautification evaluation score of 95, resulting in a total score of 97.1. Artistic QR code image 2 has a recognizability evaluation score of 90 and a beautification evaluation score of 99, resulting in a total score of 92.7. If the output artistic QR code image has the highest score, artistic QR code image 1 can be output. If the output artistic QR code image has a score greater than or equal to the threshold score of 90, both artistic QR code image 1 and artistic QR code image 2 can be output.
[0126] In order to make the generated artistic QR code image more able to reflect the characteristics of the artistic image and improve the success rate of identifying the artistic QR code image, the generation method of the initial QR code image in the embodiment of this specification may optionally include:
[0127] Acquire a first area image in the art image to be fused corresponding to a fill area in the two-dimensional code template; the fill area is an area in the two-dimensional code template used to place fill characters in the encoded data stream;
[0128] 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;
[0129] The initial two-dimensional code image is generated based on the encoding data corresponding to the target data and the filling data sequence.
[0130] In the embodiments of this specification, the filling area can represent the filling bit characters in the encoded data stream, and can also be called placeholders, placeholder codes, etc. In the position area in the QR code template, it 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 continuously adjacent characters is greater than the 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. It can also be understood as the number of continuously adjacent characters is relatively small. The first area image can be a collection of sub-images corresponding to each unit rectangle of the filling area in the art image to be fused after the QR code template and the art image to be fused are adjusted to the same size.
[0131] In the embodiments of this specification, the binarized sequence value may represent the data obtained by binarizing each sub-image within the first region image of the art image to be fused. Specifically, the first region image may be grayscale processed, and the binarized data for each sub-image may be determined based on the relationship between the grayscale values of each sub-image after grayscale processing and a preset grayscale threshold. In practical applications, the order of each binary character in the binarized sequence value within the padded data sequence may be determined based on the padded order of the QR code, so that the first region image or image features of the art image to be fused can be represented in the QR code image generated using the encoded data stream containing the padded data sequence.
[0132] In practical applications, the padding area in the QR code template can also be filled using the existing method for processing the padding area. For example, 11101100 00010001 is repeated, and the resulting repeated data sequence with the same length as the padding area to be filled can be used as the data sequence of the padding area.
[0133] In order to reduce data interference caused by the mask on the filled area of the data sequence corresponding to the filled first area image, optionally, in the embodiment of this specification, processing the initial QR code image for the target data generated based on the QR code template according to the first number of mask patterns may specifically include:
[0134] The remaining areas of the initial two-dimensional code image except the filling area are processed according to a first number of mask patterns.
[0135] In the embodiments of this specification, other regions may include regions within the QR code template used to fill in target data, error correction codes, 8-bit padding codes, and other data. These regions may be processed using existing methods for adding mask patterns, such as performing an exclusive-OR operation on the binary data based on the mask pattern and the binary data of the initial QR code image to obtain the binary data corresponding to each unit rectangle in the other regions. This can reduce the presence of overly dense black or white areas in the QR code image and improve the aesthetics of the QR code image.
[0136] In order to make the generated artistic QR code image have more features of the artistic image to be fused, improve the aesthetics of the artistic QR code image and meet business needs, the embodiment of this specification optionally fuses the multiple QR code images with the artistic image to be fitted, specifically including:
[0137] For at least one of the multiple two-dimensional code images, the at least one two-dimensional code image is fused with a second region image of the art image to be fused, where the second region image is an image of the art image to be fused excluding the first region image.
[0138] In the embodiments of this specification, the existing AI model can be used to perform image fusion on other regions and the second region 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 the other regions in the initial QR code image and the corresponding regions in the art image to be fused can be set as the fusion area, so that the AI model processes based on the set area and outputs the art QR code image. Before performing the AI model fusion, the initial QR code can be extracted to obtain other region images; the corresponding region images of the other region images in the art image to be fused can also be extracted, and the extracted other region images and the corresponding region images can be used as the input of the AI model to obtain the region fusion image output by the AI model, and then the region fusion image can be overlaid on the other region images in the initial QR code to obtain the art QR code image.
[0139] As an implementation manner, optionally, the method described in the embodiments of this specification may further include:
[0140] The first area image is overlaid onto the filling area of the initial two-dimensional code image.
[0141] In the embodiments of this specification, the first area image can be covered in the filling area before the QR code image is fused with the second area image of the art image to be fused; or the first area image can be covered in the filling area after the QR code image is fused with the second area image of the art image to be fused and before the art QR code image is generated, so as to ensure the beauty of the art QR code image while not affecting the recognition of the art QR code.
[0142] To more clearly illustrate the method for generating an artistic QR code provided in the embodiments of this specification, Figure 3 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 3, the method may include a template acquisition stage, a data preprocessing stage, and an artistic QR code generation stage, which may specifically include:
[0143] Step 302: The user inputs target data at the terminal.
[0144] 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.
[0145] Step 304: The server obtains the target data, encodes the target data, and obtains a data code.
[0146] The target data can be encoded using the above encoding methods for single encoding or mixed encoding to obtain multiple different data sequences, and the shortest data sequence can be used as the data code. The target data can also be encoded according to the encoding method specified by the user to obtain the data code.
[0147] Step 306: The server determines M target QR code templates that can carry the data encoding based on the encoded data.
[0148] In the embodiments of this specification, the determination of the QR code template can be based on the data capacity of each version of the QR code template and the length of the encoded data 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. The M QR code templates can include templates with different error correction levels for the same version, templates with the same error correction level for different versions, and templates with different error correction levels for different versions.
[0149] Step 308: The server generates M initial QR code images based on the M target QR code templates.
[0150] In actual applications, according to the filling requirements of each QR code template and the encoding data corresponding to the target data, the binary encoding stream corresponding to each QR code template can be obtained. The binary encoding stream can be filled into the corresponding QR code template in the filling order to obtain the initial QR code image.
[0151] Step 310: The server may mirror each initial QR code image to obtain Y mirrored initial QR code images.
[0152] In the embodiments of this specification, existing mirror processing means can be used to perform mirror processing on part or all of the initial two-dimensional code image. Y can be a value less than or equal to M.
[0153] Step 312: For each of the M initial two-dimensional code images and the Y mirrored initial two-dimensional code images, select N target mask patterns from preset mask patterns.
[0154] The target mask pattern selected in the embodiments of this specification may be an existing mask pattern or a user-defined mask pattern, which is not specifically limited here.
[0155] Step 314: Masking is performed on each of the initial two-dimensional code images and the mirrored initial two-dimensional code image according to the N target mask patterns to obtain K two-dimensional code images.
[0156] In the embodiments of this specification, each of the initial two-dimensional code images that have not been mirrored can be processed based on the target mask pattern to obtain MxN two-dimensional code images; each of the mirrored initial two-dimensional code images that have been mirrored can be processed based on the target mask pattern to obtain YxN two-dimensional code images, and K can be the sum of the two. It is understandable that the first part of the N mask patterns can also be selected to process the initial two-dimensional code image, and the second part of the N mask patterns can be selected to process the mirrored initial two-dimensional code image, and there can be overlapping parts between the first part of the pattern and the second part of the pattern. If the filling area in the initial two-dimensional code image is filled with existing repeatable data, the entire initial two-dimensional code image and the mirrored initial two-dimensional code image can be masked; if the filling area in the initial two-dimensional code image is filled with a data sequence after the first area image in the art image to be fused is binarized, other areas outside the filling area can be masked.
[0157] In practical applications, the obtained QR code image can also be rotated, wherein the initial QR code image can be rotated, the mirrored QR code can be rotated, and the masked QR code image can be processed. It can be understood that the processing order of the mask image processing, mirror processing, and rotation processing methods introduced above can be set according to actual needs. For example, the QR code image can be processed in the order of mirroring, rotation, and masking, or in the order of rotation, mirroring, and masking, or in the order of masking, rotation, and mirroring, etc., which are not specifically limited here. For a QR code image, multiple processing methods can be selected or one processing method can be selected. This can also be set according to actual needs and is not specifically limited here.
[0158] Step 316: The user can select an art image to be fused or input description information on the terminal.
[0159] 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.
[0160] Step 318: The server obtains the art image to be fused, and fits the QR code image with the art image to be fused to obtain an art QR code image.
[0161] In the embodiments of this specification, if the filled region in the QR code image is filled with a data sequence obtained by binarizing the first region image in the to-be-fused art image, a second region image in the to-be-fused art image corresponding to other regions in the QR code image can be determined, and the second region image and other regions in the QR code image can be fitted using an existing AI model to obtain the art QR code image. If the filled region in the initial QR code image is filled with existing repeatable data, the QR code image and the to-be-fused art image can be fitted using an existing AI model.
[0162] Step 320: The server scores the artistic QR code image using a preset scoring rule.
[0163] In the embodiments of this specification, the preset scoring rules may be scoring the aesthetics of the artistic QR code image, scoring the proportion of abnormal data in the artistic QR code image, or scoring the similarity between the features in the artistic QR code image and the features of the artistic image to be fused, etc., or a weighted sum of multiple scoring methods may be used to calculate the score of each artistic QR code image.
[0164] Step 322: The server outputs the artistic QR code image with the highest score.
[0165] In the embodiment of this specification, the artistic QR code images can be arranged according to their scores, and the artistic QR code image with the highest score can be selected as the target artistic QR code image that meets the business needs, or the artistic QR code image with a score higher than a threshold score can be selected as the target artistic QR code image.
[0166] Step 324: The terminal displays the target art QR code image.
[0167] In the embodiments of this specification, a terminal may display an artistic QR code image on a display interface. The display interface may display one or more artistic QR code images. If multiple artistic QR code images are displayed, the user may select one based on their needs. The user may choose to save the artistic QR code image as an image on the display interface; they may also choose to transfer or share the artistic QR code image with a target user; and the display interface may include a print control so that the user can choose to print the artistic QR code image on paper.
[0168] Through the above method, multiple artistic QR code images can be obtained, from which artistic QR code images that meet business needs can be selected, which can improve the aesthetics of the artistic QR code images and the success rate of recognition.
[0169] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 4 is a schematic diagram of the structure of a device for generating an artistic QR code provided in the embodiments of this specification. As shown in Figure 4, the device may include:
[0170] The target data acquisition module 402 is used to acquire the target data carried in the QR code image;
[0171] A QR code template determination module 404 is configured to determine a QR code template based on the length of the encoded data corresponding to the target data;
[0172] a mask processing module 406 configured to process an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns including a plurality of different mask patterns;
[0173] A fusion module 408 is configured to fuse the plurality of QR code images with the art image to be fitted, respectively, to obtain a plurality of art QR code images;
[0174] A scoring module 410 is configured to perform usability evaluation on the plurality of artistic QR code images using a preset usability evaluation rule to obtain an evaluation score corresponding to each artistic QR code image;
[0175] The image output module 412 is configured to output the artistic QR code image with the highest evaluation score.
[0176] Based on the same idea, the embodiments of this specification also provide devices corresponding to the above methods.
[0177] FIG5 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 FIG5 , the device 500 may include:
[0178] at least one processor 510; and,
[0179] A memory 530 in communication with the at least one processor; wherein,
[0180] The memory 530 stores instructions 520 executable by the at least one processor 510. The instructions are executed by the at least one processor 510 to enable the at least one processor 510 to:
[0181] Obtaining target data to be carried in a QR code image;
[0182] Determine a QR code template according to the length of the coded data corresponding to the target data;
[0183] processing an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns including a plurality of different mask patterns;
[0184] fusing the multiple two-dimensional code images with the art images to be fitted, respectively, to obtain multiple art two-dimensional code images;
[0185] Using preset usability evaluation rules, performing usability evaluation on the plurality of artistic QR code images to obtain an evaluation score corresponding to each artistic QR code image;
[0186] Output the artistic QR code image with the highest evaluation score.
[0187] 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:
[0188] 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 FIG5 is generally similar to the method embodiment, so the description is relatively simple. For relevant parts, refer to the description of the method embodiment.
[0189] 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.
[0190] 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.
[0191] 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.
[0192] 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.
[0193] 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.
[0194] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, 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 flowchart and / or one or more boxes in the block diagram.
[0195] 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.
[0196] 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.
[0197] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0198] 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.
[0199] Computer-readable media include 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 media such as modulated data signals and carrier waves.
[0200] 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.
[0201] 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.
[0202] 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.
[0203] 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 modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for generating an artistic QR code, comprising: Obtaining target data to be carried in a two-dimensional code image; Determine a QR code template according to the length of the coded data corresponding to the target data; Processing an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns includes a plurality of different mask patterns; Merging the multiple two-dimensional code images with the art images to be fitted respectively to obtain multiple art two-dimensional code images; Using preset usability evaluation rules, the plurality of artistic two-dimensional code images are evaluated for usability, and an evaluation score corresponding to each artistic two-dimensional code image is obtained; Output the artistic QR code image with the highest evaluation score.
2. The method according to claim 1, further comprising: Mirroring the initial two-dimensional code image to obtain a mirrored initial two-dimensional code image; Processing the mirrored initial two-dimensional code image according to a second number of mask patterns to obtain a plurality of mirrored two-dimensional code images; the second number of mask patterns includes one or more different mask patterns; The step of fitting the plurality of two-dimensional code images with the art images to be fitted respectively specifically includes: The multiple two-dimensional code images and the plurality of mirrored two-dimensional code images are respectively fitted with the art images to be fitted.
3. The method according to claim 1, wherein the two-dimensional code template comprises a plurality of two-dimensional code templates having a capacity greater than the length of the coded data corresponding to the target data; The processing of the initial two-dimensional code image for the target data generated based on the two-dimensional code template according to the first number of mask patterns specifically includes: For any two-dimensional code template among the plurality of two-dimensional code templates, an initial two-dimensional code image for the target data generated based on the any two-dimensional code template is processed according to a first number of mask patterns.
4. According to the method of claim 3, the multiple two-dimensional code templates include two-dimensional code templates of different versions and / or two-dimensional code templates of different error correction levels.
5. The method according to claim 1, further comprising: Determining an encoding method according to the character type contained in the target data; The target data is encoded according to the encoding method to obtain the encoded data.
6. The method according to claim 1, further comprising: Encoding the target data according to multiple encoding methods to obtain a plurality of candidate encoding data; Select the encoding data with the shortest length from the plurality of candidate encoding data as the encoding data corresponding to the target data.
7. The method according to claim 5, 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.
8. According to the method of claim 6, the multiple encoding methods include an encoding method using a single encoding mode and / or an encoding method using a mixed encoding mode.
9. The method according to claim 1, using preset usability evaluation rules to perform usability evaluation on the plurality of artistic two-dimensional code images, specifically comprising: For any artistic two-dimensional code image among the multiple artistic two-dimensional code images, obtaining binary values of a plurality of sampling points in the any artistic two-dimensional code image; Determine, according to the binarized values of the plurality of sampling points, an abnormal sampling point among the plurality of sampling points; the binarized value of the abnormal sampling point is inconsistent with a preset binarized value; 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 number of abnormal sampling points, the recognizability of each artistic two-dimensional code image is evaluated.
10. The method according to claim 1, using a preset usability evaluation rule to perform usability evaluation on the plurality of artistic two-dimensional code images, specifically comprising: Use the pre-trained beautification evaluation model to evaluate each artistic QR code image.
11. According to the method of claim 1, the initial two-dimensional code image is generated in a manner comprising: Acquire a first area image in the art image to be fused corresponding to the filled area in the two-dimensional 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; The initial two-dimensional code image is generated based on the encoding data corresponding to the target data and the filling data sequence.
12. The method according to claim 11, processing the initial two-dimensional code image for the target data generated based on the two-dimensional code template according to the first number of mask patterns, specifically comprising: The other regions of the initial two-dimensional code image except the filling region are processed according to a first number of mask patterns.
13. The method according to claim 12, wherein the step of fusing the plurality of two-dimensional code images with the art images to be fitted comprises: For at least one of the multiple two-dimensional code images, the at least one two-dimensional code image is fused with a second region image of the art image to be fused, where the second region image is an image of the art image to be fused except the first region image.
14. A device for generating an artistic QR code, comprising: A target data acquisition module, used to acquire target data carried in a two-dimensional code image; A two-dimensional code template determination module, used to determine the two-dimensional code template according to the length of the encoded data corresponding to the target data; a mask processing module, configured to process an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns comprising a plurality of different mask patterns; A fusion module, used for fusing the multiple two-dimensional code images with the art images to be fitted, respectively, to obtain multiple art two-dimensional code images; A scoring module, used to perform usability evaluation on the plurality of artistic two-dimensional code images by using preset usability evaluation rules, and obtain an evaluation score corresponding to each artistic two-dimensional code image; The image output module is used to output the artistic QR code image with the highest evaluation score.
15. 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: Obtaining target data to be carried in a two-dimensional code image; Determine a QR code template according to the length of the coded data corresponding to the target data; Processing an initial two-dimensional code image for the target data generated based on the two-dimensional code template according to a first number of mask patterns to obtain a plurality of two-dimensional code images; the first number of mask patterns includes a plurality of different mask patterns; Merging the multiple two-dimensional code images with the art images to be fitted respectively to obtain multiple art two-dimensional code images; Using preset usability evaluation rules, the plurality of artistic two-dimensional code images are evaluated for usability, and an evaluation score corresponding to each artistic two-dimensional code image is obtained; Output the artistic QR code image with the highest evaluation score.
16. 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 13.
Citation Information
Patent Citations
A method, device, equipment and medium for generating an art two-dimensional code
CN117172267B
Generation method and device of artistic two-dimensional code fused with image
CN106778995A
Two-dimensional code generation method and device
CN109376830A
Two-dimensional code processing method and device, medium and electronic device
CN112560530A
Method and device for generating artistic two-dimensional code, equipment and medium
CN117172267A