IP Library › Granted Patent US 12,437,175
Granted Patent B2
US 12,437,175 · App. 18/215,378 · Granted Oct 7, 2025

Two-dimensional code generation method and related device

Inventors: Tingrui Han (Hangzhou, CN); Fuyang Rao (Shenzhen, CN); Huajingling Wu (Hangzhou, CN); Chengqian Deng (Shenzhen, CN)
Assignee: HUAWEI TECHNOLOGIES CO., LTD.
G06K19/06037
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,437,175
App. No.
18/215,378
Granted
Oct 7, 2025
Kind
B2
Abstract

A two-dimensional code generation method is disclosed, including: obtaining M colors and a characteristic value of each color in a target color path; determining a target mapping relationship based on a magnitude relationship between characteristic values of the M colors in the target color path; obtaining a target link, and generating a bitstream corresponding to the target link; and determining a color corresponding to each piece of element information in the bitstream, and generating a target two-dimensional code based on the color corresponding to each piece of element information in the bitstream. According to the two-dimensional code generation method, a code scanning side can restore, based on a magnitude relationship between characteristic values of colors of elements in the scanned two-dimensional code, a correspondence that is between colors and element information and that is used for generating the two-dimensional code, to accurately identify content in the two-dimensional code.

Claims (66)

1. A two-dimensional code generation method, comprising:

obtaining M colors input by a user and a characteristic value of each color in a target color path, wherein the M colors comprise at least one chromatic color, and M is an integer greater than 1;

determining a target mapping relationship based on a magnitude relationship between characteristic values of the M colors in the target color path, wherein the target mapping relationship comprises element information corresponding to each of the M colors;

obtaining a target link, and generating a bitstream corresponding to the target link, wherein the bitstream comprises a plurality of pieces of element information; and

determining, based on the target mapping relationship, a color corresponding to each piece of element information in the bitstream, and generating a target two-dimensional code based on the color corresponding to each piece of element information in the bitstream.

2. The method according to claim 1 , wherein the obtaining M colors comprises:

obtaining a target object; and

obtaining, based on the target object, M colors comprised in the target object.

3. The method according to claim 2 , wherein the obtaining M colors comprised in the target object comprises:

obtaining M colors in the target object, wherein a pixel proportion of the M colors in the target object is larger than other colors in the target object.

4. The method according to claim 2 , wherein the obtaining M colors comprised in the target object comprises:

obtaining N colors in the target object, wherein N is a positive integer greater than M, a pixel proportion of the N colors in the target object is larger than other colors in the target object; and

obtaining M colors meeting a first preset condition from the N colors, wherein the first preset condition comprises at least one of the following: a difference between characteristic values of any two of the M colors in a chrominance path is greater than a first preset value, or a characteristic value of each of the M colors in a saturation path is greater than a second preset value.

5. The method according to claim 2 , wherein the obtaining, based on the target object, M colors comprised in the target object comprises:

obtaining N colors comprised in the target object, wherein N is a positive integer greater than M;

displaying a target interface, wherein the target interface comprises N color options, and each color option indicates one of the N colors;

receiving a selection operation performed by a user on M of the N color options; and

obtaining, in response to the selection operation, M colors indicated by the M color options.

6. The method according to claim 1 , wherein the obtaining M colors comprises:

obtaining a target object;

obtaining, based on the target object, M to-be-processed colors comprised in the target object; and

adjusting characteristic values of the M to-be-processed colors in a luminance path, so that a difference between characteristic values of any two of the M to-be-processed colors in the luminance path is greater than a preset value, to obtain the M colors.

7. The method according to claim 2 , wherein the obtaining a target object comprises:

displaying a first interface, wherein the first interface comprises a first control, and the first control is used to indicate the user to input an image; and

receiving the target object that is input by the user based on the first control.

8. The method according to claim 1 , wherein the receiving M colors that are input by a user comprises:

displaying a second interface, wherein the second interface comprises a first input box, and the first input box is used to indicate the user to input color information used for indicating a color;

receiving M pieces of color information that are input by the user in the first input box; and

obtaining the M colors based on the M pieces of color information.

9. The method according to claim 1 , wherein the target color path comprises at least one of the following: a red path, a green path, a blue path, a chrominance path, a luminance path, or a saturation path.

10. The method according to claim 1 , wherein the target link comprises a first character and a second character, and the generating a bitstream corresponding to the target link comprises:

encoding the first character according to a first encoding rule to obtain a first sub-bitstream; and

encoding the second character according to a second encoding rule to obtain a second sub-bitstream, wherein the first encoding rule is different from the second encoding rule.

11. The method according to claim 10 , wherein a size of the first character is the same as a size of the second character, and a quantity of bits of the first sub-bitstream is different from a quantity of bits of the second sub-bitstream.

12. The method according to claim 10 , further comprising:

after the encoding the first character according to a first encoding rule to obtain a first sub-bitstream and before the encoding the second character according to a second encoding rule, obtaining a jump indicator, wherein the jump indicator indicates to perform character encoding according to the second encoding rule, wherein the first character and the second character are adjacent characters in the target link; and

encoding the jump indicator according to the first encoding rule to obtain a third sub-bitstream; and

correspondingly, the encoding the second character according to a second encoding rule comprises:

encoding the second character based on the jump indicator according to the second encoding rule.

13. A two-dimensional code generation apparatus, comprising:

an obtaining module, configured to obtain M colors and a characteristic value of each color in a target color path, wherein the M colors comprise at least one chromatic color, and M is an integer greater than 1, wherein the M colors are inputted by a user;

a mapping relationship determining module, configured to determine a target mapping relationship based on a magnitude relationship between characteristic values of the M colors in the target color path, wherein the target mapping relationship comprises element information corresponding to each of the M colors, wherein

the obtaining module is configured to: obtain a target link, and generate a bitstream corresponding to the target link, wherein the bitstream comprises a plurality of pieces of element information; and

a two-dimensional code generation module, configured to: determine, based on the target mapping relationship, a color corresponding to each piece of element information in the bitstream, and generate a target two-dimensional code based on the color corresponding to each piece of element information in the bitstream.

14. The apparatus according to claim 13 , wherein the obtaining module is configured to:

obtain a target object; and

obtain, based on the target object, M colors comprised in the target object.

15. The apparatus according to claim 14 , wherein the obtaining module is configured to:

obtain M colors in the target object, wherein a pixel proportion of the M colors in the target object is larger than other colors in the target object.

16. The apparatus according to claim 14 , wherein the obtaining module is configured to:

obtain N colors in the target object, wherein N is a positive integer greater than M, a pixel proportion of the N colors in the target object is larger than other colors in the target object; and

obtain M colors meeting a first preset condition from the N colors, wherein the first preset condition comprises at least one of the following: a difference between characteristic values of any two of the M colors in a chrominance path is greater than a first preset value, and a characteristic value of each of the M colors in a saturation path is greater than a second preset value.

17. The apparatus according to claim 14 , wherein the obtaining module is configured to:

obtain N colors comprised in the target object, wherein Nis a positive integer greater than M;

display a target interface, wherein the target interface comprises N color options, and each color option indicates one of the N colors;

receive a selection operation performed by a user on M of the N color options; and

obtain, in response to the selection operation, M colors indicated by the M color options.

18. The apparatus according to claim 13 , wherein the obtaining module is configured to:

obtain a target object;

obtain, based on the target object, M to-be-processed colors comprised in the target object; and

adjust characteristic values of the M to-be-processed colors in a luminance path, so that a difference between characteristic values of any two of the M to-be-processed colors in the luminance path is greater than a preset value, to obtain the M colors.

19. A non-transitory computer-readable storage medium, comprising a program, wherein when the program is run on a computer, the computer is enabled to:

obtain M colors input by a user and a characteristic value of each color in a target color path, wherein the M colors comprise at least one chromatic color, and M is an integer greater than 1;

determine a target mapping relationship based on a magnitude relationship between characteristic values of the M colors in the target color path, wherein the target mapping relationship comprises element information corresponding to each of the M colors;

obtain a target link, and generating a bitstream corresponding to the target link, wherein the bitstream comprises a plurality of pieces of element information; and

determine, based on the target mapping relationship, a color corresponding to each piece of element information in the bitstream, and generate a target two-dimensional code based on the color corresponding to each piece of element information in the bitstream.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 15, 2023
From: HAN, TINGRUI; RAO, FUYANG; WU, HUAJINGLING; DENG, CHENGQIAN
To: HUAWEI TECHNOLOGIES CO., LTD.
Reel/Frame 064919/0263 →
Priority Claims (1)
CN 202011607876.4 · Dec 29, 2020 · national
Continuity (2)
Continuation PCTCN2021140891 · Dec 23, 2021
Related Publication 20230342579A1 · Oct 26, 2023
References Cited (15)
US 7020327B2 · Tack-Don et al. · 2006 [cited by applicant]
US 8978989B2 · Friedman · 2015 [cited by examiner]
US 9805296B2 · Loy et al. · 2017 [cited by applicant]
US 10534948B1 · Walters · 2020 [cited by examiner]
US 20180314924A1 · Mai et al. · 2018 [cited by applicant]
CN 101493901A · 2009 [cited by applicant]
CN 104573781A · 2015 [cited by applicant]
CN 106022431A · 2016 [cited by applicant]
CN 109214490A · 2019 [cited by applicant]
CN 112070195A · 2020 [cited by applicant]
EP 1591948B1 · 2007 [cited by applicant]
JP 2008027029A · 2008 [cited by applicant]
Mingliang Xu et al, “Stylized Aesthetic QR Code”, IEEE Transactions on Multimedia, vol. 21, No. 8, Aug. 2019,total 11 pages. [cited by applicant]
Zhibo Yang et al, “Towards Robust Color Recovery for High-Capacity Color QR Codes”, IEEE International Conference on Image Processing, Aug. 19, 2016, total 5 pages. [cited by applicant]
Fuwang Yi et al, “A Robust Circular Two-Dimensional Barcode and Decoding Method”, Picture Coding Symposium, PCS,Sep. 16, 2019,total 5 pages. [cited by applicant]