CN112561016A - Two-dimensional code generation method and system and document anti-counterfeiting method and system - Google Patents

Two-dimensional code generation method and system and document anti-counterfeiting method and system Download PDF

Info

Publication number
CN112561016A
CN112561016A CN202011538535.6A CN202011538535A CN112561016A CN 112561016 A CN112561016 A CN 112561016A CN 202011538535 A CN202011538535 A CN 202011538535A CN 112561016 A CN112561016 A CN 112561016A
Authority
CN
China
Prior art keywords
dimensional code
code
coloring
information
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011538535.6A
Other languages
Chinese (zh)
Inventor
刘伟宾
郭峰
金宏洲
程亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Tiangu Information Technology Co ltd
Original Assignee
Hangzhou Tiangu Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Tiangu Information Technology Co ltd filed Critical Hangzhou Tiangu Information Technology Co ltd
Priority to CN202011538535.6A priority Critical patent/CN112561016A/en
Publication of CN112561016A publication Critical patent/CN112561016A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/018Certifying business or products
    • G06Q30/0185Product, service or business identity fraud
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour

Abstract

The invention discloses a two-dimensional code generation method and a system thereof, and a document anti-counterfeiting method and a system thereof, wherein the two-dimensional code generation method comprises the following steps: acquiring information to be stored, and acquiring a matched two-dimensional code template based on the information to be stored; generating first encoding data corresponding to the two-dimensional code template based on the information to be stored, wherein the first encoding data comprises a data code sequence and an error correction code sequence; carrying out interference processing on the error correcting code sequence to obtain a corresponding interference sequence, wherein the interference sequence comprises a true error correcting code and a false error correcting code; and generating a corresponding two-dimensional code on a two-dimensional code template based on the data code sequence and the interference sequence, wherein the two-dimensional code comprises a first pixel block which is completely colored and a second pixel block which is partially colored. According to the invention, by interfering the error correction code sequence and combining the design of the second pixel block, the two-dimensional code generated by the invention has certain vulnerability, and the pixels are easy to lose in the copying process, so that the copying is unreadable.

Description

Two-dimensional code generation method and system and document anti-counterfeiting method and system
Technical Field
The invention relates to the field of anti-counterfeiting, in particular to a generation method and a generation system of a copy-proof two-dimensional code, and a document anti-counterfeiting method and a document anti-counterfeiting system based on the two-dimensional code.
Background
At present, a two-dimensional code is often added in a document, and the condition that the document is tampered by using information stored in the two-dimensional code is prevented, but because the two-dimensional code is difficult to copy prevention, the condition that a copy replaces an original to be used is difficult to prevent.
At present, the method for preventing the two-dimensional code from copying generally needs to depend on optical and material related technical means, and has higher cost, such as:
the two-dimensional code anti-counterfeiting method based on the digital watermark, with publication number (CN110503592A), adds the digital watermark in the two-dimensional code, and needs to be identified and judged by a specially-designed anti-counterfeiting server to identify whether the two-dimensional code is a copy, so that the method needs to have a printing device capable of printing the digital watermark and also needs to identify the anti-counterfeiting server of the digital watermark, and is relatively high in cost.
The anti-counterfeiting two-dimensional code with the publication number (CN110428034A) for detecting the report is printed by temperature-change anti-counterfeiting ink, heating equipment is required to heat the two-dimensional code and the report generation date during reading, an optical instrument is used for identifying, after identification, the anti-counterfeiting information is decrypted by a computer, and information is output through text, voice or video.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a method and a system for generating a two-dimensional code, which can effectively prevent the two-dimensional code from being copied without additionally arranging specific equipment or application software, and have low cost and convenient implementation. .
In order to solve the technical problem, the invention is solved by the following technical scheme:
a two-dimensional code generation method comprises the following steps:
acquiring information to be stored, and acquiring a matched two-dimensional code template based on the information to be stored;
generating first encoding data corresponding to the two-dimensional code template based on the information to be stored, wherein the first encoding data comprises a data code sequence and an error correction code sequence;
carrying out interference processing on the error correcting code sequence to obtain a corresponding interference sequence, wherein the interference sequence comprises a true error correcting code and a false error correcting code;
and generating a corresponding two-dimensional code on a two-dimensional code template based on the data code sequence and the interference sequence, wherein the two-dimensional code comprises a first pixel block which is completely colored and a second pixel block which is partially colored.
As an implementable embodiment:
taking the data code sequence and the interference sequence as second encoded data, wherein the second encoded data comprises a first code word and a second code word, the bit of the first code word is 1, the bit of the second code word is 0, and the two-dimensional code template comprises coloring blocks corresponding to the code words in the second encoded data one to one;
the first code words comprise common coloring code words and special coloring code words, the value range of the special coloring code words is 1-M, the total number of the first code words is 2M, and M is a positive integer;
obtaining a fully colored first block of pixels when coloring a corresponding colored block based on the common colored codeword;
when coloring the respective colored block based on the special colored code word, a partially colored second pixel block is obtained.
As an implementable way, when coloring the respective colored block based on the special colored code word, the following steps are performed:
splitting the coloring blocks to obtain a plurality of coloring sub-blocks;
and selecting at least 50% of the colored sub-blocks for coloring to obtain the corresponding second pixel block.
As an implementable embodiment:
acquiring information to be stored and a preset target size;
acquiring initial configuration information based on the information to be stored;
acquiring a template size corresponding to initial configuration information, wherein the initial configuration information comprises a version number and an error correction level;
calculating a proportional adjustment coefficient based on the template size and the target size, adjusting initial configuration information based on the proportional adjustment coefficient, and obtaining corresponding configuration adjustment information;
and generating a corresponding version check two-dimensional code based on the information to be stored, the configuration adjustment information and the target size, identifying the version check two-dimensional code, taking the configuration adjustment information as initial configuration information when the identification is successful, repeating the steps, and extracting a two-dimensional code template corresponding to the initial configuration information adopted in the adjustment process when the identification is failed.
As an implementable embodiment:
generating a corresponding color value check two-dimensional code on a two-dimensional code template according to preset RGBA data based on the data code sequence and the interference sequence;
and identifying the color value verification two-dimensional code, adjusting RGBA data of the color value verification two-dimensional code when the identification fails until the identification succeeds, and outputting the color value verification two-dimensional code corresponding to the identification succeeds as the finally generated two-dimensional code.
The invention also provides a system for generating the two-dimensional code, which comprises the following steps:
the information acquisition module is used for acquiring information to be stored;
the configuration module is used for acquiring a matched two-dimensional code template based on the information to be stored;
the encoding module is used for generating first encoding data corresponding to the two-dimensional code template based on the information to be stored, and the first encoding data comprises a data code sequence and an error correction code sequence;
the interference module is used for carrying out interference processing on the error correcting code sequence to obtain a corresponding interference sequence, and the interference sequence comprises a true error correcting code and a false error correcting code;
and the generating module is used for generating a corresponding two-dimensional code on the two-dimensional code template based on the data code sequence and the interference sequence.
As an implementable embodiment:
the two-dimensional code template comprises a plurality of coloring blocks;
the generation module comprises a selection unit and a coloring unit;
taking the data code sequence and the interference sequence as second encoded data, where the second encoded data includes a first codeword and a second codeword, where a bit of the first codeword is 1 and a bit of the second codeword is 0, the selecting unit is configured to select a plurality of first codewords as special coloring codewords, and the remaining first codewords serve as common coloring codewords, where a value range of the special coloring codewords is 1-M, a total number of the first codewords is 2M, and M is a positive integer;
the coloring unit is used for coloring the corresponding coloring blocks based on the common coloring code words to obtain a fully colored first pixel block, and is also used for coloring the corresponding coloring blocks based on the special coloring code words to obtain a partially colored second pixel block.
As an implementable embodiment:
the information acquisition module is used for acquiring information to be stored and a preset target size;
the configuration module is configured to:
acquiring initial configuration information based on the information to be stored, and acquiring a template size corresponding to the initial configuration information, wherein the initial configuration information comprises a version number and an error correction level;
calculating a proportional adjustment coefficient based on the template size and the target size, adjusting initial configuration information based on the proportional adjustment coefficient, and obtaining corresponding configuration adjustment information;
and generating a corresponding version check two-dimensional code based on the information to be stored, the configuration adjustment information and the target size, identifying the version check two-dimensional code, adjusting the configuration adjustment information when the identification fails, repeating the steps to identify the corresponding version check two-dimensional code until the identification succeeds, and extracting a two-dimensional code template corresponding to the configuration adjustment information when the identification succeeds.
The invention also provides a document anti-counterfeiting method, which comprises the following steps:
and embedding a corresponding anti-counterfeiting two-dimensional code into the specified document page, wherein the anti-counterfeiting two-dimensional code is generated according to any one of the two-dimensional code generation methods.
The invention also provides a document anti-counterfeiting system which comprises a two-dimension code generating module and a two-dimension code inserting module;
the two-dimension code generation module is used for executing any one of the two-dimension code generation methods to obtain a corresponding anti-counterfeiting two-dimension code;
and the two-dimension code insertion module is used for embedding the anti-counterfeiting two-dimension code in the specified document page.
Due to the adoption of the technical scheme, the invention has the remarkable technical effects that:
1. according to the invention, the error correction capability of the two-dimensional code is reduced through the interference on the error correction code sequence, and part of pixel blocks in the generated two-dimensional code are only partially colored (namely, the design of the second pixel block), so that the pixels of the two-dimensional code are more easily lost in the copying process, and the purpose that an original is readable and a copy is unreadable is realized.
2. According to the invention, by automatically adjusting the version number and the error correction level of the generated two-dimensional code, when a scene of the two-dimensional code size is specified, the influence of over-amplification on the anti-copying effect is effectively avoided on the premise of not adjusting related proportional parameters by a user, the application range is wide, the working efficiency can be effectively improved, and the problem that an original cannot be identified due to over-intervention on the version number and the error correction level is avoided by actively simulating and identifying the pre-generated two-dimensional code.
3. The method enhances the copying vulnerability of the two-dimensional code by modifying RGBA data (such as grey) of the two-dimensional code, and simultaneously ensures the reading robustness of the original two-dimensional code.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a two-dimensional code generation method according to the present invention;
FIG. 2 is a schematic diagram of a first block of pixels;
fig. 3 is a schematic diagram of a second block of pixels.
Detailed Description
The present invention will be described in further detail with reference to examples, which are illustrative of the present invention and are not to be construed as being limited thereto.
Embodiment 1, a method for generating a two-dimensional code, as shown in fig. 1, includes the following steps:
s100, information to be stored is obtained, and a matched two-dimensional code template is obtained based on the information to be stored;
taking QR code as an example, it has 40 versions, different versions have different corresponding capacities and sizes, from 21x21 (version 1) to 177x177 (version 40), each version has a symbol that is increased by 4 modules per side than the previous version.
Selecting a proper version based on information to be stored belongs to the prior art, and the two-dimensional code template is a two-dimensional code template corresponding to the version, which is not described in detail in this embodiment.
S200, generating first coded data corresponding to the two-dimensional code template based on the information to be stored, wherein the first coded data comprise a data code sequence and an error correction code sequence;
s300, carrying out interference processing on the error correction code sequence to obtain a corresponding interference sequence, wherein the interference sequence comprises a true error correction code and a false error correction code;
the data code sequence and the error correcting code sequence are both sequences combined by bit '1' and bit '0';
in this embodiment, partial code words of the error correction code sequence are inverted according to a preset rule, that is, when a selected code word is a bit "1", the selected code word is inverted to a bit "0", and the bit "0" that is inverted at this time is a false error correction code.
In this embodiment, the false error correction code accounts for 10% to 50% of the total number of the true error correction code and the false error correction code, and a person skilled in the art can adjust the false error correction code according to actual situations.
S400, generating a corresponding two-dimensional code on a two-dimensional code template based on the data code sequence and the interference sequence, wherein the two-dimensional code comprises a fully colored first pixel block (as shown in fig. 2) and a partially colored second pixel block (as shown in fig. 3).
In this embodiment, the pixel block refers to a coloring area corresponding to a bit "1", the two-dimensional code template has a coding area, when the two-dimensional code is generated, the coding area is colored according to each code word in the data code sequence and the interference sequence, if the current code word is the bit "1", the corresponding area is colored to form the pixel block, and if the current code word is the bit "0", the corresponding area is set to be blank.
The situation that part of pixels are weakened or lost inevitably occurs after the two-dimensional code is copied, but because the two-dimensional code has a redundant error correction code sequence, data error correction can be carried out through the error correction code sequence when the two-dimensional code is identified, and correct identification can still be realized;
in this embodiment, the error correction capability is reduced by the interference to the error correction code sequence, and a part of pixel blocks in the generated two-dimensional code is only partially colored, that is, the second pixel block is designed, so that the pixels of the two-dimensional code are more easily lost in the scanning and copying processes, and thus, the original can be read, and the copied copy cannot be read.
Further, the method for generating the first pixel block and the second pixel block in step S400 specifically includes:
s411, using the data code sequence and the interference sequence as second encoded data, where the second encoded data includes a first codeword and a second codeword, a bit of the first codeword is 1, a bit of the second codeword is 0, and the two-dimensional code template includes coloring blocks corresponding to the codewords in the second encoded data one to one;
s412, the first code words comprise common coloring code words and special coloring code words, the value range of the special coloring code words is 1-M, the total number of the first code words is 2M, and M is a positive integer;
the skilled person can set the number of the special coloring code words according to the actual requirement, randomly select the corresponding first code words as the special coloring code words based on the set number, and the rest first code words are the common coloring code words.
S413, when the corresponding shading block is shaded based on the common shading codeword, obtaining a fully shaded first pixel block;
s414, when coloring the corresponding coloring block based on the special coloring code word, obtaining a partially colored second pixel block.
The skilled person can design the coloring method for the second pixel block according to the actual requirement, for example, a coloring ratio can be set, a corresponding coloring area is obtained based on the coloring ratio, a polygon conforming to the coloring area is randomly generated in the coloring block to obtain the corresponding second pixel block, and a coloring pattern can be preset, and the coloring pattern is added to the corresponding coloring block to obtain the corresponding second pixel block.
Further, when the step S414 colors the corresponding color block based on the special color code word, the following steps are performed:
splitting the coloring blocks to obtain a plurality of coloring sub-blocks;
and selecting at least 50% of the colored sub-blocks for coloring to obtain the corresponding second pixel block.
In the embodiment, the color blocks are split, and at least half of the colored subblocks are colored, so that data are more easily lost in the copying process on the premise of ensuring that an original can be read, and the copy cannot be read.
The skilled person can design the splitting rule by himself according to the actual situation, and the splitting manner is described by taking 16 × 16 color blocks as an example below:
splitting the coloring block into 16 coloring sub-blocks of 1x 1, connecting the coloring sub-blocks, and randomly selecting at least 8 coloring sub-blocks for coloring;
splitting the coloring block into 9 coloring sub-blocks of 4 by 4, wherein two pixels are spaced between each coloring sub-block, and at least 4 coloring sub-blocks are randomly selected for coloring;
the coloring block is divided into 9 coloring units of 4 x 4, each coloring unit is composed of coloring subblocks of 1x 1, two pixels are arranged between each coloring unit at intervals, at least 2 coloring subblocks are randomly selected in each coloring unit for coloring, and the scheme performs random selection in each coloring subblock, so that coloring areas in the same pixel block are dispersed, interference cannot be caused in the original identification process, data is easily lost in the copying process, and the copying prevention effect is best.
Further, in step S300, a person skilled in the art may also set a rule for selecting the inverted codeword according to actual needs, for example, randomly select the inverted codeword, or calculate a pseudo-random value according to the relevant parameters of the two-dimensional code, and then perform reverse reduction according to the algorithm, so as to further determine whether the two-dimensional code is true or false according to the pseudo-error correction code, thereby preventing another person from regenerating the two-dimensional code according to the read content to forge the original.
Embodiment 2, a method for generating a two-dimensional code, which is to make the size of the generated two-dimensional code consistent with a target size, and further improve step S100 in embodiment 1, in this embodiment, step S100 obtains information to be stored, and a specific implementation step of obtaining a matched two-dimensional code template based on the information to be stored is as follows:
s110, obtaining information to be stored and a preset target size;
s120, acquiring initial configuration information based on the information to be stored;
s130, obtaining a template size corresponding to initial configuration information, wherein the initial configuration information comprises a version number and an error correction level;
selecting a proper version based on information to be stored, obtaining an initial version number, wherein the two-dimensional code corresponding to each version is different in size, taking the two-dimensional code corresponding to the current version as the template size, and configuring an initial error correction level, wherein the error correction level refers to the size of a fault tolerance rate, and can be divided into four levels, namely L (< 7%), M (< 15%), Q (< 25%) and H (< 30%) from small to large according to the fault tolerance rate.
S140, calculating a proportional adjustment coefficient based on the template size and the target size, adjusting initial configuration information based on the proportional adjustment coefficient, and obtaining corresponding configuration adjustment information;
in the application process of the two-dimensional code, the generated two-dimensional code is usually required to be amplified or reduced to be matched with a preset embedding area, and then the two-dimensional code with the adjusted size is inserted into the embedding area;
when the information to be stored is small, the size of the two-dimensional code is small, so that the two-dimensional code is amplified to a target size, the size of each pixel block is amplified and is easy to identify, the anti-copying effect is achieved by increasing the proportion of the false error correction code and the proportion of the second pixel block, reducing the number of colored subblocks for coloring and the like, the process is complex, the workload of related workers is greatly increased, and the working efficiency is reduced.
Therefore, in the embodiment, the version number and the error correction level are automatically adjusted through the proportion adjustment coefficient, the situation that the pixel block in the two-dimensional code is large is avoided, and related workers do not need to adjust related proportion parameters repeatedly.
When the scaling factor is greater than 1, i.e., the template size is smaller than the target size, and the scaling factor is less than 1, i.e., the template size is larger than the target size.
The method comprises the following specific steps:
calculating a scaling factor based on the template size corresponding to the initial version number and the target size;
acquiring a preset zooming-in threshold (such as 1.25) and a zooming-out threshold (such as 0.75);
when the proportional adjustment coefficient is larger than the amplification threshold, increasing one level on the basis of the initial version number and/or the initial error correction level to counteract the influence of over amplification and obtain corresponding configuration adjustment information;
when the scaling factor is smaller than the reduction threshold, reducing the level one on the basis of the initial version number and/or the initial error correction level to counteract the influence of over-scaling and obtain corresponding configuration adjustment information;
and when the scale adjustment coefficient is between a reduction threshold and an enlargement threshold, extracting the two-dimensional code template corresponding to the initial configuration information.
S150, generating a corresponding version check two-dimensional code (namely, a two-dimensional code generated by the existing two-dimensional code generation method) based on the information to be stored, the configuration adjustment information and the target size, identifying the version check two-dimensional code, taking the configuration adjustment information as initial configuration information when the identification is successful, repeating the steps S130 to S150, and extracting a two-dimensional code template corresponding to the initial configuration information adopted in the adjustment process when the identification is failed.
And subsequently, generating a corresponding two-dimension code according to the extracted two-dimension code template, adjusting the size of the two-dimension code according to the target size information, and outputting the two-dimension code with the adjusted size.
The version number and the error correction level of the generated two-dimensional code are automatically adjusted, so that when a scene of the two-dimensional code size is appointed, on the premise that a user does not need to adjust related proportional parameters, the influence of excessive amplification on the anti-copying effect is effectively avoided, the application range is wide, the working efficiency can be effectively improved, the two-dimensional code generated in advance is identified through active simulation, and the problem that the original cannot be identified due to excessive intervention of the version number and the error correction level is avoided.
Embodiment 3, the color value modification step is added in step S400 of embodiment 1, and the rest is the same as embodiment 1, and the specific steps of generating the corresponding two-dimensional code on the two-dimensional code template based on the data code sequence and the interference sequence in step S400 are as follows:
s410, generating a corresponding color value verification two-dimensional code on a two-dimensional code template according to preset RGBA data based on the data code sequence and the interference sequence;
that is, according to the method described in steps S411 to S414 in embodiment 1, coloring the coloring blocks corresponding to the first codeword in the data code sequence and the interference sequence according to the preset RGBA data (e.g. 211,211,211), and obtaining the corresponding color value checking two-dimensional code.
Further, the RGBA data comprises a first RGBA value and a second RGBA value, the first RGBA value is used for coloring the coloring block corresponding to the common coloring code word, the second RGBA value is used for coloring the coloring block corresponding to the special coloring code word, and the first RGBA value and the second RGBA value are the same or different;
the first RGBA value and the second RGBA value can be set by those skilled in the art according to actual needs.
And S420, identifying the color value verification two-dimensional code, adjusting RGBA data of the color value verification two-dimensional code when the identification fails until the identification succeeds, and outputting the corresponding color value verification two-dimensional code when the identification succeeds as the finally generated two-dimensional code.
Namely, the color value verification two-dimensional code generated in the active simulation identification step S410 is output as a finally generated two-dimensional code when the identification is successful;
when the identification fails, adjusting RGBA data of the color value checking two-dimensional code according to a preset color matching rule to deepen the two-dimensional code so that a pixel block of the two-dimensional code is easier to identify, identifying the color value checking two-dimensional code after color matching again until the identification is successful, and outputting the color value checking two-dimensional code after color matching as a finally generated two-dimensional code;
in the embodiment, the copying vulnerability of the two-dimensional code is enhanced by modifying RGBA data (such as grey) of the two-dimensional code, and meanwhile, the reading robustness of the original two-dimensional code is ensured.
Embodiment 4, a two-dimensional code generation system, comprising:
the information acquisition module is used for acquiring information to be stored;
the configuration module is used for acquiring a matched two-dimensional code template based on the information to be stored, and the two-dimensional code template comprises a plurality of coloring blocks;
the encoding module is used for generating first encoding data corresponding to the two-dimensional code template based on the information to be stored, and the first encoding data comprises a data code sequence and an error correction code sequence;
the interference module is used for carrying out interference processing on the error correcting code sequence to obtain a corresponding interference sequence, and the interference sequence comprises a true error correcting code and a false error correcting code;
and the generating module is used for generating a corresponding two-dimensional code on the two-dimensional code template based on the data code sequence and the interference sequence.
The generation module comprises a selection unit and a coloring unit;
taking the data code sequence and the interference sequence as second encoded data, where the second encoded data includes a first codeword and a second codeword, where a bit of the first codeword is 1 and a bit of the second codeword is 0, the selecting unit is configured to select a plurality of first codewords as special coloring codewords, and the remaining first codewords serve as common coloring codewords, where a value range of the special coloring codewords is 1-M, a total number of the first codewords is 2M, and M is a positive integer;
the coloring unit is used for coloring the corresponding coloring blocks based on the common coloring code words to obtain a fully colored first pixel block, and is also used for coloring the corresponding coloring blocks based on the special coloring code words to obtain a partially colored second pixel block.
Further, the information acquisition module is used for acquiring information to be stored and a preset target size;
further, the configuration module is configured to:
acquiring initial configuration information based on the information to be stored, and acquiring a template size corresponding to the initial configuration information, wherein the initial configuration information comprises a version number and an error correction level;
calculating a proportional adjustment coefficient based on the template size and the target size, adjusting initial configuration information based on the proportional adjustment coefficient, and obtaining corresponding configuration adjustment information;
and generating a corresponding version check two-dimensional code based on the information to be stored, the configuration adjustment information and the target size, identifying the version check two-dimensional code, adjusting the configuration adjustment information when the identification fails, repeating the steps to identify the corresponding version check two-dimensional code until the identification succeeds, and extracting a two-dimensional code template corresponding to the configuration adjustment information when the identification succeeds.
For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, refer to the partial description of embodiments 1 to 3.
Embodiment 5, a document anti-counterfeiting method, comprising the steps of:
and embedding a corresponding anti-counterfeiting two-dimensional code into the specified document page, wherein the anti-counterfeiting two-dimensional code is generated by any one of the two-dimensional code generation methods in the embodiments 1 to 3.
In actual use, a user signs the anti-counterfeiting two-dimensional code into a specified document page and prints the document page to obtain a document original, and at the moment, the user can identify the anti-counterfeiting two-dimensional code by using a universal two-dimensional code identification device;
when a user copies the original document to obtain a corresponding document copy, the pixel data of the two-dimension code part is lost in the copying process, so that the original document and the copy cannot be identified, the original document and the copy can be effectively distinguished in the original document readable and copy unreadable modes, the implementation is simple and convenient, special equipment does not need to be additionally purchased, and the document reading cannot be influenced.
Embodiment 6, a document anti-counterfeiting system, comprising a two-dimensional code generation module and a two-dimensional code insertion module;
the two-dimensional code generation module is used for executing any one of the two-dimensional code generation methods in the embodiments 1 to 3 to obtain a corresponding anti-counterfeiting two-dimensional code;
and the two-dimension code insertion module is used for embedding the anti-counterfeiting two-dimension code in the specified document page.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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 terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, 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 terminal 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 terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that:
reference in the specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. Thus, the appearances of the phrase "one embodiment" or "an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
In addition, it should be noted that the specific embodiments described in the present specification may differ in the shape of the components, the names of the components, and the like. All equivalent or simple changes of the structure, the characteristics and the principle of the invention which are described in the patent conception of the invention are included in the protection scope of the patent of the invention. Various modifications, additions and substitutions for the specific embodiments described may be made by those skilled in the art without departing from the scope of the invention as defined in the accompanying claims.

Claims (10)

1. A two-dimensional code generation method is characterized by comprising the following steps:
acquiring information to be stored, and acquiring a matched two-dimensional code template based on the information to be stored;
generating first encoding data corresponding to the two-dimensional code template based on the information to be stored, wherein the first encoding data comprises a data code sequence and an error correction code sequence;
carrying out interference processing on the error correcting code sequence to obtain a corresponding interference sequence, wherein the interference sequence comprises a true error correcting code and a false error correcting code;
and generating a corresponding two-dimensional code on a two-dimensional code template based on the data code sequence and the interference sequence, wherein the two-dimensional code comprises a first pixel block which is completely colored and a second pixel block which is partially colored.
2. The two-dimensional code generation method according to claim 1, characterized in that:
taking the data code sequence and the interference sequence as second encoded data, wherein the second encoded data comprises a first code word and a second code word, the bit of the first code word is 1, the bit of the second code word is 0, and the two-dimensional code template comprises coloring blocks corresponding to the code words in the second encoded data one to one;
the first code words comprise common coloring code words and special coloring code words, the value range of the special coloring code words is 1-M, the total number of the first code words is 2M, and M is a positive integer;
obtaining a fully colored first block of pixels when coloring a corresponding colored block based on the common colored codeword;
when coloring the respective colored block based on the special colored code word, a partially colored second pixel block is obtained.
3. The two-dimensional code generation method according to claim 2, wherein when coloring the corresponding coloring block based on the special coloring code word, the following steps are performed:
splitting the coloring blocks to obtain a plurality of coloring sub-blocks;
and selecting at least 50% of the colored sub-blocks for coloring to obtain the corresponding second pixel block.
4. The two-dimensional code generation method according to any one of claims 1 to 3, characterized in that:
acquiring information to be stored and a preset target size;
acquiring initial configuration information based on the information to be stored;
acquiring a template size corresponding to initial configuration information, wherein the initial configuration information comprises a version number and an error correction level;
calculating a proportional adjustment coefficient based on the template size and the target size, adjusting initial configuration information based on the proportional adjustment coefficient, and obtaining corresponding configuration adjustment information;
and generating a corresponding version check two-dimensional code based on the information to be stored, the configuration adjustment information and the target size, identifying the version check two-dimensional code, taking the configuration adjustment information as initial configuration information when the identification is successful, repeating the steps, and extracting a two-dimensional code template corresponding to the initial configuration information adopted in the adjustment process when the identification is failed.
5. The two-dimensional code generation method according to any one of claims 1 to 3, characterized in that:
generating a corresponding color value check two-dimensional code on a two-dimensional code template according to preset RGBA data based on the data code sequence and the interference sequence;
and identifying the color value verification two-dimensional code, adjusting RGBA data of the color value verification two-dimensional code when the identification fails until the identification succeeds, and outputting the color value verification two-dimensional code corresponding to the identification succeeds as the finally generated two-dimensional code.
6. A two-dimensional code generation system, comprising:
the information acquisition module is used for acquiring information to be stored;
the configuration module is used for acquiring a matched two-dimensional code template based on the information to be stored;
the encoding module is used for generating first encoding data corresponding to the two-dimensional code template based on the information to be stored, and the first encoding data comprises a data code sequence and an error correction code sequence;
the interference module is used for carrying out interference processing on the error correcting code sequence to obtain a corresponding interference sequence, and the interference sequence comprises a true error correcting code and a false error correcting code;
and the generating module is used for generating a corresponding two-dimensional code on the two-dimensional code template based on the data code sequence and the interference sequence.
7. The two-dimensional code generation system according to claim 6, characterized in that:
the two-dimensional code template comprises a plurality of coloring blocks;
the generation module comprises a selection unit and a coloring unit;
taking the data code sequence and the interference sequence as second encoded data, where the second encoded data includes a first codeword and a second codeword, where a bit of the first codeword is 1 and a bit of the second codeword is 0, the selecting unit is configured to select a plurality of first codewords as special coloring codewords, and the remaining first codewords serve as common coloring codewords, where a value range of the special coloring codewords is 1-M, a total number of the first codewords is 2M, and M is a positive integer;
the coloring unit is used for coloring the corresponding coloring blocks based on the common coloring code words to obtain a fully colored first pixel block, and is also used for coloring the corresponding coloring blocks based on the special coloring code words to obtain a partially colored second pixel block.
8. The two-dimensional code generation system according to claim 6, characterized in that:
the information acquisition module is used for acquiring information to be stored and a preset target size;
the configuration module is configured to:
acquiring initial configuration information based on the information to be stored, and acquiring a template size corresponding to the initial configuration information, wherein the initial configuration information comprises a version number and an error correction level;
calculating a proportional adjustment coefficient based on the template size and the target size, adjusting initial configuration information based on the proportional adjustment coefficient, and obtaining corresponding configuration adjustment information;
and generating a corresponding version check two-dimensional code based on the information to be stored, the configuration adjustment information and the target size, identifying the version check two-dimensional code, adjusting the configuration adjustment information when the identification fails, repeating the steps to identify the corresponding version check two-dimensional code until the identification succeeds, and extracting a two-dimensional code template corresponding to the configuration adjustment information when the identification succeeds.
9. A document anti-counterfeiting method is characterized by comprising the following steps:
embedding a corresponding anti-counterfeiting two-dimensional code into a specified document page, wherein the anti-counterfeiting two-dimensional code is generated according to the two-dimensional code generation method of any one of claims 1 to 5.
10. The document anti-counterfeiting system comprises a two-dimensional code generation module and a two-dimensional code insertion module, and is characterized in that: the two-dimension code generation module is used for executing the two-dimension code generation method of any one of claims 1 to 5 to obtain a corresponding anti-counterfeiting two-dimension code;
and the two-dimension code insertion module is used for embedding the anti-counterfeiting two-dimension code in the specified document page.
CN202011538535.6A 2020-12-23 2020-12-23 Two-dimensional code generation method and system and document anti-counterfeiting method and system Pending CN112561016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011538535.6A CN112561016A (en) 2020-12-23 2020-12-23 Two-dimensional code generation method and system and document anti-counterfeiting method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011538535.6A CN112561016A (en) 2020-12-23 2020-12-23 Two-dimensional code generation method and system and document anti-counterfeiting method and system

Publications (1)

Publication Number Publication Date
CN112561016A true CN112561016A (en) 2021-03-26

Family

ID=75031580

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011538535.6A Pending CN112561016A (en) 2020-12-23 2020-12-23 Two-dimensional code generation method and system and document anti-counterfeiting method and system

Country Status (1)

Country Link
CN (1) CN112561016A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070277150A1 (en) * 2006-03-03 2007-11-29 Namco Bandai Games Inc. Program, information storage medium, two-dimensional code generation system, image generation system and printed material
CN104966115A (en) * 2015-06-12 2015-10-07 吴伟和 Method for filling two-dimensional code through image
CN105447546A (en) * 2015-11-25 2016-03-30 林蔚 Two-dimensional code capable of being embedded with large-ratio graph as well as coding and decoding method and device therefor
CN105989390A (en) * 2015-02-11 2016-10-05 北京鼎九信息工程研究院有限公司 Generation method of two-dimensional code and apparatus thereof
CN106156820A (en) * 2015-03-25 2016-11-23 北大方正集团有限公司 two-dimensional code generation method and device
CN107563475A (en) * 2017-07-18 2018-01-09 中国农业大学 A kind of coding method of Quick Response Code and device
CN108960387A (en) * 2018-07-12 2018-12-07 南京林业大学 A kind of anti-counterfeiting two dimensional code and its generation and recognition methods
CN109948762A (en) * 2017-12-20 2019-06-28 北京京东尚科信息技术有限公司 Method and apparatus for generating two dimensional code

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070277150A1 (en) * 2006-03-03 2007-11-29 Namco Bandai Games Inc. Program, information storage medium, two-dimensional code generation system, image generation system and printed material
CN105989390A (en) * 2015-02-11 2016-10-05 北京鼎九信息工程研究院有限公司 Generation method of two-dimensional code and apparatus thereof
CN106156820A (en) * 2015-03-25 2016-11-23 北大方正集团有限公司 two-dimensional code generation method and device
CN104966115A (en) * 2015-06-12 2015-10-07 吴伟和 Method for filling two-dimensional code through image
CN105447546A (en) * 2015-11-25 2016-03-30 林蔚 Two-dimensional code capable of being embedded with large-ratio graph as well as coding and decoding method and device therefor
CN107563475A (en) * 2017-07-18 2018-01-09 中国农业大学 A kind of coding method of Quick Response Code and device
CN109948762A (en) * 2017-12-20 2019-06-28 北京京东尚科信息技术有限公司 Method and apparatus for generating two dimensional code
CN108960387A (en) * 2018-07-12 2018-12-07 南京林业大学 A kind of anti-counterfeiting two dimensional code and its generation and recognition methods

Similar Documents

Publication Publication Date Title
CN108229596B (en) Combined two-dimensional code, electronic certificate carrier, generating and reading device and method
Zhang et al. Fragile watermarking with error-free restoration capability
EP1456812B1 (en) Generating graphical codes by halftoning with embedded graphical encoding
MXPA06001533A (en) Machine readable data.
US6456393B1 (en) Information embedding in document copies
KR20060121873A (en) Printed matter processing system, watermark-containing document printing device, watermark-containing document read device, printed matter processing method, information read device, and information read method
JP4173994B2 (en) Detection of halftone modulation embedded in an image
CN110796586B (en) Blind watermarking method and system based on digital dot matrix and readable storage medium
CN109840576A (en) The generation method and coding/decoding method of anti-copying two dimensional code based on segmentation insertion
WO2020237881A1 (en) Method and apparatus for injecting anti-counterfeit information, computer device, and storage medium
CN116579908B (en) Method and device for implanting encrypted hidden information into image
US8243985B2 (en) Bit pattern design for visible watermarking
CN116681098A (en) Method and system for generating anti-counterfeiting mark image based on two-dimensional code generation
CN112561016A (en) Two-dimensional code generation method and system and document anti-counterfeiting method and system
JP4469301B2 (en) Information embedding device, printing medium, and information reading device
Varna et al. Data hiding in hard-copy text documents robust to print, scan and photocopy operations
CN109840574B (en) Two-dimensional code information hiding method and device, electronic equipment and storage medium
KR100988309B1 (en) Inserting method of document identifier and decoding method thereof
CN114330621A (en) Two-dimensional code anti-counterfeiting method and device based on identification information and storage medium
US20110194690A1 (en) Data Adaptive Message Embedding For Visible Watermarking
CN113076528A (en) Anti-counterfeiting information embedding method, anti-counterfeiting information extracting method, anti-counterfeiting information embedding device, anti-counterfeiting information extracting device and storage medium
JP2005286963A (en) Device for embedding information in medium for print, information reader, and medium having information embedded therein
JP4905142B2 (en) Image processing apparatus, printed matter, and image processing program
Zhou et al. A QR data hiding method based on redundant region and BCH
JP4260076B2 (en) Document creation device, document verification device, document creation method, document verification method, document creation program, document verification program, recording medium storing document creation program, and recording medium storing document verification program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210326