CN112819122A - Two-dimensional code generation and analysis method and device - Google Patents

Two-dimensional code generation and analysis method and device Download PDF

Info

Publication number
CN112819122A
CN112819122A CN202110119924.3A CN202110119924A CN112819122A CN 112819122 A CN112819122 A CN 112819122A CN 202110119924 A CN202110119924 A CN 202110119924A CN 112819122 A CN112819122 A CN 112819122A
Authority
CN
China
Prior art keywords
code
coding units
dimensional code
dimensional
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110119924.3A
Other languages
Chinese (zh)
Inventor
陶霖密
任胜韦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tsinghua University
Original Assignee
Tsinghua University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tsinghua University filed Critical Tsinghua University
Priority to CN202110119924.3A priority Critical patent/CN112819122A/en
Publication of CN112819122A publication Critical patent/CN112819122A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K2019/06215Aspects not covered by other subgroups
    • G06K2019/06225Aspects not covered by other subgroups using wavelength selection, e.g. colour code

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The embodiment of the invention provides a method and a device for generating and analyzing a two-dimensional code, wherein the generating method comprises the following steps: determining a plurality of corresponding coding units based on the information to be coded; generating a two-dimensional code in which the plurality of coding units are spaced apart from each other by a spacer. The method can solve the problem of accurate interpretation of the two-dimensional code in the state of the blurred image.

Description

Two-dimensional code generation and analysis method and device
Technical Field
The invention relates to the technical field of two-dimensional codes, in particular to a method and a device for generating and analyzing a two-dimensional code.
Background
In recent years, with the development of mobile phone technology, code scanning application of two-dimensional codes is comprehensively developed, and the two-dimensional codes are deeply applied to the aspects of daily life.
The two-dimensional code is expanded from a one-dimensional bar code, so the formal name is the two-dimensional bar code, and the two-dimensional bar code is obtained by extending and folding the one-dimensional bar code. The two-dimensional codes commonly used at present are all called Quick Response 2D Bar codes, and are a two-dimensional Code coding mode jointly proposed by the international organization for standardization and the national standard. The conventional two-dimensional bar code is a square two-dimensional code comprising coding units 1 which are closely adjacent (as shown in fig. 3), and the square two-dimensional code is provided with a plurality of functional regions and coding regions, such as three positioning regions of a left upper corner, a right upper corner and a left lower corner.
Because the two-dimensional bar code is developed by extending from the one-dimensional bar code, the encoding mode of the two-dimensional bar code is the same as that of the one-dimensional bar code, one code bit represents the number of one bit, and black and white represents 0 and 1. And in combination with the positioning symbol of the two-dimensional code, the machine can obtain a string of data consisting of 0 and 1, and the information in the string of data is obtained after decoding.
With the popularization and application of two-dimensional codes, a great number of patents about the two-dimensional codes appear, and mainly include two directions, namely, the code capacity is increased, namely, a black-and-white image with one bit of each code is changed into a color two-dimensional code with multiple bits of each code bit. Some patents related to the nearly ten two-dimensional color bar codes (for example, CN201110119768.7A a color-superimposed two-dimensional code system and its application method, southern China agricultural university, CN2012100488571A color bar code and color two-dimensional code, Von Shi) develop one-bit black-and-white two-dimensional code into multi-bit color two-dimensional code, which greatly increases the information coding capacity of the two-dimensional code. Another development of color codes is to use two-dimensional codes in the fields of encryption, forgery prevention, and the like while increasing the capacity (for example, CN201510572367.5A two-dimensional code generation method, decoding method, and apparatus, and a company, alliba group stock control). A great deal of patent applications in the aspect of color two-dimensional codes reflect great progress of China in popularization and acquisition in the field of two-dimensional codes. In consideration of the fact that the two-dimensional code is easily affected by shooting noise and jitter, the other patent (CN201380059381.4A two-dimensional code, co-printed corporation) discloses a two-dimensional code encoding method with more than four positioning patterns, so that the two-dimensional code is more accurately positioned in the identification process and has stronger anti-interference capability.
However, in the conventional two-dimensional code technology, when decoding a two-dimensional code, it is necessary that an image is focused clearly and positioned accurately, so that a decoding system can accurately divide and read each coding unit to realize subsequent decoding. Therefore, there is a technical problem that, in the case where the camera is moved and it is difficult to accurately focus, the two-dimensional code cannot be decoded because the acquired defocused image cannot be recognized by the decoding system.
Disclosure of Invention
The invention adopts a technical scheme for solving the technical problems, and on one hand, provides a two-dimensional code generation method, which comprises the following steps:
determining a plurality of corresponding coding units based on the information to be coded;
generating a two-dimensional code in which the plurality of coding units are spaced apart from each other by a spacer.
Preferably, the determining the corresponding plurality of coding units based on the information to be coded includes determining the plurality of coding units corresponding to the information to be coded based on preset N different coding units, where N > -2.
Preferably, the generating the two-dimensional code includes determining four positioning coding units, and arranging the plurality of coding units and the four positioning coding units in a two-dimensional array in the two-dimensional code, where a dimension value of a first dimension of the two-dimensional array is not equal to a dimension value of a second dimension, and the four positioning coding units are located at four corners of the two-dimensional array, where upper-left, lower-left, upper-right, and lower-right corner coding units respectively represent a first value, a second value, a first value, and a second value.
Specifically, determining the corresponding plurality of coding units based on the information to be encoded includes:
generating an index code of an N-system number corresponding to information to be coded according to a pre-established database;
and determining the plurality of coding units according to the index codes.
Specifically, determining the corresponding plurality of coding units based on the information to be encoded includes:
generating a first index code of an L-system number corresponding to information to be coded according to an L-system public code table;
converting the first index code into a second index code of an N-system number;
and determining the plurality of coding units according to the second index code.
In a second aspect, a two-dimensional code parsing method is provided, including:
acquiring a two-dimensional code to be analyzed, wherein the two-dimensional code comprises a plurality of coding units which are separated from each other through a spacer;
and acquiring information corresponding to the two-dimensional code based on the plurality of coding units.
Preferably, the acquiring information corresponding to the two-dimensional code based on the plurality of coding units includes:
determining an index code of an N-ary number according to a plurality of coding units;
and acquiring information corresponding to the two-dimensional code according to the index code and a pre-established database.
Preferably, the acquiring information corresponding to the two-dimensional code based on the plurality of coding units includes:
determining a third index code of the N-ary number according to the plurality of coding units;
converting the third index code into a fourth index code of an L-system number;
and determining information corresponding to the two-dimensional code according to the fourth index code and the public code table of the L system.
Preferably, the two-dimensional code includes a plurality of coding units, including obtaining a plurality of to-be-analyzed two-dimensional codes in a lens;
the acquiring information corresponding to the two-dimensional code based on the plurality of coding units comprises acquiring information corresponding to the plurality of two-dimensional codes respectively based on the plurality of coding units respectively included in the plurality of two-dimensional codes.
In a third aspect, a two-dimensional code generating apparatus is provided, including:
an encoding unit determination unit configured to determine a corresponding plurality of encoding units based on information to be encoded;
a two-dimensional code generation unit configured to generate a two-dimensional code in which the plurality of coding units are spaced apart from each other by a spacer.
In a fourth aspect, a two-dimensional code analysis device is provided, including:
the two-dimensional code acquisition unit is configured to acquire a two-dimensional code to be analyzed, wherein the two-dimensional code comprises a plurality of coding units which are separated from each other through a spacer;
a correspondence information acquisition unit configured to acquire information corresponding to the two-dimensional code based on the plurality of encoding units.
By using any one of the method and the device, the technical problem of accurately reading the corresponding information from the two-dimensional code in the state of the blurred image can be effectively solved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a two-dimensional code generation method according to an embodiment of the present invention;
fig. 2 is a flowchart of a two-dimensional code parsing method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a conventional two-dimensional code according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a two-row ten-column discrete four-valued two-dimensional code according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a three-row eight-column discrete eight-valued two-dimensional code according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a four-row ten-column discrete eight-valued two-dimensional code according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a four-row six-column discrete binary two-dimensional code according to an embodiment of the present invention;
fig. 8 is a schematic diagram illustrating an implementation manner of a two-dimensional code generation and analysis method using a private index code according to an embodiment of the present invention;
fig. 9 is a schematic diagram of an implementation manner of using a public index code in a two-dimensional code generation and analysis method according to an embodiment of the present invention;
fig. 10 is a structural diagram of a two-dimensional code generation apparatus according to an embodiment of the present invention;
fig. 11 is a structural diagram of a two-dimensional code analysis apparatus according to an embodiment of the present invention;
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The inventor shows that the existing two-dimensional codes generally have high coding density and coding units which are closely adjacent without intervals, as shown in fig. 1, the coding units 1 of the traditional two-dimensional codes are closely adjacent without intervals. Therefore, when decoding the two-dimensional code, the image needs to be focused clearly and positioned accurately, so that the decoding system can accurately divide and read each coding unit to realize subsequent decoding. The coding mode has the characteristic of high density, namely, the coding amount in a unit area is large, the noise-resistant and defocus-resistant capability is low, and the like, and the main reason is that the noise-resistant and defocus-resistant performance of the coding is limited by a high-density two-dimensional coding mode, the current two-dimensional code is poor in defocus-resistant performance, and information can be read and decoded only after the two-dimensional code is focused accurately. When the camera moves and is difficult to focus accurately, the acquired defocused image cannot be recognized by a decoding system and the two-dimensional code cannot be decoded.
In order to solve the problem of accurately reading a two-dimensional code in a blurred image state such as inaccurate focusing and motion blur during motion of a mobile camera, the inventor provides a method for generating and analyzing a two-dimensional code with discrete units in the specification. Different from the traditional two-dimensional bar code, the coding units of the two-dimensional bar code have non-coding intervals, so that the camera can accurately divide and match to obtain the coding units under the state of image blurring such as defocusing, motion and the like. In addition, since such a non-coding interval reduces the space utilization of the coding region to some extent, it is intended to solve this problem. The multi-value unit is combined to shorten the code length of the two-dimensional code, thereby reducing the consumption of the coding space.
Fig. 1 is a flowchart of a two-dimensional code generation method according to an embodiment of the present invention. As shown, the method comprises at least the following steps:
and step 11, determining a plurality of corresponding coding units based on the information to be coded.
In this step, the information to be encoded is the information to be converted into the corresponding two-dimensional code, and the encoding unit is a multi-valued encoding unit. The multi-value coding unit is that the number of values that one coding unit can represent is multiple, that is, for an N-value coding unit, N numbers of values can be represented by N colors or patterns. According to different embodiments, for the N-value encoding unit, any N colors or patterns of a plurality of colors or patterns including black, white, gray, red, blue, green, yellow, etc. may be used to represent N numbers of values, respectively. In a specific example, black, white, and gray may be selected to represent specific values among the N number of values. It is understood that in other embodiments, the coding units having more values may also be implemented in a manner of increasing the number of colors/patterns used to constitute the coding units.
Specifically, in different embodiments, the multi-value encoding unit may have different implementations, such as a 2-value (the two-dimensional code in the embodiment shown in fig. 7 includes a 2-value encoding unit), a 3-value, a 4-value (the two-dimensional code in the embodiment shown in fig. 4 includes a 4-value encoding unit), an 8-value (the encoding unit in the embodiment shown in fig. 4 includes an 8-value encoding unit), and a 16-value encoding unit.
In one embodiment, a plurality of coding units corresponding to information to be coded can be determined based on preset N different coding units, where N > -2.
According to one embodiment, a private code table recording information to be encoded and corresponding index codes may be stored in a pre-established database. Therefore, in an example of this embodiment, an index code of an N-ary number corresponding to information to be encoded may be generated according to a pre-established database;
and determining the plurality of coding units according to the index codes.
In a specific example, the index code of the N-ary number corresponding to the information to be encoded may be obtained from a pre-established database. In another specific example, an index code of another system corresponding to the information to be encoded may also be obtained from a pre-established database, and then converted into an index code of an N system number.
According to another embodiment, the index code corresponding to the information to be encoded can also be obtained by using the public code table. Therefore, in an example of this embodiment, a first index code of an L-ary number corresponding to information to be encoded may be generated from an L-ary public code table;
converting the first index code into a second index code of an N-system number;
and determining the plurality of coding units according to the second index code.
Step 12, generating a two-dimensional code in which the plurality of coding units are separated from each other by a spacer.
The spacer is an area in the two-dimensional code, which is spaced between the coding units, and due to the existence of the spacer, the coding units in the two-dimensional code do not have close contact in spatial distribution. Thus, even if the two-dimensional code image is blurred and shot by a camera under conditions such as defocus and motion conditions, accurate image segmentation and matching can be more easily performed, thereby obtaining a coding unit of the two-dimensional code. Namely, the two-dimensional code generated by the method has better ambiguity resistance and interference resistance. In addition, in view of the spatial dispersion among the encoding units of the two-dimensional code, the two-dimensional code is also referred to as a discrete multi-valued two-dimensional code in this specification.
In one embodiment, the color of the spacer area is selected to be different from that of the coding unit, and has a color with larger discrimination, so that the coding unit and the background non-coding area thereof form large contrast of color and brightness, which is beneficial to visual detection. In one example, the color of the four-color coding units adopted by the two-dimensional code is red, green, blue and white, and the color of the spacing area can be black, dark blue or dark green. In another example, the width of the spacer between adjacent coding units is 1/2-1/4 of the coding unit width.
In one embodiment, four positioning coding units may also be determined, the plurality of coding units and the four positioning coding units are arranged in a two-dimensional array in the two-dimensional code, a dimension value of a first dimension of the two-dimensional array is not equal to a dimension value of a second dimension, the four positioning coding units are located at four corners of the two-dimensional array, wherein the upper-left, lower-left, upper-right and lower-right corner coding units respectively represent a first value, a second value, a first value and a second value. Because the dimension value of the first dimension of the two-dimensional array is not equal to the dimension value of the second dimension, namely the two-dimensional code is rectangular, the positioning area only needs to determine the up-down direction of the two-dimensional code. In other embodiments, only 2 or 3 positioning coding units of the 4 positioning coding units may be determined to determine the up and down directions of the two-dimensional code, for example, only the determined top left and top right corner coding units according to which the up and down directions of the two-dimensional code are positioned.
In a specific embodiment, four positioning coding units are determined, wherein the upper left coding unit represents a value of 0, the lower left coding unit represents a value other than 0, the upper right coding unit represents a value of 0, and the lower right coding unit represents a value other than 0.
Fig. 2 is a flowchart of a two-dimensional code analysis method according to an embodiment of the present invention. As shown in fig. 2, the method at least comprises the following steps:
step 21, acquiring a two-dimensional code to be analyzed, wherein the two-dimensional code comprises a plurality of coding units which are separated from each other through a spacer;
in this step, the two-dimensional code, the coding unit, and the spacer to be analyzed are the two-dimensional code, the coding unit, and the spacer described in steps 11 and 12 of fig. 1 above, and are not described herein again.
In one embodiment, the plurality of coding units may be determined based on a preset N different coding units, where N > -2.
In one embodiment, the two-dimensional code may include four positioning coding units, the plurality of coding units and the four positioning coding units in the two-dimensional code are arranged in a two-dimensional array, a dimension value of a first dimension of the two-dimensional array is not equal to a dimension value of a second dimension, the four positioning coding units are located at four corners of the two-dimensional array, and the upper-left, lower-left, upper-right and lower-right corner coding units respectively represent a first value, a second value, a first value and a second value. In one example, the plurality of coding units may be obtained by removing four positioning coding units at four corners of the two-dimensional array.
Step 22, acquiring information corresponding to the two-dimensional code based on the plurality of coding units;
for the embodiment of saving the private code table in the pre-established database as in step 11 of fig. 1, the index code of the N-ary number may be determined according to a plurality of coding units; and acquiring information corresponding to the two-dimensional code according to the index code and a pre-established database.
For the embodiment using the public code table as in step 11 of fig. 1, the third index code of the N-ary number may be determined according to a plurality of coding units; converting the third index code into a fourth index code of an L-system number; and determining information corresponding to the two-dimensional code according to the fourth index code and the public code table of the L system.
In actual production, a plurality of two-dimensional codes on one picture (in one lens) can occur, and the plurality of two-dimensional codes can be clear, fuzzy or fuzzy, and it is generally difficult to make all the two-dimensional codes clear. Therefore, the conventional two-dimensional code reader must select one of the two-dimensional codes and focus on the selected code to read the code. The two-dimensional code analysis method provided by the embodiment of the invention has good anti-ambiguity, so that focusing is not needed, and all the ambiguity codes can be read and decoded, namely multi-code common reading is realized.
Therefore, in one embodiment, a plurality of to-be-analyzed two-dimensional codes in one shot can be acquired; information corresponding to each of the plurality of two-dimensional codes is acquired based on a plurality of encoding units included in each of the plurality of two-dimensional codes.
In one example, after a pattern including a plurality of discrete multi-valued two-dimensional codes is acquired, the multi-code co-reading technology is used, and the color camera is used for reading the plurality of discrete multi-valued two-dimensional codes in one lens together and then decoding the codes to obtain corresponding information of all the discrete multi-valued two-dimensional codes.
Fig. 8 is a schematic diagram of an implementation manner of a two-dimensional code generation and analysis method using a private index code according to an embodiment of the present invention. As shown in fig. 8, the two-dimensional code generation method includes the following steps:
establishing a database 15 for the information 14 to be coded, and establishing a decimal numerical value index code for each piece of information;
selecting a coding mode of a coding unit and a coding code length, for example, selecting a 4-value coding unit, and if the two-dimensional code coding matrix is 4 rows and 9 columns, the code length is 32(4 × 9-4, that is, 4 rows and 9 columns of coding units of the coding matrix-4-corner positioning coding unit);
and converting the decimal index code into the index code of the decimal system of the coding unit according to the selected coding unit value. For example, a 4-value coding unit is selected in the second step, and the decimal index code is converted into a 4-ary index code in the third step;
each converted index code represents a coding unit, and if the length of the index code is insufficient, zero is filled in front of the index code;
and converting the index codes after zero padding into coding units according to the numerical values of the index codes, and arranging to form the discrete two-dimensional code 12.
The two-dimensional code generated by the two-dimensional code generation method and the corresponding two-dimensional code analysis method comprise the following steps:
acquiring a picture 18 of the two-dimensional code, and arranging all coding units into a line from top to bottom from left to right;
converting the coding unit into the number represented by the coding unit to obtain a string of numbers;
inputting the obtained number as an index code into the corresponding database 15;
the database converts the input index code into decimal according to the index code scale, gives out the information corresponding to the index code according to the numerical value of the decimal index code, and realizes decoding to obtain the coded information 14.
As shown in fig. 8, in this embodiment, a two-dimensional code generation system and a two-dimensional code analysis system are also provided. The generating system comprises a computer 16, a coding information database 15 and an output device 13, wherein the index code of the information 14 to be coded is generated into a multi-value discrete two-dimensional code pattern 12 after being coded and calculated by the computer, and the multi-value discrete two-dimensional code pattern is output by the output device and then pasted on the position to be coded. The analysis system comprises a color camera (not shown in the figure), a computer and a code information database 15, wherein the color camera acquires a multi-value discrete two-dimensional code pattern 18, obtains an index code through decoding operation of the computer 16, and acquires coded information 14 in the database or a code table.
In one embodiment, a plurality of two-dimensional codes (discrete multi-valued two-dimensional codes) in one lens can be simultaneously read and analyzed through a multi-code common reading technology, so that the coding information of all the two-dimensional codes can be further obtained.
Fig. 9 is a schematic diagram of an implementation manner of using a public index code in a two-dimensional code generation and analysis method according to an embodiment of the present invention. As shown in fig. 9, the two-dimensional code generation method includes the following steps:
the selection determines a published code table 17 and determines the encoded character set from the code table, e.g., in one example, 128 characters of ASCII code are selected as the code table. In another example, 256-character ASCII codes are selected as a code table;
selecting a coding mode and a code length of a coding unit, for example, in one example, selecting a 4-value coding unit, and if the two-dimensional code coding matrix is 4 rows and 9 columns, the code length is 32(4 × 9-4, that is, 4 rows and 9 columns of coding units of the coding matrix-4-corner positioning coding unit);
converting the information to be coded into corresponding code values according to the selected and determined public code table;
each converted bit code value is converted into a system of a coding unit to obtain an information code, and the part of the information code needing to be coded, which is short of the code length, is filled with a null character before or after the information code;
and converting the information codes after the characters are filled into coding units according to the numerical values of the information codes, and arranging to form the multi-valued discrete two-dimensional code 12.
The two-dimensional code generated by the two-dimensional code generation method and the corresponding two-dimensional code analysis method comprise the following steps:
obtaining a multi-valued discrete two-dimensional code 18, and arranging all coding units in the multi-valued discrete two-dimensional code into a line from left to right from top to bottom;
converting the coding unit into a number of a corresponding binary number according to the binary system of the coding unit to obtain a string of numbers;
according to the selected public code table 17 and the difference of the encoding unit system, taking a plurality of combination of the numbers from left to right for the string of numbers, and converting to obtain a public code table index code (for example, a binary, decimal or hexadecimal public code table index code);
and obtaining a character string from an open coding table according to the numerical value of the obtained index code, and decoding to obtain the coded information 14.
As shown in fig. 9, in this embodiment, a two-dimensional code generation system and a two-dimensional code analysis system are also provided. The generating system comprises a computer 16, a public code table 17 and an output device 13, wherein after the information 14 to be coded is coded and calculated by the computer, an index code and a corresponding multi-value discrete two-dimensional code pattern 12 are generated according to the public code table 17, and the index code and the corresponding multi-value discrete two-dimensional code pattern are output by the output device and then pasted to the position to be coded. The analysis system comprises a color camera (not shown in the figure), a computer and a code information database 15, wherein the color camera acquires a multi-value discrete two-dimensional code pattern 18, obtains an index code through decoding operation of the computer 16, and acquires coded information 14 in the database or a code table.
The process is further illustrated by the following specific examples
Fig. 4 is a schematic diagram of a two-row ten-column discrete four-valued two-dimensional code according to an embodiment of the present invention; as shown in fig. 4, in this embodiment, the multi-value encoding units (specifically, four-value encoding units) 2, 3, 4, and 5 are squares, and represent 4 encoded values 0, 1, 2, and 3, respectively. The four- value encoding units 2, 3, 4, 5 and the non-encoding space region 6 are composed of five colors or patterns, including any five colors of a plurality of colors or patterns such as black, white, gray, red, blue, green, yellow, etc.
The choice of non-coding spacers 6 is different from the coding units. In one example, the color with the color discrimination degree higher than the predetermined value is selected, so that the coding unit and the background non-coding region thereof form a large contrast of color and brightness, which is beneficial to visual detection. In one example, the width of the non-coding spacer between adjacent coding units is 1/2-1/4 of the coding unit width.
The positioning area is composed of positioning coding units on four corners of the upper left corner, the lower left corner, the upper right corner and the lower right corner of the two-dimensional code, the value 0 represented by the upper left positioning coding unit is smaller than the value 2 represented by the lower left positioning coding unit, and the value 0 represented by the upper right positioning coding unit is smaller than the value 2 represented by the lower right positioning coding unit. Because the two-dimensional code is rectangular, the positioning area only needs to determine the upper part and the lower part of the two-dimensional code.
According to the above method, as shown in fig. 4, the 16-bit 4-ary value corresponding to the two-dimensional code of the embodiment is: 1021320131020312.
in one example, the two-dimensional code may be generated and parsed by using a private index code, and the corresponding generation method includes:
establishing a database for information to be coded, and establishing a 16-bit 4-system numerical index code for each piece of information;
selecting a 4-value coding unit and a coding matrix with 2 rows and 10 columns;
and (3) establishing a 16-bit 4-system numerical index code for each piece of information, converting the information into a coding matrix with 2 rows and 10 columns, and realizing coding.
The corresponding analysis method comprises the following steps:
acquiring an image and determining the orientation of 2 rows and 10 columns of discrete two-dimensional codes according to the value of the four-corner positioning unit;
after removing the coding units at four corners, converting the remaining 16 coding units into corresponding numerical values, and arranging all the coding units into a line from top to bottom from left to right to obtain a string of numbers;
the obtained number is used as an index code and is input into a corresponding database;
the database provides information corresponding to the index code according to the numerical value of the index code, and decoding is achieved.
Fig. 5 is a schematic diagram of a three-row eight-column discrete eight-valued two-dimensional code according to an embodiment of the present invention; as shown in fig. 5, in this embodiment, the multi-value encoding units (specifically, eight-value encoding units) 2, 3, 4, 5, 8, 9, 10, 11 are squares and represent 8 encoded values 0, 1, 2, 3, 4, 5, 6, 7, respectively. The eight- value coding units 2, 3, 4, 5, 8, 9, 10, 11 and the non-coding space region 6 are composed of 9 colors or patterns, and any 9 colors of the multiple colors or patterns comprise black, white, gray, red, blue, green, yellow and the like.
The color of the non-coding spacer 6 is chosen differently from the coding unit. In one example, the color with the color discrimination degree higher than the predetermined value is selected, so that the coding unit and the background non-coding region thereof form a large contrast of color and brightness, which is beneficial to visual detection. In one example, the width of the non-coding spacer between adjacent coding units is 1/2-1/4 of the coding unit width.
The positioning area is composed of positioning coding units on four corners of the upper left corner, the lower left corner, the upper right corner and the lower right corner of the two-dimensional code, the value 0 represented by the upper left positioning coding unit is smaller than the value 2 represented by the lower left positioning coding unit, and the value 0 represented by the upper right positioning coding unit is smaller than the value 2 represented by the lower right positioning coding unit. Because the two-dimensional code is rectangular, the positioning area only needs to determine the upper part and the lower part of the two-dimensional code.
According to the above method, as shown in fig. 5, the 20-bit 8-ary value corresponding to the two-dimensional code of the embodiment is: 10243256405764175213.
in one example, the two-dimensional code may be generated and parsed by using a private index code, and the corresponding generation method includes:
establishing a database for information to be coded, and establishing a 20-bit 8-system numerical index code for each piece of information;
selecting an 8-value coding unit and a 3-row and 8-column coding matrix;
and (3) establishing a 20-bit 8-system numerical index code for each piece of information, converting the information into a 3-row 8-column coding matrix, and realizing coding.
The corresponding analysis method comprises the following steps:
acquiring an image and determining the orientation of the 3 rows and 8 columns of discrete two-dimensional codes according to the value of the four-corner positioning unit;
after removing the coding units at four corners, converting the remaining 20 coding units into corresponding numerical values, and arranging all the coding units into a line from top to bottom from left to right to obtain a string of numbers;
using the obtained number as an index code and inputting the index code into a corresponding database;
the database provides information corresponding to the index code according to the numerical value of the index code, and decoding is achieved.
Fig. 6 is a schematic diagram of a four-row ten-column discrete eight-valued two-dimensional code according to an embodiment of the present invention; as shown in fig. 6, in this embodiment, the multi-value encoding units (specifically, eight-value encoding units) 2, 3, 4, 5, 8, 9, 10, 11 are squares and represent 8 encoded values 0, 1, 2, 3, 4, 5, 6, 7, respectively. The eight- value coding units 2, 3, 4, 5, 8, 9, 10, 11 and the non-coding space region 6 are composed of 9 colors or patterns, and comprise any 9 colors of a plurality of colors such as black, white, gray, red, blue, green, yellow and the like.
The color of the non-coding spacer 6 is chosen differently from the coding unit. In one example, the color with the color discrimination degree higher than the predetermined value is selected, so that the coding unit and the background non-coding region thereof form a large contrast of color and brightness, which is beneficial to visual detection. In one example, the width of the non-coding spacer between adjacent coding units is 1/2-1/4 of the coding unit width.
The positioning area is composed of positioning coding units on four corners of the upper left corner, the lower left corner, the upper right corner and the lower right corner of the two-dimensional code, the value 0 represented by the upper left positioning coding unit is smaller than the value 2 represented by the lower left coding unit, and the value 0 represented by the upper right positioning coding unit is smaller than the value 2 represented by the lower right positioning coding unit. Because the two-dimensional code is rectangular, the positioning area only needs to determine the upper part and the lower part of the two-dimensional code.
According to the above method, as shown in fig. 5, the 8-ary value of 36 bits corresponding to the two-dimensional code picture of this embodiment is: 256452575051664556575267466364526572.
in one example, the two-dimensional code may be generated and parsed by using a public code table, and the corresponding generation method includes:
selecting and determining an open code table and determining a coded character set according to the code table, wherein in the embodiment, ASCII codes are selected as the code table;
selecting a coding mode and a code length of a coding unit, selecting an 8-value coding unit in the embodiment, wherein a two-dimensional code coding matrix is 4 rows and 10 columns, and the code length is 36 bits;
converting the information such as English capital and small letter and symbol to be coded into corresponding code values according to the selected and determined ASCII code table, and subtracting 77 (8-system) from each converted code value;
each bit code value obtained in the last step is converted into a color or a symbol of a coding unit representing a corresponding value, and the part of the information code needing to be coded with insufficient code length is filled with a null character before or after the information code;
the corresponding analysis method comprises the following steps:
acquiring a discrete two-dimensional code image, and determining the orientation of the discrete two-dimensional code according to a positioning unit;
according to the system of the coding unit, the coding unit is converted into the number of the corresponding system number, and all the numbers are arranged in a line from left to right from top to bottom to obtain a string of numbers. In this embodiment, the resulting digit string is: 256452575051664556575267466364526572, respectively;
every two bits of the digital string represent an ASCII code, namely: 256452575051664556575267466364526572,
after adding 77 (8-system) to each code in the numeric string, the ASCII code is obtained as follows: 124163151156147150165141125156151166145162163151164171, respectively;
and obtaining a character string from an ASCII code table according to the obtained numerical value of the index code, and realizing decoding. In this embodiment, the above-mentioned numeric string is a character string retrieved from an ASCII code table:
TsinghuaUniversity。
fig. 7 is a schematic diagram of a four-row six-column discrete binary two-dimensional code according to an embodiment of the present invention; as shown in fig. 7, in this embodiment, the binary coding units 2 and 7 are squares, and represent 2 code values 0 and 1, respectively. The binary coding units 2 and 7 and the non-coding interval area 6 are composed of 3 colors or patterns, and any 3 colors of the multiple colors or patterns comprise black, white, gray, red, blue, green, yellow and the like.
The color of the non-coding spacer 6 is chosen differently from the coding unit. In one example, the color with the color discrimination degree higher than the predetermined value is selected, so that the coding unit and the background non-coding region thereof form a large contrast of color and brightness, which is beneficial to visual detection. In one example, the width of the non-coding spacer between adjacent coding units is 1/2-1/4 of the coding unit width.
The positioning area is composed of positioning coding units on four corners of the two-dimensional code, namely, the upper left corner, the lower left corner, the upper right corner and the lower right corner, the values represented by the positioning coding units on the upper left corner and the upper right corner are 0, and the values represented by the positioning coding units on the small left corner and the lower right corner are not 0. Because the two-dimensional code is rectangular, the positioning area only needs to determine the upper part and the lower part of the two-dimensional code.
According to the above method, as shown in fig. 4, the 20-bit 2-ary value corresponding to the two-dimensional code of the embodiment is: 10111010101011011100
The maximum number that can be encoded is 220-1,048,576.
In one example, the two-dimensional code may be generated and parsed by using a private index code, and the corresponding generation method includes:
establishing a database for information to be coded, and establishing a 20-bit 2-system numerical index code for each piece of information;
selecting a 2-value coding unit, a coding matrix with 4 rows and 6 columns;
and converting the 20-bit 2-system numerical index code corresponding to each piece of information into a 4-row 6-column 2-system coding matrix to realize coding.
The corresponding analysis method comprises the following steps:
acquiring an image and determining the orientation of 4 rows and 6 columns of discrete two-dimensional codes according to the value of the four-corner positioning unit;
after removing the coding units at four corners, converting the remaining 20 coding units into corresponding numerical values, and arranging all the coding units into a row from top to bottom from left to right to obtain a string of 2-system numbers;
using the obtained number as an index code and inputting the index code into a corresponding database;
the database provides information corresponding to the index code according to the numerical value of the index code, and decoding is achieved.
Fig. 10 is a structural diagram of a two-dimensional code generation apparatus according to an embodiment of the present invention. As shown in fig. 10, the apparatus 1000 includes:
an encoding unit determination unit 101 configured to determine a corresponding plurality of encoding units based on information to be encoded;
a two-dimensional code generation unit 102 configured to generate a two-dimensional code in which the plurality of coding units are spaced apart from each other by a spacer.
Fig. 11 is a structural diagram of a two-dimensional code analysis device according to an embodiment of the present invention. As shown in fig. 11, the apparatus 1100 includes:
the two-dimensional code acquiring unit 111 is configured to acquire a two-dimensional code to be analyzed, wherein the two-dimensional code comprises a plurality of coding units, and the coding units are separated from each other by a spacer;
a correspondence information acquisition unit 112 configured to acquire information corresponding to the two-dimensional code based on the plurality of encoding units.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (11)

1. A two-dimensional code generation method comprises the following steps:
determining a plurality of corresponding coding units based on the information to be coded;
generating a two-dimensional code in which the plurality of coding units are spaced apart from each other by a spacer.
2. The method of claim 1, wherein determining the corresponding plurality of coding units based on the information to be encoded comprises determining the plurality of coding units to which the information to be encoded corresponds based on a preset N number of different coding units, where N > ═ 2.
3. The method according to claim 1 or 2, wherein the generating of the two-dimensional code comprises determining four positioning coding units, and arranging the plurality of coding units and the four positioning coding units in the two-dimensional code into a two-dimensional array, wherein a dimension value of a first dimension of the two-dimensional array is not equal to a dimension value of a second dimension, and the four positioning coding units are located at four corners of the two-dimensional array, wherein upper-left, lower-left, upper-right and lower-right corner coding units respectively represent a first value, a second value, a first value and a second value.
4. The method of claim 3, wherein determining the corresponding plurality of coding units based on the information to be encoded comprises:
generating an index code of an N-system number corresponding to information to be coded according to a pre-established database;
and determining the plurality of coding units according to the index codes.
5. The method of claim 3, wherein determining the corresponding plurality of coding units based on the information to be encoded comprises:
generating a first index code of an L-system number corresponding to information to be coded according to an L-system public code table;
converting the first index code into a second index code of an N-system number;
and determining the plurality of coding units according to the second index code.
6. A two-dimensional code analysis method comprises the following steps:
acquiring a two-dimensional code to be analyzed, wherein the two-dimensional code comprises a plurality of coding units which are separated from each other through a spacer;
and acquiring information corresponding to the two-dimensional code based on the plurality of coding units.
7. The method of claim 6, wherein the obtaining information corresponding to the two-dimensional code based on the plurality of coding units comprises:
determining an index code of an N-ary number according to a plurality of coding units;
and acquiring information corresponding to the two-dimensional code according to the index code and a pre-established database.
8. The method of claim 6, wherein the obtaining information corresponding to the two-dimensional code based on the plurality of coding units comprises:
determining a third index code of the N-ary number according to the plurality of coding units;
converting the third index code into a fourth index code of an L-system number;
and determining information corresponding to the two-dimensional code according to the fourth index code and the public code table of the L system.
9. The method according to claim 6, wherein the obtaining the two-dimensional code to be analyzed, which includes a plurality of coding units, comprises obtaining a plurality of two-dimensional codes to be analyzed in one lens;
the acquiring information corresponding to the two-dimensional code based on the plurality of coding units comprises acquiring information corresponding to the plurality of two-dimensional codes respectively based on the plurality of coding units respectively included in the plurality of two-dimensional codes.
10. A two-dimensional code generation device comprising:
an encoding unit determination unit configured to determine a corresponding plurality of encoding units based on information to be encoded;
a two-dimensional code generation unit configured to generate a two-dimensional code in which the plurality of coding units are spaced apart from each other by a spacer.
11. A two-dimensional code analysis device comprises:
the two-dimensional code acquisition unit is configured to acquire a two-dimensional code to be analyzed, wherein the two-dimensional code comprises a plurality of coding units which are separated from each other through a spacer;
a correspondence information acquisition unit configured to acquire information corresponding to the two-dimensional code based on the plurality of encoding units.
CN202110119924.3A 2021-01-28 2021-01-28 Two-dimensional code generation and analysis method and device Pending CN112819122A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110119924.3A CN112819122A (en) 2021-01-28 2021-01-28 Two-dimensional code generation and analysis method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110119924.3A CN112819122A (en) 2021-01-28 2021-01-28 Two-dimensional code generation and analysis method and device

Publications (1)

Publication Number Publication Date
CN112819122A true CN112819122A (en) 2021-05-18

Family

ID=75860116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110119924.3A Pending CN112819122A (en) 2021-01-28 2021-01-28 Two-dimensional code generation and analysis method and device

Country Status (1)

Country Link
CN (1) CN112819122A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147873A (en) * 2011-03-21 2011-08-10 上海彩码信息科技有限公司 Method and system for generating color code as well as method and system for analyzing color code
CN105976004A (en) * 2016-04-25 2016-09-28 华南农业大学 Color two-dimensional code multi-dimensional information encoding and decoding methods and devices
US20160283763A1 (en) * 2012-11-13 2016-09-29 Kyodo Printing Co., Ltd. Two-dimensional code
CN109543803A (en) * 2018-11-23 2019-03-29 上海好想法网络科技有限公司 The coded system and decoding system of editable primary-secondary type color two dimensional code
CN112001469A (en) * 2020-08-12 2020-11-27 北京太和互邦科技有限公司 Two-dimensional code encoding method, decoding method and two-dimensional code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147873A (en) * 2011-03-21 2011-08-10 上海彩码信息科技有限公司 Method and system for generating color code as well as method and system for analyzing color code
US20160283763A1 (en) * 2012-11-13 2016-09-29 Kyodo Printing Co., Ltd. Two-dimensional code
CN105976004A (en) * 2016-04-25 2016-09-28 华南农业大学 Color two-dimensional code multi-dimensional information encoding and decoding methods and devices
CN109543803A (en) * 2018-11-23 2019-03-29 上海好想法网络科技有限公司 The coded system and decoding system of editable primary-secondary type color two dimensional code
CN112001469A (en) * 2020-08-12 2020-11-27 北京太和互邦科技有限公司 Two-dimensional code encoding method, decoding method and two-dimensional code

Similar Documents

Publication Publication Date Title
Grillo et al. High capacity colored two dimensional codes
US4072928A (en) Industrial system for inspecting and identifying workpieces
US9014479B2 (en) Method and system for text-image orientation
US5726435A (en) Optically readable two-dimensional code and method and apparatus using the same
JP2622235B2 (en) Method and apparatus for forming a machine-readable optically readable binary code
EP1469420B1 (en) Method, system and program for reconstructing a bar code
US10068156B2 (en) Methods and systems for decision-tree-based automated symbol recognition
EP1456812A1 (en) Generating graphical codes by halftoning with embedded graphical encoding
CN109902530B (en) Two-dimensional code decoding method and terminal
CN102243704A (en) Positioning system for two-dimension bar code and two-dimension bar code identification method and equipment
US7770805B2 (en) Method for coding two dimensional optical identification with the same gray level and printing product thereof
JP2967014B2 (en) Image processing device
US6839450B2 (en) Detecting halftone modulations embedded in an image
EP0643363B1 (en) Pattern matching method using matrixes of binary pixels and pixel vectors
US20160110635A1 (en) Halftone data-bearing encoding system and halftone data-bearing decoding system
EP0352011B1 (en) Method for establishing pixel colour probabilities for use in OCR logic
CN112819122A (en) Two-dimensional code generation and analysis method and device
CN202267974U (en) Positioning system used for two-dimension code and two-dimension code identification device
CN110610219B (en) Color annular two-dimensional code and generation and decoding method thereof
US6337926B2 (en) Image recognition method, image recognition apparatus, and recording medium
CN107153804B (en) Method for generating and identifying stacked two-dimensional code with positioning area
CN115861034A (en) Wireless routing data intelligent management system
CN111428534B (en) Decryption identification method based on dot matrix hidden writing information coding
US11847516B2 (en) Method and device for reading a two-dimensional encoded pattern applied on a non-uniform background
Liu et al. A novel encoding method for visual two-dimensional barcode using pattern substitution

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination