CN102004935A - LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes - Google Patents

LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes Download PDF

Info

Publication number
CN102004935A
CN102004935A CN 201010534320 CN201010534320A CN102004935A CN 102004935 A CN102004935 A CN 102004935A CN 201010534320 CN201010534320 CN 201010534320 CN 201010534320 A CN201010534320 A CN 201010534320A CN 102004935 A CN102004935 A CN 102004935A
Authority
CN
China
Prior art keywords
information
compression
coding
decoding
type
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
CN 201010534320
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN 201010534320 priority Critical patent/CN102004935A/en
Publication of CN102004935A publication Critical patent/CN102004935A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention relates to an LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes, comprising the following steps of: obtaining input information according to encoding type process of the input binary data information; carrying out lengthening compression or fixed-length compression on the input information; calculating an information length required for storing according to a compressed result, obtaining the information to be encoded according to the encoding type and the compression type; carrying out LDPC encoding compression on the information to be encoded; integrating the compressed result and the version information to obtain the compressed information; and setting a flag bit and generating a two dimensional bar code image. The encoding method has large information capacity and strong error correction capability; the aspect ratio can be optionally set; and various types of encoding are supported and the locating is easier.

Description

Two-dimensional bar code coding and coding/decoding method based on the LDPC sign indicating number
Technical field
The present invention relates to a kind of Code And Decode method of two-dimensional bar code, relate in particular to a kind of encoding and decoding method of the two-dimensional bar code based on the LDPC sign indicating number.
Background technology
Barcode technology has developed very rapidly since early 1970s comes out, and only 20 years, it has been widely used in fields such as commercial distribution, storage, health care, books information, postal service, railway, communications and transportation, production automation management.The application of barcode technology has greatly improved the speed of data acquisition and information processing, has improved people's work and living environment, has improved work efficiency, and is that significant contribution has been made in the scientific and modernization of managing.
What the barcode technology development was adopted in early days is bar code, comes expressing information by horizontal bar, sky, and data volume is less, can only store letter and number, and size is bigger, can not read after the damage.And in the application system of general commodity bar code, to merchandise news, as the description of date of manufacture, price etc. must dependency database support.In the place of not setting up merchandising database or inconvenience networking in advance, bar code represents that Chinese character and image information almost are impossible, even can represent, also seem very inconvenient and efficient very low.
Characteristics such as two-dimensional bar code has that storage capacity is big, confidentiality is high, tracking property height, anti-damage property is strong, redundant is big, cost is cheap, these characteristics are specially adapted to aspects such as list, safe and secret, tracking, license, stock taking, data redundant.
Want in the sign indicating number in present tens kinds of two dimensions, code system commonly used has: the PDF417 two-dimensional bar code, the Datamatrix two-dimensional bar code, Maxicode two-dimensional bar code, QR Code, Code 49, Code 16K, Code one etc. are except these common two-dimensional bar codes, also have Vericode bar code, CP bar code, Codablock F bar code, field character code, Ultracode bar code, the Aztec bar code.These two-dimensional bar codes can be divided into two classes: stack/row row formula two-dimensional bar code and matrix two-dimensional barcode.
Be that bar code by the multirow cutting back piles up and forms on stack/row row formula two-dimensional bar code form, inherited some characteristics of bar code at aspects such as code Design, verification principle, recognition modes, recognizing apparatus and bar code printing and bar code technical compatibility.But because the increase of line number, need judge row, its decoding algorithm and software is not entirely identical to bar code yet.Representational capable row's formula two-dimensional bar code has CODE49, CODE 16K, PDF417 etc.PDF 417 (US 5304786 A) is made up of a plurality of bar code Extra Section control patterns, shortcoming has been to adopt one based on 929 code words coded system of (4 black and white at interval), each bar code character can only be represented 9.2 bit data, greatly reduces the data volume of single PDF417 bar code.
Matrix two-dimensional barcode claims the checkerboard type two-dimensional bar code again, forms with the form of matrix, with " point " expression binary one, represents binary zero with " sky ", by the code that rearranges of " point " and " sky " on matrix respective element position.Representative matrix two-dimensional barcode has: Code One, Maxi Code, QR Code, Data Matrix etc.QR Code is that bar code can only be square by the matrix two-dimension code that is used for industrial automation of Japanese Denso company in September, 1994 development, and can not the scan-synchronized decoding.Though QR Code can represent Chinese character, expression quantity limits to some extent.Capacity is restriction to some extent also, only can represent 1817 " Chinese character " characters in theory.During 750 error correction, its maximum data capacity is 2956 bytes when 177 Z sizes of its maximum area and error correcting capability are minimum.QR Code, Data Matrix etc. are than the square that tends to simple readability at the beginning of the design of Versatile two-dimension sign indicating number, and in the process that replaces the one dimension sign indicating number, the corresponding space of a whole page then needs redesign.
When these two-dimension codes are used for printed matter, because printed matter is easy to wearing and tearing, image in 2 D code is thickened, discrimination reduces, and two-dimension code does not in the market also have good solution.
The LDPC sign indicating number is low density parity check code (Low Density Parity Check Code, LDPC), it has sparse parity check matrix by the class that Robert doctor G.Gallager proposed in 1963, class liner code by the check matrix definition, for making decoding feasible, when code length is longer, need check matrix to satisfy " sparse property ", be that 1 density is lower in the check matrix, just require in the check matrix 1 the number number much smaller than 0, and code length is long more, and density will be low more.LDPC not only has the superperformance of approaching the Shannon limit, and decoding complexity is lower, and structure is flexible, is the research focus of field of channel coding in recent years, has been widely used in fields such as deep space communication, optical fiber communication, satellite digital video and audio broadcasting at present.The LDPC sign indicating number has become the 4th strong rival of generation communication system (4G), and is adopted by satellite digital video broadcast standard DVB-S2 of future generation based on the encoding scheme of LDPC sign indicating number.In up-to-date IEEE 802.16E, classify the recommendation coding method as.
Along with the development of modern high technology, press for bar code and in limited geometric space, represent more information, to satisfy the needs of Protean information representation.Particularly need the two-dimensional bar code that a kind of information capacity is big, error correcting capability is strong, Aspect Ratio preferably can be set arbitrarily, support that polytype is encoded, the location is easier.
Summary of the invention
Based on above reason, the invention is intended to provide the two-dimensional bar code that a kind of information capacity is big, error correcting capability is strong, Aspect Ratio preferably can be set arbitrarily, support that polytype is encoded, the location is easier.
For this reason, the invention provides a kind of coding method of the two-dimensional bar code based on LPDC coding, in order to will the input original binary data information by exporting and can it is characterized in that may further comprise the steps attached to the two-dimensional bar code on the carrier based on the code compression method of low density parity check code (LDPC):
A, handle the input information obtain the byte type according to the type of coding of the original binary data information of input;
B, the input information of this byte type is carried out first compression, compression type of this first compression can be elongated compression or fixed length compression;
C, according to first the compression the result calculate needs canned data length, obtain information to be encoded according to type of coding and compression type;
D, to this information to be encoded carry out second the compression, this second boil down to LDPC encoding compression;
E, result and the version information integration of second compression is obtained compressed information;
F, zone bit is set, generates two-dimensional barcode image.
In addition, the present invention also correspondingly provides a kind of coding/decoding method of the two-dimensional bar code based on LPDC coding.This method uses one dimensional linear array contact-type or non-contact type imageing sensor to obtain the view data of two-dimensional bar code, recovers binary data output information through the coding/decoding method based on LDPC, it is characterized in that may further comprise the steps:
A, employing average ashing method carry out ashing to the two-dimensional barcode image data, obtain each code element corresponding gray;
B, seek positioning mark and obtain the pixel size value according to the zone bit pattern;
C, read the effective information that ashing obtains according to pixel size value piecemeal;
D, employing binomial distribution method are optimized this effective information;
E, from effective information, intercept version information;
F, the effective information remainder of intercepting after the version information carried out first decoding, this LDPC decoding of first decoding;
G, intercepting comprises the header of type of coding and compression type from first result that obtain of decoding;
H, the result who first decoding is obtained according to header carry out second decoding;
I, generate binary data information according to second decoded results.
The present invention has done better correction at the limitation of existing two-dimension code simultaneously by two-dimension code and LDPC sign indicating number are effectively combined, and reformulates a cover and generates and the method for resolving two-dimension code, has the following advantages:
1. adopt the LDPC sign indicating number to replace the Reed-Solomon error correcting code,, obtain higher code check, increase code capacity at same code length.During decoding, soft output image information adopts belief propagation (BP) decoded mode, and blurred picture more easy to identify makes two-dimension code have stronger error correction.According to binomial distribution feature calculation code element 01 probability, increase decoding performance to fuzzy two-dimension code.
2. can Aspect Ratio be set arbitrarily, be convenient to replace existing rectangular one dimension sign indicating number.
3. acquiescence is supported GB18030 and UTF-8 type, supports self-defining other types coding simultaneously.
4. adopt fixed length and the elongated two kinds of compress modes of Huffman, improve the ratio of compression of information, further increase information capacity.
5. the space encoder of super large can be supported 65535 byte quantity of information in theory, and more than 20000 Chinese character easily compiled, separated in emulation testing.
6. cancel complexity and the two-dimension code finger URL pattern of practical degree shortcoming, effective location ease in use pattern, easier location.
Description of drawings
Describe flow process in detail hereinafter with reference to accompanying drawing according to the Code And Decode method of the two-dimensional bar code based on LPDC coding of the present invention.
Fig. 1 is the process flow diagram based on the coding method of the two-dimensional bar code of LPDC coding;
Fig. 2 is a LPDC coding method process flow diagram used in the present invention;
Fig. 3 is the process flow diagram based on the coding/decoding method of the two-dimensional bar code of LPDC coding;
Fig. 4 is a LPDC coding/decoding method process flow diagram used in the present invention;
Fig. 5 a and 5b constitute synoptic diagram for the present invention uses the node of Huffman compression;
Fig. 5 c constitutes synoptic diagram for the information bit that the present invention uses;
Fig. 6 is the synoptic diagram of the zone bit of two-dimensional bar code of the present invention; And
Fig. 7 is the synoptic diagram according to binomial distribution log likelihood ratios function of the present invention.
Embodiment
Describe the feature and the technique effect thereof of technical solution of the present invention in detail referring now to accompanying drawing, disclose a kind of two-dimensional bar code coding and coding/decoding method based on the LDPC sign indicating number.
Accompanying drawing 1 has shown the basic procedure according to the two-dimensional bar code coding method based on the LDPC sign indicating number of the present invention.
Step 100 is imported pending character.The character of input can be numeral, letter, ASCII character, ISO-8859-1 character set, GB18030 character set, UTF8 character set etc.The present invention compares with the QR code coding method that current two-dimensional bar code is used always, increased the type of coding of GB18030, acquiescence is supported all Chinese, and can only support more than 6000 Chinese character in the KANJI type among the QR code, no longer is subjected to the restriction of Chinese character coding in the application.
Step 101 obtains importing array according to the character of importing.This input array is the byte array, and acquiescence is supported following 6 kinds of type of codings.Every type all has a sign v who is used for the identification character collection, is the fixed value of coding method definition.The bit number that each character needs represents that with the block value this block value will be used for follow-up judgement compression type.6 kinds of type of codings are respectively:
A) Numeric numeric type
Ident value is v=1.Character comprise [0123456789 ,-./:], the bit that needs counts block=4.Wherein,
0-9 represents numeral
10 represent space (corresponding A SCII sign indicating number is 32)
11 represent comma, " (corresponding A SCII sign indicating number is 44)
12 representative folding number "-" (corresponding A SCII sign indicating number is 45)
13 represent fullstop ". " (corresponding A SCII sign indicating number is 46)
14 represent slash "/" (corresponding A SCII sign indicating number is 47)
15 represent colon ": " (corresponding A SCII sign indicating number is 58)
B) Alpha letter type
Ident value is v=2.Character comprises the ASCII character of [| ~] and from 32 to 94, and the bit that needs counts block=6.When selecting this alphabetical type, the lowercase in the character string that needs will import into earlier all is converted into capitalization.
0-61 represents ASCII character 32-94
The perpendicular thick stick " | " of 62 representatives, (corresponding A SCII sign indicating number is 124)
63 represent tilde " ~ " (corresponding A SCII sign indicating number is 126)
C) ASCII character type
Ident value is v=3.Character comprises 128 ASCII character, and the bit that needs counts block=7.
D) Byte type
Ident value is v=4.Acquiescence adopts the ISO-8859-1 character set, and the bit that needs counts block=8.When adopting this Byte type, can directly pass the byte array and encode, return the byte array after the decoding, do not do transcoding.
E) CN type
Ident value is v=5.The bit that this Chinese character needs counts block=8.Adopt GB18030 character set transcoding, the byte array is not done other processing.
F) UTF8 type
Ident value is v=6.The bit that needs counts block=8.Adopt UTF8 character set transcoding, the byte array is not done other processing.
The length of the byte array that obtains in the step 101 is defined as n.
Step 102, the input array that step 101 is obtained-also be byte array-carry out Huffman compression.The elongated compress mode of Huffman boil down in the step 102 is at first added up the frequency that each byte occurs in the byte array, makes up the Huffman tree, and wherein right child node is 0, and left child node is 1.
Added up after the word frequency, adopted postorder traversal to add the algorithm stores Huffman tree of node degree.If each node has the mode bit of a 0-3,0 this node of expression is a leafy node, and 1 this node of expression has only left child node, and 2 these nodes of expression have only right child node, and 3 these nodes of expression have left and right child node, and then this mode bit is the node degree of each node.Postorder traversal Huffman sets, and calculates the node degree of each node simultaneously.Each node can be stored as 8 node information+2 node degree.
When decoding, we only use the leafy node in the Huffman tree, thus before each node information, increase by 1 zone bit, shown in accompanying drawing 5a.When flag is 1, represent this node effective, the back is immediately following 8 node information.When being 0, represent this node information useless, the back is storage node information not, immediately following 2 node degree.
For promoting compression ratio, can determine the figure place of node information storage, i.e. the block value according to type of coding v.Shown in accompanying drawing 5b, for example when Alpha letter type, block=6 then each node information only needs 6 bit positions.
Through after a series of compressions, the bit position that obtains the Huffman tree is cp, and the Huffman tree length that also obtains after the i.e. compression is cp, and the elongated message length of its correspondence is p.Preserve the result that this compression obtains.
Step 103 is judged compression type.Compression type identifies with ctype, when the byte array length n of input satisfies n*block>cp+p, should adopt the Huffman compression, set ctype=1, no longer this Huffman compressed tree is directly called in the Huffman compression result adjustment that step 102 is obtained during subsequent treatment.Otherwise, also promptly when byte array length n satisfies n*block<=cp+p, then should adopt the fixed length compression, set ctype=0, abandon the Huffman compression, adopt the fixed length compression to press again one time.
The method ratio of compression of the fixed length addition of the Huffman encoding ratio QRcode that step 102 adopts is higher, can also compress the Huffman tree according to the type of coding of setting simultaneously.
Step 104 is calculated canned data length.If the information bit number is k, code length is N, code check R=k/N then, (k equals header information and compressed information figure place sum here), N=k/R.We adopt the QC-LDPC sign indicating number among the IEEE 802.16e in cataloged procedure after a while, and this sign indicating number requires code length to be necessary for 24 integral multiple, so obtain qualified minimum N by R and k, obtains the N * R of message length L=minimum then, L>=k.
When fixed length is compressed, k=4+3+16+ compressed information bits number.
When Huffman compresses, the elongated message length p of k=4+3+12+16+Huffman tree message length cp+.
Definition spreading factor z=L/24.
Step 105 is provided with header information.Define an array to be encoded,, be used to deposit data to be encoded for initial length is the bit array data of L.Deposit type of coding value v for preceding 4 of data, deposit compression type value ctype immediately following 3.The common header information that constitutes array data to be encoded of v and ctype.
Step 106 is provided with compressed information.When fixed length is compressed, in array data to be encoded, add 16 bit lengths, in order to deposit the length n of input array-byte array.Byte is added in circulation afterwards, and each byte accounts for block bit number.When Huffman compresses, in data, add 12, deposit the node number of Huffman tree; Add 16 again, deposit byte array length n; Adding length again is the Huffman tree information of cp; Add the elongated information after the compression that length is p afterwards.As follows:
After having added compressed information, if added length less than the message length L in the step 104, add at random then remaining position.Rule is at random: 1/3 probability is that 1,2/3 probability is 0.
Step 107 is treated coding array data and is carried out the LDPC coding.For raising the efficiency, data to be encoded data is cut segment encoding by the longest sLen=2304 * R.With reference to Fig. 2, adopt industry standard LDPC algorithm commonly used, treat coding array data and carry out segment encoding.Concrete algorithm can be with reference to IEEE 802.16e Annex G:LDPC direct encoding, and G.6Method 2.
Code length (every section length separately after the segmentation) and code check R for example are set earlier, obtain the pattern matrix Hbm of appointment, then generate basis matrix Hb, Hb is divided into following form according to near-sighted lower triangular matrix coding method according to code check R:
H = A ( m b - 1 ) × k b B ( m b - 1 ) × 1 T ( m b - 1 ) × ( m b - 1 ) C 1 × k b D 1 × 1 E 1 × ( m b - 1 )
M wherein bBe the data bit of basis matrix, n bBe the code length of basis matrix, k b=n b-m bIf enter code word is u, then the brief calculation process is as follows:
1) calculates Au TAnd Cu T
2) calculate ET -1(Au T)
3) calculate p 1 T=ET -1(Au T)+Cu T
4) calculate p 2 T, Tp 2 T=Au T+ Bp 1 T
By obtaining output code word c=[u p after the aforementioned calculation 1p 2] .c is every section output data after encoding successfully.The output of all segmentations is connected into a big array LData according to the order of sequence, and its total length is LLen, LLen=L/R, and wherein L is the length L of array data to be encoded.In the cataloged procedure, can adopt 4 kinds of level of error correction Level, corresponding code rate R is respectively:
A) height
Code check R=1/2, Level=3.1/2 code check among the corresponding IEEE 802.16e.
B) in
Code check R=2/3, Level=2.2/3A code check among the corresponding IEEE 802.16e.
C) general
Code check R=3/4, Level=1.3/4A code check among the corresponding IEEE 802.16e.
D) low
Code check R=5/6, Level=0.5/6 code check among the corresponding IEEE 802.16e.
Step 108 is calculated total number of symbols.Accompanying drawing 6 is the diagram of zone bit, upper left, upper right, the lower-left of two-dimensional barcode image occupy 8 * 8 cells, wherein represent 1 usefulness black to represent near 7 * 7 cells of frame, Regional Representative shown in the dotted line 0 makes a circle outward, the image bottom right has a cell to represent 1 usefulness black to represent, in addition be the effective information of non-zone bit.Therefore, the shared code element number of zone bit is: 8 * 8 * 3+1=193.The length breadth ratio that definition generates image is ratio, can be imported by the outside, and its value minimum is 1.
The version information fixed length of two-dimensional bar code coding is 48.Therefore the effective information total length is sum=LLen+193+48.If the wide y of the image of the final two-dimensional bar code that generates, long x=y * ratio is by x * y>=sum, promptly (y * ratio) * y>=sum, releasing the y minimum is the evolution of (sum/ratio), and y should be more than or equal to (2 * 8+1), guaranteeing has enough spaces to come the show label position simultaneously.Y by the minimum of above-mentioned release obtains x=y * ratio, and wherein x should be integer.Obtain total number of symbols total=x * y at last.
Step 109 generates version information.The version information regular length is 48, is made up of 24 information bits and 24 bit check positions, adopts the LDPC sign indicating number coding of 1/2 code check.Shown in accompanying drawing 5c, be the composition of 24 information bits wherein.
Version number can have 32 versions at most for expand upgrading in the future by 1 beginning.Afterwards 17 deposit the numerical value behind the LLen/24.Deposit code check Level for last 2.24 information bits obtain information checking bit array VData behind the LDPC coding.
Step 110 is integrated array.Generate coding and integrate array TData, length is (total-193), is used to deposit other information except that zone bit.Add earlier 48 version information, begin to add LDPC coding array LData then from the head, fill up that the version information since 48 fills up latter half successively after the first half through behind the LDPC coding at 1/2 place of this array.Handling advantage like this is: 1) easier generation image, and only need add zone bits in the generation image stage and get final product at 4 angles, no longer need complicated pathfinding algorithm, faster simpler; 2) easier parsing behind the analysis diagram picture, is easily thrown and is removed zone bit, and also being easy to afterwards no longer also needs to discern separately the position of version information from 1/2 acquisition version information as QRCODE; 3) because total length is indefinite, version information has certain randomness on the position, be not subject to malicious sabotage.After LDPC coding array LData filled and finishes, added at random remaining position among the coding integration array TData.Rule is at random: 1/3 probability is that 1,2/3 probability is 0.
Step 111 is provided with zone bit.Generate the image array bid of two dimension, dimension is respectively x, y.Regard this two-dimensional array as matrix, in upper left, upper right, lower-left 7 * 7 magnitude range of this matrix, all be set to the peripheral circle 0 that adds of 1,7 * 7 sizes.The lower right corner is set to 1 again.So just be provided with the zone bit shown in the step 108.Zone bit is fixing four jiaos among the present invention, though the same with QRCODE, all have all discernible characteristic of the three-sixth turn of revolving, because pattern is simple, identification is got up faster.
Step 112 generates two-dimensional barcode image.In the image array bid of two dimension, add the information that coding is integrated array TData line by line by order from left to right.Each information all is a lattice, and length and width are scale pixel, and pixel size scale can be limited by initial input.1 and 0 adopts two kinds of different colors to show differentiation.
The above two-dimensional bar code coding method of encoding based on LDPC that illustrated with reference to Fig. 1 according to of the present invention.
Referring now to Fig. 3 coding/decoding method according to the two-dimensional bar code based on LDPC coding of the present invention is described.
Step 201, scan image.Elements all in the two-dimensional barcode image to be decoded is carried out ashing with the average ashing method, and the result who obtains is stored in ashing as a result in the array with gray-scale value round values form between 0-255.The present invention is different with existing two-dimensional sign indicating number decoding technique, distinctive gray-scale value when having utilized image analysis during decoding, form with the soft 0-255 of being output as of the data that should have only 0,1 two value gray-scale value of each pixel, make full use of image information, use the decoding of belief propagation (BP) algorithm then, blurred picture more easy to identify makes two-dimension code have stronger error correction.
Step 202 is sought positioning mark.Seek positioning mark according to the zone bit pattern, need to judge whether flipped image according to the positioning mark that finds, if the positioning mark of two-dimensional bar code with default inconsistent, flipped image then.And obtain scale value, the i.e. width of the shared block of pixels of each code element.The detailed process of location can be used the industry technique known, and for example CN1818926 is described.
Step 203, soft output information position.Press the scale size, piecemeal reads information, removes flag then, obtains effective information array sout, and each value is the gray-scale value of corresponding informance in this effective information array.
Step 204 adopts binomial distribution to optimize effective information array sout.At first calculate the LLR value, the LLR value is the log likelihood ratios of binomial distribution, and is relevant with the LDPC decoding, and what propagate when adopting message-passing decoder is exactly this rate value.Because information bit non-0 is 1, so its probability of getting " 0|1 " meets binomial distribution, establishing maximum probability is 0.98, and minimum probability is 0.02.Then the formula of this binomial distribution is f (x)=0.98e^ ((x-255) ^2/ (2*91^2)), and x is the gray-scale value of information bit.Distribute shown in the following accompanying drawing 7.
If log likelihood ratios L (x)=ln (p (x=0)/p (x=1)), p (x=0) expression x is 0 probability, is LLR.Because have only 256 gray-scale values, so can try to achieve the LLR value by tabling look-up.After trying to achieve LLR, traversal effective information array sout uses the LLR value of each gray-scale value correspondence in the array that calculates to cover initial value.Like this, according to binomial distribution feature calculation code element 01 probability, can increase decoding performance to fuzzy two-dimension code.
Step 205, the intercepting version information.48 of 1/2 place of the effective information array of soft output interceptings, as version information.Code check 1/2 is set, and code length 48 is tried to achieve version information after the LDPC decoding, and preceding 5 is version number, and back 17 is 24 multiple l of message length to be decoded, tries to achieve message length LLen=l to be decoded * 24, and back two is the level of error correction Level of information to be decoded.
Step 206 is carried out the LDPC decoding to the effective information array sout of the soft output except that version information.Figure 4 shows that the LDPC decoding process figure of standard.Generate pattern matrix Hbm by code length and code check, on the basis of pattern matrix, adopt, obtain check matrix H the unit matrix ring shift right.Adopt minimum-sum algorithm to decipher, when the transposed matrix of check matrix and enter code word c amasss to null matrix, successfully decoded.According to code check intercepting and return message position.
When LLen surpasses 2304 when long, by the longest be 2304 long segmentations decodings, code check is unified to be R, R is determined by Level, and is identical with step 107.Obtain decoding array data by the LDPC decoding.In this step, for reducing calculated amount, minimum and SPA algorithm are adopted in the LDPC decoding, and minimum-sum algorithm is the simplification of BP decoding algorithm.The transmission form of message is log likelihood ratios (Log-Likelihood Ratio in the BP decoding algorithm, LLR), LLR transmits along the limit between variable node and the restraint joint, thereby provides the discriminative information about variable node in each decoding iteration.In order to improve accuracy rate, increase modifying factor b, b=0.15 simultaneously.
Concrete decoding process can reference: Sarah J.Johnson shows " Introducing Low-Density Parity-Check Codes " 2.3 trifle Sum-product decoding.
Step 207, the intercepting header.Analytic solution yardage group data, preceding 4 is type of coding value v, is compression type value ctype immediately following 3.When ctype=0, adopt the fixed length compression, back 16 bit representations compression byte number n is compressed information afterwards.When ctype=1, adopt the Huffman compression, 12 bit representation Huffman tree node number cp thereafter, inferior back 16 bit representations compression byte number n is Huffman tree and elongated information after again.
Step 208 decompresses.According to compression type value ctype decoding array data is decompressed.During ctype=0, a byte generating solution compression of each block position intercepting array BData, according to type of coding v, traversal decompression array BData reduction initial value.During ctype=1, carry out Huffman decoding, generating solution compression array BData.During Huffman decoding, obtain Huffman tree canned data, travel through node successively, rebuild the Huffman tree according to the value of postorder traversal and node degree: if zone bit 1 then earlier according to type of coding v, reverts to 8 with node information, storage then; If zone bit 0 is then given up node information, directly extract two node degree.
Step 209 generates character string.According to the different coding type, the kinds of characters collection is set, BData is converted into character string with decompression.If but type of coding is the Byte type, then directly returns array BData, no longer carries out transcoding.
Although with reference to one or more exemplary embodiments explanation the present invention, those skilled in the art can know and need not to break away from the scope of the invention and method flow is made various suitable changes and equivalents.In addition, can make by disclosed instruction and manyly may be suitable for the modification of particular condition or condition and do not break away from the scope of the invention.Therefore, purpose of the present invention does not lie in and is limited to as being used to realize preferred forms of the present invention and disclosed specific embodiment, and the Code And Decode method of disclosed two-dimensional bar code will comprise all embodiment that fall in the scope of the invention.

Claims (10)

1. the coding method of a two-dimensional bar code, in order to will the input original binary data information by exporting and can it is characterized in that may further comprise the steps attached to the two-dimensional bar code on the carrier based on the code compression method of low density parity check code (LDPC):
A, handle the input information obtain the byte type according to the type of coding of the original binary data information of input;
B, the input information of this byte type is carried out first compression, compression type of this first compression can be elongated compression or fixed length compression;
C, according to first the compression the result calculate needs canned data length, obtain information to be encoded according to type of coding and compression type;
D, to this information to be encoded carry out second the compression, this second boil down to LDPC encoding compression;
E, result and the version information integration of second compression is obtained compressed information;
F, zone bit is set, generates two-dimensional barcode image.
2. the coding method of two-dimensional bar code as claimed in claim 1, wherein the input information of steps A can be supported 6 kinds of type of codings such as numeral, letter, ASCII character, Byte, Chinese character CN and UTF8.
3. the coding method of two-dimensional bar code as claimed in claim 1, wherein step B comprises:
B1, the input information of this byte type is carried out the elongated compression of Huffman;
B2, the Huffman tree length that obtains as step B1 and elongated message length sum are used fixed length instead and are compressed during smaller or equal to the product of the used bit number of the length of the input information of byte type and type of coding.
4. the coding method of two-dimensional bar code as claimed in claim 1, wherein the version information of step e also adopts the LDPC encoding compression, version information is left in 1/2 place, centre of compressed information.
5. the coding method of two-dimensional bar code as claimed in claim 1, wherein in step F, zone bit is all filled the information 1 of 7 * 7 sizes and its peripheral interpolation information 0 in upper left, the upper right and lower left corner of two-dimensional barcode image, the lower right corner of two-dimensional barcode image only is filled to the information 1 of 1 * 1 size.
6. the coding method of two-dimensional bar code as claimed in claim 1, wherein in step F, can adjust two-dimensional barcode image according to the pixel size of original input is non-square.
7. the coding/decoding method of a two-dimensional bar code uses one dimensional linear array contact-type or non-contact type imageing sensor to obtain the view data of two-dimensional bar code, recovers binary data output information through the coding/decoding method based on LDPC, it is characterized in that may further comprise the steps:
A, employing average ashing method carry out ashing to the two-dimensional barcode image data, obtain each code element corresponding gray;
B, seek positioning mark and obtain the pixel size value according to the zone bit pattern;
C, read the effective information that ashing obtains according to pixel size value piecemeal;
D, employing binomial distribution method are optimized this effective information;
E, from effective information, intercept version information;
F, the effective information remainder of intercepting after the version information carried out first decoding, this LDPC decoding of first decoding;
G, intercepting comprises the header of type of coding and compression type from first result that obtain of decoding;
H, the result who first decoding is obtained according to header carry out second decoding;
I, generate binary data information according to second decoded results.
8. the coding/decoding method of two-dimensional bar code as claimed in claim 7, wherein step D comprises:
Being tabled look-up by the gray-scale value of each code element obtains the log likelihood ratios of binomial distribution, and the traversal effective information is with this log likelihood ratios covering gray-scale value.
9. the coding/decoding method of two-dimensional bar code as claimed in claim 7, wherein step e comprises:
At 1/2 place, centre of effective information intercepting version information.
10. the coding/decoding method of two-dimensional bar code as claimed in claim 7, wherein step H comprises:
When the compression type value is 0, carry out fixed length decoding; When the compression type value is 1, carry out the elongated decoding of Huffman.
CN 201010534320 2010-11-08 2010-11-08 LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes Pending CN102004935A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010534320 CN102004935A (en) 2010-11-08 2010-11-08 LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010534320 CN102004935A (en) 2010-11-08 2010-11-08 LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes

Publications (1)

Publication Number Publication Date
CN102004935A true CN102004935A (en) 2011-04-06

Family

ID=43812285

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010534320 Pending CN102004935A (en) 2010-11-08 2010-11-08 LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes

Country Status (1)

Country Link
CN (1) CN102004935A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103020685A (en) * 2012-12-14 2013-04-03 苏州阔地网络科技有限公司 Method and system for coding and expanding two-dimensional codes
CN103020686A (en) * 2012-12-14 2013-04-03 苏州阔地网络科技有限公司 Method and system for coding two-dimensional code colors
CN103400174A (en) * 2013-07-30 2013-11-20 人民搜索网络股份公司 Encoding method, decoding method and system of two-dimensional code
CN104517143A (en) * 2013-09-30 2015-04-15 阿里巴巴集团控股有限公司 Methods, devices and system for encoding and decoding codes
CN104518800A (en) * 2013-09-26 2015-04-15 北大方正集团有限公司 Method and device for data compression of electronic supervision code
CN105608043A (en) * 2014-11-13 2016-05-25 卡西欧计算机株式会社 Electronic device, method of displaying code, and recording medium
CN105630999A (en) * 2015-12-28 2016-06-01 华为技术有限公司 Data compressing method and device of server
CN107295344A (en) * 2017-05-12 2017-10-24 杨铮 The method and device of embedded graphic code in a kind of video
CN108256609A (en) * 2018-01-08 2018-07-06 佛山市顺德区中山大学研究院 A kind of circle view finding figure Quick Response Code and its generation and decomposition method
CN108270736A (en) * 2016-12-30 2018-07-10 中国移动通信集团内蒙古有限公司 A kind of method for interchanging data and device
CN112668031A (en) * 2021-03-15 2021-04-16 尤尼泰克(嘉兴)信息技术有限公司 Coding and decoding method and device for network file protection
CN113610203A (en) * 2021-06-28 2021-11-05 清华大学 Bit stream coding method and device for quick response matrix code

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159515A (en) * 2007-11-22 2008-04-09 普天信息技术研究院有限公司 Encoding method and system of variable length low-density parity code
CN101197004A (en) * 2007-12-25 2008-06-11 深圳矽感科技有限公司 Two-dimension bar code and its coding and decoding method
CN101493901A (en) * 2009-02-27 2009-07-29 深圳华为通信技术有限公司 Two-dimensional code data compressing and decompressing method and terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159515A (en) * 2007-11-22 2008-04-09 普天信息技术研究院有限公司 Encoding method and system of variable length low-density parity code
CN101197004A (en) * 2007-12-25 2008-06-11 深圳矽感科技有限公司 Two-dimension bar code and its coding and decoding method
CN101493901A (en) * 2009-02-27 2009-07-29 深圳华为通信技术有限公司 Two-dimensional code data compressing and decompressing method and terminal

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103020685A (en) * 2012-12-14 2013-04-03 苏州阔地网络科技有限公司 Method and system for coding and expanding two-dimensional codes
CN103020686A (en) * 2012-12-14 2013-04-03 苏州阔地网络科技有限公司 Method and system for coding two-dimensional code colors
CN103020686B (en) * 2012-12-14 2015-11-04 阔地教育科技有限公司 A kind of Quick Response Code colour coding method and system
CN103020685B (en) * 2012-12-14 2015-11-04 阔地教育科技有限公司 A kind of Quick Response Code coding extending method and system
CN103400174A (en) * 2013-07-30 2013-11-20 人民搜索网络股份公司 Encoding method, decoding method and system of two-dimensional code
CN104518800B (en) * 2013-09-26 2018-05-08 北大方正集团有限公司 The data compression method and apparatus of electronic supervision code
CN104518800A (en) * 2013-09-26 2015-04-15 北大方正集团有限公司 Method and device for data compression of electronic supervision code
CN104517143B (en) * 2013-09-30 2018-04-20 阿里巴巴集团控股有限公司 For code coding, decoded method and apparatus and code coding/decoding system
CN104517143A (en) * 2013-09-30 2015-04-15 阿里巴巴集团控股有限公司 Methods, devices and system for encoding and decoding codes
CN105608043A (en) * 2014-11-13 2016-05-25 卡西欧计算机株式会社 Electronic device, method of displaying code, and recording medium
CN105608043B (en) * 2014-11-13 2019-07-12 卡西欧计算机株式会社 Electronic equipment and code display methods
CN105630999A (en) * 2015-12-28 2016-06-01 华为技术有限公司 Data compressing method and device of server
CN108270736A (en) * 2016-12-30 2018-07-10 中国移动通信集团内蒙古有限公司 A kind of method for interchanging data and device
CN107295344A (en) * 2017-05-12 2017-10-24 杨铮 The method and device of embedded graphic code in a kind of video
CN107295344B (en) * 2017-05-12 2021-01-26 赵毅 Method and device for embedding graphic code in video
CN108256609A (en) * 2018-01-08 2018-07-06 佛山市顺德区中山大学研究院 A kind of circle view finding figure Quick Response Code and its generation and decomposition method
CN108256609B (en) * 2018-01-08 2021-11-16 佛山市顺德区中山大学研究院 Circular image finding graph two-dimensional code and generation and interpretation method thereof
CN112668031A (en) * 2021-03-15 2021-04-16 尤尼泰克(嘉兴)信息技术有限公司 Coding and decoding method and device for network file protection
CN113610203A (en) * 2021-06-28 2021-11-05 清华大学 Bit stream coding method and device for quick response matrix code
CN113610203B (en) * 2021-06-28 2024-04-19 清华大学 Bit stream coding method and device for quick response matrix code

Similar Documents

Publication Publication Date Title
CN102004935A (en) LDPC (Low Density Parity Code)-based method for encoding and decoding two dimensional bar codes
CN103400174B (en) The coded method of a kind of Quick Response Code, coding/decoding method and system
Rahman et al. Lossless image compression techniques: A state-of-the-art survey
Campbell A theory of single-shot error correction for adversarial noise
CN106815544B (en) A kind of information concealing method based on two dimensional code
CN105447546B (en) The two dimensional code and its coding and decoding methods and equipment of embeddable large scale figure
CN107545289A (en) The coding method of matrix two-dimensional code and coding/decoding method
CN103858433B (en) Layered entropy encoding and decoding
US6321986B1 (en) Robust machine-readable symbology and method and apparatus for printing and reading same
US6186406B1 (en) Bar code symbology capable of encoding bytes, words, 16-bit characters, etc. and method and apparatus for printing and reading same
CN100576753C (en) The system and method for static Huffman decoding
US6196466B1 (en) Data compression method using multiple base number systems
US6012638A (en) Machine-readable symbology and method and apparatus for printing and reading same
Victor Enhancing the data capacity of QR codes by compressing the data before generation
JP2001519068A (en) Distortion-resistant double data correction color transition barcode and its generation and use
US8360333B2 (en) HD barcode
CN101493901B (en) Two-dimensional code data compressing and decompressing method and terminal
CN110868223A (en) Method and circuit for realizing numerical operation of Huffman coding
Chang et al. Near-optimal distance emulator for planar graphs
EP4273741A1 (en) Method for building dot matrix code, method for generating and reading dot matrix code, terminal, and dot matrix code system
KR20010006507A (en) Robust machine-readable symbology and method and apparatus for printing and reading same
Abas et al. Expanding the data capacity of QR codes using multiple compression algorithms and base64 encode/decode
US8488894B2 (en) Method and system for dot-matrix font data compression and decompression
Subpratatsavee et al. An implementation of a high capacity 2D barcode
CN100504912C (en) Two dimensional bar code symbol generation method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20110406