CN115310572B - Graphic code generation method and graphic code verification method - Google Patents

Graphic code generation method and graphic code verification method Download PDF

Info

Publication number
CN115310572B
CN115310572B CN202210939987.8A CN202210939987A CN115310572B CN 115310572 B CN115310572 B CN 115310572B CN 202210939987 A CN202210939987 A CN 202210939987A CN 115310572 B CN115310572 B CN 115310572B
Authority
CN
China
Prior art keywords
code
graphic
information
embedded
graph
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.)
Active
Application number
CN202210939987.8A
Other languages
Chinese (zh)
Other versions
CN115310572A (en
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.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai 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 Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202210939987.8A priority Critical patent/CN115310572B/en
Publication of CN115310572A publication Critical patent/CN115310572A/en
Application granted granted Critical
Publication of CN115310572B publication Critical patent/CN115310572B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06K19/06056Constructional details the marking comprising a further embedded marking, e.g. a 1D bar code with the black bars containing a smaller sized coding
    • 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/06018Record 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 one-dimensional coding
    • G06K19/06028Record 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 one-dimensional coding using bar codes
    • 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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Medical Informatics (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The embodiment of the specification analyzes the acquired original graphic code to obtain an information code, determines a graphic to be embedded in each graphic unit contained in the original graphic code according to the information code and the acquired information to be embedded, and embeds the graphic to generate a target graphic code carrying the information to be embedded. And identifying the graphics embedded in each graphics unit contained in the graphics code to be checked when the service verification is performed, determining the verification information carried by the graphics code to be checked according to the identified graphics, and verifying the graphics code to be checked based on the verification information. In the method, the graphics carrying the information to be embedded are directly embedded into each graphic unit in the original graphic code, so that the authenticity of the graphic code and the authenticity of the commodity can be accurately distinguished through the identified graphics in each graphic unit of the embedded graphic code.

Description

Graphic code generation method and graphic code verification method
Technical Field
The present disclosure relates to the field of image processing, and in particular, to a method for generating a graphic code and a method for verifying the graphic code.
Background
At present, people pay more attention to authenticity of commodities and private data of the commodities. Aiming at the authenticity of the commodity, people can verify the authenticity of the commodity by scanning the graphic code on the commodity package to verify the authenticity of the graphic code.
However, the graphic code generated by the existing method often cannot well show the anti-counterfeiting information for distinguishing the authenticity of the graphic code, so that the authenticity of the graphic code may not be effectively verified by the existing graphic code.
Disclosure of Invention
The embodiment of the specification provides a method for generating a graphic code and a method for verifying the graphic code, so as to partially solve the problems existing in the prior art.
The embodiment of the specification adopts the following technical scheme:
the method for generating the graphic code provided by the specification comprises the following steps:
Acquiring an original graphic code and information to be embedded, wherein the original graphic code is composed of graphic units;
analyzing the original graphic code to obtain an information code corresponding to the original graphic code;
determining a graph to be embedded in each graph unit contained in the original graph code according to the information code and the information to be embedded;
And embedding the graph into each graph unit contained in the original graph code to generate a target graph code carrying the information to be embedded.
Optionally, determining, according to the information code and the information to be embedded, a graph to be embedded in each graph unit included in the original graph code, including:
determining a check code corresponding to each graphic unit contained in the original graphic code according to the information code and the information to be embedded;
And determining the graph to be embedded in each graph unit according to the corresponding relation between each check code and each graph.
Optionally, determining, according to the information code and the information to be embedded, a check code corresponding to each graphic unit included in the original graphic code, specifically includes:
Inputting the information code and the information to be embedded into a pre-trained coding model so as to code the information code and the information to be embedded through the coding model, thereby obtaining a check code corresponding to each graphic unit contained in the original graphic code.
Optionally, inputting the information code and the information to be embedded into a pre-trained coding model, so as to code the information code and the information to be embedded through the coding model, so as to obtain a check code corresponding to each graphic unit contained in the original graphic code, which specifically includes:
Performing redundancy coding on the information to be embedded to obtain redundant information;
and inputting the information code and the redundant information into a pre-trained coding model so as to code the information code and the redundant information through the coding model, thereby obtaining a check code corresponding to each graphic unit contained in the original graphic code.
Optionally, training the coding model specifically includes:
acquiring a sample graphic code and sample embedded information, wherein the sample graphic code is composed of graphic units;
analyzing the sample graphic code to obtain a sample information code corresponding to the sample graphic code;
Inputting the sample information code and the sample embedded information into a coding model to be trained so as to code the sample information code and the sample embedded information through the coding model, thereby obtaining a check code to be optimized corresponding to each graphic unit contained in the sample graphic code;
Inputting the check code to be optimized corresponding to each graphic unit into a decoding model, so as to decode the check code to be optimized corresponding to each graphic unit through the decoding model, and obtain the check information to be optimized carried by the sample graphic code;
And training the coding model and the decoding model by taking the difference between the to-be-optimized verification information and the sample embedded information as an optimization target.
Optionally, determining, according to the information code and the information to be embedded, a graph to be embedded in each graph unit included in the original graph code, including:
determining a designated graphic unit contained in the original graphic code;
Determining a graph to be embedded in the designated graph unit according to the information code and the information to be embedded;
Embedding the graphics into each graphics unit contained in the original graphics code to generate a target graphics code carrying the information to be embedded, wherein the method specifically comprises the following steps of:
And embedding the graphics into each designated graphic unit contained in the original graphic code to generate a target graphic code carrying the information to be embedded.
The specification provides a graphic code verification method, which comprises the following steps:
obtaining a graphic code to be checked, wherein the graphic code to be checked consists of graphic units;
identifying the graphics embedded by each graphics unit contained in the graphics code to be checked;
Determining verification information carried by the graphic code to be verified according to the identified graphic;
And verifying the graphic code to be verified according to the verification information.
Optionally, determining the verification information carried by the graphic code to be verified according to the identified graphic specifically includes:
Determining the verification code corresponding to the identified graph according to the corresponding relation between each graph and each verification code;
And inputting the check code corresponding to the graph into a pre-trained decoding model so as to decode the check code through the decoding model, thereby obtaining the check information carried by the graph code to be checked.
Optionally, according to the verification information, verifying the graphic code to be verified specifically includes:
performing redundancy decoding on the check information to obtain decoded information;
and verifying the graphic code to be verified according to the decoded information.
Optionally, pre-training the decoding model specifically includes:
acquiring a sample graphic code and sample embedded information, wherein the sample graphic code is composed of graphic units;
analyzing the sample graphic code to obtain a sample information code corresponding to the sample graphic code;
Inputting the sample information code and the sample embedded information into a coding model to code the sample information code and the sample embedded information through the coding model so as to obtain a check code to be optimized corresponding to each graphic unit contained in the sample graphic code;
inputting the check code to be optimized corresponding to each graphic unit into a decoding model to be trained, so as to decode the check code to be optimized corresponding to each graphic unit through the decoding model, and obtain the check information to be optimized carried by the sample graphic code;
And training the coding model and the decoding model by taking the difference between the to-be-optimized verification information and the sample embedded information as an optimization target.
The device for generating the graphic code provided by the specification comprises the following components:
The acquisition module is used for acquiring an original graphic code and information to be embedded, wherein the original graphic code is composed of graphic units;
the analysis module is used for analyzing the original graphic code to obtain an information code corresponding to the original graphic code;
the determining module is used for determining a graph to be embedded in each graph unit contained in the original graph code according to the information code and the information to be embedded;
And the generating module is used for embedding the graph into each graph unit contained in the original graph code so as to generate the target graph code carrying the information to be embedded.
The graphic code verification device provided in the specification comprises:
The acquisition module is used for acquiring the graphic code to be checked, wherein the graphic code to be checked consists of graphic units;
The identification module is used for identifying the graphics embedded in each graphic unit contained in the graphic code to be checked;
The determining module is used for determining verification information carried by the graphic code to be verified according to the identified graphic;
and the verification module is used for verifying the graphic code to be verified according to the verification information.
A computer-readable storage medium is provided in the present specification, the storage medium storing a computer program that, when executed by a processor, implements the above-described method of generating a graphic code and method of verifying a graphic code.
The electronic device provided by the specification comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the generation method and the verification method of the graphic code when executing the program.
The above-mentioned at least one technical scheme that this description embodiment adopted can reach following beneficial effect:
in the embodiment of the specification, the obtained original graphic code is analyzed to obtain the information code, and the graphics to be embedded in each graphic unit contained in the original graphic code are determined according to the information code and the obtained information to be embedded and are embedded to generate the target graphic code carrying the information to be embedded. And when the graphic code verification is carried out, identifying the graphics embedded in each graphic unit contained in the graphic code to be verified, determining verification information carried by the graphic code to be verified according to the identified graphics, and verifying the graphic code to be verified based on the verification information. In the method, the graphics carrying the information to be embedded are directly embedded into each graphic unit in the original graphic code, so that the authenticity of the graphic code and the authenticity of the commodity can be accurately distinguished through the identified graphics in each graphic unit of the embedded graphic code.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification, illustrate and explain the exemplary embodiments of the present specification and their description, are not intended to limit the specification unduly. In the drawings:
FIG. 1 is a schematic diagram of a graphic code generated by using an image steganography technique in the prior art;
FIG. 2 is a flowchart illustrating a method for generating a graphic code according to an embodiment of the present disclosure;
Fig. 3 is a schematic diagram of a graphic unit with two-dimensional code according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of embedding an elliptical target graphic code in a black block graphic unit according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a target graphic code with triangles embedded in a black tile graphic unit according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a diamond-shaped object graphic code embedded in a black block graphic unit according to the embodiment of the present disclosure;
FIG. 7 is a schematic diagram of an embodiment of embedding an elliptical target graphic code in a black tile graphic unit of a non-positioning pattern;
FIG. 8 is a schematic diagram of embedding an elliptical target graphic code in a white block graphic unit according to an embodiment of the present disclosure;
fig. 9 is a schematic diagram of embedding an oval two-dimensional code in a partial black block pattern unit according to the embodiment of the present disclosure;
FIG. 10 is a schematic diagram of embedding an oval bar code in a partially black block pattern cell provided by the present illustrative embodiment;
FIG. 11 is a flowchart illustrating a method for checking a graphic code according to an embodiment of the present disclosure;
FIG. 12 is a schematic diagram of a first graphic code according to an embodiment of the present disclosure;
FIG. 13 is a schematic diagram of a second graphic code according to an embodiment of the present disclosure;
FIG. 14 is a schematic diagram of a third graphic code according to an embodiment of the present disclosure;
FIG. 15 is a schematic structural diagram of a graphic code generating device according to an embodiment of the present disclosure;
FIG. 16 is a schematic diagram of a graphic code verification device according to an embodiment of the present disclosure;
fig. 17 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In the prior art, a watermark can be added into a graphic code by a digital watermarking method so as to ensure the authenticity of the graphic code. However, after the graphic code added with the watermark is printed by a printer, the watermark of the graphic code becomes ink dots with different sizes, so that the printed graphic code is distorted, and the authenticity of the graphic code cannot be distinguished.
In the prior art, other information can be added into the least significant bit in the graphic code by using an image steganography method, which may cause the right-angle contour of the positioning pattern in the original graphic code to be changed into an arc contour. As shown in fig. 1, fig. 1 is a partial view of a graphic code, and the circular arc profile of the positioning pattern is enlarged. However, when the graphic code with the arc outline is printed, the graphic code is reduced, and whether the outline of the positioning pattern is the arc outline cannot be displayed, so that the printed graphic code is distorted, and the authenticity of the graphic code cannot be distinguished.
In the embodiment of the specification, the graphics are directly embedded in the black area and/or the white area in the graphics code, so that the graphics embedded in the graphics code can be identified, and whether the embedded information carried by the graphics is correct or not is verified, so as to distinguish the authenticity of the graphics code and the authenticity of the commodity. Thus, the accuracy of distinguishing the authenticity of the graphic code and the accuracy of verifying the authenticity of the commodity can be improved.
For the purposes of making the objects, technical solutions and advantages of the present specification more apparent, the technical solutions of the present specification will be clearly and completely described below with reference to specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
In the embodiment of the present specification, the operation on the graphic code is divided into two parts, the first part: embedding the information to be embedded into the original graphic code to generate a target graphic code; a second part: and verifying the acquired graphic code, and judging the authenticity of the graphic code and the authenticity of the commodity.
Next, these two portions will be described separately.
For the first part:
Fig. 2 is a flow chart of a method for generating a graphic code according to an embodiment of the present disclosure, including:
S200: and obtaining an original graphic code and information to be embedded, wherein the original graphic code is composed of graphic units.
S202: and analyzing the original graphic code to obtain an information code corresponding to the original graphic code.
In the embodiment of the present specification, the original graphic code refers to a graphic code in which information needs to be embedded, where the graphic code may include: bar codes, two-dimensional codes, and the like. In addition, the graphic code is composed of graphic units, the graphic units are the smallest units composing the graphic code, and the graphic units are not detachable. Wherein one black block or white block in the graphic code is one graphic unit. As shown in fig. 3. In fig. 3, taking a two-dimensional code as an example, one black rectangular block or white rectangular block in the two-dimensional code is one graphic unit.
In the embodiment of the present description, the original graphic code and the information to be embedded may be obtained, and the information to be embedded may be stored in a database. Wherein the original graphic code may be a unique graphic code generated based on information related to the commodity. The information related to the commodity may be commodity information, or may be a website carrying commodity information, where the commodity information at least includes: information such as commodity name, production address, logistics, etc. The information to be embedded may refer to information to be embedded with the original graphic code, and the information to be embedded may include: numerical, textual, graphical, etc. information. In addition, the information to be embedded may be information specifying a data format, such as: binary, decimal, hexadecimal, etc. data formats.
In this embodiment of the present disclosure, the original graphic code may be parsed to obtain the information code corresponding to the original graphic code. Wherein, a graphic unit contained in the original graphic code corresponds to an information code, and the information code may include: binary codes, gray codes, etc. Such as: the black block in the original graphic code is 1 and the white block is 0.
Next, a process of embedding the original graphic code with the information to be embedded will be described taking a binary code as an example.
S204: and determining the graphics to be embedded in each graphic unit contained in the original graphic code according to the information code and the information to be embedded.
In the embodiment of the present specification, the graphics to be embedded in each graphics unit included in the original graphics code may be determined according to the information code and the information to be embedded. Wherein the graphic may include: lines, rectangles, ovals, circles, triangles, polygons, diamonds, and the like.
In addition, the pattern may be constituted by a contour line of a specified width. However, it is required that the pattern is constituted by a contour line of a prescribed width, because if the pattern is constituted by using an excessively thick contour line, there is no significant difference between the original and a replica obtained by copying a pattern code in which such a pattern is embedded, that is, such patterns can still be effectively recognized from the replica to a large extent, so that it is difficult to exert an effective forgery preventing effect. If the pattern is formed by the contour lines with the specified width, after the pattern code embedded with the pattern is copied, the pattern embedded in the obtained replica can be broken, unclear and the like, so that the pattern embedded in the replica can not be identified.
Next, a method of determining the graphics to be embedded in each graphic unit will be described.
Specifically, the graphic set corresponding to the information to be embedded can be determined according to the pre-established corresponding relationship between the embedded information and the graphic set. And then, determining each graphic unit in the original graphic code according to each information code in the original graphic code, and determining the graphics to be embedded in each graphic unit contained in the original graphic code according to the arrangement sequence of each graphic in the graphic set corresponding to the information to be embedded and the position of each graphic unit in the original graphic code.
In addition, in addition to the method for determining the graphics embedded with the original graphic code, the check code corresponding to each graphic unit contained in the original graphic code can be determined according to the information code and the information to be embedded. And then, determining the graphics to be embedded in each graphic unit contained in the original graphic code according to the check code corresponding to each graphic unit of the original graphic code and the pre-established corresponding relation between each check code and each graphic. It should be noted that, not every graphic unit included in the original graphic code has a graphic to be embedded.
Wherein, the check codes are different and the patterns are also different. One check code may refer to a binary code of a specified number of bits corresponding to a pattern that needs to be embedded in the original pattern code. Such as: the number of bits is four, and the number of bits and a check code may be 1011, and 1011 corresponds to an ellipse with an aspect ratio of 0.8 and an angle of 45 degrees.
Next, a method for determining the check code corresponding to each graphic unit included in the original graphic code according to the information code and the information to be embedded will be described.
Specifically, the information code of the original graphic code can be used as a reference, and the information to be embedded is aligned with the information code, so as to obtain the check code corresponding to each information code of the original graphic code. I.e. the check code corresponding to each graphic unit of the original graphic code is obtained. The check code corresponding to one information code may be a binary code of a specified bit number corresponding to a pattern to be embedded in the original pattern code in the information to be embedded.
Because the bar code only has data stored longitudinally, when the graphic code is the bar code, the information code of the original graphic code can be used as a reference, the information to be embedded is aligned with the information code, and each check code corresponding to each information code of the original graphic code is obtained, namely each check code corresponding to each graphic unit of the original graphic code is obtained. And then, determining each graph to be embedded in each target graph unit contained in the original graph code according to each check code corresponding to each target graph unit of the original graph code and the corresponding relation between each check code and each graph which is established in advance. That is, for each target graphic unit in the original graphic code, the graphics to be embedded in that target graphic unit are in turn.
When each check code corresponding to each graphic unit of the original graphic code is obtained, the graphic unit meeting the preset condition can be determined from the original graphic code and used as the target graphic unit. And then, taking the information code corresponding to each target graphic unit as a reference, and aligning the information to be embedded with the information code corresponding to each target graphic unit to obtain each check code corresponding to each target graphic unit. The preset condition may be that the width of the graphic unit is greater than the preset width.
Since the problem of whether the bit number of the binary code of the information to be embedded can be aligned with the information code of the original graphic code is considered, different methods for determining the check code are provided for different situations.
When the bit number of the binary code of the information to be embedded is equal to the preset bit number, each information code of the original graphic code corresponds to the binary code with the appointed bit number in the information to be embedded, and the binary code with the appointed bit number is used as a check code. The preset number of bits may refer to a specified multiple of the number of bits of all information codes of the original graphic code, where the value of the specified multiple is the same as the specified number of bits of the binary code corresponding to one graphic to be embedded in the original graphic code. In this case, the information to be embedded may refer to binary codes corresponding to all graphics to be embedded in the original graphic code. That is, each graphic unit contained in the original graphic code has a graphic to be embedded therein.
When the number of bits of the binary code of the information to be embedded is smaller than the preset number of bits, redundant encoding can be performed on the information to be embedded, so that the information to be embedded with the preset number of bits is obtained. In this case, the information to be embedded does not contain binary codes corresponding to all the graphics to be embedded in the original graphics code.
Specifically, the information to be embedded may be divided to obtain each coding block. And performing redundancy coding on each coding block to obtain a redundancy block corresponding to the coding block. And finally, forming information to be embedded with preset digits according to the redundant blocks corresponding to each coding block. Wherein a redundancy code may be added at the end of each coding block, which can be determined by a polynomial in RS coding (Reed-solomon codes).
When determining the graphics to be embedded in each graphic unit contained in the original graphic code, aligning the information to be embedded with the preset bit number with the information code to obtain the check code corresponding to each graphic unit of the original graphic code. Since the redundancy code is added to the information to be embedded with the preset bit number, not all check codes can be corresponding to one graph. That is, not every graphic element contained in the original graphic code has a graphic that needs to be embedded.
In addition, when the number of bits of the binary code of the information to be embedded is smaller than the preset number of bits, the information code corresponding to each graphic unit can be used as a reference, and the information code corresponding to each graphic unit and the information code to be embedded can be aligned to obtain a part of check code. And determining redundancy check codes required by the graphic units in the original graphic codes except the partial check codes, and randomly adding each redundancy check code between any two check codes in the partial check codes to determine the check code corresponding to each graphic unit. One redundancy check code may be a binary code that specifies the number of bits and specifies the character string, such as: 0000. the redundancy check code has no corresponding relation with the graph.
Such as: if the number of bits of the information to be embedded is 80, the preset number of bits is 100, and the designated number of bits is 4, 20 check codes can be determined, and 5 redundancy check codes are needed. Then, 5 redundancy check codes may be randomly inserted between any two check codes, thereby determining check codes corresponding to 25 graphic units, respectively.
In addition, in addition to determining the check code corresponding to each graphic unit, the check code corresponding to each graphic unit may also be determined through a machine learning model.
Specifically, the information code and the information to be embedded can be input into a pre-trained coding model, so that the information code and the information to be embedded are coded through the coding model, and a check code corresponding to each graphic unit contained in the original graphic code is obtained. Wherein the coding model may comprise: neural networks, regression trees, RBFs, etc.
It should be noted that, the information to be embedded may refer to any information that needs to be embedded in the original graphic code, for example: literal, numerical, graphic, etc. Because each graph is represented by a binary code with a specified bit number, the information to be embedded needs to be mapped into different graphs, so that the information to be embedded is carried by different graphs. Therefore, the coding model is used for mapping the information to be embedded into binary codes corresponding to the graphics embedded into the original graphic codes. In addition, the input of the coding model may be a binary code (taking a binary code as an example) with a fixed bit number, and the fixed bit number may be a preset bit number or not, and the fixed bit number may include: 128. 256, etc.
When the graphic code is a bar code, the graphic unit meeting the preset condition can be determined from the original graphic code and used as the target graphic unit. The preset condition may be that the width of the graphic unit is greater than the preset width. And inputting the information codes corresponding to the target graphic units and the information to be embedded into a pre-trained coding model, so as to code the information codes corresponding to the target graphic units and the information to be embedded through the coding model, and obtaining all check codes corresponding to the target graphic units contained in the original graphic codes. And then, determining each graph to be embedded in the target graph unit contained in the original graph code according to each check code corresponding to the target graph unit of the original graph code and the corresponding relation between each check code and each graph, which is established in advance. That is, for each target graphic unit in the original graphic code, the graphics to be embedded in the target graphic unit are determined in turn. In addition, the number of graphics to be embedded in a graphics unit may be fixed or non-fixed.
When the bit number of the binary code to be embedded with the information is equal to the fixed bit number, the information code and the information to be embedded can be directly input into a pre-trained coding model, so that the information to be embedded and the information code are coded through the coding model, and the check code corresponding to each graphic unit contained in the original graphic code is obtained. In this case, each graphic unit included in the original graphic code has a graphic to be embedded therein.
When the number of bits of the binary code of the information to be embedded is smaller than the fixed number of bits, the information to be embedded can be subjected to redundancy coding to obtain the information to be embedded with the fixed number of bits, and the information to be embedded is used as the information after redundancy.
Specifically, the information to be embedded may be divided to obtain each coding block. And performing redundancy coding on each coding block to obtain a redundancy block corresponding to the coding block. Finally, according to the redundant blocks corresponding to each coding block, redundant information with fixed digits is formed. Wherein a redundancy code may be added at the end of each coding block, which can be determined by a polynomial in RS coding (Reed-solomon codes).
After the redundant information is obtained, the information code and the redundant information can be input into a pre-trained coding model, so that the information code and the redundant information are coded through the coding model, and the check code corresponding to each graphic unit contained in the original graphic code is obtained. In this case, since a redundancy code is added to the information to be embedded, not all the check codes can correspond to one pattern. That is, not every graphic element contained in the original graphic code has a graphic that needs to be embedded.
In addition, when the number of bits of the binary code to be embedded with information is smaller than the fixed number of bits, the information code and the information to be embedded can be input into a pre-trained coding model, so that the information to be embedded and the information code are coded through the coding model, the check code corresponding to part of the graphic units contained in the original graphic code is determined, and the check code of the part is output. Then, redundancy check codes required for the graphic units in the original graphic code except the partial check codes are determined, and each redundancy check code is randomly added between any two check codes in the partial check codes to determine the check code corresponding to each graphic unit. One redundancy check code may be a binary code that specifies the number of bits and specifies the character string, such as: 0000. the redundancy check code has no corresponding relation with the graph.
In addition, when the information code and the information to be embedded (or the information after redundancy) are input into a pre-trained coding model, the information code and the information to be embedded (or the information after redundancy) can be spliced to obtain the information after splicing. And then, inputting the spliced information into a pre-trained coding model to code the spliced information through the coding model so as to obtain the check code corresponding to each graphic unit contained in the original graphic code.
In addition, the information to be embedded can be encrypted according to an encryption algorithm to obtain ciphertext with preset digits. Then, dividing ciphertext with preset digits to obtain each ciphertext group. And each ciphertext group is used as a check code corresponding to each graphic unit.
Next, a method for determining a pattern to be embedded in each graphic unit included in the original graphic code based on the check code corresponding to each graphic unit of the original graphic code and the pre-established correspondence between each check code and each pattern will be described.
In determining the graphics to be embedded in each graphic unit in the original graphic code, only the graphics to be embedded in the specified graphic unit may be determined. Wherein specifying the graphic element may include: at least one of a graphic unit of a black block, a graphic unit of a white block, and a graphic unit of a non-positioning pattern.
Specifically, each designated graphic unit contained in the original graphic code is determined according to each information code of the original graphic code. And then, determining the graph to be embedded in each designated graph unit contained in the original graph code according to the determined check code corresponding to the designated graph unit and the corresponding relation between each check code and each graph, which are established in advance.
The method for determining the check code corresponding to the designated graphic unit can comprise the following steps: the information codes and the information to be embedded (or the information after redundancy) are input into a pre-trained coding model, so that the information codes and the information to be embedded (or the information after redundancy) are coded through the coding model, and the check codes corresponding to the appointed graphic units contained in the original graphic codes are obtained.
In addition, the method for determining the check code corresponding to the designated graphic unit further comprises the following steps: after determining each specified graphic unit contained in the original graphic code, the information code corresponding to the specified graphic unit can be used as a reference, and the information to be embedded is aligned with the information code corresponding to each specified graphic unit, so as to obtain the check code corresponding to each specified graphic unit.
S206: and embedding the graph into each graph unit contained in the original graph code to generate a target graph code carrying the information to be embedded.
In the embodiment of the present specification, the determined graphics are embedded into each graphics unit included in the original graphics code, so as to generate the graphics code carrying the information to be embedded, as the target graphics code. The target graphic code may then be printed and attached to the merchandise package.
When only the graphics to be embedded in each specified graphic unit is determined, the graphics to be embedded in each specified graphic unit contained in the original graphic code can be embedded in each specified graphic unit to generate a target graphic code carrying information to be embedded.
When the graphic code is a bar code, each graphic embedded in each graphic unit (or target graphic unit) is determined for each graphic unit, and each graphic corresponding to the graphic unit (or target graphic unit) is obtained. Then, each graph corresponding to the graph unit (or the target graph unit) is embedded into the graph unit (or the target graph unit) in sequence according to a preset embedding sequence. The preset embedding sequence may include: any one of top-down and bottom-up.
The target graphic code generated in the various ways of embedding graphics is provided in the embodiments of the present description. Wherein the graphic code may include a two-dimensional code and a bar code. It should be noted that, different kinds of graphics may be embedded in the same target graphics code, for example: square and diamond are embedded in the same target graphic code. The following target graphic code is only an example of one type of graphic.
Aiming at two-dimensional codes:
Pattern embedding mode one: only the black block graphics unit is embedded with graphics.
Fig. 4 is a schematic diagram of embedding an elliptical target graphic code in a black block graphic unit according to the embodiment of the present disclosure, and in fig. 4, ellipses with different aspect ratios and angles are embedded in the black block graphic unit, where the ellipses with different aspect ratios and angles represent different embedded information.
Fig. 5 is a diagram of a target graphic code of a triangle embedded in a black block graphic unit according to the embodiment of the present disclosure, and in fig. 5, triangles with different angles and sides are embedded in the black block graphic unit, where the triangles with different angles and sides represent different embedded information.
Fig. 6 is a diagram of a target graphic code with diamond embedded in a black block graphic unit according to the embodiment of the present disclosure, and in fig. 6, diamond with different pairs of sides are embedded in a black block graphic unit, where the diamond with different pairs of sides represents different embedded information.
Pattern embedding mode II: the pattern is embedded only in the black block pattern cells of the non-positioning pattern.
Fig. 7 is a schematic diagram of embedding an elliptical target graphic code in a black block graphic unit of a non-positioning pattern according to the embodiment of the present disclosure, and in fig. 7, ellipses with different aspect ratios and angles are embedded in the black block graphic unit of the non-positioning pattern, where the ellipses with different aspect ratios and angles represent different embedded information.
Pattern embedding mode three: graphics are embedded only in the white block graphics unit.
Fig. 8 is a diagram showing embedding of an elliptical target graphic code in a white block graphic unit according to the present embodiment, and in fig. 8, ellipses of different aspect ratios and angles are embedded in the white block graphic unit.
Pattern embedding mode four: the graphics are embedded in only a portion of the black block graphics cells.
Fig. 9 is a schematic diagram of embedding an oval two-dimensional code in a partial black block pattern unit according to the embodiment of the present disclosure, and in fig. 9, oval shapes with different aspect ratios and angles are embedded in a partial black block pattern unit.
For bar codes:
Pattern embedding mode five: the graphics are embedded in only a portion of the black block graphics cells of the bar code.
Fig. 10 is a bar code with oval embedded in a partially black block pattern unit, in which fig. 10 oval with different aspect ratios and angles are embedded, according to the embodiment of the present invention.
For the second part:
Fig. 11 is a flow chart of a graphic code verification method according to an embodiment of the present disclosure, including:
s1100: and obtaining a graphic code to be checked, wherein the graphic code to be checked consists of graphic units.
In the embodiment of the present specification, the graphic code to be verified refers to a graphic code embedded with a graphic, where the graphic code may include: bar codes, two-dimensional codes, and the like. In addition, the graphic code is composed of graphic units, wherein one black block or white block in the graphic code is one graphic unit.
In the embodiment of the present disclosure, the graphic code on the package of the commodity may be obtained by scanning, and used as the graphic code to be verified.
S1102: and identifying the graphics embedded by each graphics unit contained in the graphics code to be verified.
In this embodiment of the present disclosure, after the graphics code to be verified is obtained, the graphics code to be verified may be identified, and the graphics embedded in each graphics unit included in the graphics code to be verified may be identified. Specifically, each graphic unit in the graphic code to be checked is determined, and then, for each graphic unit, the graphics in the graphic unit are identified and extracted.
In addition, the graphic code to be checked can be input into a pre-trained image model so as to identify the graphics embedded by each graphic unit contained in the graphic code to be checked through the image model. Wherein the image model may comprise: a machine learning model such as a transducer model and a deep learning model.
In addition, besides the above pattern recognition by the machine learning model, the pattern embedded by the pattern code to be verified may be recognized based on a conventional image algorithm, taking a two-dimensional code as an example.
Specifically, graying operation is carried out on the graphic code to be checked, and the graphic code after graying is obtained. And then binarizing the graphic code after gray level to obtain a binarized graphic code. And then, reversing the numerical value in the binarized graphic code to obtain a first graphic code. As shown in fig. 12.
And performing morphological closing operation on the first graphic code, and removing the embedded graph of each graphic unit in the first graphic code to obtain a second graphic code. As shown in fig. 13.
And performing exclusive OR operation on the first graphic code and the second graphic code to obtain a third graphic code containing each graphic. As shown in fig. 14. Then, an edge extraction operator and a connected domain algorithm are adopted to determine the outline of each graph in the connected domain related to the third graph code. And performing curve fitting on the outline of each graph to obtain the shape of each graph and the central position of each graph. And determining the graphic unit in which each graphic is positioned according to the central position of each graphic, namely determining the graphic embedded in each graphic unit in the graphic code to be checked.
When the graphic code is a bar code, the graphic unit where each graphic is located can be determined according to the central position of each graphic, that is, each graphic embedded in each graphic unit in the graphic code to be checked is determined.
S1104: and determining verification information carried by the graphic code to be verified according to the identified graphic.
In the embodiment of the present disclosure, after identifying the graphics embedded in each graphics unit in the graphics code to be checked, the embedded information carried by the graphics code to be checked may be determined as the check information according to the correspondence between the graphics set and the embedded information.
In addition, the verification code corresponding to each identified graph can be determined according to the corresponding relation between each graph and each verification code. And then, the check codes corresponding to each graph can be combined to obtain the check information carried by the graph codes to be checked.
In addition, after the check code corresponding to each identified graph is determined according to the corresponding relation between each graph and each check code, the check code corresponding to each graph can be input into a pre-trained decoding model, so that the check code corresponding to each graph is decoded through the decoding model, and the check information carried by the graph code to be checked is obtained. The verification information may refer to any embedded information embedded in the graphic code to be verified. The decoding model may include: neural networks, regression trees, RBFs, etc.
The decoding model is the inverse of the function implemented by the encoding model, i.e., the binary code corresponding to the pattern is mapped back to the embedded information represented by the binary code embedded in the pattern code.
In addition, when the check code is a ciphertext group, each check code can be formed into a ciphertext sequence, and then the ciphertext sequence can be decrypted according to a decryption algorithm corresponding to a preset encryption algorithm to obtain check information carried by the graphic code to be checked.
S1106: and verifying the graphic code to be verified according to the verification information.
In the embodiment of the present disclosure, after the verification information carried by the graphic code to be verified is determined, the verification information may be matched with the embedded information stored in the database, so as to obtain a matching result of the verification information. And checking the graphic code to be checked according to the matching result of the checking information. The verification information and the embedded information stored in the database can be matched according to the similarity between the verification information and the embedded information stored in the database.
If the matching result of the verification information is successful, determining that the graphic code to be verified passes the verification, and indicating that the graphic code to be verified is true. And the graphic code to be checked is true, which indicates that the commodity information is true.
And if the matching result of the verification information is failure, determining that the verification of the graphic code to be verified is failed, and indicating that the graphic code to be verified is false. And the graphic code to be checked is false, which indicates that the commodity information is false.
In addition, when redundancy exists in the check information carried by the graphic code to be checked, the check information can be subjected to redundancy decoding to obtain decoded information. And then, matching is carried out according to the decoded information and the embedded information stored in the database, so as to obtain a matching result of the verification information. And checking the graphic code to be checked according to the matching result of the checking information.
The coding model and the decoding model related to the methods of fig. 2 and 11 may be trained in advance based on the coding model and the decoding model.
Specifically, a sample graphic code and sample embedded information are obtained, wherein the sample graphic code is composed of graphic units;
And analyzing the sample graphic code to obtain a sample information code corresponding to the sample graphic code. And then, inputting the sample information code and the sample embedded information into a coding model to be trained, so as to code the sample information code and the sample embedded information through the coding model, and obtaining a check code to be optimized corresponding to each graphic unit contained in the sample graphic code. And inputting the check code to be optimized corresponding to each graphic unit into a decoding model to be trained, so as to decode the check code to be optimized corresponding to each graphic unit through the decoding model, and obtaining the check information to be optimized carried by the sample graphic code. And finally, carrying out joint training on the coding model and the decoding model by taking the difference between the to-be-optimized verification information and the sample embedded information as an optimization target.
In addition, the above-described coding model and decoding model can be understood as a coding layer and a decoding layer in one large model, i.e., the coding model and decoding model are nested into another model as a coding layer and a decoding layer of another model.
As can be seen from the methods shown in fig. 2 and 11, the present disclosure analyzes the obtained original graphic code to obtain an information code, determines a graphic to be embedded in each graphic unit included in the original graphic code according to the information code and the obtained information to be embedded, and embeds the graphic to generate a target graphic code carrying the information to be embedded. And when the business verification is carried out, identifying the graph embedded by each graph unit contained in the graph code to be verified, determining verification information carried by the graph code to be verified according to the identified graph, and verifying the graph code to be verified based on the verification information. In the method, the graphics carrying the information to be embedded are directly embedded into each graphic unit in the original graphic code, so that the authenticity of the graphic code and the authenticity of the commodity can be accurately distinguished through the identified graphics in each graphic unit of the embedded graphic code.
The above method for generating the graphic code and the method for verifying the graphic code provided in the embodiments of the present specification further provide a corresponding device, a storage medium, and an electronic apparatus based on the same idea.
Fig. 15 is a schematic structural diagram of a generating device for graphic codes according to an embodiment of the present disclosure, where the device includes:
an obtaining module 1501, configured to obtain an original graphic code and information to be embedded, where the original graphic code is composed of graphic units;
the parsing module 1502 is configured to parse the original graphic code to obtain an information code corresponding to the original graphic code;
a determining module 1503, configured to determine, according to the information code and the information to be embedded, a graphic to be embedded in each graphic unit included in the original graphic code;
and a generating module 1504, configured to embed the graphic into each graphic unit included in the original graphic code, so as to generate a target graphic code carrying the information to be embedded.
Optionally, the determining module 1503 is specifically configured to determine, according to the information code and the information to be embedded, a check code corresponding to each graphic unit included in the original graphic code; and determining the graph to be embedded in each graph unit according to the corresponding relation between each check code and each graph.
Optionally, the determining module 1503 is specifically configured to input the information code and the information to be embedded into a pre-trained coding model, so as to code the information code and the information to be embedded through the coding model, so as to obtain a check code corresponding to each graphic unit included in the original graphic code.
Optionally, the determining module 1503 is specifically configured to perform redundancy encoding on the information to be embedded to obtain redundant information; and inputting the information code and the redundant information into a pre-trained coding model so as to code the information code and the redundant information through the coding model, thereby obtaining a check code corresponding to each graphic unit contained in the original graphic code.
Optionally, the determining module 1503 is specifically configured to determine a designated graphic unit included in the original graphic code; and determining a graph to be embedded in the designated graph unit according to the information code and the information to be embedded.
Optionally, the generating module 1504 is configured to embed the graphics into each designated graphic unit included in the original graphic code, so as to generate a target graphic code carrying the information to be embedded.
Optionally, the apparatus further comprises: training module 1505;
The training module 1505 is configured to obtain a sample graphic code and sample embedded information, where the sample graphic code is composed of graphic units; analyzing the sample graphic code to obtain a sample information code corresponding to the sample graphic code; inputting the sample information code and the sample embedded information into a coding model to be trained so as to code the sample information code and the sample embedded information through the coding model, thereby obtaining a check code to be optimized corresponding to each graphic unit contained in the sample graphic code; inputting the check code to be optimized corresponding to each graphic unit into a decoding model, so as to decode the check code to be optimized corresponding to each graphic unit through the decoding model, and obtain the check information to be optimized carried by the sample graphic code; and training the coding model and the decoding model by taking the difference between the to-be-optimized verification information and the sample embedded information as an optimization target.
The embodiment of fig. 16 provides a schematic structural diagram of a graphic code verification device, where the device includes:
an obtaining module 1601, configured to obtain a graphic code to be checked, where the graphic code to be checked is composed of graphic units;
An identifying module 1602, configured to identify a graphic embedded in each graphic unit included in the graphic code to be verified;
A determining module 1603, configured to determine, according to the identified graphic, verification information carried by the graphic code to be verified;
And the verification module 1604 is configured to verify the graphic code to be verified according to the verification information.
Optionally, the determining module 1603 is specifically configured to determine, according to a correspondence between each graphic and each check code, a check code corresponding to the identified graphic; and inputting the check code corresponding to the graph into a pre-trained decoding model so as to decode the check code through the decoding model, thereby obtaining the check information carried by the graph code to be checked.
Optionally, the verification module 1604 is specifically configured to perform redundancy decoding on the verification information to obtain decoded information; and verifying the graphic code to be verified according to the decoded information.
Optionally, the apparatus further comprises: a training module 1605;
The training module 1605 is configured to obtain a sample graphic code and sample embedded information, where the sample graphic code is composed of graphic units; analyzing the sample graphic code to obtain a sample information code corresponding to the sample graphic code; inputting the sample information code and the sample embedded information into a coding model to code the sample information code and the sample embedded information through the coding model so as to obtain a check code to be optimized corresponding to each graphic unit contained in the sample graphic code; inputting the check code to be optimized corresponding to each graphic unit into a decoding model to be trained, so as to decode the check code to be optimized corresponding to each graphic unit through the decoding model, and obtain the check information to be optimized carried by the sample graphic code; and training the coding model and the decoding model by taking the minimum difference between the to-be-optimized verification information and the sample embedded information as an optimization target.
The present specification also provides a computer readable storage medium storing a computer program which when executed by a processor is operable to perform the above-described method of generating a graphic code provided in fig. 2 and the method of verifying a graphic code provided in fig. 11.
Based on the method for generating the graphic code provided in fig. 2 and the method for verifying the graphic code provided in fig. 11, the embodiment of the present disclosure further provides a schematic structural diagram of the unmanned device shown in fig. 17. At the hardware level, as in fig. 17, the unmanned device includes a processor, an internal bus, a network interface, a memory, and a non-volatile storage, although it may include hardware required for other services. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to implement the method for generating the graphic code provided in fig. 2 and the method for verifying the graphic code provided in fig. 11.
Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present description, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable GATE ARRAY, FPGA)) is an integrated circuit whose logic functions are determined by user programming of the device. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented with "logic compiler (logic compiler)" software, which is similar to the software compiler used in program development and writing, and the original code before being compiled is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but HDL is not just one, but a plurality of kinds, such as ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language), and VHDL (very-high-SPEED INTEGRATED Circuit Hardware Description Language) and verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application SPECIFIC INTEGRATED Circuits (ASICs), programmable logic controllers, and embedded microcontrollers, examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.

Claims (13)

1. A method of generating a graphic code, the method comprising:
Acquiring an original graphic code and information to be embedded, wherein the original graphic code is composed of graphic units;
analyzing the original graphic code to obtain an information code corresponding to the original graphic code, wherein each graphic unit contained in the original graphic code is respectively corresponding to the information code;
Determining a graph to be embedded in each graph unit contained in the original graph code according to the information code and the information to be embedded, wherein a check code corresponding to each graph unit contained in the original graph code is determined according to the information code and the information to be embedded; determining the graph to be embedded in each graph unit according to the corresponding relation between each check code and each graph;
And embedding the graph into each graph unit contained in the original graph code to generate a target graph code carrying the information to be embedded.
2. The method of claim 1, wherein determining, according to the information code and the information to be embedded, a check code corresponding to each graphic unit included in the original graphic code, specifically includes:
Inputting the information code and the information to be embedded into a pre-trained coding model so as to code the information code and the information to be embedded through the coding model, thereby obtaining a check code corresponding to each graphic unit contained in the original graphic code.
3. The method of claim 2, wherein the information code and the information to be embedded are input into a pre-trained coding model, so that the information code and the information to be embedded are coded by the coding model to obtain a check code corresponding to each graphic unit contained in the original graphic code, and the method specifically comprises:
Performing redundancy coding on the information to be embedded to obtain redundant information;
and inputting the information code and the redundant information into a pre-trained coding model so as to code the information code and the redundant information through the coding model, thereby obtaining a check code corresponding to each graphic unit contained in the original graphic code.
4. The method of claim 2, training the coding model, comprising in particular:
acquiring a sample graphic code and sample embedded information, wherein the sample graphic code is composed of graphic units;
analyzing the sample graphic code to obtain a sample information code corresponding to the sample graphic code;
Inputting the sample information code and the sample embedded information into a coding model to be trained so as to code the sample information code and the sample embedded information through the coding model, thereby obtaining a check code to be optimized corresponding to each graphic unit contained in the sample graphic code;
Inputting the check code to be optimized corresponding to each graphic unit into a decoding model, so as to decode the check code to be optimized corresponding to each graphic unit through the decoding model, and obtain the check information to be optimized carried by the sample graphic code;
And training the coding model and the decoding model by taking the difference between the to-be-optimized verification information and the sample embedded information as an optimization target.
5. The method according to claim 1, according to the information code and the information to be embedded, determining the graphics to be embedded in each graphic unit contained in the original graphic code, specifically comprising:
determining a designated graphic unit contained in the original graphic code;
Determining a graph to be embedded in the designated graph unit according to the information code and the information to be embedded;
Embedding the graphics into each graphics unit contained in the original graphics code to generate a target graphics code carrying the information to be embedded, wherein the method specifically comprises the following steps of:
And embedding the graphics into each designated graphic unit contained in the original graphic code to generate a target graphic code carrying the information to be embedded.
6. A method of graphic code verification, the method comprising:
Obtaining a graphic code to be checked, wherein the graphic code to be checked consists of graphic units, and the graphic code to be checked comprises a graphic code generated by the method according to any one of claims 1 to 5;
identifying the graphics embedded by each graphics unit contained in the graphics code to be checked;
Determining verification information carried by the graphic code to be verified according to the identified graphic;
And verifying the graphic code to be verified according to the verification information.
7. The method of claim 6, wherein determining the verification information carried by the graphic code to be verified according to the identified graphic specifically comprises:
Determining the verification code corresponding to the identified graph according to the corresponding relation between each graph and each verification code;
And inputting the check code corresponding to the graph into a pre-trained decoding model so as to decode the check code through the decoding model, thereby obtaining the check information carried by the graph code to be checked.
8. The method of claim 7, wherein the verifying the graphic code to be verified according to the verification information specifically comprises:
performing redundancy decoding on the check information to obtain decoded information;
and verifying the graphic code to be verified according to the decoded information.
9. The method of claim 7, pre-training the decoding model, comprising in particular:
acquiring a sample graphic code and sample embedded information, wherein the sample graphic code is composed of graphic units;
analyzing the sample graphic code to obtain a sample information code corresponding to the sample graphic code;
Inputting the sample information code and the sample embedded information into a coding model to code the sample information code and the sample embedded information through the coding model so as to obtain a check code to be optimized corresponding to each graphic unit contained in the sample graphic code;
inputting the check code to be optimized corresponding to each graphic unit into a decoding model to be trained, so as to decode the check code to be optimized corresponding to each graphic unit through the decoding model, and obtain the check information to be optimized carried by the sample graphic code;
And training the coding model and the decoding model by taking the difference between the to-be-optimized verification information and the sample embedded information as an optimization target.
10. A graphic code generating apparatus, comprising:
The acquisition module is used for acquiring an original graphic code and information to be embedded, wherein the original graphic code is composed of graphic units;
The analysis module is used for analyzing the original graphic code to obtain an information code corresponding to the original graphic code, and each graphic unit contained in the original graphic code is respectively corresponding to the information code;
The determining module is used for determining a graph to be embedded in each graph unit contained in the original graph code according to the information code and the information to be embedded, wherein the verification code corresponding to each graph unit contained in the original graph code is determined according to the information code and the information to be embedded; determining the graph to be embedded in each graph unit according to the corresponding relation between each check code and each graph;
And the generating module is used for embedding the graph into each graph unit contained in the original graph code so as to generate the target graph code carrying the information to be embedded.
11. A graphic code verification apparatus, comprising:
an acquisition module for acquiring a graphic code to be checked, the graphic code to be checked being composed of graphic units, the graphic code to be checked including a graphic code generated by the method according to any one of claims 1 to 5;
The identification module is used for identifying the graphics embedded in each graphic unit contained in the graphic code to be checked;
The determining module is used for determining verification information carried by the graphic code to be verified according to the identified graphic;
and the verification module is used for verifying the graphic code to be verified according to the verification information.
12. A computer readable storage medium storing a computer program which, when executed by a processor, implements the method of any of the preceding claims 1-9.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of the preceding claims 1-9 when the program is executed.
CN202210939987.8A 2022-08-05 2022-08-05 Graphic code generation method and graphic code verification method Active CN115310572B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210939987.8A CN115310572B (en) 2022-08-05 2022-08-05 Graphic code generation method and graphic code verification method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210939987.8A CN115310572B (en) 2022-08-05 2022-08-05 Graphic code generation method and graphic code verification method

Publications (2)

Publication Number Publication Date
CN115310572A CN115310572A (en) 2022-11-08
CN115310572B true CN115310572B (en) 2024-04-16

Family

ID=83860918

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210939987.8A Active CN115310572B (en) 2022-08-05 2022-08-05 Graphic code generation method and graphic code verification method

Country Status (1)

Country Link
CN (1) CN115310572B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101149813A (en) * 2007-07-13 2008-03-26 中兴通讯股份有限公司 Matrix type colorful two-dimensional bar code encoding and decoding method
CN104392260A (en) * 2014-12-17 2015-03-04 肖学静 Two-dimensional code anti-counterfeiting method based on additional information
CN104778489A (en) * 2015-03-24 2015-07-15 立德高科(北京)数码科技有限责任公司 Combined anti-counterfeit label, and generation method and generation device of combined anti-counterfeit label
CN105550730A (en) * 2016-01-28 2016-05-04 北京兆信信息技术股份有限公司 Safe two-dimensional code manufacture method and decoding method, and safe two-dimensional code identifier
CN107563245A (en) * 2017-08-24 2018-01-09 广东欧珀移动通信有限公司 The generation of graphic code and method of calibration, device and terminal, readable storage medium storing program for executing
CN107895275A (en) * 2017-11-28 2018-04-10 北京信用达互联网信息技术有限公司 The product preventing counterfeiting means of proof
WO2018095149A1 (en) * 2016-11-28 2018-05-31 深圳大学 Method and system for generating two-dimensional code having embedded visual image, and reading system
CN108665041A (en) * 2018-05-09 2018-10-16 深圳市码云可变数据科技有限公司 Quick Response Code generates and recognition methods, device, computer equipment and storage medium
WO2018206289A1 (en) * 2017-05-09 2018-11-15 Robert Bosch Gmbh A method and a system for creating and authenticating a binary graphic code
CN109190738A (en) * 2018-08-16 2019-01-11 北京奇虎科技有限公司 A kind of generation of encoding of graphs, recognition methods and device
CN109840576A (en) * 2019-01-18 2019-06-04 深圳大学 The generation method and coding/decoding method of anti-copying two dimensional code based on segmentation insertion
CN111353321A (en) * 2020-02-24 2020-06-30 口碑(上海)信息技术有限公司 Data generating and analyzing method and device, computer storage medium and electronic device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6915020B2 (en) * 2001-12-19 2005-07-05 Hewlett-Packard Development Company, L.P. Generating graphical bar codes by halftoning with embedded graphical encoding

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101149813A (en) * 2007-07-13 2008-03-26 中兴通讯股份有限公司 Matrix type colorful two-dimensional bar code encoding and decoding method
CN104392260A (en) * 2014-12-17 2015-03-04 肖学静 Two-dimensional code anti-counterfeiting method based on additional information
CN104778489A (en) * 2015-03-24 2015-07-15 立德高科(北京)数码科技有限责任公司 Combined anti-counterfeit label, and generation method and generation device of combined anti-counterfeit label
CN105550730A (en) * 2016-01-28 2016-05-04 北京兆信信息技术股份有限公司 Safe two-dimensional code manufacture method and decoding method, and safe two-dimensional code identifier
WO2018095149A1 (en) * 2016-11-28 2018-05-31 深圳大学 Method and system for generating two-dimensional code having embedded visual image, and reading system
WO2018206289A1 (en) * 2017-05-09 2018-11-15 Robert Bosch Gmbh A method and a system for creating and authenticating a binary graphic code
EP3622425A1 (en) * 2017-05-09 2020-03-18 Robert Bosch GmbH A method and a system for creating and authenticating a binary graphic code
CN107563245A (en) * 2017-08-24 2018-01-09 广东欧珀移动通信有限公司 The generation of graphic code and method of calibration, device and terminal, readable storage medium storing program for executing
CN107895275A (en) * 2017-11-28 2018-04-10 北京信用达互联网信息技术有限公司 The product preventing counterfeiting means of proof
CN108665041A (en) * 2018-05-09 2018-10-16 深圳市码云可变数据科技有限公司 Quick Response Code generates and recognition methods, device, computer equipment and storage medium
CN109190738A (en) * 2018-08-16 2019-01-11 北京奇虎科技有限公司 A kind of generation of encoding of graphs, recognition methods and device
CN109840576A (en) * 2019-01-18 2019-06-04 深圳大学 The generation method and coding/decoding method of anti-copying two dimensional code based on segmentation insertion
CN111353321A (en) * 2020-02-24 2020-06-30 口碑(上海)信息技术有限公司 Data generating and analyzing method and device, computer storage medium and electronic device

Also Published As

Publication number Publication date
CN115310572A (en) 2022-11-08

Similar Documents

Publication Publication Date Title
TWI675330B (en) Method and device for generating and identifying identification code
CN101908125B (en) QR (Quick Response) bar code decoding chip and decoding method thereof
CN107111782B (en) Neural network structure and method thereof
US20160350568A1 (en) Two-dimensional (2-d) code generating method, detecting method, detecting apparatus, and anti-counterfeit label
CN111539502B (en) Anti-counterfeiting two-dimensional code generation method and device, server and storage medium
CN107025480B (en) Image generation method and apparatus thereof
CN102930192A (en) Method for generating and acquiring safety information and relevant devices
CN101908128B (en) Aztec Code bar code decoding chip and decoding method thereof
JP2017516133A (en) Contour encryption and decryption
CN110309301B (en) Enterprise category classification method and device and intelligent terminal
CN114239780A (en) Anti-counterfeiting tracing code generation and verification method based on dot matrix
CN115310572B (en) Graphic code generation method and graphic code verification method
CN107766909B (en) The method and system of anti-tamper processing is carried out to two-dimension code pattern
WO2024113874A1 (en) Encoding method and decoding method for annular 2-dimensional bar code
CN112560428A (en) Text processing method and device, electronic equipment and storage medium
CN116703427A (en) Anti-counterfeiting tracing method combining dot matrix code and digital watermark
CN115964080A (en) Code clone detection method, system, equipment and medium based on visual image
CN113536782B (en) Sensitive word recognition method and device, electronic equipment and storage medium
CN101882211B (en) Chinese-sensible code barcode decoding chip and decoding method thereof
CN111291726B (en) Medical bill sorting method, device, equipment and medium
KR20220168924A (en) Self-attention based text recognition method and device
CN110378829B (en) Method, device and equipment for providing information and extracting watermark
CN112199731A (en) Data processing method, device and equipment
CN112862045B (en) Encryption graphic structure, encoding method and device, and identification method and device
CN113537484B (en) Network training, encoding and decoding method, device and medium for digital watermarking

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
GR01 Patent grant
GR01 Patent grant