A QR code generation method and related equipment
By obtaining user-defined colors and their characteristic values, and generating QR codes that are consistent with the color style of the target object, the existing QR code is solved, and the effect of color customization and content recognition is achieved.
Patent Information
- Application Number
- CN202011607876.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-29
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2040-12-29
AI Technical Summary
The existing QR code style is single, lacks personality, and the encoding method is open, not private and unsafe, and cannot customize the colors.
By obtaining M user-defined colors and their characteristic values in the target color channel, determine the target mapping relationship, generate the target QR code, so that its color style is consistent with the target object.
The color customization of the QR code is realized, which enhances the visual appeal, and ensures that the QR code content can be accurately identified through the feature value relationship.
Smart Images

Figure CN114692800B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition, and in particular to a two-dimensional code generation method and related equipment. Background Art
[0002] A two-dimensional code, also known as a two-dimensional barcode, is a black and white graphic that records data symbol information and is distributed in a plane (two-dimensional direction) according to a certain geometric pattern. The most common two-dimensional code is QR Code, which has become a very popular encoding method on mobile devices in recent years. It can store more information and represent more data types than traditional bar codes.
[0003] With the popularity of smart phones and the development of mobile Internet, QR codes have been widely used in various fields as a convenient and fast graphical information transmission method. However, most of the current QR codes are monotonous black and white squares, with a single style and lack of personality. It is difficult to visually attract the audience. In addition, the encoding method is public, not private and not safe. Some applications have launched their own exclusive custom QR codes to increase brand recognition and use their own defined private encoding methods.
[0004] However, each code element of these two-dimensional codes is represented by black and white, which can only represent one bit, that is, 0 or 1, resulting in a small capacity. In order to increase the capacity of the two-dimensional code, a color two-dimensional code can be designed. However, the color of the code element in the color two-dimensional code is determined according to the preset code book, and the user cannot customize the color when generating the color two-dimensional code. Summary of the invention
[0005] The present application discloses a method for generating a QR code. Even if the colors in the QR code are customized by the user, the scanning side can restore the correspondence between the color and code element information used when generating the QR code based on the characteristic value size relationship between the colors of the code elements in the scanned QR code, thereby accurately identifying the content in the QR code.
[0006] The present application provides a method for generating a two-dimensional code, the method comprising:
[0007] Obtain M colors and a characteristic value of each color in a target color channel, wherein the M colors include at least one chromatic color, and M is an integer greater than 1;
[0008] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0009] Acquire a target link, and generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0010] According to the target mapping relationship, the color corresponding to each code element information in the code stream is determined, and according to the color corresponding to each code element information in the code stream, a target two-dimensional code is generated.
[0011] In a possible implementation, obtaining M colors includes:
[0012] Get the target object;
[0013] According to the target object, M colors included in the target object are acquired.
[0014] In a possible implementation, acquiring the M colors included in the target object includes:
[0015] Obtain M colors with a larger pixel ratio in the target object.
[0016] In a possible implementation, acquiring the M colors included in the target object includes:
[0017] Obtain N colors with a larger pixel ratio in the target object, where N is a positive integer greater than M;
[0018] M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
[0019] In a possible implementation, acquiring, according to the target object, M colors included in the target object includes:
[0020] Obtain N colors included in the target object, where N is a positive integer greater than M;
[0021] Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors;
[0022] Receiving a selection operation of a user for M color options among the N color options;
[0023] In response to the selection operation, M colors indicated by the M color options are obtained.
[0024] In a possible implementation, obtaining M colors includes:
[0025] Get the target object;
[0026] According to the target object, obtaining M colors to be processed included in the target object;
[0027] The characteristic values of the M colors to be processed in the brightness channel are adjusted so that the difference between the characteristic values of any two colors to be processed in the brightness channel among the M colors to be processed is greater than a preset value, so as to obtain the M colors.
[0028] In a possible implementation, obtaining the target object includes:
[0029] Displaying a first interface, wherein the first interface includes a first control, and the first control is used to instruct a user to input an image;
[0030] The target object input by the user based on the first control is received.
[0031] In a possible implementation, obtaining M colors includes:
[0032] Receive M colors input by the user.
[0033] In a possible implementation, the receiving M colors input by the user includes:
[0034] Displaying a second interface, the second interface including a first input box, the first input box being used to instruct a user to input color information for indicating a color;
[0035] Receive M color information input by the user in the first input box;
[0036] The M colors are obtained according to the M color information.
[0037] In a possible implementation, the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel.
[0038] In a possible implementation, the target link includes a first character and a second character, and generating a code stream corresponding to the target link includes:
[0039] Encode the first character based on a first encoding rule to obtain a first subcode stream;
[0040] The second character is encoded based on a second encoding rule to obtain a second subcode stream, wherein the first encoding rule and the second encoding rule are different.
[0041] In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0042] In a possible implementation, the first character and the second character are adjacent characters in the target link, and after encoding the first character based on the first encoding rule to obtain the first subcode stream and before encoding the second character based on the second encoding rule, the method further includes:
[0043] Obtaining a jump indicator, where the jump indicator is used to indicate that character encoding is performed using the second encoding rule;
[0044] Encoding the jump indicator based on a first encoding rule to obtain a third sub-code stream;
[0045] Correspondingly, encoding the second character based on the second encoding rule includes:
[0046] According to the jump indicator, the second character is encoded based on the second encoding rule.
[0047] In a second aspect, the present application provides a two-dimensional code recognition method, the method comprising:
[0048] Acquire a target image, wherein the target image includes a target two-dimensional code, and the target two-dimensional code includes a plurality of code elements;
[0049] Acquire M colors included in the multiple code elements and a characteristic value of each color in a target color channel;
[0050] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0051] Determining, according to the target mapping relationship, code element information corresponding to the color of each code element in the plurality of code elements;
[0052] The target two-dimensional code is decoded according to the code element information corresponding to the color of each code element in the multiple code elements.
[0053] In a possible implementation, the method further includes:
[0054] Obtaining decoded content obtained after decoding, wherein the decoded content includes a character string, and the decoded content is used to trigger a corresponding function;
[0055] The functions include at least one of the following:
[0056] Jump to the corresponding web page;
[0057] Open the target function in the corresponding application;
[0058] Display the corresponding string;
[0059] Display the corresponding video;
[0060] Or, play the corresponding audio.
[0061] In a possible implementation, the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel.
[0062] In a possible implementation, the target image is a grayscale image, and the target color channel is a brightness channel.
[0063] In a possible implementation, obtaining the M colors included in the multiple code elements includes:
[0064] Acquire the color of each code element in the multiple code elements, and acquire M colors included in the multiple code elements based on a clustering algorithm, wherein each color in the M colors is a cluster center obtained by the clustering algorithm;
[0065] Correspondingly, determining the code element information corresponding to the color of each code element in the multiple code elements according to the target mapping relationship includes:
[0066] Obtain the color of each code element and the color most similar to the M colors;
[0067] According to the target mapping relationship, the code element information corresponding to the color of each code element and the most similar color among the M colors is determined.
[0068] In a possible implementation, the code element information corresponding to the color of each code element in the multiple code elements is used to form a code stream, and the code stream includes a first sub-code stream and a second sub-code stream; and decoding the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements includes:
[0069] Decoding the first sub-code stream based on a first decoding rule to obtain a first character;
[0070] The second subcode stream is decoded based on a second decoding rule to obtain a second character, wherein the first decoding rule is different from the second decoding rule.
[0071] In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0072] In a possible implementation, the code stream further includes a third sub-code stream, the first sub-code stream is adjacent to the third sub-code stream, the third sub-code stream is adjacent to the second sub-code stream, and after decoding the first sub-code stream based on the first decoding rule and before decoding the second sub-code stream based on the second decoding rule, the method further includes:
[0073] Decoding the third sub-code stream based on the first decoding rule to obtain a jump indicator, wherein the jump indicator is used to indicate that character decoding is performed according to the second decoding rule;
[0074] Correspondingly, decoding the second sub-stream based on the second decoding rule includes:
[0075] The second sub-code stream is decoded according to the jump indicator based on the second decoding rule.
[0076] In a third aspect, the present application provides a two-dimensional code generating device, the device comprising:
[0077] An acquisition module, used for acquiring M colors and a characteristic value of each color in a target color channel, wherein the M colors include at least one chromatic color, and M is an integer greater than 1;
[0078] A mapping relationship determination module, used to determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0079] The acquisition module is used to acquire a target link and generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0080] Generate a code stream corresponding to the target link, the code stream includes multiple code element information two-dimensional code generation modules, which are used to determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0081] In a possible implementation, the acquisition module is used to:
[0082] Get the target object;
[0083] According to the target object, M colors included in the target object are acquired.
[0084] In a possible implementation, the acquisition module is used to:
[0085] Obtain M colors with a larger pixel ratio in the target object.
[0086] In a possible implementation, the acquisition module is used to:
[0087] Obtain N colors with a larger pixel ratio in the target object, where N is a positive integer greater than M;
[0088] M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
[0089] In a possible implementation, the acquisition module is used to:
[0090] Obtain N colors included in the target object, where N is a positive integer greater than M;
[0091] Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors;
[0092] Receiving a selection operation of a user for M color options among the N color options;
[0093] In response to the selection operation, M colors indicated by the M color options are obtained.
[0094] In a possible implementation, the acquisition module is used to:
[0095] Get the target object;
[0096] According to the target object, obtaining M colors to be processed included in the target object;
[0097] The characteristic values of the M colors to be processed in the brightness channel are adjusted so that the difference between the characteristic values of any two colors to be processed in the brightness channel among the M colors to be processed is greater than a preset value, so as to obtain the M colors.
[0098] In a possible implementation, the acquisition module is used to:
[0099] Displaying a first interface, wherein the first interface includes a first control, and the first control is used to instruct a user to input an image;
[0100] The target object input by the user based on the first control is received.
[0101] In a possible implementation, the acquisition module is used to:
[0102] Receive M colors input by the user.
[0103] In a possible implementation, the acquisition module is used to:
[0104] Displaying a second interface, the second interface including a first input box, the first input box being used to instruct a user to input color information for indicating a color;
[0105] Receive M color information input by the user in the first input box;
[0106] The M colors are obtained according to the M color information.
[0107] In a possible implementation, the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel.
[0108] In a possible implementation, the target link includes a first character and a second character, and the acquisition module is used to:
[0109] Encode the first character based on a first encoding rule to obtain a first subcode stream;
[0110] The second character is encoded based on a second encoding rule to obtain a second subcode stream, wherein the first encoding rule and the second encoding rule are different.
[0111] In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0112] In a possible implementation, the first character and the second character are adjacent characters in the target link, and the acquisition module is used to:
[0113] Obtaining a jump indicator, where the jump indicator is used to indicate that character encoding is performed using the second encoding rule;
[0114] Encoding the jump indicator based on a first encoding rule to obtain a third sub-code stream;
[0115] According to the jump indicator, the second character is encoded based on the second encoding rule.
[0116] In a fourth aspect, the present application provides a two-dimensional code recognition device, the device comprising:
[0117] An acquisition module, used for acquiring a target image, wherein the target image includes a target two-dimensional code, and the target two-dimensional code includes a plurality of code elements;
[0118] Acquire M colors included in the multiple code elements and a characteristic value of each color in a target color channel;
[0119] A mapping relationship determination module, used to determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0120] Determining, according to the target mapping relationship, code element information corresponding to the color of each code element in the plurality of code elements;
[0121] The decoding module is used to decode the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements.
[0122] In a possible implementation, the acquisition module is used to:
[0123] Obtaining decoded content obtained after decoding, wherein the decoded content includes a character string, and the decoded content is used to trigger a corresponding function;
[0124] The functions include at least one of the following:
[0125] Jump to the corresponding web page;
[0126] Open the target function in the corresponding application;
[0127] Display the corresponding string;
[0128] Display the corresponding video;
[0129] Or, play the corresponding audio.
[0130] In a possible implementation, the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel.
[0131] In a possible implementation, the target image is a grayscale image, and the target color channel is a brightness channel.
[0132] In a possible implementation, the acquisition module is used to:
[0133] Acquire the color of each code element in the multiple code elements, and acquire M colors included in the multiple code elements based on a clustering algorithm, wherein each color in the M colors is a cluster center obtained by the clustering algorithm;
[0134] Correspondingly, the mapping relationship determination module is used to obtain the color of each code element and the most similar color among the M colors;
[0135] According to the target mapping relationship, the code element information corresponding to the color of each code element and the most similar color among the M colors is determined.
[0136] In a possible implementation, the code element information corresponding to the color of each code element in the multiple code elements is used to form a code stream, and the code stream includes a first sub-code stream and a second sub-code stream; the decoding module is used to decode the first sub-code stream based on a first decoding rule to obtain a first character;
[0137] The second subcode stream is decoded based on a second decoding rule to obtain a second character, wherein the first decoding rule is different from the second decoding rule.
[0138] In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0139] In a possible implementation, the code stream further includes a third sub-code stream, the first sub-code stream is adjacent to the third sub-code stream, and the third sub-code stream is adjacent to the second sub-code stream, and the decoding module is configured to:
[0140] Decoding the third sub-code stream based on the first decoding rule to obtain a jump indicator, wherein the jump indicator is used to indicate that character decoding is performed according to the second decoding rule;
[0141] Correspondingly, decoding the second sub-stream based on the second decoding rule includes:
[0142] The second sub-code stream is decoded according to the jump indicator based on the second decoding rule.
[0143] In a fifth aspect, the present application provides a method for generating a two-dimensional code, the method comprising:
[0144] Get the target object and target link;
[0145] According to the target object, M colors included in the target object are acquired, wherein the M colors include at least one color, and M is an integer greater than 1;
[0146] Among them, the terminal device can automatically obtain the M colors included in the target object based on the target object. For example, the terminal device can obtain the target object and obtain the M colors with a larger pixel ratio in the target object; or, the terminal device can obtain N colors with a larger pixel ratio in the target object, and obtain M colors that meet the first preset condition from the N colors. In an optional implementation, the terminal device can obtain the target object and obtain the M colors with a larger pixel ratio in the target object. The algorithm for extracting the color from the target object may include but is not limited to color quantization, clustering, and color modeling. Taking the clustering algorithm used in implementation as an example, the K-means clustering algorithm can be used to extract the main colors from the input target image, and sort the pixels of each main color in the target object from most to least, so as to obtain the M colors with a larger pixel ratio in the target object.
[0147] A target QR code is generated based on the M colors and the target link, wherein the color style of the target QR code is consistent with the color style of the target object, the target QR code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to characterize the target link.
[0148] Among them, the so-called consistent color style can mean that the color included in the target QR code is consistent with the main color in the target object (for example, the main color can be described as M colors with a larger pixel proportion in the target object), and the target QR code and the target object have the same color style recognition; for example, the target object is the LOGO of Company A, and the LOGO of Company A is red and blue, then the target QR code can include red and blue, and then the target QR code has the color style recognition of Company A.
[0149] For example, the target object may be a corporate LOGO, and the M colors with a larger pixel ratio in the target object may represent the main colors of the corporate LOGO.
[0150] For example, the target object may be an image of a target commodity, and the M colors with a larger pixel proportion in the target object may represent the main colors of the target commodity.
[0151] Among them, the multiple code element information corresponding to the colors of the multiple code elements is used to characterize the target link. It can be understood that the multiple code element information corresponding to the colors of the multiple code elements carries the information of the target link. By parsing and processing the multiple code element information corresponding to the colors of the multiple code elements, the target link can be obtained. Specifically, the multiple code element information corresponding to the colors of the multiple code elements can form a code stream, which is consistent with the code stream obtained after encoding the target link.
[0152] The embodiment of the present application provides a method for generating a two-dimensional code, including: obtaining a target object and a target link; according to the target object, obtaining M colors included in the target object, wherein the M colors include at least one color, and M is an integer greater than 1; according to the M colors and the target link, generating a target two-dimensional code, wherein the color style of the target two-dimensional code is consistent with the color style of the target object, the target two-dimensional code includes multiple code elements, the colors of the multiple code elements include the M colors, and the colors of each code element correspond to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to characterize the target link. The present application generates a target two-dimensional code having a color style consistent with the target object based on the M colors included in the target object, thereby realizing color customization of the two-dimensional code.
[0153] In a possible implementation, the target object is an identification for indicating a target enterprise or a target product, the target QR code includes an image area located in the middle and a coding area surrounding the image area, the coding area includes the multiple code elements, and the image area includes the target object.
[0154] In a possible implementation, acquiring, according to the target object, M colors included in the target object includes:
[0155] Obtain M colors with a larger pixel ratio in the target object.
[0156] In a possible implementation, acquiring, according to the target object, M colors included in the target object includes:
[0157] Obtain N colors included in the target object, where N is a positive integer greater than M;
[0158] Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors;
[0159] Receiving a selection operation of a user for M color options among the N color options;
[0160] In response to the selection operation, M colors indicated by the M color options are obtained.
[0161] In a possible implementation, obtaining the target object includes:
[0162] Displaying a first interface, wherein the first interface includes a first control, and the first control is used to instruct a user to input an image;
[0163] The target object input by the user based on the first control is received.
[0164] In a possible implementation, the method further includes:
[0165] Obtaining a characteristic value of each color in the target color channel of the M colors, the M colors including at least one chromatic color, and M being an integer greater than 1;
[0166] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0167] Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0168] Correspondingly, generating a target QR code according to the M colors and the target link includes:
[0169] According to the target mapping relationship, the color corresponding to each code element information in the code stream is determined, and according to the color corresponding to each code element information in the code stream, a target two-dimensional code is generated.
[0170] In a possible implementation, acquiring, according to the target object, M colors included in the target object includes:
[0171] Obtain N colors with a larger pixel ratio in the target image, where N is a positive integer greater than M;
[0172] M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
[0173] In a possible implementation, the target link is used to trigger a corresponding function;
[0174] The functions include at least one of the following:
[0175] Jump to the corresponding web page;
[0176] Open the target function in the corresponding application;
[0177] Display the corresponding string;
[0178] Display the corresponding video;
[0179] Or, play the corresponding audio.
[0180] In a sixth aspect, the present application provides a method for generating a two-dimensional code, the method comprising:
[0181] Receiving M colors input by a user and obtaining a target link, wherein the M colors include at least one color, and M is an integer greater than 1;
[0182] A target two-dimensional code is generated according to the M colors and the target link, wherein the target two-dimensional code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to represent the target link.
[0183] The embodiment of the present application provides a method for generating a two-dimensional code, including: receiving M colors input by a user and obtaining a target link, wherein the M colors include at least one color, and M is an integer greater than 1; generating a target two-dimensional code according to the M colors and the target link, wherein the target two-dimensional code includes multiple code elements, the colors of the multiple code elements include the M colors, and the colors of each code element correspond to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to characterize the target link. The present application generates a target two-dimensional code including M colors based on the M colors input by the user, thereby realizing color customization of the two-dimensional code.
[0184] In a possible implementation, the receiving M colors input by the user includes:
[0185] Displaying a second interface, the second interface including a first input box, the first input box being used to instruct a user to input color information for indicating a color;
[0186] Receive M color information input by the user in the first input box;
[0187] The M colors are obtained according to the M color information.
[0188] In a possible implementation, the method further includes:
[0189] Obtaining a characteristic value of each color in the target color channel of the M colors, the M colors including at least one chromatic color, and M being an integer greater than 1;
[0190] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0191] Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0192] Correspondingly, generating a target QR code according to the M colors and the target link includes:
[0193] According to the target mapping relationship, the color corresponding to each code element information in the code stream is determined, and according to the color corresponding to each code element information in the code stream, a target two-dimensional code is generated.
[0194] In a possible implementation, the target link is used to trigger a corresponding function;
[0195] The functions include at least one of the following:
[0196] Jump to the corresponding web page;
[0197] Open the target function in the corresponding application;
[0198] Display the corresponding string;
[0199] Display the corresponding video;
[0200] Or, play the corresponding audio.
[0201] In a seventh aspect, the present application provides a two-dimensional code generating device, the device comprising:
[0202] The acquisition module is used to acquire the target object and the target link;
[0203] According to the target object, M colors included in the target object are acquired, wherein the M colors include at least one color, and M is an integer greater than 1;
[0204] A QR code generation module is used to generate a target QR code based on the M colors and the target link, wherein the color style of the target QR code is consistent with the color style of the target object, the target QR code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to characterize the target link.
[0205] In a possible implementation, the target object is an identification for indicating a target enterprise or a target product, the target QR code includes an image area located in the middle and a coding area surrounding the image area, the coding area includes the multiple code elements, and the image area includes the target object.
[0206] In a possible implementation, the acquisition module is used to acquire M colors with a larger pixel proportion in the target object.
[0207] In a possible implementation, the acquisition module is used to acquire N colors included in the target object, where N is a positive integer greater than M;
[0208] Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors;
[0209] Receiving a selection operation of a user for M color options among the N color options;
[0210] In response to the selection operation, M colors indicated by the M color options are obtained.
[0211] In a possible implementation, the acquisition module is used to display a first interface, where the first interface includes a first control, and the first control is used to instruct a user to input an image;
[0212] The target object input by the user based on the first control is received.
[0213] In a possible implementation, the acquisition module is used to acquire a characteristic value of each color in the M colors in a target color channel, the M colors include at least one color, and M is an integer greater than 1;
[0214] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0215] Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0216] Correspondingly, the two-dimensional code generation module is used to determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0217] In a possible implementation, the acquisition module is used to acquire N colors with a larger pixel proportion in the target object, where N is a positive integer greater than M;
[0218] M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
[0219] In a possible implementation, the target link is used to trigger a corresponding function;
[0220] The functions include at least one of the following:
[0221] Jump to the corresponding web page;
[0222] Open the target function in the corresponding application;
[0223] Display the corresponding string;
[0224] Display the corresponding video;
[0225] Or, play the corresponding audio.
[0226] In an eighth aspect, the present application provides a two-dimensional code generating device, the device comprising:
[0227] An acquisition module, used for receiving M colors input by a user and acquiring a target link, wherein the M colors include at least one color, and M is an integer greater than 1;
[0228] A QR code generation module is used to generate a target QR code based on the M colors and the target link, wherein the target QR code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to represent the target link.
[0229] In a possible implementation, the acquisition module is used to display a second interface, where the second interface includes a first input box, where the first input box is used to instruct a user to input color information for indicating a color;
[0230] Receive M color information input by the user in the first input box;
[0231] The M colors are obtained according to the M color information.
[0232] In a possible implementation, the acquisition module is used to acquire a characteristic value of each color in the M colors in a target color channel, the M colors include at least one color, and M is an integer greater than 1;
[0233] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0234] Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0235] Correspondingly, the two-dimensional code generation module is used to determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0236] In a possible implementation, the target link is used to trigger a corresponding function;
[0237] The functions include at least one of the following:
[0238] Jump to the corresponding web page;
[0239] Open the target function in the corresponding application;
[0240] Display the corresponding string;
[0241] Display the corresponding video;
[0242] Or, play the corresponding audio.
[0243] In the ninth aspect, the present application provides a terminal device, comprising: one or more processors; one or more memories; multiple applications; and one or more programs, wherein the one or more programs are stored in the memories, and when the one or more programs are executed by the processor, the terminal device performs any step in any one of the possible implementation methods of the first to second aspects, the fifth to sixth aspects, and any aspect.
[0244] In a tenth aspect, the present application provides a device, which is included in a terminal device, and has the function of implementing any terminal device behavior in the first aspect to the second aspect, the fifth aspect to the sixth aspect, and any possible implementation of any aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions.
[0245] In an eleventh aspect, the present application provides a terminal device, comprising: a display screen; a camera; one or more processors; a memory; a plurality of applications; and one or more computer programs. Among them, the one or more computer programs are stored in the memory, and the one or more computer programs include instructions. When the instructions are executed by the electronic device, the electronic device performs any of the steps in any possible implementation of the first aspect to the second aspect, the fifth aspect to the sixth aspect, and any possible implementation of any aspect.
[0246] In a twelfth aspect, the present application provides a computer storage medium, including computer instructions, which, when executed on an electronic device or a server, enables the electronic device to execute any possible method of any of the above aspects.
[0247] In a thirteenth aspect, the present application provides a computer program product, including codes, which, when executed on an electronic device or a server, enables the electronic device to execute any possible method of any of the above aspects.
[0248] The embodiment of the present application provides a two-dimensional code generation method, including: obtaining M colors and characteristic values of each color in a target color channel, the M colors including at least one color, and M being an integer greater than 1; determining a target mapping relationship according to the size relationship between the characteristic values of the M colors in the target color channel, the target mapping relationship including the code element information corresponding to each color in the M colors; obtaining a target link, and generating a code stream corresponding to the target link, the code stream including multiple code element information; determining the color corresponding to each code element information in the code stream according to the target mapping relationship, and generating a target two-dimensional code according to the color corresponding to each code element information in the code stream. In the above manner, the target mapping relationship is determined according to the size relationship between the characteristic values of the M colors in the target color channel, that is, when generating a two-dimensional code, each color is not corresponded to a fixed code element information, but the corresponding relationship between each color and the code element information is generated based on the relative size relationship between the characteristic values of each color in the target color channel. For example, the M colors include color 1 and color 2. In the existing implementation, color 1 must correspond to code element information 1, and color 2 must correspond to code element information 2. In the embodiment of the present application, the color with the larger characteristic value in the target color channel corresponds to code element information 1, and the smaller one corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is greater than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 1, and color 2 corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is less than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 2, and color 2 corresponds to code element information 1. In this way, the correspondence between color and code element information is determined based on the relationship between the characteristic values between colors. As the code scanning side, even if the colors in the two-dimensional code are all user-defined, the code scanning side can also restore the correspondence between the color and code element information used when generating the two-dimensional code based on the relationship between the characteristic values between the colors of the code elements in the scanned two-dimensional code, and then accurately identify the content in the two-dimensional code. BRIEF DESCRIPTION OF THE DRAWINGS
[0249] Figure 1 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0250] Figure 2 A software structure block diagram of a terminal device according to an embodiment of the present application;
[0251] Figure 3 A schematic diagram of a process for generating a two-dimensional code according to an embodiment of the present application;
[0252] Figures 4 to 10 This is a schematic diagram of the terminal interface of an embodiment of the present application;
[0253] Fig.11This is a schematic diagram of the grayscale distribution of an embodiment of the present application;
[0254] Figures 12 to 15 This is a schematic diagram of the terminal interface of an embodiment of the present application;
[0255] Figures 16 to 21 The following is a schematic diagram of the coding rules of the embodiment of the present application;
[0256] Fig.22a This is a coding diagram of an embodiment of the present application;
[0257] Figure 22b A schematic diagram of a process for generating a two-dimensional code according to an embodiment of the present application;
[0258] Fig.22c A schematic diagram of a process for generating a two-dimensional code according to an embodiment of the present application;
[0259] Fig.23 A schematic diagram of a process for generating a two-dimensional code according to an embodiment of the present application;
[0260] Fig.24 A schematic diagram of a code scanning scenario in an embodiment of the present application;
[0261] Fig.25 A schematic diagram of the process of a two-dimensional code recognition method according to an embodiment of the present application;
[0262] Fig.26 A schematic diagram of a two-dimensional code generating device according to an embodiment of the present application;
[0263] Fig. 27 A schematic diagram of a two-dimensional code recognition device according to an embodiment of the present application;
[0264] Fig.28 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0265] Fig.29 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0266] The embodiments of the present invention are described below in conjunction with the accompanying drawings in the embodiments of the present invention. The terms used in the implementation mode of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.
[0267] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0268] For ease of understanding, the structure of the terminal device 100 provided in the embodiment of the present application is described below by way of example. Figure 1 , Figure 1 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application.
[0269] like Figure 1 As shown, the terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0270] It is understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0271] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0272] The controller may be the nerve center and command center of the terminal device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0273] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0274] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (IC) interface, an inter-integrated circuit sound (IS) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0275] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0276] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
[0277] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory interface 120, the display screen 194, the camera 193, and the wireless communication module 160.
[0278] The wireless communication function of the terminal device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0279] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0280] The mobile communication module 150 can provide solutions for wireless communications including 1G / 3G / 4G / 5G applied to the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 2. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0281] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0282] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the terminal device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 1, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through antenna 2.
[0283] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0284] The terminal device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0285] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0286] In some feasible implementations, the display screen 194 may be used to display various interfaces output by the system of the terminal device 100. For various interfaces output by the terminal device 100, reference may be made to the relevant descriptions of the subsequent embodiments.
[0287] The terminal device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0288] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0289] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0290] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals.
[0291] Video codecs are used to compress or decompress digital videos. The terminal device 100 may support one or more video codecs. Thus, the terminal device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG1, MPEG3, MPEG4, etc.
[0292] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the terminal device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0293] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0294] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the terminal device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the terminal device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0295] The terminal device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor, etc. For example, music playing, recording, etc. In some feasible implementations, the audio module 170 can be used to play the sound corresponding to the video. For example, when the display screen 194 displays the video playing screen, the audio module 170 outputs the sound of the video playing.
[0296] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
[0297] The speaker 170A, also called a "horn", is used to convert audio electrical signals into sound signals.
[0298] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals.
[0299] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.
[0300] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0301] The pressure sensor 180A is used to sense pressure signals and can convert pressure signals into electrical signals. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. The gyroscope sensor 180B can be used to determine the motion posture of the terminal device 100. The air pressure sensor 180C is used to measure air pressure.
[0302] The acceleration sensor 180E can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes). When the terminal device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the terminal device and applied to applications such as horizontal and vertical screen switching and pedometers.
[0303] The distance sensor 180F is used to measure the distance.
[0304] The ambient light sensor 180L is used to sense the brightness of ambient light.
[0305] The fingerprint sensor 180H is used to collect fingerprints.
[0306] The temperature sensor 180J is used to detect the temperature.
[0307] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the terminal device 100, which is different from the position of the display screen 194.
[0308] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The terminal device 100 may receive key input and generate key signal input related to user settings and function control of the terminal device 100.
[0309] Motor 191 can generate vibration prompts.
[0310] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0311] The SIM card interface 195 is used to connect a SIM card.
[0312] The above is a description of the structure of the terminal device 100. Next, the software structure of the terminal device is described. The software system of the terminal device 100 can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the terminal device 100.
[0313] Figure 2 It is a software structure block diagram of the terminal device of an embodiment of the present application.
[0314] like Figure 2 As shown, the layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer. The application layer can include a series of application packages.
[0315] like Figure 2 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0316] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0317] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0318] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0319] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0320] The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build applications. The interface content can be composed of one or more views. For example, the display interface including the SMS notification icon can include a view for displaying text and a view for displaying images.
[0321] The phone manager is used to provide communication functions for terminal devices, such as the management of call status (including answering, hanging up, etc.).
[0322] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0323] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.
[0324] Android runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0325] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0326] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0327] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0328] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0329] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0330] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0331] A 2D graphics engine is a drawing engine for 2D drawings.
[0332] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0333] For ease of understanding, the following embodiments of the present application will be described in detail with Figure 1 and Figure 2 Taking the terminal device of the shown structure as an example, in combination with the accompanying drawings and application scenarios, a QR code generation method and a QR code recognition method provided in an embodiment of the present application are specifically explained.
[0334] Reference Figure 3 , Figure 3 A schematic diagram of an embodiment of a two-dimensional code generation method provided in an embodiment of the present application, such as Figure 3 As shown, the QR code generation method provided by the present application may include:
[0335] 301. Obtain M colors and a characteristic value of each color in a target color channel, wherein the M colors include at least one chromatic color, and M is an integer greater than 1.
[0336] It should be understood that the execution entity of step 301 can be a terminal device or a server on the cloud side.
[0337] In the embodiment of the present application, the types of two-dimensional codes may include but are not limited to PDF417, Aztec, PDF 417 two-dimensional barcode, Datamatrix two-dimensional barcode, Maxicode two-dimensional barcode, Code 49, Code 16K, and Code one.
[0338] In some scenarios, in order to make the QR code have certain visual characteristics, such as a certain style recognition, a QR code with certain color characteristics can be generated. For example, the LOGO of Company A is red and blue. If a QR code including red and blue can be generated, then the QR code has the style recognition of Company A.
[0339] Here are some examples of scenarios where a colored QR code is required:
[0340] 1. Website / Link QR Code
[0341] For example, some companies have created a high-quality article, produced an interesting video, developed an interesting website, etc. As long as there is a corresponding URL, they can generate a QR code, which is particularly suitable for displaying QR codes in Moments, official websites, WeChat public accounts, etc. If it is a video file that is produced or shared, you can upload the video to a video website or the server of your own official website, and then generate a QR code based on the video playback URL for others to watch. In order to reflect the characteristics of the company, the QR code can have a color style similar to the company's LOGO.
[0342] 2. WeChat / Weibo / Mini Program QR Code
[0343] When publishing posters, holding events, and other scenarios, companies can directly attach the QR code of the WeChat public account, Sina Weibo QR code, or WeChat mini-program related to the event, so that users can scan the code directly to follow, which can also effectively increase traffic. In order to reflect the characteristics of the company, the QR code can have a color style similar to the company's logo.
[0344] 3. Business card / phone number / text message / email QR code of company employees
[0345] In addition to personal use, companies can also tailor a unique business card, phone number, SMS, and email QR code for employees, especially important employees, which is convenient for employees to carry when they go out and for users to view and save. In order to reflect the characteristics of the company, the company's business card / phone number / SMS / email QR code can have a color style similar to the company's logo.
[0346] 4. Enterprise product QR code
[0347] When an enterprise releases a product, participates in a new product exhibition, holds a collective meeting or a full-staff event, etc., it can upload the product name, production date, origin, price, picture, usage, price and other basic parameters to generate a QR code, and upload some necessary information of the event or conference to generate a QR code. Users can directly scan the code to understand, which is very convenient. The enterprise product QR code can have a color style similar to the enterprise's LOGO.
[0348] 5. Wireless fidelity (WiFi) QR code
[0349] In public places such as offices and conference rooms, companies upload the account and password of the free WiFi they provide and generate a corresponding QR code, which is placed on a table or wall for visiting customers to scan and connect. This is both concealed and innovative, and can also play a good role in promoting the brand. The company's WiFi QR code can have a color style similar to the company's LOGO.
[0350] In some other scenarios, when using a terminal device, the user sometimes needs to present a real-time generated QR code on the terminal device.
[0351] For example, in a scenario where a terminal device is required to make a payment, a user can open a QR code payment interface on some applications with payment functions, such as the payment QR code interface of the WeChat application and the Alipay application, and another example is the QR code payment interface of the Huawei Wallet application. The QR code payment interface includes a generated payment QR code. Another device can scan the payment QR code in the QR code payment interface to realize the transaction. The other device can be a desktop or mobile barcode scanner device, or an electronic device such as a smartphone or tablet computer.
[0352] For another example, when a user is taking a bus, the user can open a QR code interface for recording the boarding and alighting points on some applications that have the function of taking a bus, and place the QR code in the QR code interface in the scanning area of the QR code scanning device on the bus, thereby recording the boarding or alighting point. The QR code scanning device on the bus can be a desktop or mobile scanner device, or an electronic device such as a smart phone or tablet computer.
[0353] For another example, some applications can generate a QR code containing user identity information, and other devices can scan the QR code to obtain the user identity information. For example, the QR code can contain the user's account information, and other devices can add the account as a friend, invite the account with the QR code to join a chat group, etc. After scanning the QR code, other devices can perform operations such as adding a friend to the account, inviting the account with the QR code to join a chat group, etc. For another example, the QR code can contain a link to a store, a link to a company's homepage, etc., and other devices can open the corresponding store or company's homepage, etc. after scanning the QR code.
[0354] In the embodiment of the present application, in order to generate a two-dimensional code containing color, M colors can be first obtained, and the M colors can be used as color selection for code elements in the finally generated two-dimensional code.
[0355] It should be understood that colors can be divided into two categories: non-color and color. Non-color can refer to white, black and various shades of gray. White, gray and black objects have no selectivity in reflecting each wavelength of the spectrum, and they are neutral colors. Color refers to various colors other than the white and black series. Colors are selective in reflecting each wavelength of the spectrum, so they appear colorful under white light. Color has three characteristics: brightness, hue and saturation. Non-color only has differences in brightness, but does not have the two characteristics of hue and saturation. Luminance refers to the brightness of the color light, which is related to the energy contained in the color light. For color, the brightness of the color is proportional to its luminous flux (light power). Hue refers to the category of color. The commonly mentioned red, green, blue, etc. refer to hue. Saturation refers to the degree of hue depth. Various monochromatic lights have the highest saturation. The more white light is mixed into the monochromatic light, the lower the saturation. The saturation of white light is equal to zero.
[0356] Next, we describe how to trigger the acquisition of M colors.
[0357] In one implementation, the acquisition of M colors may be triggered based on an application with a QR code generation function on a terminal device or options on some web pages with a QR code generation function.
[0358] Take the application on the terminal device that has the function of generating a QR code as an example, refer to Figure 4 , Figure 4 This is a schematic diagram of an operation interface of a terminal device, such as Figure 4 As shown, the terminal device may include an application for generating a QR code (eg Figure 4 The user can click on the QR code generator, and the terminal device can display the QR code generator in response to the user's click operation. Figure 5 The application interface shown in the figure, wherein the application interface of the QR code generator may include a string input box, a custom color control, a LOGO add control, and a QR code generation control, wherein the user may enter the content that the QR code needs to carry in the string input box, such as a web link, an audio or video link, etc., which is not limited here. The custom color control may point to a page where the user specifies the color of the code element in the QR code, and the user may click on the custom color control, and the terminal device may respond to the user's click operation and display a page for obtaining the color (e.g. Fig.11 The interface shown in FIG. 1 is a diagram showing how to obtain M colors based on the interface. The following embodiments will describe how to obtain M colors based on the interface and will not be described in detail here.) Accordingly, the terminal device can change the color of the QR code based on the color input by the user.
[0359] It should be understood that Figure 4 and Figure 5The application interface shown in the figure is only an example, and the arrangement and type of controls on the interface are only a schematic representation and are not limited in this application.
[0360] In one implementation, some applications can generate a QR code containing user identity information, and other devices can scan the QR code to obtain the user identity information. For example, the QR code can contain the user's account information, and other devices can perform operations such as adding friends of the account, inviting the account with the QR code to join a chat group, etc. After scanning the QR code, other devices can perform operations such as adding friends of the account, inviting the account with the QR code to join a chat group, etc. For another example, the QR code can contain a link to a store, a link to a company's homepage, etc., and other devices can open the corresponding store or company's homepage, etc. after scanning the QR code.
[0361] For example, refer to Figure 6 , Figure 6 This is a schematic diagram of an operation interface of a terminal device, such as Figure 6 As shown, the terminal device may include an application for generating a QR code containing user identity information. The user may click on a control to generate a QR code, and the terminal device may display a QR code in response to the user's click operation. Figure 7 The application interface shown, Figure 7 The interface shown includes a QR code display area and a QR code style change control. The user can click the QR code style change control. In response to the user's click operation, the terminal device can display a display interface as shown in 8. The display interface can include a custom color control, an add LOGO control, etc., wherein the custom color control can point to a page where the user specifies the color of the code element in the QR code. The user can click the custom color control, and the terminal device can respond to the user's click operation and display a page for obtaining the color (for example, Fig.11 The interface shown in FIG. 1 is a diagram showing how to obtain M colors based on the interface. The following embodiments will describe how to obtain M colors based on the interface and will not be described in detail here.) Accordingly, the terminal device can change the color of the QR code based on the color input by the user.
[0362] In some other scenarios, when a terminal device is required to make a payment, the user can open a QR code payment interface on some applications with payment functions, such as the payment QR code interface of the WeChat application and the Alipay application, and the QR code payment interface of the Huawei Wallet application. The QR code payment interface includes a generated payment QR code. Another device can scan the payment QR code in the QR code payment interface to realize the transaction.
[0363] For example, refer to Fig. 9 , Fig. 9 This is a schematic diagram of an operation interface of a terminal device, such as Fig. 9As shown, the terminal device may include an application for generating a payment QR code. The user may click on a control for generating a payment QR code. The terminal device may display a QR code in response to the user's click operation. Fig.10 The application interface shown, Fig.10 The interface shown includes a QR code display area and a QR code style change control. The user can click the QR code style change control. In response to the user's click operation, the terminal device can display a display interface as shown in 8. The display interface can include a custom color control, an add LOGO control, etc., wherein the custom color control can point to a page where the user specifies the color of the code element in the QR code. The user can click the custom color control, and the terminal device can respond to the user's click operation and display a page for obtaining the color (for example, Fig.11 The interface shown in FIG. 1 is a diagram showing how to obtain M colors based on the interface. The following embodiments will describe how to obtain M colors based on the interface and will not be described in detail here.) Accordingly, the terminal device can change the color of the QR code based on the color input by the user.
[0364] It should be understood that Figures 6 to 11 The application interface shown in the figure is only an example, and the arrangement and type of controls on the interface are only a schematic representation and are not limited in this application.
[0365] Next, we describe how to obtain M colors.
[0366] In the embodiment of the present application, in order to generate a QR code including several colors specified by the user, or to generate a QR code of a color style specified by the user, the color input by the user can be obtained, or the color can be extracted from the target object provided by the user. Next, they are described respectively:
[0367] 1. Get M colors from the target object.
[0368] Taking the execution subject of step 301 as a terminal device as an example, specifically, in one implementation, the user can input the target object, and accordingly, the terminal device can obtain the target object, and the terminal device can obtain M colors included in the target object based on the target object.
[0369] Among them, the terminal device can automatically obtain the M colors included in the target object based on the target object. For example, the terminal device can obtain the target object and obtain the M colors with a larger pixel ratio in the target object; or the terminal device can obtain N colors with a larger pixel ratio in the target object, and obtain M colors that meet the first preset condition from the N colors. The following two implementations are described respectively:
[0370] In an optional implementation, the terminal device can obtain the target object and obtain M colors with a larger pixel proportion in the target object. The algorithm for extracting the color from the target object may include, but is not limited to, color quantization, clustering, and color modeling. Taking the clustering algorithm used in implementation as an example, the K-means clustering algorithm can be used to extract the main colors from the input target image, and sort the pixels of each main color in the target object from most to least, thereby obtaining M colors with a larger pixel proportion in the target object.
[0371] In the embodiment of the present application, the target object may be an image containing a corporate LOGO, and the M colors with a larger pixel proportion in the target object may represent the main colors of the corporate LOGO.
[0372] In the embodiment of the present application, the target object may be an image containing an image of a product, and the M colors with a larger pixel proportion in the target object may represent the main colors of the product.
[0373] In an optional implementation, N colors with a larger pixel proportion in the target object can be obtained, where N is a positive integer greater than M, and M colors that meet a first preset condition are obtained from the N colors. The first preset condition includes at least one of the following: the difference between the characteristic values of any two colors in the M colors in the chroma channel is greater than a first preset value, and the characteristic value of each color in the M colors in the saturation channel is greater than a second preset value.
[0374] In an embodiment of the present application, N colors can be first obtained from the target object, and then M better colors can be selected from the N colors. The so-called better means that the QR code including the screened M colors is more beautiful. Specifically, if at least two of the M colors are relatively similar colors, or at least one of the M colors is a color with lower purity, the aesthetics of the QR code generated based on the M colors is poor.
[0375] Therefore, N colors can be obtained from the target object, and better M colors can be selected from the N colors. Specifically, M colors that meet the first preset condition can be obtained from the N colors, and the first preset condition includes at least one of the following: the difference between the characteristic values of any two colors in the M colors in the chroma channel is greater than the first preset value, and the characteristic value of each color in the M colors in the saturation channel is greater than the second preset value.
[0376] It should be understood that the first preset value can be set according to actual conditions, as long as it can indicate that the two colors have a good visual distinction, and the present application does not limit the specific value of the first preset value.
[0377] It should be understood that the second preset value can be set according to actual conditions, as long as it can indicate that the color has good visual color purity, and the present application does not limit the specific value of the second preset value.
[0378] In one implementation, N colors may be acquired from the target object, and M colors are selected from the N colors, any two of which have a difference between characteristic values of the chromaticity channel greater than a first preset value.
[0379] In one implementation, N colors may be acquired from the target object, and M colors are selected from the N colors, each of which has a characteristic value in a saturation channel greater than a second preset value.
[0380] In one implementation, N colors can be obtained from the target object, and M colors are selected from the N colors, wherein the difference between the characteristic values of any two colors in the chroma channel is greater than a first preset value, and the characteristic value of each color in the saturation channel is greater than a second preset value.
[0381] In an optional implementation, only less than M colors can be selected from N colors, that is, less than M colors among the N colors meet the first preset condition. In order to obtain M colors, at least one color can be selected from the preset colors and added to the selected less than M colors to obtain M colors.
[0382] In one implementation, the M colors consisting of the preset colors and the selected colors less than M satisfy the first preset condition in the above embodiment.
[0383] Exemplarily, taking M equal to 4 as an example, first, the N colors with a larger pixel ratio in the target object and a saturation lower than the second preset value are excluded, and the first color that meets the requirements is determined as the first color selected, and then compared sequentially. If the difference between the characteristic value of the chromaticity channel and the characteristic value of the already selected color in the chromaticity channel is greater than the first preset value, it is retained as the selected color. If the number of selected colors is less than 4, you can select and add from the preset default colors. For example, if only one color is selected, black and white are added, and at the same time, a color with a saturation higher than the second preset value and a difference between the characteristic value of the chromaticity channel and the characteristic value of the already selected color in the chromaticity channel is greater than the first preset value is added; if only two colors are selected, black and white are added; if only three colors are selected, black is added.
[0384] In addition, the terminal device may also determine M colors from N colors in combination with the user's selection.
[0385] In a possible implementation, the terminal device may obtain N colors included in the target object, where N is a positive integer greater than M; display the N colors, and receive a first instruction from the user, where the first instruction is used to instruct the user to select the M colors from the N colors; and respond to the first instruction to obtain the M colors included in the target object. In other words, the terminal device may obtain N candidate colors from the target object for the user to select, and the user may select M colors from the N candidate colors. Accordingly, the terminal device may obtain the M colors selected by the user.
[0386] In a possible implementation, the characteristic value of the color obtained according to the target object in the brightness channel can also be adjusted so that the difference between the characteristic values of any two of the M colors to be processed in the brightness channel is greater than a preset value. Specifically, the terminal device can obtain the target object, obtain the M colors to be processed included in the target object according to the target object, and adjust the characteristic values of the M colors to be processed in the brightness channel so that the difference between the characteristic values of any two of the M colors to be processed in the brightness channel is greater than a preset value, so as to obtain the M colors.
[0387] In one scenario, a barcode scanning device may not be compatible with scanning color QR codes. Specifically, some scanning devices can only obtain grayscale images. In order to enable such barcode scanning devices to scan color QR codes, it is necessary to distinguish between the grayscale of the colors included in the QR code (that is, the characteristic values of the brightness channel). More specifically, color A and color B are colors. Although color A and color B are different, a barcode scanning device that is not compatible with scanning color QR codes can only obtain the characteristic values of color A and color B in the brightness channel after scanning color A and color B. In this embodiment, the characteristic value of the color obtained according to the target object in the brightness channel can be adjusted so that the difference between the characteristic values of any two of the M colors to be processed in the brightness channel is greater than a preset value, so that the barcode scanning device that is not compatible with scanning color QR codes can determine that color A and color B are different colors and the size relationship between the characteristic values of color A and color B in the brightness channel after scanning color A and color B.
[0388] It should be understood that the size of the preset value can be set according to actual conditions, as long as the code scanning device can accurately distinguish the size relationship of the characteristic values of each color on the brightness channel. The embodiment of the present application does not limit the specific size of the preset value.
[0389] For example, you can refer to Fig.11 , Fig.11Taking M equal to 4 as an example, the relationship between the eigenvalues of the four colors on the brightness channel is shown, wherein the grayscale value difference between the color with the largest eigenvalue on the brightness channel and the color with the second largest eigenvalue on the brightness channel is 32, the grayscale value difference between the color with the second largest eigenvalue on the brightness channel and the color with the third largest eigenvalue on the brightness channel is 96, and the grayscale value difference between the color with the third largest eigenvalue on the brightness channel and the color with the smallest eigenvalue on the brightness channel is 32.
[0390] In an embodiment of the present application, M colors that meet the first preset condition can be obtained from the N colors, and the characteristic values of the M colors to be processed in the brightness channel can be adjusted so that the difference between the characteristic values of any two colors to be processed in the M colors to be processed in the brightness channel is greater than the preset value.
[0391] Exemplarily, Table 1 shows four colors to be processed obtained by the terminal device according to the target image. The next step is to adjust the characteristic value of each color to be processed on the brightness channel, thereby obtaining the adjusted colors shown in Table 2.
[0392] Table 1
[0393] RGB Value 54,138,248 254,211,50 35,24,21 249,245,236
[0394] Table 2
[0395] RGB Value 4,61,136 254,222,106 35,24,21 249,245,236
[0396] 2. Get the M colors input by the user.
[0397] In the embodiment of the present application, the terminal device can receive M colors input by the user.
[0398] Specifically, the terminal device may display a second interface, the second interface including a first input box, the first input box being used to instruct the user to input color information for indicating a color, receiving M color information input by the user in the first input box, and acquiring the M colors according to the M color information. The color information may be an RGB value of a color or other information that may indicate a color, which is not limited in this embodiment.
[0399] Next, how the terminal device obtains M colors is described from the perspective of interaction between the user and the terminal device.
[0400] In an embodiment of the present application, if the terminal device obtains M colors based on the target object input by the user, a first interface can be displayed, wherein the first interface includes a first control, and the first control is used to instruct the user to input an image, after which the terminal device can receive the target object input by the user based on the first control.
[0401] For details, please refer to Fig.12 The terminal device can display an interface for setting the color of the QR code (i.e., the first interface in the above embodiment), which may include a control for inputting a picture (i.e., the first control in the above embodiment), and the user can click the control for inputting a picture and input a target object, after which the terminal device can receive the target object input by the user based on the first control.
[0402] In addition, in the embodiment of the present application, the terminal device can obtain N candidate colors from the target object for the user to select, and the user can select M colors from the N candidate colors. Accordingly, the terminal device can obtain the M colors selected by the user. Fig.13 , the terminal device can display an interface for color selection of the QR code, the color selection interface can display 5 candidate colors obtained from the target object, the user can select M colors from the 5 candidate colors, and accordingly, the terminal device can obtain the M colors selected by the user.
[0403] In addition, in the embodiment of the present application, the terminal device can also obtain M colors based on the color information input by the user, referring to Fig.12 The terminal device can display an interface for setting the color of the QR code, which can include a control for inputting a picture and multiple input boxes, wherein the user can enter a color information in each input box, for example Fig.12 In the interface shown in , the user can enter the RGB value of a color in each input box.
[0404] It should be understood that the above description uses the example of a terminal device obtaining M colors. In actual applications, M colors can also be obtained for the server on the cloud side. For example, some web pages can have the function of generating a QR code. The user can enter the color of the QR code or enter the target object on the web page. The server can receive the color or target object entered by the user, and obtain M colors based on the color or target object entered by the user.
[0405] For example, please refer to Fig.15 , Fig.15 A schematic diagram of a web page interface is shown in FIG. Fig.15 As shown, the web page with the function of generating a QR code may include a custom color option, and the user can click the custom color option to enter the color of the QR code, or enter the target object. For details, refer to the above embodiment. Fig.12 as well as Fig.13 The description of the corresponding embodiments will not be repeated for similarities.
[0406] 302. Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, where the target mapping relationship includes code element information corresponding to each color in the M colors.
[0407] In the embodiment of the present application, after obtaining M colors, it is necessary to determine a codebook based on the M colors. The so-called codebook is the target mapping relationship in the present embodiment. The target mapping relationship may include the code element information corresponding to each color in the M colors, wherein the code element information may be binary information. A two-dimensional code is composed of multiple code elements, each of which may carry certain information. In the process of generating a two-dimensional code, it is necessary to convert a character string (the information to be carried in the generated two-dimensional code) into a binary code stream, and divide the code stream into multiple sub-code streams (or referred to as code element information), each of which corresponds to a code element in the two-dimensional code. A code element is the basic unit of a two-dimensional code, each code element is an area on a two-dimensional code, and each code element carries certain code element information. After scanning the two-dimensional code, the code element included in the two-dimensional code can be parsed to obtain the code element information corresponding to the code element, and the content carried by the two-dimensional code can be obtained based on the code element information of each code element obtained.
[0408] In the existing implementation of generating color QR codes, each color corresponds to fixed code element information, for example, color 1 corresponds to code element information (0, 1), color 2 corresponds to code element information (1, 1), and this correspondence is fixed. When scanning the code, the code scanning device can determine that the code element of color 1 in the QR code corresponds to code element information (0, 1), and the code element of color 2 corresponds to code element information (1, 1). This implementation prevents users from customizing colors because the code scanning end cannot determine what code element information the color of each code element in the scanned QR code corresponds to.
[0409] In the embodiment of the present application, the target mapping relationship is determined according to the size relationship between the characteristic values of the M colors in the target color channel, that is, when generating a two-dimensional code, each color is not corresponding to a fixed code element information, but the corresponding relationship between each color and the code element information is generated based on the relative size relationship between the characteristic values of each color in the target color channel. For example, the M colors include color 1 and color 2. In the existing implementation, color 1 must correspond to code element information 1, and color 2 must correspond to code element information 2. In the embodiment of the present application, the color with a larger characteristic value in the target color channel corresponds to code element information 1, and the smaller one corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is greater than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 1, and color 2 corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is less than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 2, and color 2 corresponds to code element information 1.
[0410] In this way, the correspondence between color and code element information is determined based on the size relationship of the eigenvalues between colors. As the scanning side, even if the colors in the QR code are customized by the user, the scanning side can also restore the correspondence between the color and code element information used when generating the QR code based on the size relationship of the eigenvalues between the colors of the code elements in the scanned QR code.
[0411] Next, it is described how to determine the target mapping relationship according to the size relationship between the characteristic values of the M colors in the target color channel.
[0412] In the embodiment of the present application, the target color channel may include at least one color channel in a color space, wherein the color space may be, but is not limited to, an RGB space, a YUV space, an HSL space, and an HSV space.
[0413] Among them, the most common use of RGB (red, green, blue) space is the display system. Color cathode ray tubes and color raster graphics displays all use R, G, B values to drive R, G, B electron guns to emit electrons, and respectively stimulate the three colors of R, G, B phosphors on the screen to emit light of different brightness, and produce various colors by adding and mixing; scanners also absorb the R, G, B components of the light sent by the original through reflection or transmission, and use it to represent the color of the original. The RGB color space is called a device-related color space, because different scanners will obtain image data of different colors when scanning the same image.
[0414] Among them, the model of HSV (hue, saturation, value) space corresponds to a cone-shaped subset in the cylindrical coordinate system, and the top surface of the cone corresponds to V = 1. It contains three faces of R = 1, G = 1, and B = 1 in the RGB model, and the color represented is brighter. The color H is given by the rotation angle around the V axis. Red corresponds to an angle of 0°, green corresponds to an angle of 120°, and blue corresponds to an angle of 240°. In the HSV color model, each color is 180° different from its complementary color. The saturation S ranges from 0 to 1, so the radius of the top surface of the cone is 1. The color domain represented by the HSV color model is a subset of the CIE chromaticity diagram. In this model, the purity of a color with a saturation of 100% is generally less than 100%. At the vertex of the cone (i.e., the origin), V = 0, H and S are undefined, representing black. At the center of the top surface of the cone, S = 0, V = 1, and H is undefined, representing white. From this point to the origin represents gray with gradually dimming brightness, that is, gray with different grayscales. For these points, S = 0, and the value of H is undefined. It can be said that the V axis in the HSV model corresponds to the main diagonal in the RGB color space. For the color on the circumference of the top surface of the cone, V = 1, S = 1, and this color is a pure color.
[0415] Among them, for YUV space, in modern color television systems, three-tube color cameras or color CCD (dot coupled device) cameras are usually used. It separates the captured color image signal, amplifies and corrects it separately to obtain RGB, and then passes through the matrix conversion circuit to obtain the brightness signal Y and two color difference signals R-Y and B-Y. Finally, the transmitter encodes the three signals of brightness and color difference separately and sends them out through the same channel. This is the commonly used YUV color space. The importance of using YUV color space is that its brightness signal Y and chrominance signals U and V are separated. If there is only the Y signal component but no U and V components, then the image represented in this way is a black and white grayscale image. The use of YUV space in color television is precisely to use the brightness signal Y to solve the compatibility problem between color television and black and white television, so that black and white television can also receive color signals.
[0416] Exemplarily, the target color channels may be the chromaticity channel (hue) and the brightness channel (value) in the HSV space. The eigenvalues of the brightness channel of each of the M colors in the HSV space may be compared, and the target mapping relationship may be determined based on the size relationship between the eigenvalues of the brightness channel of the M colors.
[0417] In the embodiment of the present application, the code element information is fixed, for example, the code element information of 2 bits includes (0, 0), (0, 1), (1, 0), (1, 1), and the method of mapping each color in the M colors to a code element information is very flexible. If the target color channel is a color channel, the code element information of the color with the smallest eigenvalue in the target color channel among the M colors can be set to (1, 1), and the code element information of the color with the largest eigenvalue in the target color channel among the M colors can be set to (0, 0), or any other rule. As long as each color can uniquely correspond to a code element information in the target mapping relationship determined based on the size relationship between the eigenvalues of the M colors in the brightness channel, and each code element information uniquely corresponds to a color, the present application does not limit the specific eigenvalue size comparison rule.
[0418] Taking M equal to 4 and the code element information as 2 bits as an example, the code element information of the color with the smallest eigenvalue of the brightness channel in the HSV space among the M colors can be set to (1, 1), and the code element information of the color with the largest eigenvalue of the brightness channel in the HSV space among the M colors can be set to (0, 0). For the other two colors, the one with the low eigenvalue of the brightness channel in the HSV space is (1, x), and the one with the high eigenvalue of the brightness channel in the HSV space is (0, 1-x). If the eigenvalue of the brightness channel in the HSV space is low and the eigenvalue of the chromaticity channel is large, x is 0, otherwise it is 1. Thus, the codebook (or target mapping relationship) in Table 3 can be obtained:
[0419] Table 3
[0420] Color (RGB value) Code element information 4,61,136 (1,0) 254,222,106 (0,1) 35,24,21 (1,1) 249,245,236 (0,0)
[0421] 303. Obtain a target link, and generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information. Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information.
[0422] In the embodiment of the present application, the target link can be obtained. The target link is the information that should be carried in the QR code. In order to enable the QR code to represent the target link, the target link needs to be encoded to obtain a binary code stream. Specifically, the target link can be obtained and a code stream corresponding to the target link can be generated.
[0423] In an embodiment of the present application, each code element included in the two-dimensional code to be generated can represent a part of the information in the code stream (each code element represents a code element information), and then the multiple code elements included in the two-dimensional code to be generated can represent the entire code stream.
[0424] In a possible implementation, the target link includes a first character and a second character. In the process of generating a code stream, the first character can be encoded based on a first encoding rule to obtain a first sub-code stream; the second character can be encoded based on a second encoding rule to obtain a second sub-code stream, and the first encoding rule and the second encoding rule are different.
[0425] In existing implementations, such as QR coding, the same encoding rule is used for each character string. For example, when encoding the character string abcd123456abcdefghijklmn based on QR coding, in an 8-bit byte mode, the mode indicator is 4 bits, the character count indicator is 8 bits, and the data is 8*24=192 bits, requiring a total of 204 bits.
[0426] Exemplarily, the first encoding rule and the second encoding rule may be one of the following encoding rules:
[0427] Base10: used to encode 10 numeric characters. For specific encoding rules, please refer to Fig.16 As shown, Fig.16 A schematic diagram of a coding rule is shown.
[0428] Base32_L: used to encode 26 lowercase letters, spaces, and 5 jump characters. For specific encoding rules, refer to Fig.17 As shown, Fig.17 A schematic diagram of a coding rule is shown.
[0429] Base32_U: used to encode 26 uppercase letters, spaces, and 5 jump characters. For specific encoding rules, refer to Fig.18 As shown, Fig.18 A schematic diagram of a coding rule is shown.
[0430] Base45: used to encode 10 numeric characters, 26 uppercase letters A to Z, and 9 symbols. For specific encoding rules, please refer to Fig.19 As shown, Fig.19 A schematic diagram of a coding rule is shown.
[0431] Base90: used to encode 10 numeric characters, 52 uppercase and lowercase letters, 23 special characters SP! ”#$%&'()*+,-. / :;=?@_~, 5 jump characters, the specific encoding rules can be referred to Fig. 20 As shown, Fig. 20 A schematic diagram of a coding rule is shown.
[0432] Base108: used to encode ASCII printable characters, 95 characters, 8 escape characters, 5 jump characters, the specific encoding rules can be referred to Fig.21 As shown, Fig.21 A schematic diagram of a coding rule is shown.
[0433] In the embodiment of the present application, different encoding rules can be used for different character strings, which can reduce the number of bits required overall. In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream is different from the number of bits of the second sub-code stream. For example, in Base32_L, the number of bits required for encoding a unit character is 5, and in Base10, the number of bits required for encoding a unit character is 4. Taking the encoding string abcd123456abcdefghijklmn as an example, the first 4 lowercase letters use Base32_L, the following 6 numbers use Base10, and the remaining lowercase letters jump to Base32_L, then the number of bits required is 4+5*4+5+10+10*2+4+5*14=133bit, which is less than the 201bit required for QR encoding.
[0434] In an embodiment of the present application, in order to achieve a jump between encoding rules, a jump symbol can be added during encoding. Specifically, in a possible implementation, the first character and the second character are adjacent characters in the target link, and after encoding the first character based on the first encoding rule to obtain a first subcode stream, before encoding the second character based on the second encoding rule, a jump indicator can also be obtained, and the jump indicator is used to indicate that the character is encoded according to the second encoding rule; the jump indicator is encoded based on the first encoding rule to obtain a third subcode stream; accordingly, the second character can be encoded based on the second encoding rule according to the jump indicator.
[0435] by Fig.22a For example, by looking at Fig.17 , we can see that (2,15,11,25,17,6) represents specific characters. When we encounter the number 27, we can see Fig.17 It can be seen that it is a jump indicator used to indicate a jump to Base32_U. Jumping to Base32_U means that the next encoding should be in accordance with Fig.18 The encoding rules are followed.
[0436] 304. Determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0437] In the embodiment of the present application, after the code stream is acquired, the color corresponding to each code element information included in the code stream can be determined based on the target mapping relationship determined in step 302, and the code elements with corresponding colors can be combined to generate a target two-dimensional code.
[0438] For example, taking the code stream "01010011" as an example, the code stream "01010011" is divided into two equal parts to obtain 0101; 0011, and each column constitutes a code element information, that is, four code element information (0,0), (1,0), (0,1), (1,1) are obtained. Then, the color corresponding to each code element information can be determined in the target mapping relationship.
[0439] It should be understood that the execution entity of each step from step 301 to step 304 can be a terminal device or a server on the cloud side, and this application does not limit this.
[0440] The embodiment of the present application provides a two-dimensional code generation method, including: obtaining M colors and characteristic values of each color in a target color channel, the M colors including at least one color, and M being an integer greater than 1; determining a target mapping relationship according to the size relationship between the characteristic values of the M colors in the target color channel, the target mapping relationship including the code element information corresponding to each color in the M colors; obtaining a target link, and generating a code stream corresponding to the target link, the code stream including multiple code element information; determining the color corresponding to each code element information in the code stream according to the target mapping relationship, and generating a target two-dimensional code according to the color corresponding to each code element information in the code stream. In the above manner, the target mapping relationship is determined according to the size relationship between the characteristic values of the M colors in the target color channel, that is, when generating a two-dimensional code, each color is not corresponded to a fixed code element information, but the corresponding relationship between each color and the code element information is generated based on the relative size relationship between the characteristic values of each color in the target color channel. For example, the M colors include color 1 and color 2. In the existing implementation, color 1 must correspond to code element information 1, and color 2 must correspond to code element information 2. In the embodiment of the present application, the color with the larger characteristic value in the target color channel corresponds to code element information 1, and the smaller one corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is greater than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 1, and color 2 corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is less than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 2, and color 2 corresponds to code element information 1. In this way, the correspondence between color and code element information is determined based on the relationship between the characteristic values between colors. As the code scanning side, even if the colors in the two-dimensional code are all user-defined, the code scanning side can also restore the correspondence between the color and code element information used when generating the two-dimensional code based on the relationship between the characteristic values between the colors of the code elements in the scanned two-dimensional code, and then accurately identify the content in the two-dimensional code.
[0441] Reference Figure 22b , Figure 22b A schematic diagram of a process for generating a two-dimensional code provided in an embodiment of the present application, the method comprising:
[0442] 2101. Get the target object and the target link.
[0443] In a possible implementation, the target object is an identification for indicating a target enterprise or a target product, the target QR code includes an image area located in the middle and a coding area surrounding the image area, the coding area includes the multiple code elements, and the image area includes the target object.
[0444] Taking the execution subject of step 301 as a terminal device as an example, specifically, in one implementation, the user can input the target object, and accordingly, the terminal device can obtain the target object, and the terminal device can obtain M colors included in the target object based on the target object.
[0445] Among them, the terminal device can automatically obtain the M colors included in the target object based on the target object. For example, the terminal device can obtain the target object and obtain the M colors with a larger pixel ratio in the target object; or the terminal device can obtain N colors with a larger pixel ratio in the target object, and obtain M colors that meet the first preset condition from the N colors. The following two implementations are described respectively:
[0446] In an optional implementation, the terminal device can obtain the target object and obtain M colors with a larger pixel proportion in the target object. The algorithm for extracting the color from the target object may include, but is not limited to, color quantization, clustering, and color modeling. Taking the clustering algorithm used in implementation as an example, the K-means clustering algorithm can be used to extract the main colors from the input target image, and sort the pixels of each main color in the target object from most to least, thereby obtaining M colors with a larger pixel proportion in the target object.
[0447] In the embodiment of the present application, the target object may be an image containing a corporate LOGO, and the M colors with a larger pixel proportion in the target object may represent the main colors of the corporate LOGO.
[0448] In the embodiment of the present application, the target object may be an image containing an image of a product, and the M colors with a larger pixel proportion in the target object may represent the main colors of the product.
[0449] In an optional implementation, N colors with a larger pixel proportion in the target object can be obtained, where N is a positive integer greater than M, and M colors that meet a first preset condition are obtained from the N colors. The first preset condition includes at least one of the following: the difference between the characteristic values of any two colors in the M colors in the chroma channel is greater than a first preset value, and the characteristic value of each color in the M colors in the saturation channel is greater than a second preset value.
[0450] In an embodiment of the present application, N colors can be first obtained from the target object, and then M better colors can be selected from the N colors. The so-called better means that the QR code including the screened M colors is more beautiful. Specifically, if at least two of the M colors are relatively similar colors, or at least one of the M colors is a color with lower purity, the aesthetics of the QR code generated based on the M colors is poor.
[0451] Therefore, N colors can be obtained from the target object, and better M colors can be selected from the N colors. Specifically, M colors that meet the first preset condition can be obtained from the N colors, and the first preset condition includes at least one of the following: the difference between the characteristic values of any two colors in the M colors in the chroma channel is greater than the first preset value, and the characteristic value of each color in the M colors in the saturation channel is greater than the second preset value.
[0452] It should be understood that the first preset value can be set according to actual conditions, as long as it can indicate that the two colors have a good visual distinction, and the present application does not limit the specific value of the first preset value.
[0453] It should be understood that the second preset value can be set according to actual conditions, as long as it can indicate that the color has good visual color purity, and the present application does not limit the specific value of the second preset value.
[0454] Regarding how to obtain the target image, reference may be made to the description related to obtaining the target object in step 301 , which will not be repeated here.
[0455] Regarding how to obtain the target link, reference may be made to the description related to obtaining the target link in step 303, which will not be repeated here.
[0456] 2102. According to the target object, obtain M colors included in the target object, where the M colors include at least one color, and M is an integer greater than 1.
[0457] Regarding how to obtain the M colors included in the target object according to the target object, reference may be made to the description related to obtaining the M colors included in the target object in step 301, which will not be repeated here.
[0458] 2103. Generate a target QR code based on the M colors and the target link, wherein the color style of the target QR code is consistent with the color style of the target object, wherein the target QR code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to represent the target link.
[0459] Among them, the so-called consistent color style means that the color included in the target QR code is consistent with the main color of the target object. For example, the target object is the LOGO of Company A, and the LOGO of Company A is red and blue, then the target QR code can include red and blue, and then the target QR code has the color style recognition of Company A.
[0460] Regarding how to generate the target QR code according to the M colors and the target link, reference may be made to the description of step 304 and will not be repeated here.
[0461] In a possible implementation, the target object is a logo indicating a target enterprise, the target QR code includes an image area in the middle and a coding area surrounding the image area, the coding area includes the multiple code elements, and the image area includes the target object.
[0462] In a possible implementation, M colors having a larger pixel proportion in the target object may be obtained.
[0463] In a possible implementation, acquiring, according to the target object, M colors included in the target object includes:
[0464] Obtain N colors included in the target object, where N is a positive integer greater than M;
[0465] Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors;
[0466] Receiving a selection operation of a user for M color options among the N color options;
[0467] In response to the selection operation, M colors indicated by the M color options are obtained.
[0468] In an embodiment of the present application, if the terminal device obtains M colors based on the target object input by the user, a first interface can be displayed, wherein the first interface includes a first control, and the first control is used to instruct the user to input an image, after which the terminal device can receive the target object input by the user based on the first control.
[0469] For details, please refer to Fig.12 The terminal device can display an interface for setting the color of the QR code (i.e., the first interface in the above embodiment), which may include a control for inputting a picture (i.e., the first control in the above embodiment), and the user can click the control for inputting a picture and input a target object, after which the terminal device can receive the target object input by the user based on the first control.
[0470] In addition, in the embodiment of the present application, the terminal device can obtain N candidate colors from the target object for the user to select, and the user can select M colors from the N candidate colors. Accordingly, the terminal device can obtain the M colors selected by the user. Fig.13 , the terminal device can display an interface for color selection of the QR code, the color selection interface can display 5 candidate colors obtained from the target object, the user can select M colors from the 5 candidate colors, and accordingly, the terminal device can obtain the M colors selected by the user.
[0471] In a possible implementation, a first interface may be displayed, where the first interface includes a first control, and the first control is used to instruct a user to input an image;
[0472] The target object input by the user based on the first control is received.
[0473] In a possible implementation, a characteristic value of each color in the target color channel of the M colors may be obtained, the M colors include at least one color, and M is an integer greater than 1;
[0474] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0475] Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0476] Correspondingly, generating a target QR code according to the M colors and the target link includes:
[0477] According to the target mapping relationship, the color corresponding to each code element information in the code stream is determined, and according to the color corresponding to each code element information in the code stream, a target two-dimensional code is generated.
[0478] In a possible implementation, acquiring, according to the target object, M colors included in the target object includes:
[0479] Obtain N colors with a larger pixel ratio in the target image, where N is a positive integer greater than M;
[0480] M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
[0481] In a possible implementation, the target link is used to trigger a corresponding function;
[0482] The functions include at least one of the following:
[0483] Jump to the corresponding web page;
[0484] Open the target function in the corresponding application;
[0485] Display the corresponding string;
[0486] Display the corresponding video;
[0487] Or, play the corresponding audio.
[0488] The embodiment of the present application provides a method for generating a two-dimensional code, including: obtaining a target object and a target link; according to the target object, obtaining M colors included in the target object, wherein the M colors include at least one color, and M is an integer greater than 1; according to the M colors and the target link, generating a target two-dimensional code, wherein the color style of the target two-dimensional code is consistent with the color style of the target object, the target two-dimensional code includes multiple code elements, the colors of the multiple code elements include the M colors, and the colors of each code element correspond to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to characterize the target link. The present application generates a target two-dimensional code having a color style consistent with the target object based on the M colors included in the target object, thereby realizing color customization of the two-dimensional code.
[0489] Reference Fig.22c , Fig.22c A schematic diagram of a process for generating a two-dimensional code provided in an embodiment of the present application, the method comprising:
[0490] 2201. Receive M colors input by a user and obtain a target link, wherein the M colors include at least one color, and M is an integer greater than 1;
[0491] In the embodiment of the present application, the terminal device can obtain M colors based on the color information input by the user, referring to Fig.12 The terminal device can display an interface for setting the color of the QR code, which can include a control for inputting a picture and multiple input boxes, wherein the user can enter a color information in each input box, for example Fig.12 In the interface shown in , the user can enter the RGB value of a color in each input box.
[0492] For more information on how to receive the M colors input by the user, please refer to the description related to receiving the M colors input by the user in step 301, which will not be repeated here.
[0493] Regarding how to obtain the target link, reference may be made to the description related to obtaining the target link in step 301, which will not be repeated here.
[0494] 2202. Generate a target QR code based on the M colors and the target link, wherein the target QR code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to represent the target link.
[0495] Regarding how to generate the target QR code according to the M colors and the target link, reference may be made to the description of step 304 and will not be repeated here.
[0496] In one possible implementation, receiving M colors input by a user includes: displaying a second interface, the second interface including a first input box, the first input box being used to indicate color information input by the user for indicating a color; receiving M color information input by the user in the first input box; and obtaining the M colors based on the M color information.
[0497] In a possible implementation, the method further includes: obtaining a characteristic value of each color in the target color channel of the M colors, the M colors including at least one color, and M being an integer greater than 1; determining a target mapping relationship according to a size relationship between the characteristic values of the M colors in the target color channel, the target mapping relationship including code element information corresponding to each color in the M colors; generating a code stream corresponding to the target link, the code stream including multiple code element information; accordingly, generating a target two-dimensional code according to the M colors and the target link includes: determining a color corresponding to each code element information in the code stream according to the target mapping relationship, and generating a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0498] In a possible implementation, the target link is used to trigger a corresponding function;
[0499] The functions include at least one of the following:
[0500] Jump to the corresponding web page;
[0501] Open the target function in the corresponding application;
[0502] Display the corresponding string;
[0503] Display the corresponding video;
[0504] Or, play the corresponding audio.
[0505] A code stream corresponding to the target link is generated, wherein the code stream includes a plurality of code element information.
[0506] The embodiment of the present application provides a method for generating a two-dimensional code, including: receiving M colors input by a user and obtaining a target link, wherein the M colors include at least one color, and M is an integer greater than 1; generating a target two-dimensional code according to the M colors and the target link, wherein the target two-dimensional code includes multiple code elements, the colors of the multiple code elements include the M colors, and the colors of each code element correspond to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to characterize the target link. The present application generates a target two-dimensional code including M colors based on the M colors input by the user, thereby realizing color customization of the two-dimensional code.
[0507] Reference Fig.23 , Fig.23 A schematic diagram of a two-dimensional code recognition method provided in an embodiment of the present application is shown in FIG. Fig.23 As shown, the two-dimensional code recognition method provided in the embodiment of the present application includes:
[0508] 2301. Acquire a target image, where the target image includes a target two-dimensional code, and the target two-dimensional code includes multiple code elements.
[0509] In an embodiment of the present application, the terminal device can obtain a target image including a target QR code.
[0510] Next, it is described how the terminal device acquires the target image.
[0511] 1. The terminal device can capture the target image through the camera it carries.
[0512] In one embodiment, a user may turn on a barcode recognition function on certain applications and select barcode scanning, which will call the camera on the terminal device. Then, the user may use the camera of the terminal device to shoot an area where a target QR code is set, thereby enabling the terminal device to obtain a target image including the target QR code.
[0513] Reference Fig.24 , Fig.24 A scenario diagram provided for an embodiment of the present application is as follows: Fig.24 As shown in FIG. 4 , a user can use a camera of a terminal device 401 to shoot an area 402 where a target two-dimensional code is set. Accordingly, the terminal device 401 can obtain a target image including a target two-dimensional code 403 .
[0514] In one embodiment, a user can turn on a barcode recognition function on certain applications and select barcode scanning, which will call an external camera of the terminal device, which is connected to the terminal device. Then, the user can use the external camera to shoot an area where multiple barcodes are set, so that the terminal device can obtain a target image including a target QR code.
[0515] 2. The terminal device can obtain a target image including the target QR code in a local album or a cloud album.
[0516] In one embodiment, a user can turn on a barcode recognition function on certain applications and choose to select an image from a local album or a cloud album. This function will open the local album or the cloud album on the terminal device. The user can select a target image for barcode recognition in the local album or the cloud album on the terminal device. The target image may include a target QR code. Then, the terminal device can obtain a target image including a target QR code in the local album or the cloud album.
[0517] In the embodiment of the present application, the types of target two-dimensional codes may include but are not limited to PDF417, Aztec, PDF 417 two-dimensional barcode, Datamatrix two-dimensional barcode, Maxicode two-dimensional barcode, Code 49, Code 16K, and Code one.
[0518] 2302. Obtain M colors included in the multiple code elements and a characteristic value of each color in a target color channel.
[0519] In the embodiment of the present application, after the target image is acquired, the M colors included in the multiple code elements and the characteristic value of each color in the target color channel may be acquired.
[0520] Among them, in the process of identifying the target two-dimensional code, it is necessary to first identify which colors the target two-dimensional code is composed of. Since the target image obtained by the code scanning device may have color recognition errors due to polarization or other reasons, the M colors obtained by the code scanning device are the colors approximately included in the target two-dimensional code. At the same time, since the code elements originally have the same color, due to polarization and other reasons, the color recognition results of the code elements with the same color by the code scanning device will be different. Therefore, in one implementation, the code scanning device can obtain the color of each code element in the multiple code elements, and based on the clustering algorithm, obtain the M colors included in the multiple code elements, wherein each color in the M colors is a cluster center obtained by the clustering algorithm. In other words, the M colors are the M main colors included in the target two-dimensional code.
[0521] It should be understood that the clustering algorithm in this embodiment can be K-Means clustering, mean shift clustering, density-based clustering method (DBSCAN), maximum expectation (EM) clustering using Gaussian mixture model (GMM), agglomerative hierarchical clustering, etc., and this application is not limited.
[0522] In a possible implementation, the target image is a grayscale image, and the target color channel is a brightness channel.
[0523] In the embodiment of the present application, the code scanning device may not be compatible with scanning color two-dimensional codes. Specifically, some scanning devices can only obtain grayscale images. In order to enable such code scanning devices to scan color two-dimensional codes, when generating the target two-dimensional code, it is necessary to distinguish between the grayscales of the colors included in the two-dimensional code (that is, the characteristic values in the brightness channel). More specifically, color A and color B are colors. Although color A and color B are different, the code scanning device that is not compatible with scanning color two-dimensional codes can only obtain the characteristic values of color A and color B in the brightness channel after scanning color A and color B. In this embodiment, the characteristic values of the color obtained according to the target image in the brightness channel can be adjusted so that the difference between the characteristic values of any two of the M colors to be processed in the brightness channel is greater than the preset value, so that the code scanning device that is not compatible with scanning color two-dimensional codes can determine that color A and color B are different colors after scanning color A and color B, and the size relationship between the characteristic values of color A and color B in the brightness channel. And the code book is restored based on the size relationship between the characteristic values of color A and color B in the brightness channel.
[0524] 2303. Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, where the target mapping relationship includes code element information corresponding to each color in the M colors.
[0525] In an embodiment of the present application, after acquiring the target image, the M colors included in the multiple code elements and the characteristic value of each color in the target color channel can be obtained, and the target mapping relationship can be determined based on the size relationship between the characteristic values of the M colors in the target color channel, and the target mapping relationship includes the code element information corresponding to each color in the M colors.
[0526] and Figure 3 The difference between step 302 in the corresponding embodiment is that in this embodiment, the target mapping relationship is restored based on the code element color of the scanned target two-dimensional code (the target mapping relationship is generated based on the M colors obtained in step 302).
[0527] In the embodiment of the present application, after obtaining the M colors included in the multiple code elements, it is necessary to restore the code book based on the M colors. The so-called code book is the target mapping relationship in the present embodiment. The target mapping relationship may include the code element information corresponding to each color in the M colors, wherein the code element information may be binary information. The two-dimensional code is composed of multiple code elements, each of which may carry certain information. In the process of generating the two-dimensional code, it is necessary to convert the character string (the information to be carried in the generated two-dimensional code) into a binary code stream, and divide the code stream into multiple sub-code streams (or referred to as code element information), each of which corresponds to a code element in the two-dimensional code. The code element is the basic unit of the two-dimensional code, each code element is an area on the two-dimensional code, and each code element carries certain code element information. After the code scanning device scans the two-dimensional code, it can parse the code elements included in the two-dimensional code to obtain the code element information corresponding to the code element, and obtain the content carried by the two-dimensional code based on the code element information of each code element obtained.
[0528] In the embodiment of the present application, the target mapping relationship is determined according to the size relationship between the characteristic values of the M colors in the target color channel, that is, when recognizing the two-dimensional code, each color is not corresponding to a fixed code element information, but the corresponding relationship between each color and the code element information is determined based on the relative size relationship between the characteristic values of each color in the target color channel. For example, the M colors include color 1 and color 2. In the existing implementation, color 1 must correspond to code element information 1, and color 2 must correspond to code element information 2. In the embodiment of the present application, the color with a larger characteristic value in the target color channel corresponds to code element information 1, and the smaller one corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is greater than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 1, and color 2 corresponds to code element information 2. If the characteristic value of color 1 in the target color channel is less than the characteristic value of color 2 in the target color channel, color 1 corresponds to code element information 2, and color 2 corresponds to code element information 1.
[0529] In this way, the correspondence between color and code element information is determined based on the size relationship of the eigenvalues between colors. As the scanning side, even if the colors in the QR code are customized by the user, the scanning side can also restore the correspondence between the color and code element information used when generating the QR code based on the size relationship of the eigenvalues between the colors of the code elements in the scanned QR code.
[0530] Next, it is described how to determine the target mapping relationship according to the size relationship between the characteristic values of the M colors in the target color channel.
[0531] In the embodiment of the present application, the target color channel may include at least one color channel in a color space, wherein the color space may be, but is not limited to, an RGB space, a YUV space, an HSL space, and an HSV space.
[0532] Exemplarily, the target color channels may be the chromaticity channel (hue) and the brightness channel (value) in the HSV space. The eigenvalues of the brightness channel of each of the M colors in the HSV space may be compared, and the target mapping relationship may be determined based on the size relationship between the eigenvalues of the brightness channel of the M colors.
[0533] In the embodiment of the present application, the code element information is fixed, for example, the 2-bit code element information includes (0, 0), (0, 1), (1, 0), (1, 1), and the method of mapping each color in the M colors to a code element information is very flexible. If the target color channel is a color channel, the code element information of the color with the smallest eigenvalue in the target color channel among the M colors can be set to (1, 1), and the code element information of the color with the largest eigenvalue in the target color channel among the M colors can be set to (0, 0), or any other rule. As long as each color can uniquely correspond to a code element information in the target mapping relationship determined based on the size relationship between the eigenvalues of the M colors in the brightness channel, and each code element information uniquely corresponds to a color, as long as the method used in the code scanning device to determine the target mapping relationship is consistent with the method used when generating the target two-dimensional code, the present application does not limit the specific eigenvalue size comparison rules.
[0534] Exemplarily, taking M as 4 as an example, the colors of each code element included in the target two-dimensional code are subjected to a 4-category k-means clustering algorithm, and a group of RGB values of the colors will be obtained, for example, as shown in Table 4:
[0535] Table 4
[0536] RGB Value X1 X2 X3 X4
[0537] At this time, the RGB values of X1, X2, X3, and X4 may be different from those when they were generated because of color deviation. Restoring the color codebook is the inverse process of generating the color codebook. According to the obtained X1, X2, X3, and X4, the size relationship between the feature values of X1, X2, X3, and X4 on the target color channel is calculated and the target mapping relationship is restored according to the preset mutual relationship rules. For example, the target mapping relationship can be shown in Table 5:
[0538] Table 5
[0539] RGB Value information X1 (1,0) X2 (0,1) X3 (1,1) X4 (0,0)
[0540] 2304. Determine the code element information corresponding to the color of each code element in the multiple code elements according to the target mapping relationship.
[0541] Due to polarization and other reasons, the code elements that originally have the same color will have different color recognition results for the code elements with the same color by the code scanning device. Therefore, it is possible to determine, based on the target mapping relationship, the code element information corresponding to the color of each code element and the most similar color among the M colors.
[0542] Exemplarily, when determining the color of each code element and the color most similar to the M colors, let the RGB value obtained in the color quantization step be X1-X4. If white and yellow are regarded as one category, and blue and black are regarded as another category, and the LDA solution is performed using the values of X1-X4, the following is obtained:
[0543]
[0544] If we consider white and blue as one category and yellow and black as another category, and use the values of X1-X4 to perform LDA, we get:
[0545]
[0546] Finally, the color of each code element in multiple code elements can be obtained.
[0547] In the embodiment of the present application, after the color of each symbol is obtained, the symbol information corresponding to the color of each symbol in the multiple symbols can be determined based on the target mapping relationship. The specific description of the symbol information can refer to the description in the above embodiment, which will not be repeated here.
[0548] 2305. Decode the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements.
[0549] In a possible implementation, the code element information corresponding to the color of each code element in the multiple code elements is used to form a code stream, and the code stream includes a first sub-code stream and a second sub-code stream; the first sub-code stream is decoded based on a first decoding rule to obtain a first character; the second sub-code stream is decoded based on a second decoding rule to obtain a second character, and the first decoding rule and the second decoding rule are different.
[0550] In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0551] In a possible implementation, the code stream further includes a third sub-code stream, the first sub-code stream is adjacent to the third sub-code stream, and the third sub-code stream is adjacent to the second sub-code stream, after decoding the first sub-code stream based on the first decoding rule and before decoding the second sub-code stream based on the second decoding rule, the third sub-code stream may be decoded based on the first decoding rule to obtain a jump indicator, where the jump indicator is used to indicate that character decoding is performed according to the second decoding rule; accordingly, the second sub-code stream may be decoded based on the second decoding rule according to the jump indicator.
[0552] In a possible implementation, a decoded content obtained after decoding may be obtained, wherein the decoded content includes a character string, and the decoded content is used to trigger a corresponding function;
[0553] The functions include at least one of the following:
[0554] Jump to the corresponding web page;
[0555] Open the target function in the corresponding application;
[0556] Display the corresponding string;
[0557] Display the corresponding video;
[0558] Or, play the corresponding audio.
[0559] The embodiment of the present application provides a two-dimensional code recognition method, the method comprising: obtaining a target image, the target image comprising a target two-dimensional code, the target two-dimensional code comprising a plurality of code elements; obtaining M colors included in the plurality of code elements and the characteristic value of each color in the target color channel; determining a target mapping relationship according to the size relationship between the characteristic values of the M colors in the target color channel, the target mapping relationship comprising the code element information corresponding to each color in the M colors; determining the code element information corresponding to the color of each code element in the plurality of code elements according to the target mapping relationship; decoding the target two-dimensional code according to the code element information corresponding to the color of each code element in the plurality of code elements. In this way, based on the size relationship of the characteristic values between the colors, the corresponding relationship between the color and the code element information is determined. As the code scanning side, even if the colors in the two-dimensional code are all user-defined, the code scanning side can also restore the corresponding relationship between the color and the code element information used when generating the two-dimensional code based on the size relationship of the characteristic values between the colors of the code elements in the scanned two-dimensional code, thereby accurately identifying the content in the two-dimensional code.
[0560] Next, the QR code recognition method in this application is described with the server as the execution subject. Fig.25 , Fig.25An example of a two-dimensional code recognition method provided in the present application is shown in FIG. Fig.25 As shown, a two-dimensional code recognition method provided in an embodiment of the present application includes:
[0561] 2501. The server receives a target image sent by a terminal device, where the target image includes a target two-dimensional code, and the target two-dimensional code includes multiple code elements;
[0562] 2502. The server obtains M colors included in the multiple code elements and a characteristic value of each color in a target color channel;
[0563] 2503. The server determines a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, where the target mapping relationship includes symbol information corresponding to each color in the M colors.
[0564] 2504. The server determines the code element information corresponding to the color of each code element in the multiple code elements according to the target mapping relationship;
[0565] 2505. The server decodes the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements.
[0566] Optionally, the method further includes:
[0567] Obtaining decoded content obtained after decoding, wherein the decoded content includes a character string, and the decoded content is used to trigger a corresponding function;
[0568] The functions include at least one of the following:
[0569] Jump to the corresponding web page;
[0570] Open the target function in the corresponding application;
[0571] Display the corresponding string;
[0572] Display the corresponding video;
[0573] Or, play the corresponding audio.
[0574] Optionally, the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel.
[0575] Optionally, the target image is a grayscale image, and the target color channel is a brightness channel.
[0576] Optionally, obtaining the M colors included in the multiple code elements includes:
[0577] Acquire the color of each code element in the multiple code elements, and acquire M colors included in the multiple code elements based on a clustering algorithm, wherein each color in the M colors is a cluster center obtained by the clustering algorithm;
[0578] Correspondingly, determining the code element information corresponding to the color of each code element in the multiple code elements according to the target mapping relationship includes:
[0579] Obtain the color of each code element and the color most similar to the M colors;
[0580] According to the target mapping relationship, the code element information corresponding to the color of each code element and the most similar color among the M colors is determined.
[0581] Optionally, the code element information corresponding to the color of each code element in the multiple code elements is used to form a code stream, and the code stream includes a first sub-code stream and a second sub-code stream; and decoding the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements includes:
[0582] Decoding the first sub-code stream based on a first decoding rule to obtain a first character;
[0583] The second subcode stream is decoded based on a second decoding rule to obtain a second character, wherein the first decoding rule is different from the second decoding rule.
[0584] Optionally, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0585] Optionally, the code stream further includes a third sub-code stream, the first sub-code stream is adjacent to the third sub-code stream, the third sub-code stream is adjacent to the second sub-code stream, and after decoding the first sub-code stream based on the first decoding rule and before decoding the second sub-code stream based on the second decoding rule, the method further includes:
[0586] Decoding the third sub-code stream based on the first decoding rule to obtain a jump indicator, wherein the jump indicator is used to indicate that character decoding is performed according to the second decoding rule;
[0587] Correspondingly, decoding the second sub-stream based on the second decoding rule includes:
[0588] The second sub-code stream is decoded according to the jump indicator based on the second decoding rule.
[0589] The description of steps 2501 to 2505 can refer to the description in the above embodiment and will not be repeated here.
[0590] The present application also provides a two-dimensional code generating device, which can be a terminal device or a server. Fig.26 , Fig.26 A schematic diagram of a structure of a two-dimensional code generating device provided in an embodiment of the present application, the two-dimensional code generating device 2600 includes:
[0591] An acquisition module 2601 is used to acquire M colors and a characteristic value of each color in a target color channel, wherein the M colors include at least one chromatic color, and M is an integer greater than 1;
[0592] The specific description of the acquisition module 2601 can refer to the description of step 301 and step 303, which will not be repeated here.
[0593] A mapping relationship determination module 2602 is used to determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0594] The specific description of the mapping relationship determination module 2602 can refer to the description of step 302, which will not be repeated here.
[0595] The acquisition module 2601,
[0596] Used to obtain a target link and generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0597] Generate a code stream corresponding to the target link, the code stream includes multiple code element information two-dimensional code generation modules 2603, which are used to determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0598] The specific description of the QR code generation module 2603 can refer to the description of step 304, which will not be repeated here.
[0599] In a possible implementation, the acquisition module is used to:
[0600] Get the target object;
[0601] According to the target object, M colors included in the target object are acquired.
[0602] In a possible implementation, the acquisition module is used to:
[0603] Obtain M colors with a larger pixel ratio in the target object.
[0604] In a possible implementation, the acquisition module is used to:
[0605] Obtain N colors with a larger pixel ratio in the target object, where N is a positive integer greater than M;
[0606] M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
[0607] In a possible implementation, the acquisition module is used to:
[0608] Obtain N colors included in the target object, where N is a positive integer greater than M;
[0609] Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors;
[0610] Receiving a selection operation of a user for M color options among the N color options;
[0611] In response to the selection operation, M colors indicated by the M color options are obtained.
[0612] In a possible implementation, the acquisition module is used to:
[0613] Get the target object;
[0614] According to the target object, obtaining M colors to be processed included in the target object;
[0615] The characteristic values of the M colors to be processed in the brightness channel are adjusted so that the difference between the characteristic values of any two colors to be processed in the brightness channel among the M colors to be processed is greater than a preset value, so as to obtain the M colors.
[0616] In a possible implementation, the acquisition module is used to:
[0617] Displaying a first interface, wherein the first interface includes a first control, and the first control is used to instruct a user to input an image;
[0618] The target object input by the user based on the first control is received.
[0619] In a possible implementation, the acquisition module is used to:
[0620] Receive M colors input by the user.
[0621] In a possible implementation, the acquisition module is used to:
[0622] Displaying a second interface, the second interface including a first input box, the first input box being used to instruct a user to input color information for indicating a color;
[0623] Receive M color information input by the user in the first input box;
[0624] The M colors are obtained according to the M color information.
[0625] In a possible implementation, the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel.
[0626] In a possible implementation, the target link includes a first character and a second character, and the acquisition module is used to:
[0627] Encode the first character based on a first encoding rule to obtain a first subcode stream;
[0628] The second character is encoded based on a second encoding rule to obtain a second subcode stream, wherein the first encoding rule and the second encoding rule are different.
[0629] In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0630] In a possible implementation, the first character and the second character are adjacent characters in the target link, and the acquisition module is used to:
[0631] Obtaining a jump indicator, where the jump indicator is used to indicate that character encoding is performed using the second encoding rule;
[0632] Encoding the jump indicator based on a first encoding rule to obtain a third sub-code stream;
[0633] According to the jump indicator, the second character is encoded based on the second encoding rule.
[0634] The present application also provides a two-dimensional code recognition device, which can be a terminal device or a server. Fig. 27 , Fig. 27 A schematic diagram of the structure of a two-dimensional code recognition device provided in an embodiment of the present application is shown in FIG. Fig. 27 As shown in FIG. 2 , the two-dimensional code recognition device 2700 includes:
[0635] An acquisition module 2701 is used to acquire a target image, wherein the target image includes a target two-dimensional code, and the target two-dimensional code includes a plurality of code elements;
[0636] Acquire M colors included in the multiple code elements and a characteristic value of each color in a target color channel;
[0637] The specific description of the acquisition module 2701 can refer to the description of step 2301 and step 2302, which will not be repeated here.
[0638] A mapping relationship determination module 2702 is used to determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0639] Determining, according to the target mapping relationship, code element information corresponding to the color of each code element in the plurality of code elements;
[0640] The specific description of the mapping relationship determination module 2702 can refer to the description of step 2303 and step 2304, which will not be repeated here.
[0641] The decoding module 2703 is used to decode the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements.
[0642] The specific description of the decoding module 2703 can refer to the description of step 2305, which will not be repeated here.
[0643] In a possible implementation, the acquisition module is used to:
[0644] Obtaining decoded content obtained after decoding, wherein the decoded content includes a character string, and the decoded content is used to trigger a corresponding function;
[0645] The functions include at least one of the following:
[0646] Jump to the corresponding web page;
[0647] Open the target function in the corresponding application;
[0648] Display the corresponding string;
[0649] Display the corresponding video;
[0650] Or, play the corresponding audio.
[0651] In a possible implementation, the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel.
[0652] In a possible implementation, the target image is a grayscale image, and the target color channel is a brightness channel.
[0653] In a possible implementation, the acquisition module is used to:
[0654] Acquire the color of each code element in the multiple code elements, and acquire M colors included in the multiple code elements based on a clustering algorithm, wherein each color in the M colors is a cluster center obtained by the clustering algorithm;
[0655] Correspondingly, the mapping relationship determination module is used to obtain the color of each code element and the most similar color among the M colors;
[0656] According to the target mapping relationship, the code element information corresponding to the color of each code element and the most similar color among the M colors is determined.
[0657] In a possible implementation, the code element information corresponding to the color of each code element in the multiple code elements is used to form a code stream, and the code stream includes a first sub-code stream and a second sub-code stream; the decoding module is used to decode the first sub-code stream based on a first decoding rule to obtain a first character;
[0658] The second subcode stream is decoded based on a second decoding rule to obtain a second character, wherein the first decoding rule is different from the second decoding rule.
[0659] In a possible implementation, the first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
[0660] In a possible implementation, the code stream further includes a third sub-code stream, the first sub-code stream is adjacent to the third sub-code stream, and the third sub-code stream is adjacent to the second sub-code stream, and the decoding module is configured to:
[0661] Decoding the third sub-code stream based on the first decoding rule to obtain a jump indicator, wherein the jump indicator is used to indicate that character decoding is performed according to the second decoding rule;
[0662] Correspondingly, decoding the second sub-stream based on the second decoding rule includes:
[0663] The second sub-code stream is decoded according to the jump indicator based on the second decoding rule.
[0664] In addition, an embodiment of the present application further provides a two-dimensional code generating device, the device comprising:
[0665] The acquisition module is used to acquire the target object and the target link;
[0666] According to the target object, M colors included in the target object are acquired, wherein the M colors include at least one color, and M is an integer greater than 1;
[0667] A QR code generation module is used to generate a target QR code based on the M colors and the target link, wherein the color style of the target QR code is consistent with the color style of the target object, the target QR code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to characterize the target link.
[0668] In a possible implementation, the target object is an identification for indicating a target enterprise or a target product, the target QR code includes an image area located in the middle and a coding area surrounding the image area, the coding area includes the multiple code elements, and the image area includes the target object.
[0669] In a possible implementation, the acquisition module is used to acquire M colors with a larger pixel proportion in the target object.
[0670] In a possible implementation, the acquisition module is used to acquire N colors included in the target object, where N is a positive integer greater than M;
[0671] Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors;
[0672] Receiving a selection operation of a user for M color options among the N color options;
[0673] In response to the selection operation, M colors indicated by the M color options are obtained.
[0674] In a possible implementation, the acquisition module is used to display a first interface, where the first interface includes a first control, and the first control is used to instruct a user to input an image;
[0675] Receive the target object input by the user based on the first control. In a possible implementation, the acquisition module is used to acquire a characteristic value of each color in the target color channel of the M colors, the M colors include at least one color, and M is an integer greater than 1;
[0676] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0677] Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0678] Correspondingly, the two-dimensional code generation module is used to determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0679] In a possible implementation, the acquisition module is used to acquire N colors with a larger pixel proportion in the target object, where N is a positive integer greater than M;
[0680] M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
[0681] In a possible implementation, the target link is used to trigger a corresponding function;
[0682] The functions include at least one of the following:
[0683] Jump to the corresponding web page;
[0684] Open the target function in the corresponding application;
[0685] Display the corresponding string;
[0686] Display the corresponding video;
[0687] Or, play the corresponding audio.
[0688] In addition, an embodiment of the present application further provides a two-dimensional code generating device, the device comprising:
[0689] An acquisition module, used for receiving M colors input by a user and acquiring a target link, wherein the M colors include at least one color, and M is an integer greater than 1;
[0690] A two-dimensional code generation module is used to generate a target two-dimensional code according to the M colors and the target link, wherein the target two-dimensional code includes multiple code elements, the colors of the multiple code elements include the M colors, and the color of each code element corresponds to a code element information, and the multiple code element information corresponding to the colors of the multiple code elements are used to represent the target link.
[0691] In a possible implementation, the acquisition module is used to display a second interface, where the second interface includes a first input box, where the first input box is used to instruct a user to input color information for indicating a color;
[0692] Receive M color information input by the user in the first input box;
[0693] The M colors are obtained according to the M color information.
[0694] In a possible implementation, the acquisition module is used to acquire a characteristic value of each color in the M colors in a target color channel, the M colors include at least one color, and M is an integer greater than 1;
[0695] Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors;
[0696] Generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information;
[0697] Correspondingly, the two-dimensional code generation module is used to determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
[0698] In a possible implementation, the target link is used to trigger a corresponding function;
[0699] The functions include at least one of the following:
[0700] Jump to the corresponding web page;
[0701] Open the target function in the corresponding application;
[0702] Display the corresponding string;
[0703] Display the corresponding video;
[0704] Or, play the corresponding audio.
[0705] Next, a terminal device provided by an embodiment of the present application is introduced. Fig.28 , Fig.28 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application, the terminal device 2800 can be specifically a virtual reality VR device, a mobile phone, a tablet, a laptop computer, a smart wearable device, etc., which is not limited here. Specifically, the terminal device 2800 includes: a receiver 2801, a transmitter 2802, a processor 2803 and a memory 2804 (wherein the number of processors 2803 in the terminal device 2800 can be one or more, Fig.28In the example of FIG. 2803 , the processor 2803 may include an application processor 28031 and a communication processor 28032. In some embodiments of the present application, the receiver 2801, the transmitter 2802, the processor 2803 and the memory 2804 may be connected via a bus or other means.
[0706] The memory 2804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 2803. A portion of the memory 2804 may also include a non-volatile random access memory (NVRAM). The memory 2804 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0707] The processor 2803 controls the operation of the terminal device. In a specific application, the various components of the terminal device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0708] The method disclosed in the above embodiment of the present application can be applied to the processor 2803, or implemented by the processor 2803. The processor 2803 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 2803. The above processor 2803 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 2803 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be combined and executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 2804, and the processor 2803 reads the information in the memory 2804 and completes the steps of the above method in combination with its hardware.
[0709] The receiver 2801 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the terminal device. The transmitter 2802 can be used to output digital or character information through the first interface; the transmitter 2802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 2802 can also include a display device such as a display screen.
[0710] In an embodiment of the present application, in one case, the processor 2803 is used to execute the processing-related steps in the two-dimensional code generation and two-dimensional code recognition method in the above-mentioned embodiment.
[0711] The present application also provides a server. Fig.29 , Fig.29It is a structural diagram of a server provided in an embodiment of the present application. The server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 2922 (for example, one or more processors) and memory 2932, and one or more storage media 2930 (for example, one or more mass storage devices) storing application programs 2942 or data 2944. Among them, the memory 2932 and the storage medium 2930 can be short-term storage or permanent storage. The program stored in the storage medium 2930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processing unit 2922 can be configured to communicate with the storage medium 2930 and execute a series of instruction operations in the storage medium 2930 on the server 2900.
[0712] The server 2900 may also include one or more power supplies 2926, one or more wired or wireless network interfaces 2950, one or more input and output interfaces 2958, and / or one or more operating systems 2941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0713] In the embodiment of the present application, the central processing unit 2922 is used to execute the two-dimensional code generation and two-dimensional code recognition methods in the above embodiment.
[0714] An embodiment of the present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the steps of the QR code generation and QR code recognition methods.
[0715] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a program for signal processing. When the program is run on a computer, the computer executes the steps of the QR code generation and QR code recognition methods in the method described in the above embodiments.
[0716] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of modules in this application is a logical division. There may be other division methods when it is implemented in actual applications. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection between modules can be electrical or other similar forms, which are not limited in this application. In addition, the modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in multiple circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present application.
[0717] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0718] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0719] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0720] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A two-dimensional code generation method, characterized in that: The method comprises: Obtain M colors and feature values of each color in a target color channel, wherein the M colors include at least one color, and M is an integer greater than 1; the M colors are input by a user or included in a target object; Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors; the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel; Acquire a target link, and generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information; According to the target mapping relationship, the color corresponding to each code element information in the code stream is determined, and according to the color corresponding to each code element information in the code stream, a target two-dimensional code is generated.
2. The method according to claim 1, characterized in that: The obtaining of M colors comprises: Get the target object; According to the target object, M colors included in the target object are acquired.
3. The method according to claim 2, characterized in that The acquiring of the M colors included in the target object comprises: Obtain M colors with a larger pixel ratio in the target object.
4. The method according to claim 2, characterized in that: The acquiring of the M colors included in the target object comprises: Obtain N colors with a larger pixel ratio in the target object, where N is a positive integer greater than M; M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
5. The method according to claim 2, characterized in that: The acquiring, according to the target object, M colors included in the target object comprises: Obtain N colors included in the target object, where N is a positive integer greater than M; Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors; Receiving a selection operation of a user for M color options among the N color options; In response to the selection operation, M colors indicated by the M color options are obtained.
6. The method according to claim 1, characterized in that The obtaining of M colors comprises: Get the target object; According to the target object, obtaining M colors to be processed included in the target object; The characteristic values of the M colors to be processed in the brightness channel are adjusted so that the difference between the characteristic values of any two colors to be processed in the brightness channel among the M colors to be processed is greater than a preset value, so as to obtain the M colors.
7. The method according to any one of claims 2 to 6, characterized in that: The acquiring the target object comprises: Displaying a first interface, wherein the first interface includes a first control, and the first control is used to instruct a user to input an image; The target object input by the user based on the first control is received.
8. The method according to claim 1, characterized in that The obtaining of M colors comprises: Receive M colors input by the user.
9. The method according to claim 8, characterized in that The receiving of M colors input by the user comprises: Displaying a second interface, the second interface including a first input box, the first input box being used to instruct a user to input color information for indicating a color; Receive M color information input by the user in the first input box; The M colors are obtained according to the M color information.
10. The method according to any one of claims 1 to 6, characterized in that: The target link includes a first character and a second character, and generating a code stream corresponding to the target link includes: Encode the first character based on a first encoding rule to obtain a first subcode stream; The second character is encoded based on a second encoding rule to obtain a second subcode stream, wherein the first encoding rule and the second encoding rule are different.
11. The method according to claim 10, characterized in that The first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
12. The method according to claim 10, characterized in that The first character and the second character are adjacent characters in the target link. After encoding the first character based on the first encoding rule to obtain the first subcode stream, and before encoding the second character based on the second encoding rule, the method further includes: Obtaining a jump indicator, where the jump indicator is used to indicate that character encoding is performed using the second encoding rule; Encoding the jump indicator based on a first encoding rule to obtain a third sub-code stream; Correspondingly, encoding the second character based on the second encoding rule includes: According to the jump indicator, the second character is encoded based on the second encoding rule.
13. A two-dimensional code recognition method, characterized in that: The method comprises: Acquire a target image, wherein the target image includes a target two-dimensional code, and the target two-dimensional code includes a plurality of code elements; Acquire M colors included in the multiple code elements and a characteristic value of each color in a target color channel; Determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors; the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel; Determining, according to the target mapping relationship, code element information corresponding to the color of each code element in the plurality of code elements; The target two-dimensional code is decoded according to the code element information corresponding to the color of each code element in the multiple code elements.
14. The method according to claim 13, characterized in that The method further comprises: Obtaining decoded content obtained after decoding, wherein the decoded content includes a character string, and the decoded content is used to trigger a corresponding function; The functions include at least one of the following: Jump to the corresponding web page; Open the target function in the corresponding application; Display the corresponding string; Display the corresponding video; Or, play the corresponding audio.
15. The method according to claim 13 or 14, characterized in that The target image is a grayscale image, and the target color channel is a brightness channel.
16. The method according to claim 13 or 14, characterized in that The obtaining of the M colors included in the plurality of code elements comprises: Acquire the color of each code element in the multiple code elements, and acquire M colors included in the multiple code elements based on a clustering algorithm, wherein each color in the M colors is a cluster center obtained by the clustering algorithm; Correspondingly, determining the code element information corresponding to the color of each code element in the multiple code elements according to the target mapping relationship includes: Obtain the color of each code element and the color most similar to the M colors; According to the target mapping relationship, the code element information corresponding to the color of each code element and the most similar color among the M colors is determined.
17. The method according to claim 13 or 14, characterized in that The code element information corresponding to the color of each code element in the multiple code elements is used to form a code stream, and the code stream includes a first sub-code stream and a second sub-code stream; and decoding the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements includes: Decoding the first sub-code stream based on a first decoding rule to obtain a first character; The second subcode stream is decoded based on a second decoding rule to obtain a second character, wherein the first decoding rule is different from the second decoding rule.
18. The method according to claim 17, characterized in that The first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
19. The method according to claim 17, characterized in that The code stream further includes a third sub-code stream, the first sub-code stream is adjacent to the third sub-code stream, the third sub-code stream is adjacent to the second sub-code stream, after decoding the first sub-code stream based on the first decoding rule and before decoding the second sub-code stream based on the second decoding rule, the method further includes: Decoding the third sub-code stream based on the first decoding rule to obtain a jump indicator, wherein the jump indicator is used to indicate that character decoding is performed according to the second decoding rule; Correspondingly, decoding the second sub-stream based on the second decoding rule includes: The second sub-code stream is decoded according to the jump indicator based on the second decoding rule.
20. A two-dimensional code generating device, characterized in that: The device comprises: An acquisition module, used for acquiring M colors and a characteristic value of each color in a target color channel, wherein the M colors include at least one chromatic color, and M is an integer greater than 1; A mapping relationship determination module is used to determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors; the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel; The acquisition module is used to acquire a target link and generate a code stream corresponding to the target link, wherein the code stream includes a plurality of code element information; Generate a code stream corresponding to the target link, the code stream includes multiple code element information two-dimensional code generation modules, which are used to determine the color corresponding to each code element information in the code stream according to the target mapping relationship, and generate a target two-dimensional code according to the color corresponding to each code element information in the code stream.
21. The device according to claim 20, characterized in that The acquisition module is used to: Get the target object; According to the target object, M colors included in the target object are acquired.
22. The device according to claim 21, characterized in that The acquisition module is used to: Obtain M colors with a larger pixel ratio in the target object.
23. The device according to claim 21, characterized in that The acquisition module is used to: Obtain N colors with a larger pixel ratio in the target object, where N is a positive integer greater than M; M colors that meet a first preset condition are obtained from the N colors, where the first preset condition includes at least one of the following: a difference between characteristic values of a chromaticity channel of any two colors among the M colors is greater than a first preset value, and a characteristic value of a saturation channel of each color among the M colors is greater than a second preset value.
24. The device according to claim 21, characterized in that The acquisition module is used to: Obtain N colors included in the target object, where N is a positive integer greater than M; Displaying a target interface, wherein the target interface includes N color options, each color option is used to indicate one of the N colors; Receiving a selection operation of a user for M color options among the N color options; In response to the selection operation, M colors indicated by the M color options are obtained.
25. The device according to claim 20, characterized in that The acquisition module is used to: Get the target object; According to the target object, obtaining M colors to be processed included in the target object; The characteristic values of the M colors to be processed in the brightness channel are adjusted so that the difference between the characteristic values of any two colors to be processed in the brightness channel among the M colors to be processed is greater than a preset value, so as to obtain the M colors.
26. The device according to any one of claims 21 to 25, characterized in that The acquisition module is used to: Displaying a first interface, wherein the first interface includes a first control, and the first control is used to instruct a user to input an image; The target object input by the user based on the first control is received.
27. The device according to claim 20, characterized in that The acquisition module is used to: Receive M colors input by the user.
28. The device according to claim 27, characterized in that The acquisition module is used to: Displaying a second interface, the second interface including a first input box, the first input box being used to instruct a user to input color information for indicating a color; Receive M color information input by the user in the first input box; The M colors are obtained according to the M color information.
29. The device according to any one of claims 20 to 25, characterized in that The target link includes a first character and a second character, and the acquisition module is used to: Encode the first character based on a first encoding rule to obtain a first subcode stream; The second character is encoded based on a second encoding rule to obtain a second subcode stream, wherein the first encoding rule and the second encoding rule are different.
30. The device according to claim 29, characterized in that The first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
31. The device according to claim 29, characterized in that The first character and the second character are adjacent characters in the target link, and the acquisition module is used to: Obtaining a jump indicator, where the jump indicator is used to indicate that character encoding is performed using the second encoding rule; Encoding the jump indicator based on a first encoding rule to obtain a third sub-code stream; According to the jump indicator, the second character is encoded based on the second encoding rule.
32. A two-dimensional code recognition device, characterized in that: The device comprises: An acquisition module, used for acquiring a target image, wherein the target image includes a target two-dimensional code, and the target two-dimensional code includes a plurality of code elements; Acquire M colors included in the multiple code elements and a characteristic value of each color in a target color channel; A mapping relationship determination module is used to determine a target mapping relationship according to a size relationship between characteristic values of the M colors in a target color channel, wherein the target mapping relationship includes code element information corresponding to each color in the M colors; the target color channel includes at least one of the following: a red channel, a green channel, a blue channel, a chroma channel, a brightness channel, and a saturation channel; Determining, according to the target mapping relationship, code element information corresponding to the color of each code element in the plurality of code elements; The decoding module is used to decode the target two-dimensional code according to the code element information corresponding to the color of each code element in the multiple code elements.
33. The device according to claim 32, characterized in that The acquisition module is used to: Obtaining decoded content obtained after decoding, wherein the decoded content includes a character string, and the decoded content is used to trigger a corresponding function; The functions include at least one of the following: Jump to the corresponding web page; Open the target function in the corresponding application; Display the corresponding string; Display the corresponding video; Or, play the corresponding audio.
34. The device according to claim 32 or 33, characterized in that The target image is a grayscale image, and the target color channel is a brightness channel.
35. The device according to claim 32 or 33, characterized in that The acquisition module is used to: Acquire the color of each code element in the multiple code elements, and acquire M colors included in the multiple code elements based on a clustering algorithm, wherein each color in the M colors is a cluster center obtained by the clustering algorithm; Correspondingly, the mapping relationship determination module is used to obtain the color of each code element and the most similar color among the M colors; According to the target mapping relationship, the code element information corresponding to the color of each code element and the most similar color among the M colors is determined.
36. The device according to claim 32 or 33, characterized in that The code element information corresponding to the color of each code element in the plurality of code elements is used to form a code stream, wherein the code stream includes a first sub-code stream and a second sub-code stream; The decoding module is used to decode the first sub-code stream based on a first decoding rule to obtain a first character; The second subcode stream is decoded based on a second decoding rule to obtain a second character, wherein the first decoding rule is different from the second decoding rule.
37. The device according to claim 36, characterized in that The first character and the second character have the same size, and the number of bits of the first sub-code stream and the number of bits of the second sub-code stream are different in size.
38. The device according to claim 36, characterized in that The code stream further includes a third sub-code stream, the first sub-code stream is adjacent to the third sub-code stream, the third sub-code stream is adjacent to the second sub-code stream, and the decoding module is used to: Decoding the third sub-code stream based on the first decoding rule to obtain a jump indicator, wherein the jump indicator is used to indicate that character decoding is performed according to the second decoding rule; Correspondingly, decoding the second sub-stream based on the second decoding rule includes: The second sub-code stream is decoded according to the jump indicator based on the second decoding rule.
39. A computer-readable storage medium comprising a program, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 19.
40. A terminal device, comprising a processor and a memory, wherein the processor is coupled to the memory, characterized in that: The memory is used to store programs; The processor is configured to execute the program in the memory so that the terminal device executes the method according to any one of claims 1 to 19.
41. A computer program product, characterized in that The method comprises codes which, when executed, are used to implement the method according to any one of claims 1 to 19.
Citation Information
Patent Citations
Method and device for generating and reading color two-dimensional diagram code of color identification type
CN106022431A
Two-dimensional code recognition method and device, two-dimensional code generation method and device, electronic equipment and storage medium
CN112070195A
Optical symbol, article therewith, method of attaching optical symbol to article, and method of decoding optical symbol
JP2008027029A
Cited By
QR code generation method and related device
WO2022143417A1