CN108734048A - Various dimensions Quick Response Code based on proprietary code generates and interpretation method - Google Patents

Various dimensions Quick Response Code based on proprietary code generates and interpretation method Download PDF

Info

Publication number
CN108734048A
CN108734048A CN201810532634.XA CN201810532634A CN108734048A CN 108734048 A CN108734048 A CN 108734048A CN 201810532634 A CN201810532634 A CN 201810532634A CN 108734048 A CN108734048 A CN 108734048A
Authority
CN
China
Prior art keywords
code
data
code word
various dimensions
symbol
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
CN201810532634.XA
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.)
Xian University of Technology
Original Assignee
Xian University of Technology
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 Xian University of Technology filed Critical Xian University of Technology
Priority to CN201810532634.XA priority Critical patent/CN108734048A/en
Publication of CN108734048A publication Critical patent/CN108734048A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Error Detection And Correction (AREA)

Abstract

The invention discloses a kind of various dimensions two-dimensional code generation methods based on proprietary code.The invention also discloses a kind of various dimensions two dimension code coding method based on proprietary code.The data portion of various dimensions Quick Response Code includes general code and private code, general code generates addition general code end mark 0000 after data bit stream, continued to fill up after end mark if there are private code at this time the mode indicators of private code, count indicator, proprietary code data bit stream finally add the full stop 0000 of all data again.Decoding terminates to continue to decode, until the end mark of proprietary code terminates there are when the data information of proprietary code if the end mark for being decoded to general code is not meant to decode.The various dimensions Quick Response Code of the present invention generates and interpretation method, and printing cost is low, print speed printing speed is fast, printing area is small.

Description

Various dimensions Quick Response Code based on proprietary code generates and interpretation method
Technical field
The invention belongs to two-dimension code anti-counterfeit technical fields, are related to a kind of various dimensions Quick Response Code generation side based on proprietary code Method, the invention further relates to a kind of various dimensions two dimension code coding method based on proprietary code.
Background technology
With the fast development of economy and scientific and technological level, the anti-fake demand of business is increasingly vigorous, and Quick Response Code is propagated as information Carrier play increasingly important role in anti-counterfeit field.Common or well-known Quick Response Code code machine is formed at present DataMatrix, Maxi Code, QR Code, Chinese letter co etc..Wherein quick response codes (QR code), are by Denso Wave Company's exploitation, become international standard later, especially rapidly become one kind in transport, manufacture and retail trade now makes extensively Inventory tracking and recognition methods are even more to occupy a tiny space in anti-counterfeit field.Due to popularizing for smart mobile phone, it is easy to Online resource is decoded and is accessed, and because of its high storage capacity and decoding speed, it is specific right that QR codes become daily acquisition As the common type of/event information, more become one of most popular Quick Response Code, therefore the Quick Response Code mentioned in following context all refers to QR codes.
In existing anti-fake two-dimension code technology, common are cover hidden two-dimension code anti-counterfeit, the encrypted two-dimension code anti-counterfeit of multiple information, Invisible two-dimensional codes are anti-fake, two-dimension code anti-counterfeit based on digital watermarking, all there are various deficiencies.Hidden two-dimension code anti-counterfeit is covered, In the case where keeping the original structure of bar code constant, with hot stamping equipment, labeling device, printing equipment, light is carried out to Quick Response Code Chemical treatment can not be by duplicating hand because capped 2 D code information naked eyes can not be seen therefore have very strong security performance Duan Jinhang duplications improve anti-counterfeiting performance, but must have it is dedicated cover hidden two-dimentional code decoder and could decode, user can not be autonomous True and false information is obtained, use cost is high.Multiple information ciphering two-dimension code is anti-fake, text encryption is obtained ciphertext, and obtained by sectional drawing The image is embedded into QR codes by ciphertext image, obtains the Quick Response Code Image for including encrypted image, and multi-layer security improves Security performance, its product process is excessively cumbersome, although manufacturing cost is low, but generates longer with decoding time.Invisible two-dimensional codes It is anti-fake, it is researched and developed at first by Univ South Dakota of the U.S., mixes the fluorescent ink of Green Blue and mix group of the lanthanides nano particle, And print to these nano particles on the Quick Response Code material object drawn out with CAD by aerosol jet printer, it generates at this time Visually see less than two-dimensional bar code, which must could scan by infrared laser, although having very high steady Qualitative, confidentiality and antifalsification, but generated time long (about 90 minutes) and cost it is excessively high, which is not popularized.Cause This, it is that anti-fake two-dimension code is badly in need of solving to reduce cost, reduction generation and decoding time, simplified anti-fake flow, raising anti-counterfeiting performance etc. Key problem certainly.
Improve two-dimension code anti-counterfeit performance, be always the ultimate challenge that two-dimension code anti-fake field faces, for this challenge from Produce effective anti-fake two-dimension code direction expansion research.For various problem existing for existing anti-fake two-dimension code, research one Kind improves there are problem and effectively improves the anti-fake two-dimension code generation of anti-counterfeiting performance, decoding algorithm with very big practical application Value.
Invention content
The object of the present invention is to provide a kind of various dimensions two-dimensional code generation methods based on proprietary code, solve the prior art In anti-fake two-dimension code, the problem that cost of manufacture is high, anti-counterfeiting performance is low.
It is a further object of the present invention to provide a kind of various dimensions two dimension code coding method based on proprietary code.
The technical solution adopted by the present invention is a kind of various dimensions two-dimensional code generation method based on proprietary code, according to following Step is implemented:
The data that step 1, analysis are encoded, determine its character types, select pattern appropriate, are compiled to each sequence Code;
Version number used by user is specified, and determine and correct grade and error detection;
The data of input are converted to a bit stream, include mode indicators, character in bit stream by step 2, data encoding Count indicator, data bit stream, full stop, full stop are indicated with 0000;If data bit stream can just fill up symbol capacity, Then omit full stop;If when more than symbol capacity institute less than 4, then full stop is truncated;
Codeword sequence piecemeal is generated corresponding error correction code word, and add it to by step 3, Error Correction of Coding to press block Behind corresponding code word data sequence;
Step 4, the final information of construction, are divided into n blocks, to each according to version information and error-correction level by code word data sequence Block calculates corresponding error correction code word, each piece of data and error correction code word is assembled into final codeword sequence, if QR code signs Including data and error correction block cannot fill up the cardinality of symbol, need that remaining bit is added;
Step 5 determines corresponding long and wide square according to user-defined QR codes version number and each module size of Quick Response Code Battle array, arranges module, the final code that separator, view finding figure, correction graph, positioning pattern and step 4 are constructed in the matrix Word sequence is put into togerther matrix corresponding position, inserts the dark module of correctly light color, and temporarily vacant version information and format letter The module position of breath,
In the coding region of various dimensions two-dimensional code symbol, arrange that two modules are wide since the lower right position of symbol Then file sign character alternate carries out from right to left and from bottom to top or from top to bottom sign character arrangement;
Mask graph is applied to the coding region of symbol by step 6, mask respectively,
The purpose of mask is the reliability that energy balancing arrangement light module and dark module improve Quick Response Code reading with this;
Step 7 determines format information and version information, build version information and format information, and forms symbol;
Format information includes 5 data bit and 10 error correction bits totally 15 obtained by BCH (15,5) coding calculating;
Version information is 18, wherein 6 data bit calculate 12 error correction bits by BCH (18,6) codings.
Another technical solution that the present invention uses is a kind of various dimensions two dimension code coding method based on proprietary code, according to Following steps are implemented:
Step 1, first determines the centre coordinate of three position sensing figures, and which position position sensing figure is determined Shape is the rotation angle of upper left corner figure and symbol, so that it is determined that the orientation of symbol;It determines in upper left position detection figure The distance between the heart and the upper right corner position sensing centre of figure D, and the width L of the two detection figures is determined respectivelywWith Rw,
Then, according to LwWith RwThe width dimensions Y of each module of user-defined QR codes is calculated, calculation formula is as follows:
Y=(Lw+Rw)/14
Step 2, the version for primarily determining symbol, calculation formula are as follows:
V=(D/Y-10)/4
If step 3, the version number V primarily determined are not more than 6, the above V obtained that calculates is version number;If calculating V is not less than 7, then needs to redefine version number;
Step 4, the information for determining QR code correction graphs,
QR code begin with correction graph when from version number being 2, this is skipped if being 1 if the version number of various dimensions Quick Response Code Step 4, the centre coordinate for determining all correction graphs respectively according to version information determines sampling microwave network according to its centre coordinate;
The image pixel of each intersection point in step 5, sampling grid, determination are that light block or dark block, construction obtain one A bitmap, wherein dark pixels indicate that light pixel is indicated with Binary Zero with binary one;
Step 6, a pair format information adjacent with various dimensions Quick Response Code upper left zone position detection figure decode, and obtain for according with Number mask graph and error-correction level;
Equally, if it find that the mistake of the format information has exceeded error correction capability, then identical program pair and upper right are used Portion and the adjacent format information of lower left quarter position sensing figure are into row decoding;
Step 7 carries out XOR processing with mask graph to symbolic coding region, restores the symbol for indicating error correction and code word data Sign character;This step and the effect for the mask process that various dimensions Quick Response Code coded program uses are exactly the opposite
Step 8 determines symbol code word according to queueing discipline;
Step 9, according to error-correction level and various dimensions Quick Response Code version, again press block arrange codeword sequence;
Step 10, according to error-correcting decoding program and error-detecting routine, read error and alternative mistake are refused to correct, until full Error correction capability as defined in sufficient error-correction level and symbol version;
Step 11, reset Configuration Data block sequence, to restore original data bit stream;
Step 12 is divided into data bit stream corresponding section, and each section of paragraph header is mode indicators, and length is by counting indicator Symbol determines;
Step 13, according to pattern rules, decode per one piece of data;
If step 14, there are proprietary codes, step 8- steps 13 are recirculated after general code decodes, are obtained proprietary Code data;
Step 15, proprietary code data and general code data using acquisition complete decoding.
The invention has the advantages that various dimensions Quick Response Code has used general code and proprietary code on coding so that coding It is not reproducible and forge with uniqueness, it can ensure that product is unique and authenticity.Wherein, general code passes through common two dimension Code scanning software scanning is arrived, but the various dimensions two dimension code decoder that proprietary code can only be generated by the decoding algorithm with the present invention Scanning.Various dimensions two-dimension code anti-counterfeit technology is automatic, accurate, and for current existing anti-counterfeiting technology, advantage is have print The feature that at low cost, print speed printing speed is fast, printing area is small is brushed, traditional holographic trademark printing technology can be used to be printed, no It needs to develop new technological means for printing link.Manufacturer, retailer can be effectively improved to the control ability of product, energy It enough realizes the retrospect of product and quickly recalls, improve the information system management level of entire supply chain.
Description of the drawings
Fig. 1 is multidimensional code two-dimensional code anti-counterfeiting label hierarchical relationship figure;
Fig. 2 is upper position detection figure;
Fig. 3 is position sensing figure and version information;
Fig. 4 is the position of the position of regular character upward or downward;
Fig. 5 is the main interface of various dimensions two-dimension code generator;
Fig. 6 is to decode result to various dimensions Quick Response Code in Fig. 5 using common code reader;
Fig. 7 is to decode result to various dimensions Quick Response Code in Fig. 5 using various dimensions two dimension code decoder of the present invention.
Specific implementation mode
Referring to Fig.1, present invention various dimensions two-dimensional code anti-counterfeiting label hierarchical structure as described below is Quick Response Code identification layer packet Containing general code and proprietary code, it is covered with anti-forgery ink layer on Quick Response Code identification layer, laser anti-counterfeit layer is covered on anti-forgery ink layer.
The present invention is based on the various dimensions two-dimensional code generation methods of proprietary code, implement according to the following steps:
The data that step 1, analysis are encoded, determine its character types, select pattern appropriate, to each sequential coding (the count indicator length of different mode and different editions is different);Version number used by user is specified, and determination is entangled Positive grade and error detection;
The data of input are converted to a bit stream, include mode indicators (4 in bit stream by step 2, data encoding Position), character count indicator, data bit stream, full stop (or be end mark), full stop is indicated with 0000, if data bit Stream can just fill up symbol capacity, then omit full stop;If when more than symbol capacity institute less than 4, then full stop is truncated.
The data portion of various dimensions Quick Response Code includes general code and private code, is added after general code generation data bit stream general Code full stop 0000;If there are private codes at this time, the mode indicators of private code are continued to fill up after full stop, counting refers to The data bit stream for showing symbol, proprietary code finally adds the full stop 0000 of all data again;
The circulation of the binary data bit of generation is changed to code word again, the length of each code word is 8, if entire data bit The last one code word of stream is then filled with 8 less than 8 with 0 (binary system);Alternately addition carrys out filler code for error-correction level and version Word, growth data bit stream, and error correction code word is added in code word data sequence;When necessary be added fill character (Binary Zero) with Fill up the code word data number according to release requirement.
The various dimensions Quick Response Code that this step generates using mixed mode, convert to indicate number by mutual between permission pattern According to.It is illustrated by figure pattern of the data of input:Figure pattern need by etc. packet to be encoded, every group three, And every group of data are converted into binary number (10);If the data bits inputted is not 3 integral multiple, it is remaining 1 or 2 bit digitals should be respectively converted into 4 bits or 7 bits.
Codeword sequence piecemeal is generated corresponding error correction code word, and add it to by step 3, Error Correction of Coding to press block Behind corresponding code word data sequence.
Step 4, the final information of construction, are divided into n blocks, to each according to version information and error-correction level by code word data sequence Block calculates corresponding error correction code word, each piece of data and error correction code word is assembled into final codeword sequence, if QR code signs Including data and error correction block cannot fill up the cardinality of symbol, need that remaining bit (i.e. Binary Zero) is added,
Concrete mode is,
First according to error-correction level and version information proprietary codeword sequence and general codeword sequence be respectively divided into n blocks and M blocks;Then corresponding error correction code word is calculated to each piece;Finally every piece of data and error correction code word are assembled into successively final Codeword sequence:The code word 1 of data block 1;The code word 1 of data block 2;The code word 1 of data block 3;And so on to data block n-1 most Code word afterwards;The last code word of data block n;Then, the code word 1 of error correction block 1, the code word 1 ... of error correction block 2 and so on extremely The last code word of error correction block n-1;The last code word of error correction block n.
Such as the final code word sequence of version 5-h symbols is:
d1,d12,d23,d35,d2,d13,d24,d36,...d11,d22,d33,d45,d34,d46,e1,e23,e45, e67,e2,e24,e46,e68,...e22,e44,e66,e88.If desired, adding remaining bit (0) behind last code word.
Step 5 determines corresponding long and wide square according to user-defined QR codes version number and each module size of Quick Response Code Battle array, arranges module, the final code that separator, view finding figure, correction graph, positioning pattern and step 4 are constructed in the matrix Word sequence is put into togerther matrix corresponding position, inserts the dark module of correctly light color, and temporarily vacant version information and format letter The module position of breath,
In the coding region of various dimensions two-dimensional code symbol, arrange that two modules are wide since the lower right position of symbol Then file sign character alternate carries out from right to left and from bottom to top or from top to bottom sign character arrangement.
Mask graph is applied to the coding region of symbol by step 6, mask respectively.
The purpose of mask is the reliability that energy balancing arrangement light module and dark module improve Quick Response Code reading with this,
Concrete mode is,
Functional graphic first is without mask, then with multiple matrixes constantly to the module figure of corresponding coding region (except version information and format information) carries out xor operation, which has once been placed on each mask artwork respectively In shape, then the module of the light module of corresponding mask graph is negated (dark color becomes light color, or opposite).
The formation condition of mask graph is as shown in table 1, wherein a represent row position, b represent row position, (a, b)= (0,0) position in the entire symbol upper left corner is indicated.
The formation condition of table 1, mask graph
Mask graph refers to Condition
000 (a+b) mod 2=0
001 A mod 2=0
010 B mod 3=0
011 (a+b) mod 3=0
100 ((a div 2)+(b div 3)) mod 2=0
101 (a b) mod 2+ (a b) mod 3=0
110 ((a b) mod 2+ (a b) mod 3) mod 2=0
111 ((a b) mod 3+ (a+b) mod 2) mod 2=0
The score of mask results is as shown in table 2, and wherein N1~N4 indicates 3,3,40,10 respectively, refers to penalty score Weight, a are that the identical block number of adjacent block color is more than 5 numbers occurred, and i indicates the ratio shared by the symbol of dark module Ask poor with 50%.Then undesirable result visuals is scored, to assess these as a result, finally selection score is minimum Figure.
The score of table 2, mask results
Step 7 determines format information and version information, build version information (if desired) and format information, and forms symbol Number,
Format information includes 5 data bit and 10 error correction bits totally 15 obtained by BCH (15,5) coding calculating;
Version information is 18, wherein 6 data bit calculate 12 error correction bits by BCH (18,6) codings.
The various dimensions two dimension code coding method of the present invention, implements according to the following steps:
Step 1, first determines the centre coordinate of three position sensing figures, and which position position sensing figure is determined Shape is the rotation angle of upper left corner figure and symbol, so that it is determined that the orientation of symbol;It determines in upper left position detection figure The distance between the heart and the upper right corner position sensing centre of figure D, and the width L of the two detection figures is determined respectivelywWith Rw, Fig. 2 Figure is detected for upper position.
Then, according to LwWith RwThe width dimensions Y of each module of user-defined QR codes is calculated, calculation formula is as follows:
Y=(Lw+Rw)/14
Step 2, the version for primarily determining symbol, calculation formula are as follows:
V=(D/Y-10)/4
If step 3, the version number V primarily determined are not more than 6, the above V obtained that calculates is version number;If calculating V is not less than 7, then needs to redefine version number.
The decoding process of version information is as follows:
3.1) computing module size X, X=Rw/7;
3.2) leading line determined by the center of three position sensing figures is found out,
According to the centre coordinate of multidimensional Quick Response Code position sensing figure, module size X and be parallel to the straight line of leading line come Determine that the sampling grid in 1 region of version information, 1 position of version information are as shown in Figure 3;And according to deep, shallow on sampling grid Figure determines Binary Zero and 1;
3.3) version is determined with error correction by detection, if wrong, according to BCH error correction principles, believed in version to correct Cease the mistake that module is found;
If 3.4) occur mistake have exceeded error correction capability, according to above-mentioned steps 3.1), 3.2), 3.3) to version information (version information is obtained in generation step 7, the generation and filling in a matrix of version information symbol and conventional two-dimensional in 2 regions Code it is consistent, therefore be not described in detail, position of the version information in Quick Response Code as shown in figure 3, version information 1 here, Version information 2 only is identified to facilitate description, not actually there are two version information) into row decoding, 2 position of version information As shown in Figure 3.
Step 4, the letter for determining QR codes correction graph (QR codes correction graph generates in various dimensions Quick Response Code generation step 5) Breath.
QR code begin with correction graph when from version number being 2, this is skipped if being 1 if the version number of various dimensions Quick Response Code Step 4, the centre coordinate for determining all correction graphs respectively according to version information determines sampling microwave network according to its centre coordinate.
The image pixel of each intersection point in step 5, sampling grid, determination are that light block or dark block, construction obtain one A bitmap, wherein dark pixels indicate that light pixel is indicated with Binary Zero with binary one.
Step 6, a pair format information adjacent with various dimensions Quick Response Code upper left zone position detection figure decode, and obtain for according with Number mask graph and error-correction level;
Equally, if it find that the mistake of the format information has exceeded error correction capability, then identical program pair and upper right are used Portion and the adjacent format information of lower left quarter position sensing figure are into row decoding.
Step 7, carrying out XOR processing to symbolic coding region with mask graph (step 6 obtains mask graph), (exclusive or is transported Calculate), restore the sign character for indicating error correction and code word data;At the mask that this step is used with various dimensions Quick Response Code coded program The effect of reason process is exactly the opposite.
Step 8 determines symbol code word (being code word data and sign character) according to queueing discipline.
The layout rules of position and sign character are in the character of various dimensions Quick Response Code:
8.1) bit sequence is disposed in file from right to left, downward or upward should be unified with the placement direction of sign character;
8.2) position 7 of each code word is highest order, should be placed on first usable module position, later and so on It is placed on next available module position;It is illustrated in figure 4 the arrangement of the position of regular character upward or downward, if use Arranged direction is upward, and highest order 7 is located at the lower right corner of regular character, and according to opposite direction, then highest order 7 is located at the upper right corner;
8.3) if two module files of sign character encounter the horizontal boundary of positioning pattern or correction graph simultaneously, In the upper surface of figure or arrangement can be continued with, as being continuous coding region;
If 8.4) encounter sign character region up or down boundary (i.e. the edge of symbol, format information, version information or Separator), remaining position should change direction and be placed in the file in left side in code word.
If 8.5) right module file encounters the region that correction graph or version information occupy, arrangement will be not Regularly arranged, it should continue to extend in the single file of adjacent correction figure or version information;Character can be in next word In the case of terminating before two files of symbol, first of next character is placed in single file.
Step 9, according to error-correction level and various dimensions Quick Response Code version, again press block arrange codeword sequence.
Step 10, according to error-correcting decoding program and error-detecting routine, read error and alternative mistake are refused to correct, until full Error correction capability as defined in sufficient error-correction level and symbol version.
Step 11, reset Configuration Data block sequence, to restore original data bit stream.
Step 12 is divided into data bit stream corresponding section, and each section of paragraph header is mode indicators, and length is by counting indicator Symbol determines.
Step 13, according to pattern rules, decode per one piece of data.
If step 14, there are proprietary codes, step 8- steps 13 are recirculated after general code decodes, are obtained proprietary Code data.
Step 15, proprietary code data and general code data using acquisition complete decoding.
Therefore the present invention is based on the generation of the various dimensions Quick Response Code of proprietary code and interpretation methods, most with conventional two-dimensional code Big difference is in data encoding stage and data decoding stage.
First, the data encoding stage
The data of input are converted to a bit stream, mainly include mode indicators (4), character count indicator, Data bit stream, full stop (end mark).Full stop is indicated with 0000, if data bit stream can just fill up symbol capacity, Omit full stop, if symbol remaining off-capacity 4 when, then full stop can be truncated.The data of various dimensions Quick Response Code Part includes general code and private code, and general code generates addition general code full stop 0000 after data bit stream, if existing at this time special The mode indicators of private code, the data bit stream of count indicator, proprietary code are then continued to fill up after full stop with code, finally The full stop 0000 of all data is added again.
The circulation of the binary data bit of generation is changed to code word again, the length of each code word is 8, if entire bit stream The last one code word is then filled with 8 less than 8 with 0 (binary system).Error-correction level and version alternately add to fill code word, Extended data stream, and error correction code word is added in code word data sequence;If the number of words of the numeric data code of release requirement cannot be filled up, need Addition is filled character.
For the various dimensions Quick Response Code that the present invention generates using mixed mode, mutual conversion between permission pattern indicates number According to.It is illustrated with the data bits word pattern of input:Figure pattern need by etc. packet to be encoded, every group three, And every group of data are converted into binary number (10).If the digit of data cannot be divided exactly by 3, then remaining one digit number Word will be converted to tetrad, and remaining two digits will be converted to seven bits.
For example, the data of input are:General code is 01234, and proprietary code is 9018.
1) general code and private code are divided into every three one group respectively:It is 012 and 34 that general code 01234, which is divided, proprietary code 9018 points are 901 and 8.
2) every group of data are converted as binary data:
012——0000001100;34——0100010;
901——1110000101;8——1000.
3) connection binary data is a sequence, because the existing proprietary code of various dimensions Quick Response Code has general code again, A sequence will be generated respectively:
Universal code sequence is 0,000,001,100 0100010,
Proprietary code sequence is 1,110,000,101 1000.
4) character number of proprietary code and general code is converted into binary system respectively,
General code character number is:5 --- 0000000101,
Proprietary code character number is:4——0000000100.
5) 3) mode indicators and count indicator will be added before the data binary sequence obtained, general code is: 0001 0000000101 0000001100 0100010;
Proprietary code is:0001 0000000100 1110000101 1000.
6) general code data are added into full stop 0000 by the binary data bit stream 5) obtained, then proprietary code bit is written The end mark 0000 of stream and proprietary code, obtains all final data bit streams:0001 0000000101 0000001100 0100010 0000 0001 0000000100 1110000101 1000 0000。
Second, the data decoding stage
Data decoding is the inverse process of data encoding, is decoded to the end position of general code, if there are proprietary codes at this time simultaneously It does not mean that decoding terminates, to continue to decode, until proprietary code full stop.
The key step of data decoding includes:
1) symbol code word is determined according to queueing discipline.
2) according to error-correction level and symbol version, block is pressed again and arranges subsequence.
3) according to error-correcting decoding program and error-detecting routine, read error and replacement mistake are refused to correct, until error correction etc. Error correction capability as defined in grade and symbol version.
4) reset Configuration Data block sequence, to restore the bit stream of initial data.
5) data bit stream is divided into corresponding section, each section of paragraph header bit pattern indicator, length is by count indicator It determines.
6) it according to pattern rules, decodes per one piece of data.
If 7) there are proprietary codes, to continue step 1 after general code decodes and arrive step 6, obtain proprietary code data.
8) it obtains proprietary code and general code data, decoding process terminates.
With the above-mentioned various dimensions Quick Response Code generation of the present invention and decoding algorithm, the multidimensional applied to Android system is produced It spends Quick Response Code and generates APP (being known as various dimensions two-dimension code generator) and various dimensions Quick Response Code decoding APP (referred to as various dimensions two dimensions Code decoder), corresponding data are filled according to user demand, generate exclusive various dimensions Quick Response Code.The multidimensional that the present invention generates Degree Quick Response Code visual effect is consistent with traditional Quick Response Code, and Fig. 5 illustrates the main interface of various dimensions two-dimension code generator, fills out first General code is write, then chooses whether to need hiding information, proprietary code is applied if necessary to hiding information, then to fill in data. If selecting the option of not hiding information, the Quick Response Code generated is not different with what ordinary two dimensional code generator generated, most The various dimensions Quick Response Code of generation can be shown on the right side of main interface by clicking encoder buttons afterwards.
Fig. 6 is with " sweep and sweep " functionality scan in the wechat APP installed on iPhone5s mobile phones as a result, wechat APP General code information has only been decoded out for Fig. 6.
Fig. 7 illustrates the main interface of various dimensions two dimension code decoder of the present invention, and such as Fig. 7 clicks various dimensions two dimension of the present invention The button that scans the two-dimensional code of code generator is scanned, and scanning result can be shown below interface, can not only scan general code Information can also scan proprietary code information.

Claims (7)

1. a kind of various dimensions two-dimensional code generation method based on proprietary code, which is characterized in that implement according to the following steps:
The data that step 1, analysis are encoded, determine its character types, select pattern appropriate, to each sequential coding;
Version number used by user is specified, and determine and correct grade and error detection;
The data of input are converted to a bit stream, include mode indicators, character count in bit stream by step 2, data encoding Indicator, data bit stream, full stop, full stop are indicated with 0000;If data bit stream can just fill up symbol capacity, save Slightly full stop;If when more than symbol capacity institute less than 4, then full stop is truncated;
Codeword sequence piecemeal is generated corresponding error correction code word, and add it to corresponding by step 3, Error Correction of Coding to press block Code word data sequence behind;
Step 4, the final information of construction, are divided into n blocks by code word data sequence according to version information and error-correction level, are counted to each piece Corresponding error correction code word is calculated, each piece of data and error correction code word are assembled into final codeword sequence, if QR code signs are wrapped The data and error correction block that contain cannot fill up the cardinality of symbol, need that remaining bit is added;
Step 5 determines corresponding long and wide matrix according to user-defined QR codes version number and each module size of Quick Response Code, Module is arranged in the matrix, the final code word sequence that separator, view finding figure, correction graph, positioning pattern and step 4 are constructed It is put into togerther matrix corresponding position, inserts the dark module of correctly light color, and the temporarily mould of vacant version information and format information Block position,
In the coding region of various dimensions two-dimensional code symbol, the wide file of two modules is arranged since the lower right position of symbol Then sign character alternate carries out from right to left and from bottom to top or from top to bottom sign character arrangement;
Mask graph is applied to the coding region of symbol by step 6, mask respectively,
The purpose of mask is the reliability that energy balancing arrangement light module and dark module improve Quick Response Code reading with this;
Step 7 determines format information and version information, build version information and format information, and forms symbol;
Format information includes 5 data bit and 10 error correction bits totally 15 obtained by BCH (15,5) coding calculating;Version information It it is 18, wherein 6 data bit calculate 12 error correction bits by BCH (18,6) codings.
2. the various dimensions two-dimensional code generation method according to claim 1 based on proprietary code, which is characterized in that the step In rapid 2, concrete mode is,
The data portion of various dimensions Quick Response Code includes general code and private code, and addition general code is whole after general code generates data bit stream Only accord with 0000;If there are private codes at this time, mode indicators, the counting indicator of private code are continued to fill up after full stop The data bit stream of symbol, proprietary code, finally adds the full stop 0000 of all data again;
The circulation of the binary data bit of generation is changed to code word again, the length of each code word is 8, if entire data bit stream The last one code word is then filled with 8 less than 8 with 0;Error-correction level and version alternately add to fill code word, growth data Bit stream, and error correction code word is added in code word data sequence;It is added and is filled character to fill up the number according to release requirement when necessary According to number of codewords.
3. the various dimensions two-dimensional code generation method according to claim 1 based on proprietary code, which is characterized in that the step In rapid 4, concrete mode is,
Proprietary codeword sequence and general codeword sequence are respectively divided into according to error-correction level and version information by n blocks and m blocks first; Then corresponding error correction code word is calculated to each piece;Every piece of data and error correction code word are finally assembled into final code word successively Sequence:The code word 1 of data block 1;The code word 1 of data block 2;The code word 1 of data block 3;And so on it is last to data block n-1 Code word;The last code word of data block n;Then, the code word 1 of error correction block 1, the code word 1 ... of error correction block 2 and so on to error correction The last code word of block n-1;The last code word of error correction block n.
4. the various dimensions two-dimensional code generation method according to claim 1 based on proprietary code, which is characterized in that the step In rapid 6, concrete mode is,
Functional graphic first is without mask, then with multiple matrixes constantly to the module figure of corresponding coding region, into Row xor operation, which has once been placed on each mask graph respectively, then corresponding mask graph The module of light module negate,
The formation condition of mask graph is as shown in table 1, and wherein a represents the position of row, and b represents the position of row, (a, b)=(0,0) Indicate the position in the entire symbol upper left corner,
The formation condition of table 1, mask graph
Mask graph refers to Condition 000 (a+b) mod 2=0 001 A mod 2=0 010 B mod 3=0 011 (a+b) mod 3=0 100 ((a div 2)+(b div 3)) mod 2=0 101 (a b) mod 2+ (a b) mod 3=0 110 ((a b) mod 2+ (a b) mod 3) mod 2=0 111 ((a b) mod 3+ (a+b) mod 2) mod 2=0
The score of mask results is as shown in table 2,
The score of table 2, mask results
N1~N4 indicates 3,3,40,10 respectively in table 2, refers to that the weight of penalty score, a are identical piece of adjacent block colors Number is more than 5 numbers occurred, and i indicates that the ratio and 50% shared by the symbol of dark module asks poor;Then undesirable The score of result visuals, to assess these as a result, the last minimum figure of selection score.
5. a kind of various dimensions two dimension code coding method based on proprietary code, which is characterized in that implement according to the following steps:
Step 1, first determines the centre coordinate of three position sensing figures, and determines which position position sensing figure is The rotation angle of upper left corner figure and symbol, so that it is determined that the orientation of symbol;Determine upper left position detection centre of figure with The distance between upper right corner position sensing centre of figure D, and the width L of the two detection figures is determined respectivelywWith Rw,
Then, according to LwWith RwThe width dimensions Y of each module of user-defined QR codes is calculated, calculation formula is as follows:
Y=(Lw+Rw)/14
Step 2, the version for primarily determining symbol, calculation formula are as follows:
V=(D/Y-10)/4
If step 3, the version number V primarily determined are not more than 6, the above V obtained that calculates is version number;If the V calculated is not Less than 7, then need to redefine version number;
Step 4, the information for determining QR code correction graphs,
QR code from version number be 2 when begin with correction graph, if various dimensions Quick Response Code version number be 1 if skip this step 4, it determines the centre coordinate of all correction graphs respectively according to version information, sampling microwave network is determined according to its centre coordinate;
The image pixel of each intersection point in step 5, sampling grid, determination are that light block or dark block, construction obtain a position Figure, wherein dark pixels are indicated with binary one, and light pixel is indicated with Binary Zero;
Step 6, a pair format information adjacent with various dimensions Quick Response Code upper left zone position detection figure decode, and obtain for symbol Mask graph and error-correction level;
Equally, if it find that the mistake of the format information has exceeded error correction capability, then use identical program pair and upper right quarter and The adjacent format information of lower left quarter position sensing figure is into row decoding;
Step 7 carries out XOR processing with mask graph to symbolic coding region, restores the symbol word for indicating error correction and code word data Symbol;This step and the effect for the mask process that various dimensions Quick Response Code coded program uses are exactly the opposite;
Step 8 determines symbol code word according to queueing discipline;
Step 9, according to error-correction level and various dimensions Quick Response Code version, again press block arrange codeword sequence;
Step 10, according to error-correcting decoding program and error-detecting routine, refuse read error and alternative mistake to correct, until meet entangle Error correction capability as defined in wrong grade and symbol version;
Step 11, reset Configuration Data block sequence, to restore original data bit stream;
Step 12 is divided into data bit stream corresponding section, and each section of paragraph header is mode indicators, and length is true by count indicator It is fixed;
Step 13, according to pattern rules, decode per one piece of data;
If step 14, there are proprietary codes, step 8- steps 13 are recirculated after general code decodes, obtain proprietary yardage According to;
Step 15, proprietary code data and general code data using acquisition complete decoding.
6. the various dimensions two dimension code coding method according to claim 5 based on proprietary code, which is characterized in that the step In rapid 3, the decoding process of version information is as follows:
3.1) computing module size X, X=Rw/7;
3.2) leading line determined by the center of three position sensing figures is found out,
According to the centre coordinate of multidimensional Quick Response Code position sensing figure, module size X and it is parallel to the straight line of leading line and determines Sampling grid in 1 region of version information, 1 position of version information are as shown in Figure 3;And according to deep, the shallow figure on sampling grid To determine Binary Zero and 1;
3.3) version is determined with error correction by detection, if wrong, according to BCH error correction principles, to correct in version information mould The mistake that block is found;
If 3.4) occur mistake have exceeded error correction capability, according to above-mentioned steps 3.1), 3.2), 3.3) to 2nd area of version information Domain is into row decoding.
7. the various dimensions two dimension code coding method according to claim 5 based on proprietary code, which is characterized in that the step In rapid 8,
The layout rules of position and sign character are in the character of various dimensions Quick Response Code:
8.1) bit sequence is disposed in file from right to left, downward or upward should be unified with the placement direction of sign character;
8.2) position 7 of each code word be highest order, first usable module position should be placed on, later and so on be placed on Next available module position;If the arranged direction used is upward, highest order 7 is located at the lower right corner of regular character, if adopting With opposite direction, then highest order 7 is located at the upper right corner;
It, can be with 8.3) if two module files of sign character encounter the horizontal boundary of positioning pattern or correction graph simultaneously In the upper surface of figure or arrangement is continued with, as being continuous coding region;
If 8.4) encounter the up or down boundary in sign character region, remaining position should change direction and be placed on the vertical of left side in code word In row;
If 8.5) right module file encounters the region that correction graph or version information occupy, arrangement will be irregular Arrangement, it should continue to extend in the single file of adjacent correction figure or version information;Character can be in character late In the case of terminating before two files, first of next character is placed in single file.
CN201810532634.XA 2018-05-29 2018-05-29 Various dimensions Quick Response Code based on proprietary code generates and interpretation method Pending CN108734048A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810532634.XA CN108734048A (en) 2018-05-29 2018-05-29 Various dimensions Quick Response Code based on proprietary code generates and interpretation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810532634.XA CN108734048A (en) 2018-05-29 2018-05-29 Various dimensions Quick Response Code based on proprietary code generates and interpretation method

Publications (1)

Publication Number Publication Date
CN108734048A true CN108734048A (en) 2018-11-02

Family

ID=63936566

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810532634.XA Pending CN108734048A (en) 2018-05-29 2018-05-29 Various dimensions Quick Response Code based on proprietary code generates and interpretation method

Country Status (1)

Country Link
CN (1) CN108734048A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112001469A (en) * 2020-08-12 2020-11-27 北京太和互邦科技有限公司 Two-dimensional code encoding method, decoding method and two-dimensional code
CN114254719A (en) * 2021-12-17 2022-03-29 广州市宝绅科技应用有限公司 Novel anti-counterfeiting two-dimensional code generation method and device
CN117032085A (en) * 2023-08-04 2023-11-10 安徽捷圆电子科技有限公司 Automatic control method and system for AOI machine connection and application thereof

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103400173A (en) * 2013-07-25 2013-11-20 中国科学院信息工程研究所 Generating method and reading method of two-dimensional code containing private information
CN104239926A (en) * 2013-06-14 2014-12-24 江南大学 Child straying preventing clothes based on two-dimension code technology
CN104992207A (en) * 2015-06-16 2015-10-21 无锡久源软件科技有限公司 Mobile phone two-dimensional bar code coding and decoding method
CN105224974A (en) * 2014-06-30 2016-01-06 北京大学 A kind of method hidden Info in matrix two-dimensional code and method for anti-counterfeit
CN105706118A (en) * 2013-10-30 2016-06-22 凸版Tdk标签株式会社 2D-code generation method, 2D-code generation device, 2D-code reading method, 2D-code reading device, 2D code, and program
CN106529633A (en) * 2015-09-10 2017-03-22 阿里巴巴集团控股有限公司 Two-dimensional code generation method and decoding method and device
CN106815544A (en) * 2017-01-16 2017-06-09 武汉大学 A kind of information concealing method based on Quick Response Code
CN107122816A (en) * 2017-03-20 2017-09-01 广东顺德中山大学卡内基梅隆大学国际联合研究院 A kind of self-defined view finding figure Quick Response Code and generation method
CN107563475A (en) * 2017-07-18 2018-01-09 中国农业大学 A kind of coding method of Quick Response Code and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104239926A (en) * 2013-06-14 2014-12-24 江南大学 Child straying preventing clothes based on two-dimension code technology
CN103400173A (en) * 2013-07-25 2013-11-20 中国科学院信息工程研究所 Generating method and reading method of two-dimensional code containing private information
CN105706118A (en) * 2013-10-30 2016-06-22 凸版Tdk标签株式会社 2D-code generation method, 2D-code generation device, 2D-code reading method, 2D-code reading device, 2D code, and program
CN105224974A (en) * 2014-06-30 2016-01-06 北京大学 A kind of method hidden Info in matrix two-dimensional code and method for anti-counterfeit
CN104992207A (en) * 2015-06-16 2015-10-21 无锡久源软件科技有限公司 Mobile phone two-dimensional bar code coding and decoding method
CN106529633A (en) * 2015-09-10 2017-03-22 阿里巴巴集团控股有限公司 Two-dimensional code generation method and decoding method and device
CN106815544A (en) * 2017-01-16 2017-06-09 武汉大学 A kind of information concealing method based on Quick Response Code
CN107122816A (en) * 2017-03-20 2017-09-01 广东顺德中山大学卡内基梅隆大学国际联合研究院 A kind of self-defined view finding figure Quick Response Code and generation method
CN107563475A (en) * 2017-07-18 2018-01-09 中国农业大学 A kind of coding method of Quick Response Code and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
中国物品编码中心编著: "《二维条码技术与应用》", 31 July 2007 *
张兴华: "矩阵式快速QR码的研究和应用", 《中国优秀硕士学位论文全文数据库信息科技辑》 *
曾子剑: "基于QR二维码编解码技术的研究与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112001469A (en) * 2020-08-12 2020-11-27 北京太和互邦科技有限公司 Two-dimensional code encoding method, decoding method and two-dimensional code
CN112001469B (en) * 2020-08-12 2024-01-30 北京太和互邦科技有限公司 Two-dimensional code encoding method, decoding method and two-dimensional code
CN114254719A (en) * 2021-12-17 2022-03-29 广州市宝绅科技应用有限公司 Novel anti-counterfeiting two-dimensional code generation method and device
CN114254719B (en) * 2021-12-17 2022-11-22 广州市宝绅科技应用有限公司 Anti-counterfeiting two-dimensional code generation method and device
CN117032085A (en) * 2023-08-04 2023-11-10 安徽捷圆电子科技有限公司 Automatic control method and system for AOI machine connection and application thereof

Similar Documents

Publication Publication Date Title
CN106529633B (en) Generation method, coding/decoding method and the device of two dimensional code
CN100369059C (en) Matrix type two-dimensional bar code and its encoding and decoding method
CN105095935B (en) A kind of low-density having merged Chaos Encryption Technology, high coding capacity dot matrix Quick Response Code
EP2849115B1 (en) Method for decoding matrix-type two-dimensional code
AU2010360998B2 (en) Two-dimensional identification pattern, article including such a pattern, and methods for marking and identifying such a pattern
CN105069497B (en) A kind of method for the Quick Response Code for generating beautification
CN105224974B (en) The method and method for anti-counterfeit of hiding information in a kind of matrix two-dimensional code
JP2001519068A (en) Distortion-resistant double data correction color transition barcode and its generation and use
CN108734048A (en) Various dimensions Quick Response Code based on proprietary code generates and interpretation method
CA2502483A1 (en) Orientation-indicating cyclic position codes
EP0757823A1 (en) Machine readable binary codes
CN101086761A (en) Efficient information lattice image and its generation and decoding method
US8360333B2 (en) HD barcode
CN107563477A (en) Quick Response Code and its generation method and device
CN103617441A (en) Generating system and pattern recognition method of seal based on two-dimension code
CN103577986A (en) Multi-level two-dimension code fake preventing method
CN113313225B (en) Anti-counterfeiting method based on sparse dot matrix code
CN107247985A (en) Coding, positioning and the recognition methods of New Two Dimensional code
CN106845593A (en) A kind of rectangle fixes dot matrix information encoding-decoding method
CN102081747A (en) Two-dimensional bar code
CN109978110A (en) A kind of two dimensional code and coding/decoding method positioned for AGV with navigation
CN110991589A (en) Two-dimensional code and encryption method thereof
US8544741B2 (en) Data block offset encoding method for coordinates
JP2024505116A (en) Dot matrix code construction method, generation and reading method, terminal, and dot matrix code system
CN101777172A (en) Cellular automata-based blind watermark implementing method

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: 20181102