CN111178476A - Two-dimensional code generation and recognition method and device, computer equipment and storage medium - Google Patents

Two-dimensional code generation and recognition method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111178476A
CN111178476A CN201911158886.1A CN201911158886A CN111178476A CN 111178476 A CN111178476 A CN 111178476A CN 201911158886 A CN201911158886 A CN 201911158886A CN 111178476 A CN111178476 A CN 111178476A
Authority
CN
China
Prior art keywords
partition
dimensional code
characters
character string
segment
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
CN201911158886.1A
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.)
Wanyi Technology Co Ltd
Original Assignee
Wanyi Technology Co Ltd
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 Wanyi Technology Co Ltd filed Critical Wanyi Technology Co Ltd
Priority to CN201911158886.1A priority Critical patent/CN111178476A/en
Publication of CN111178476A publication Critical patent/CN111178476A/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/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

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)
  • Character Discrimination (AREA)

Abstract

The application relates to a two-dimensional code generation and identification method, a system, a computer device and a storage medium. The method comprises the following steps: acquiring existing two-dimensional code characters and newly added characters; dividing the existing two-dimensional code characters into compatible partitions, and dividing the newly added characters into custom partitions; splitting the custom partition into a plurality of segments according to the use of the newly added character; coding a plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain a user-defined segment description; and splicing the existing two-dimension code characters of the compatible subareas with the self-defined section description to generate compatible two-dimension code characters. By adopting the method, the compatibility of the two-dimension code can be effectively improved.

Description

Two-dimensional code generation and recognition method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a two-dimensional code generation and identification method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, two-dimensional code technology is widely applied at present, especially in the scene of internet of things, networking and control of a plurality of devices need to use two-dimensional codes as data storage devices for controlling network access, according to different application scenes, adopted two-dimensional code reading heads are different, the two-dimensional code reading heads can be perfectly embedded with channel gates, intelligent access controls, self-service terminals and the like, and mobile phone screens, paper document bar code information and the like can be read.
However, the current two-dimensional code reading heads are provided by different manufacturers, so that the coding and decoding algorithms of the two-dimensional codes are different, and the problem of incompatibility of the two-dimensional codes among different manufacturers exists.
Disclosure of Invention
In view of the above, it is necessary to provide a two-dimensional code generation and recognition method, apparatus, computer device, and storage medium capable of improving compatibility.
A two-dimensional code generation method, the method comprising:
acquiring existing two-dimensional code characters and newly added characters;
dividing the existing two-dimensional code characters into compatible partitions, and dividing the newly added characters into custom partitions;
splitting the custom partition into a plurality of segments according to the use of the newly added character;
coding a plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain a user-defined segment description;
and splicing the existing two-dimension code characters of the compatible subareas with the self-defined section description to generate compatible two-dimension code characters.
In an embodiment, the encoding the plurality of segments corresponding to the custom partition by using a preset protocol to obtain a custom segment description includes:
marking the segment corresponding to the user-defined partition as a user-defined segment;
enumerating the character string type corresponding to the self-defined segment according to the preset character length;
encrypting the user-defined segment to obtain the character string content of the user-defined segment;
calculating and coding the character string content of the user-defined section to obtain the character length corresponding to the character string content;
and combining to obtain the self-defined segment description according to the character string type, the character string content and the character length corresponding to the character string content.
In an embodiment, the encoding the plurality of segments corresponding to the custom partition by using a preset protocol to obtain the custom segment description further includes:
matching the character length corresponding to the self-defined section character string content with a preset self-defined section parameter, and carrying out validity verification.
In an embodiment, the encoding the plurality of segments corresponding to the custom partition by using a preset protocol to obtain the custom segment description further includes:
and matching the character string type corresponding to the user-defined section with a preset user-defined section parameter, and carrying out validity verification.
A two-dimensional code generation apparatus, the apparatus comprising:
the acquisition module is used for acquiring the existing two-dimensional code characters and the newly added characters;
the partitioning module is used for dividing the existing two-dimensional code characters into compatible partitions and dividing the newly added characters into custom partitions;
the splitting module is used for splitting the user-defined partition into a plurality of segments according to the purpose of the newly added character;
the coding module is used for coding a plurality of sections corresponding to the user-defined partition by using a preset protocol to obtain a user-defined section description;
and the splicing module is used for splicing the existing two-dimensional code characters of the compatible subareas with the self-defined section description to generate compatible two-dimensional code characters.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
acquiring existing two-dimensional code characters and newly added characters;
dividing the existing two-dimensional code characters into compatible partitions, and dividing the newly added characters into custom partitions;
splitting the custom partition into a plurality of segments according to the use of the newly added character;
coding a plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain a user-defined segment description;
and splicing the existing two-dimension code characters of the compatible subareas with the self-defined section description to generate compatible two-dimension code characters.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring existing two-dimensional code characters and newly added characters;
dividing the existing two-dimensional code characters into compatible partitions, and dividing the newly added characters into custom partitions;
splitting the custom partition into a plurality of segments according to the use of the newly added character;
coding a plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain a user-defined segment description;
and splicing the existing two-dimension code characters of the compatible subareas with the self-defined section description to generate compatible two-dimension code characters.
A two-dimensional code identification method, the method comprising:
reading two-dimensional code characters and self-defined segment description;
identifying partition separators in the two-dimensional code characters, and obtaining a plurality of corresponding partitions according to the partition separators;
reading a segmentation separator in each partition, and resolving each partition into a plurality of segments;
identifying a character string type corresponding to the segment, and matching the character string type with a self-defined segment description;
if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition;
if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition;
and generating scanning information by using the analyzed newly added characters and the existing two-dimensional code characters.
In an embodiment, the analyzing the new characters corresponding to the custom partition includes:
reading the self-defined segment description according to the preset character length to obtain a corresponding character string type;
reading the character length corresponding to the character string content to obtain the corresponding character string content and converting the character string content;
and decoding the character string content according to the character string type to obtain scanning information corresponding to the user-defined segment description.
A two-dimensional code recognition apparatus, the apparatus comprising:
the reading module is used for reading the two-dimensional code characters and the self-defined segment description;
the identification module is used for identifying the partition separators in the two-dimensional code characters and obtaining a plurality of corresponding partitions according to the partition separators;
the analysis module is used for reading the segmentation separators in each partition and analyzing each partition into a plurality of segments;
the matching module is used for identifying the character string type corresponding to the segment and matching the character string type with the self-defined segment description; if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition; if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition;
and the generating module is used for generating scanning information by utilizing the analyzed newly added characters and the existing two-dimensional code characters.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
reading two-dimensional code characters and self-defined segment description;
identifying partition separators in the two-dimensional code characters, and obtaining a plurality of corresponding partitions according to the partition separators;
reading a segmentation separator in each partition, and resolving each partition into a plurality of segments;
identifying a character string type corresponding to the segment, and matching the character string type with a self-defined segment description;
if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition;
if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition;
and generating scanning information by using the analyzed newly added characters and the existing two-dimensional code characters.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
reading two-dimensional code characters and self-defined segment description;
identifying partition separators in the two-dimensional code characters, and obtaining a plurality of corresponding partitions according to the partition separators;
reading a segmentation separator in each partition, and resolving each partition into a plurality of segments;
identifying a character string type corresponding to the segment, and matching the character string type with a self-defined segment description;
if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition;
if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition;
and generating scanning information by using the analyzed newly added characters and the existing two-dimensional code characters.
According to the two-dimensional code generation method, the two-dimensional code generation device, the computer equipment and the storage medium, the existing two-dimensional code characters and the new characters are obtained, the existing two-dimensional code characters are classified into the compatible partition, and the new characters are classified into the self-defined partition. And splitting the user-defined partition into a plurality of segments according to the application of the newly added character, and encoding the plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain the description of the user-defined segment. And splicing the existing two-dimensional code characters of the compatible partitions with the self-defined segment description to generate compatible two-dimensional code characters. By adopting a partition segmentation mode, the two-dimension code characters are divided into compatible areas and self-defined areas, the newly-added characters of the two-dimension code of the self-defined partition are coded and spliced with the compatible partitions, and compared with a traditional two-dimension code generation mode, the two-dimension code characters with different contents can be compatible by different partitions, so that the compatibility of the two-dimension code characters is improved.
According to the two-dimensional code identification method, the two-dimensional code identification device, the computer equipment and the storage medium, the partition separators in the two-dimensional code characters are identified by reading the two-dimensional code characters and the self-defined segment description, and the corresponding multiple partitions are obtained according to the partition separators. Reading a segmentation separator in each partition, analyzing each partition into a plurality of segments, identifying a character string type corresponding to each segment, and matching the character string type with the self-defined segment description. And if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition. And if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition. And generating scanning information by using the analyzed new characters and the existing two-dimensional code characters. By matching the character string type with the custom section description, the partition corresponding to the section can be determined to be the custom partition, the newly added characters corresponding to the custom partition are analyzed, and compared with the traditional two-dimensional code identification mode, the scanning information is generated by the newly added characters after the analysis and the existing two-dimensional code characters, so that the information of two-dimensional codes of different types can be identified, and the compatibility of the two-dimensional codes is improved.
Drawings
FIG. 1 is a diagram illustrating an exemplary implementation of a two-dimensional code generation and recognition method;
fig. 2 is a schematic flowchart of a two-dimensional code generation method in an embodiment;
FIG. 3 is a flowchart illustrating a step of encoding a plurality of segments corresponding to a custom partition using a predetermined protocol to obtain a description of the custom segment in one embodiment;
fig. 4 is a schematic flowchart of a two-dimensional code recognition method in another embodiment;
FIG. 5 is a flowchart illustrating the steps of parsing the newly added characters corresponding to the custom partition in one embodiment;
fig. 6 is a block diagram showing a structure of a two-dimensional code generating apparatus according to an embodiment;
FIG. 7 is a block diagram showing the structure of a two-dimensional code recognition apparatus according to an embodiment;
FIG. 8 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The method provided by the application can be applied to the application environment shown in FIG. 1. Wherein the first terminal 102 communicates with the second terminal 104 via a network. The first terminal 102 acquires the existing two-dimensional code characters and the newly added characters, divides the existing two-dimensional code characters into compatible partitions, and divides the newly added characters into custom partitions. The first terminal 102 splits the custom partition into a plurality of segments according to the purpose of the new character, and encodes the plurality of segments corresponding to the custom partition by using a preset protocol to obtain a custom segment description. The first terminal 102 splices the existing two-dimensional code characters of the compatible subareas with the self-defined segment description, generates compatible two-dimensional code characters and sends the compatible two-dimensional code characters to the second terminal 104, and the two-dimensional code reading head generates corresponding scanning information by identifying the compatible two-dimensional code characters received by the second terminal 104. The first terminal 102 and the second terminal 104 may be, but are not limited to, various personal computers, notebook computers, smart phones, and tablet computers.
In an embodiment, as shown in fig. 2, a two-dimensional code generating method is provided, which is described by taking the application of the method to the first terminal in fig. 1 as an example, and includes the following steps:
step 202, acquiring the existing two-dimensional code characters and the new added characters.
The first terminal can acquire different types of two-dimensional code contents according to different application scenes of the two-dimensional code. The first terminal divides the two-dimensional code content to be coded into a plurality of groups according to different actual purposes. For example, a two-dimensional code for opening an intelligent access control, a gate identification two-dimensional code for subway trips, and two-dimensional code for offline mobile phone payment. The first terminal obtains corresponding character information according to different contents of the two-dimensional code, wherein the character information comprises existing two-dimensional code characters and newly added characters. One two-dimensional code can describe various types of information, the existing two-dimensional code characters are obtained according to historical information or existing two-dimensional code functions, and the newly added characters can be newly added character information obtained according to newly added content information or purposes of the two-dimensional code.
And 204, dividing the existing two-dimension code characters into compatible partitions, and dividing the newly added characters into custom partitions.
Step 206, the custom partition is split into a plurality of segments according to the usage of the newly added characters.
The first terminal can be divided into different partitions according to different types of the two-dimensional codes according to different contents of the obtained two-dimensional codes, specifically, existing two-dimensional code characters are divided into compatible partitions, newly-added characters are divided into custom partitions, the partitions can comprise two-dimensional code content sets of the same type, the compatible partitions can comprise compatible partitions of a plurality of different types, and the custom partitions can be two-dimensional code content custom-added new characters and custom descriptions produced by workers according to needs. Furthermore, the first terminal can split the custom partition into a plurality of different segments according to different purposes of the newly added characters in the custom partition, the content of each segment can be compatible with information such as text characters and links, and the encryption mode supports dynamic expansion.
And 208, coding a plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain a user-defined segment description.
And step 210, splicing the existing two-dimension code characters of the compatible subareas with the self-defined section description to generate compatible two-dimension code characters.
The first terminal encodes a plurality of segments corresponding to the self-defined partition according to the different divided regions by using a preset protocol, for example, the first terminal may encode the self-defined segment in the self-defined partition by using a TLV protocol to obtain a self-defined segment description. And the first terminal splices the self-defined section description with the existing two-dimensional code characters in the compatible subarea, generates compatible two-dimensional code characters and sends the compatible two-dimensional code characters to the second terminal.
In this embodiment, the existing two-dimensional code characters and the newly added characters are obtained, the existing two-dimensional code characters are classified into the compatible partition, and the newly added characters are classified into the custom partition. And splitting the user-defined partition into a plurality of segments according to the application of the newly added character, and encoding the plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain the description of the user-defined segment. And splicing the existing two-dimensional code characters of the compatible partitions with the self-defined segment description to generate compatible two-dimensional code characters. By adopting a partition segmentation mode, the two-dimension code characters are divided into compatible areas and self-defined areas, the newly-added characters of the two-dimension code of the self-defined partition are coded and spliced with the compatible partitions, and compared with a traditional two-dimension code generation mode, the two-dimension code characters with different contents can be compatible by different partitions, so that the compatibility of the two-dimension code characters is improved.
In an embodiment, as shown in fig. 3, the step of encoding a plurality of segments corresponding to the custom partition by using a preset protocol to obtain a description of the custom segment includes:
step 302, marking the segment corresponding to the user-defined partition as a user-defined segment.
And step 304, enumerating the character string type corresponding to the custom segment according to the preset character length.
And step 306, encrypting the custom segment to obtain the character string content of the custom segment.
And 308, calculating and coding the character string content of the custom section to obtain the character length corresponding to the character string content.
And 310, combining the character string type, the character string content and the character length corresponding to the character string content to obtain the self-defined segment description.
The first terminal encodes a plurality of segments corresponding to the user-defined partition by using a preset protocol according to the different divided regions, so that the description of the user-defined segment can be obtained. Specifically, the first terminal marks the segment corresponding to the custom partition as a custom segment, and enumerates the character string type corresponding to the custom segment according to the preset defined character length. The preset character length may be 2 characters. Further, the first terminal may encrypt the custom segment by using different encryption technologies to obtain the string content of the custom segment. The first terminal calculates the obtained character string content, calculates the character length corresponding to the character string content, and then performs code conversion on the character string content according to different coding modes to obtain the character length corresponding to the converted character string content. And the first terminal combines to obtain the self-defined segment description according to the character string type, the character string content and the character length corresponding to the character string content by utilizing the TLV protocol.
The new characters to be encoded are taken as an offline character string for example. The first terminal marks the segments corresponding to the custom partition as custom segments, enumerates the type of the character string according to the preset defined character length, and the preset character length can be 2 characters. The pre-preparing of the character string type of the custom segment by the first terminal may include: offline character strings, offline algorithmic descriptions, online character strings, and the like. The first terminal enumerates the character string types corresponding to the custom segments, for example: 01 corresponds to an offline character string, sf corresponds to an offline algorithm description, 02 corresponds to an online character string, and the like. Further, the first terminal encrypts the content to be encrypted by using a 3des encryption technology, and the content of the offline character string is obtained as 10997. The first terminal calculates the character string content 10997 of the custom section to obtain the character length 04 corresponding to the corresponding character string content. And then 16-system coding is carried out on the character string content 10997 to obtain the converted character string content of 2AF 5. The first terminal utilizes TLV protocol according to the character string type of 01, the character string content of 2AF5 and the character length corresponding to the character string content of 04 to combine to obtain the self-defined segment description of 01042 AF 5. Therefore, the two-dimensional code can be compatible with the contents of a plurality of different partitions without mutual influence, the problem of inconsistent codes of various two-dimensional code reading heads is solved by partitioning the compatible regions and the user-defined regions, and the compatibility of the two-dimensional code is effectively improved.
In one embodiment, the step of encoding a plurality of segments corresponding to the custom partition by using a preset protocol to obtain a description of the custom segment further includes:
matching the character length corresponding to the self-defined section character string content with the preset self-defined section parameters, and carrying out validity verification.
And in the process of coding, the first terminal can carry out validity verification by matching the character length corresponding to the self-defined section character string content with the preset self-defined section parameter. For example, the length of the character corresponding to the custom segment character string content in the custom segment parameter is preset to be 08, but when validity verification is performed, the length of the character corresponding to the custom segment character string content is identified to be 088, that is, an incorrect TLV code is generated. Therefore, in the encoding process, through validity check, whether wrong TLV encoding occurs in the user-defined partition can be effectively checked, and the two-dimensional code character string which cannot be identified is prevented from occurring.
In one embodiment, the step of encoding a plurality of segments corresponding to the custom partition by using a preset protocol to obtain a description of the custom segment further includes:
and matching the character string type corresponding to the custom section with the preset custom section parameters, and carrying out validity verification.
In the process of coding, the first terminal can also perform validity verification by matching the character string type corresponding to the custom segment with the preset custom segment parameters. For example, the type of the string corresponding to the custom segment in the preset custom segment parameter is 01 offline string, but when validity verification is performed, it is recognized that the type of the string corresponding to the custom segment is 02 online string, and the TLV code is also wrong. Therefore, in the encoding process, through validity check, whether wrong TLV encoding occurs in the user-defined partition can be effectively checked, and the two-dimensional code character string which cannot be identified is prevented from occurring.
In an embodiment, as shown in fig. 4, a two-dimensional code identification method is provided, which is described by taking an example that the method is applied to the second terminal in fig. 1, and includes the following steps:
step 402, reading the two-dimensional code characters and the self-defined segment description.
The two-dimensional code reading head can be installed and embedded on various terminal devices to be used as a two-dimensional code identification component. For example, the two-dimensional code reading head is packaged and assembled with an outer shell to form a common scanning gun in a supermarket of a shopping mall, the two-dimensional code reading head is installed on a self-service vending machine, and self-service payment can be realized by placing a payment treasure or a WeChat payment code into a two-dimensional code payment window (namely a payment code sensing area) of the machine. The two-dimensional code reading head can read the two-dimensional code characters and the pre-made self-defined segment description by identifying the compatible two-dimensional code characters received by the second terminal in the embodiment, wherein the self-defined segment description is a character string generated after the pre-set protocol is used for coding. The reading code format can be various, for example, (iso-8859-01).
And step 404, identifying partition separators in the two-dimensional code characters, and obtaining a plurality of corresponding partitions according to the partition separators.
At step 406, segment separators are read from each partition, and each partition is parsed into a plurality of segments.
And 408, identifying the character string type corresponding to the segment, and matching the character string type with the self-defined segment description.
And step 410, if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition.
Step 412, if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition.
And step 414, generating scanning information by using the analyzed new characters and the existing two-dimensional code characters.
The two-dimensional code reading head reads the two-dimensional code content character by identifying the compatible two-dimensional code character received by the second terminal in the embodiment, the two-dimensional code reading head reads the two-dimensional code content according to the partition analysis by default, when the partition division character is encountered, the partition reading is finished, the next partition reading is carried out, and therefore a plurality of corresponding partitions are obtained according to the read partition division character. Wherein the plurality of partitions may include compatible areas and custom areas. Further, when the two-dimensional code reading head reads in each partition, when encountering a partition separator, the two-dimensional code reading head performs the partition reading, thereby resolving each partition into a plurality of partitions. And when the segment is read, identifying the character string type corresponding to the segment, and matching the character string type with the self-defined segment description. And judging whether the character string type is matched with a previously preset character string type, for example, whether the two-bit length character at the beginning of the segment is matched with 01, and when the matching is successful, indicating that the segment is a self-defined segment and carrying out self-defined analysis. Specifically, the two-dimensional code reading head reads the segment and performs decryption operation, for example, using 3des to perform parsing to obtain the original content of the custom segment. After the segment is read, the next segment is read downwards to determine whether the segment is a custom segment. And if the new characters do not exist, starting to read the next partition, if the next partition does not exist, finishing the two-dimensional code analysis, and generating scanning information by using the newly added analyzed characters and the existing two-dimensional code characters. When the matching fails, the segment is a common segment, and common segment analysis is carried out. Specifically, the two-dimensional code reading head reads the segment to obtain the existing two-dimensional code characters. After the reading of the segment is finished, reading down whether a segment separator exists, and if so, continuing to read the next segment; and if the new characters do not exist, starting to read the next partition, if the next partition does not exist, finishing the two-dimensional code analysis, and generating scanning information by using the newly added analyzed characters and the existing two-dimensional code characters.
In this embodiment, the two-dimensional code characters and the custom segment description are read to identify the partition separators in the two-dimensional code characters, and a plurality of corresponding partitions are obtained according to the partition separators. Reading a segmentation separator in each partition, analyzing each partition into a plurality of segments, identifying a character string type corresponding to each segment, and matching the character string type with the self-defined segment description. And if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition. And if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition. And generating scanning information by using the analyzed new characters and the existing two-dimensional code characters. By matching the character string type with the custom section description, the partition corresponding to the section can be determined to be the custom partition, the newly added characters corresponding to the custom partition are analyzed, and compared with the traditional two-dimensional code identification mode, the scanning information is generated by the newly added characters after the analysis and the existing two-dimensional code characters, so that the information of two-dimensional codes of different types can be identified, and the compatibility of the two-dimensional codes is improved.
In an embodiment, as shown in fig. 5, the step of parsing the new characters corresponding to the custom partition includes:
step 502, reading the self-defined segment description according to the preset character length to obtain the corresponding character string type.
Step 504, reading the character length corresponding to the character string content, obtaining the corresponding character string content and performing conversion.
And step 506, decoding the character string content according to the character string type to obtain the scanning information corresponding to the custom segment description.
When the two-dimensional code reading head reads the segmentation separators in each partition, each partition is analyzed into a plurality of segments, the character string type corresponding to each segment is identified, and the character string type is matched with the self-defined segment description. And when the matching is successful, performing custom analysis. Specifically, the two-dimensional code reading head reads the self-defined segment description according to a preset character length to obtain a corresponding character string type, for example, the preset character length may be 2 characters. Further, the two-dimensional code reading head reads the character length corresponding to the character string content, the character length is converted to obtain the corresponding character string content, the two-dimensional code reading head can decode the character string content by using different decryption methods, for example, when the character string type is read as sf offline algorithm description, the character string content is decrypted according to the offline algorithm description, and the scanning information corresponding to the custom segment description is obtained.
Illustrated with the custom segment description 01042 AF 5. The two-dimensional code reading head starts to read the characters with the length of 2 according to the preset character length to obtain the character string type corresponding to the character string 01 as an offline character string. And reading 2 characters with the length of 04 to obtain the character length 04 corresponding to the character string content, reading 4 characters with the length of 4, wherein the 2AF5 corresponding to the 4 characters is the character string content of the two-dimensional code, and converting the character string content 2AF5 coded in the 16 system into the 10 system to obtain the character string content 10997. The two-dimensional code reading head can decode the character string content 10997 by using a 3des technology to obtain the scanning information corresponding to the custom segment description. Therefore, the decoding program of the two-dimensional code reading head program from the designated identifier to the designated identifier can be compatible, even if the same two-dimensional code is used, different two-dimensional code information can be identified according to different requirements, the reading head device does not need to be changed too much, and the good compatibility of the two-dimensional code is realized.
It should be understood that although the various steps in the flow charts of fig. 1-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, there is provided a two-dimensional code generating apparatus including: an obtaining module 602, a partitioning module 604, a splitting module 606, an encoding module 608, and a splicing module 610, wherein:
the obtaining module 602 is configured to obtain an existing two-dimensional code character and a new added character.
And the partitioning module 604 is configured to partition the existing two-dimensional code characters into compatible partitions, and partition newly-added characters into custom partitions.
A splitting module 606, configured to split the custom partition into multiple segments according to the usage of the new character.
The encoding module 608 is configured to encode a plurality of segments corresponding to the custom partition by using a preset protocol to obtain a custom segment description.
And the splicing module 610 is used for splicing the existing two-dimensional code characters of the compatible subareas with the self-defined segment description to generate compatible two-dimensional code characters.
In one embodiment, the apparatus further comprises: a marking module, an encryption module and a combination module.
The marking module is used for marking the sections corresponding to the user-defined partition as user-defined sections and enumerating the character string types corresponding to the user-defined sections according to the preset character length. The encryption module is used for encrypting the user-defined segment to obtain the character string content of the user-defined segment. The encoding module 608 is further configured to calculate and encode the content of the character string of the custom segment, so as to obtain a character length corresponding to the content of the character string. And the combination module is used for combining according to the character string type, the character string content and the character length corresponding to the character string content to obtain the self-defined segment description.
In one embodiment, the apparatus further comprises: and a matching module.
The matching module is used for matching the character length corresponding to the self-defined section character string content with the preset self-defined section parameters and carrying out validity verification.
In one embodiment, the matching module is further configured to match the character string type corresponding to the custom segment with a preset custom segment parameter, and perform validity verification.
In one embodiment, as shown in fig. 7, there is provided a two-dimensional code recognition apparatus including: a reading module 702, a recognition module 704, a parsing module 706, a matching module 708, and a generating module 710, wherein:
and the reading module 702 is used for reading the two-dimensional code characters and the self-defined segment description.
The identifying module 704 is configured to identify partition separators in the two-dimensional code characters, and obtain a plurality of corresponding partitions according to the partition separators.
A parsing module 706, configured to read the segment separators in each partition, and parse each partition into a plurality of segments.
A matching module 708, configured to identify a string type corresponding to the segment, and match the string type with the custom segment description; if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition; and if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition.
And the generating module 710 is configured to generate scanning information by using the analyzed new characters and the analyzed existing two-dimensional code characters.
In one embodiment, the apparatus further comprises: a conversion module and a decoding module.
The reading module 702 is further configured to read the self-defined segment description according to a preset character length to obtain a corresponding character string type. The conversion module is used for reading the character length corresponding to the character string content to obtain the corresponding character string content and performing conversion. And the decoding module is used for decoding the character string content according to the character string type to obtain the scanning information corresponding to the user-defined segment description.
For specific limitations of the two-dimensional code generation and recognition apparatus, reference may be made to the above limitations of the two-dimensional code generation and recognition method, which are not described herein again. The modules in the two-dimensional code generating and identifying device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 8. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a two-dimensional code generation and recognition method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the architecture shown in fig. 8 is a block diagram of only a portion of the architecture associated with the embodiments of the present application, and does not constitute a limitation on the computing devices to which the embodiments of the present application may be applied, and that a particular computing device may include more or less components than those shown, or combine some components, or in one embodiment provide a computing device that includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the steps of the various method embodiments described above when executing the computer program.
In one embodiment, a computer device is provided, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the steps of the above-described method embodiments being implemented when the computer program is executed by the processor.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A two-dimensional code generation method, the method comprising:
acquiring existing two-dimensional code characters and newly added characters;
dividing the existing two-dimensional code characters into compatible partitions, and dividing the newly added characters into custom partitions;
splitting the custom partition into a plurality of segments according to the use of the newly added character;
coding a plurality of segments corresponding to the user-defined partition by using a preset protocol to obtain a user-defined segment description;
and splicing the existing two-dimension code characters of the compatible subareas with the self-defined section description to generate compatible two-dimension code characters.
2. The method of claim 1, wherein the encoding the plurality of segments corresponding to the custom partition using a predetermined protocol to obtain a custom segment description comprises:
marking the segment corresponding to the user-defined partition as a user-defined segment;
enumerating the character string type corresponding to the self-defined segment according to the preset character length;
encrypting the user-defined segment to obtain the character string content of the user-defined segment;
calculating and coding the character string content of the user-defined section to obtain the character length corresponding to the character string content;
and combining to obtain the self-defined segment description according to the character string type, the character string content and the character length corresponding to the character string content.
3. The method of claim 2, wherein the encoding the plurality of segments corresponding to the custom partition using a predetermined protocol to obtain a custom segment description further comprises:
matching the character length corresponding to the self-defined section character string content with a preset self-defined section parameter, and carrying out validity verification.
4. The method of claim 2, wherein the encoding the plurality of segments corresponding to the custom partition using a predetermined protocol to obtain a custom segment description further comprises:
and matching the character string type corresponding to the user-defined section with a preset user-defined section parameter, and carrying out validity verification.
5. A two-dimensional code identification method, the method comprising:
reading two-dimensional code characters and self-defined segment description;
identifying partition separators in the two-dimensional code characters, and obtaining a plurality of corresponding partitions according to the partition separators;
reading a segmentation separator in each partition, and resolving each partition into a plurality of segments;
identifying a character string type corresponding to the segment, and matching the character string type with a self-defined segment description;
if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition;
if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition;
and generating scanning information by using the analyzed newly added characters and the existing two-dimensional code characters.
6. The method of claim 5, wherein the parsing the new characters corresponding to the custom partition comprises:
reading the self-defined segment description according to the preset character length to obtain a corresponding character string type;
reading the character length corresponding to the character string content to obtain the corresponding character string content and converting the character string content;
and decoding the character string content according to the character string type to obtain scanning information corresponding to the user-defined segment description.
7. A two-dimensional code generation apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring the existing two-dimensional code characters and the newly added characters;
the partitioning module is used for dividing the existing two-dimensional code characters into compatible partitions and dividing the newly added characters into custom partitions;
the splitting module is used for splitting the user-defined partition into a plurality of segments according to the purpose of the newly added character;
the coding module is used for coding a plurality of sections corresponding to the user-defined partition by using a preset protocol to obtain a user-defined section description;
and the splicing module is used for splicing the existing two-dimensional code characters of the compatible subareas with the self-defined section description to generate compatible two-dimensional code characters.
8. A two-dimensional code recognition device, characterized in that the device includes:
the reading module is used for reading the two-dimensional code characters and the self-defined segment description;
the identification module is used for identifying the partition separators in the two-dimensional code characters and obtaining a plurality of corresponding partitions according to the partition separators;
the analysis module is used for reading the segmentation separators in each partition and analyzing each partition into a plurality of segments;
the matching module is used for identifying the character string type corresponding to the segment and matching the character string type with the self-defined segment description; if the matching is successful, determining the partition corresponding to the segment as a user-defined partition, and analyzing the newly added characters corresponding to the user-defined partition; if the matching fails, determining the partition corresponding to the segment as a compatible partition, and reading the existing two-dimensional code character corresponding to the compatible partition;
and the generating module is used for generating scanning information by utilizing the analyzed newly added characters and the existing two-dimensional code characters.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 6 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN201911158886.1A 2019-11-22 2019-11-22 Two-dimensional code generation and recognition method and device, computer equipment and storage medium Pending CN111178476A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911158886.1A CN111178476A (en) 2019-11-22 2019-11-22 Two-dimensional code generation and recognition method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911158886.1A CN111178476A (en) 2019-11-22 2019-11-22 Two-dimensional code generation and recognition method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111178476A true CN111178476A (en) 2020-05-19

Family

ID=70653756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911158886.1A Pending CN111178476A (en) 2019-11-22 2019-11-22 Two-dimensional code generation and recognition method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111178476A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111950233A (en) * 2020-07-29 2020-11-17 北京德为智慧科技有限公司 Code scanning identification method and device, electronic equipment and readable storage medium
CN112801652A (en) * 2020-12-31 2021-05-14 网银在线(北京)科技有限公司 Information processing method and device for scanning coded graphics
CN113659993A (en) * 2021-08-17 2021-11-16 深圳市康立生物医疗有限公司 Immune batch data processing method and device, terminal and readable storage medium
CN114037038A (en) * 2021-11-09 2022-02-11 广州瀚鼎信息科技有限公司 Method and system for setting code by user

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104616047A (en) * 2015-02-28 2015-05-13 立德高科(北京)数码科技有限责任公司 Two-dimension code and generation method and identification method thereof
CN105577376A (en) * 2014-10-13 2016-05-11 航天信息股份有限公司 Two-dimensional code coding-and-decoding and authentication method and two-dimensional code coding-and-decoding and authentication device
CN105976005A (en) * 2016-04-26 2016-09-28 鸿博股份有限公司 Two-dimensional code encrypting method, two-dimensional code generating device and two-dimensional code scanning device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105577376A (en) * 2014-10-13 2016-05-11 航天信息股份有限公司 Two-dimensional code coding-and-decoding and authentication method and two-dimensional code coding-and-decoding and authentication device
CN104616047A (en) * 2015-02-28 2015-05-13 立德高科(北京)数码科技有限责任公司 Two-dimension code and generation method and identification method thereof
CN105976005A (en) * 2016-04-26 2016-09-28 鸿博股份有限公司 Two-dimensional code encrypting method, two-dimensional code generating device and two-dimensional code scanning device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111950233A (en) * 2020-07-29 2020-11-17 北京德为智慧科技有限公司 Code scanning identification method and device, electronic equipment and readable storage medium
CN112801652A (en) * 2020-12-31 2021-05-14 网银在线(北京)科技有限公司 Information processing method and device for scanning coded graphics
CN112801652B (en) * 2020-12-31 2024-05-17 网银在线(北京)科技有限公司 Information processing method and apparatus for scanning encoded patterns
CN113659993A (en) * 2021-08-17 2021-11-16 深圳市康立生物医疗有限公司 Immune batch data processing method and device, terminal and readable storage medium
CN114037038A (en) * 2021-11-09 2022-02-11 广州瀚鼎信息科技有限公司 Method and system for setting code by user
CN114037038B (en) * 2021-11-09 2024-01-30 广州瀚鼎信息科技有限公司 Method and system for customizing setting code

Similar Documents

Publication Publication Date Title
CN108512830B (en) Information encryption processing method and device, computer equipment and storage medium
CN111178476A (en) Two-dimensional code generation and recognition method and device, computer equipment and storage medium
EP3418950A1 (en) Data exchange method, data exchange device and computing device
CN109766072B (en) Information verification input method and device, computer equipment and storage medium
CN108897728B (en) Short message splicing processing method and device, computer equipment and storage medium
CN110727949B (en) Data storage method and device, computer equipment and storage medium
CN109376824B (en) Dynamic two-dimensional code generation method and system
CN110210270B (en) Two-dimensional code information security reinforcement method and system and two-dimensional code image analysis method and system
CN110768784A (en) Password transmission method, device, computer equipment and storage medium
CN111177749A (en) Encrypted source code file processing method and device, computer equipment and storage medium
CN111586671B (en) Embedded user identification card configuration method and device, communication equipment and storage medium
CN111192393B (en) Network door opening method and device and computer equipment
CN109286933B (en) Authentication method, device, system, computer equipment and storage medium
CN108200087B (en) Web intrusion detection method and device, computer equipment and storage medium
CN110647641A (en) Identity authentication method, identity authentication device, computer equipment and storage medium
CN108055585A (en) Data processing method, set top box upgrading method, terminal and set-top box
CN112528201A (en) Method and device for calling third-party platform, computer equipment and storage medium
CN109887046A (en) Image processing method, image authentication method, device, equipment and medium
CN108667919B (en) Data processing method, data processing device, computer equipment and storage medium
CN113709181A (en) Website login method, device, equipment and storage medium based on browser plug-in
CN110930193A (en) Advertisement conversion rate evaluation method and device, computer equipment and storage medium
CN114448722B (en) Cross-browser login method and device, computer equipment and storage medium
CN112632504B (en) Webpage access method, device, system, computer equipment and storage medium
CN113254986B (en) Data processing method, device and computer readable storage medium
CN115765976A (en) Verification code encryption method, electronic equipment and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200519

RJ01 Rejection of invention patent application after publication