CN102117399A - Method and device for recognizing document barcode - Google Patents
Method and device for recognizing document barcode Download PDFInfo
- Publication number
- CN102117399A CN102117399A CN2009102175230A CN200910217523A CN102117399A CN 102117399 A CN102117399 A CN 102117399A CN 2009102175230 A CN2009102175230 A CN 2009102175230A CN 200910217523 A CN200910217523 A CN 200910217523A CN 102117399 A CN102117399 A CN 102117399A
- Authority
- CN
- China
- Prior art keywords
- black
- pixel points
- white pixel
- module
- document
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 27
- 238000009826 distribution Methods 0.000 claims abstract description 59
- 238000001514 detection method Methods 0.000 claims description 9
- 238000010586 diagram Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 239000003086 colorant Substances 0.000 description 1
- 239000000470 constituent Substances 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 238000007493 shaping process Methods 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
Images
Landscapes
- Character Input (AREA)
Abstract
The invention discloses a method for recognizing the document barcode. The method comprises the following steps: detecting the distribution of black pixel points and white pixel points in a document image to find the starting code and the finish region of the document barcode; detecting the distribution of the black pixel points and the white pixel points between the starting code and the finish region to obtain the color of each model in each layer of the document barcode; and recognizing and reading the information of the document barcode according to the binary value corresponding to the color of each model. The invention also discloses a device for recognizing the document barcode. The method can automatically recognize the information of the document barcode from the document image while acquiring the document image, thereby improving the work efficiency.
Description
Technical Field
The invention relates to a barcode identification technology, in particular to a method and a device for identifying a document barcode.
Background
The bar code technology is the most economical and practical automatic identification technology so far, and the bar code is widely applied to various industries, so that the speed of data acquisition and information processing is greatly improved, the working efficiency is improved, and great contribution is made to the scientification and modernization of management.
At present, barcodes in documents are identified by manually and directly scanning the barcodes by using a scanner, and the scanner can be divided into three types of optical pens, Charge Coupled Devices (CCDs) and lasers according to the difference of scanning principles, so that the barcodes compiled according to certain rules can be converted into meaningful information. When scanning identification through a scanner, two processes of scanning and decoding need to be undergone: because the color of the object is determined by the type of the reflected light, the white object can reflect visible light with various wavelengths, and the black object absorbs visible light with various wavelengths, when the light emitted by the light source of the bar code scanner is reflected on the bar code, the reflected light irradiates the photoelectric converter in the bar code scanner, and the photoelectric converter converts the reflected light signals with different intensities into corresponding electric signals; the electrical signal is sent to a shaping circuit after being output to an amplifying circuit of the bar code scanner to enhance the signal, and the analog signal is converted into a digital signal consisting of 0 and 1 according to the difference of the widths of the white bar and the black bar and the difference of the duration time of the corresponding electrical signal; then, the decoder of the bar code scanner discriminates the number of bars and spaces by measuring the number of the pulse digital electric signals 0, 1. The widths of the bars and spaces are distinguished by measuring the duration of the 0, 1 signals; at this time, the obtained data is still disordered, and if the information contained in the barcode is known, the information needs to be encoded according to the encoding rule corresponding to the barcode, for example: shortening commodity bar code (EAN-8 code), and changing bar symbols into corresponding numbers and character information; finally, the detailed information of the article can be identified by the data processing and management of the computer system.
According to the existing barcode identification method, after documents are scanned or photographed and other methods are used for storing document images, a scanner for identifying barcodes is still needed for identifying the barcodes of the documents, and the method is very troublesome and complicated in process.
Disclosure of Invention
In view of the above, the main objective of the present invention is to provide a method and an apparatus for identifying a document barcode, which can automatically identify the document barcode information from a document image while acquiring the document image.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
the invention provides a method for realizing identification of a file bar code, which comprises the following steps:
detecting the distribution of black and white pixel points in the official document image, and searching the start code and the end area of the official document bar code;
and detecting the distribution of black and white pixel points between the start code and the end area to obtain the color of each module in each layer of the official document bar code, and identifying and reading the information of the official document bar code according to the binary value corresponding to each module color.
In the scheme, the official document barcode is PDF417 code.
In the above scheme, the distribution of black and white pixel points in the document image is specifically:
the method comprises the steps of binarizing a document image, detecting the distribution of black and white pixel points line by line transversely, searching the distribution of the black and white pixel points according to the black and white pixel point distribution ratio of a start code and a black and white bar space ratio of an end area in PDF417 specification, detecting the distribution of the black and white pixel points line by line longitudinally when the black and white pixel points are not searched, and searching the distribution of the black and white pixel points according to the black and white bar space ratio of the start code and the black and white bar space ratio of the end area in the PDF417 specification.
In the above scheme, the distribution of black and white pixel points between the detection start code and the detection end region is specifically:
and detecting black and white pixel points between the start code and the end area line by line according to the positions of the start code and the end area, and sequentially comparing the distribution of three continuous lines of black and white pixel points to determine a line of black and white pixel points of each layer in the document bar code.
In the above scheme, the obtaining of the black or white color of each module in each layer of the document barcode specifically includes: and in a row of black and white pixel points of one layer, obtaining the black or white color of each module of the layer according to the distribution width of the black and white pixel points and the width of one module.
In the above scheme, the information for identifying and reading the document barcode according to the binary value corresponding to each module color specifically comprises: and identifying and reading each character code in the official document bar code according to the binary value corresponding to each module color and the coding rule that one character code comprises 17 modules and character codes, wherein the black is 1, and the white is 0.
The invention provides a device for realizing identification of a file bar code, which comprises: the document bar code positioning module and the information reading module are arranged on the document bar code positioning module; wherein,
the document barcode positioning module is used for detecting the distribution of black and white pixel points in the document image and searching the start code and the end area of the document barcode;
and the information reading module is used for detecting the distribution of black and white pixel points between the start code and the end area to obtain the color of each module in each layer of the document bar code, and identifying and reading the information of the document bar code according to the binary value corresponding to each module color.
In the above scheme, the information recognizing and reading module further includes: the layer detection module and the reading module; wherein,
the layer detection module is used for detecting the distribution of black and white pixel points between the start code and the end area, determining an effective line of black and white pixel points of each layer in the document bar code by sequentially comparing the distribution of continuous lines of black and white pixel points, and transmitting the effective line of black and white pixel points of each layer to the recognition module;
and the recognizing and reading module is used for acquiring the black or white color of each layer of each module in a row of black and white pixel points according to the distribution width of the black and white pixel points and the width of one module, and then recognizing and reading the information of the document bar code according to the binary value corresponding to each module color and the coding rule that one character code comprises 17 modules and character codes.
The invention provides a method and a device for identifying a document bar code, which are used for detecting the distribution of black and white pixel points in a document image and searching a start code and an end area of the document bar code; and detecting the distribution of black and white pixel points between the start code and the end area to obtain the black or white color of each module in each layer of the document bar code, and reading the information of the document bar code according to the binary value corresponding to each module color. According to the scheme of the invention, the document barcode information can be automatically identified from the document image while the document image is collected, such as the document is scanned or photographed and the like, and the document barcode information is stored, so that the extra barcode scanning step for the document is reduced, the working time is saved, the document processing process is simplified, and the working efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of the composition of PDF417 code;
FIG. 2 is a diagram illustrating the composition of a codeword in the PDF417 code;
FIG. 3 is a schematic flow chart of a method for recognizing a barcode of a document according to the present invention;
FIG. 4 is a schematic structural diagram of an apparatus for recognizing a barcode of a document according to the present invention.
Detailed Description
Currently, the document barcode specification specifies that the document barcode is a two-dimensional barcode of PDF417, and PDF417 is one of two-dimensional barcodes selected by the American National Standards Institute (ANSI) MH10 SBC-8 committee as one of the two-dimensional barcodes in the range specified by the international standard of two-dimensional barcodes, and is mainly prepared for application to transportation packages and commodity data labels. The PDF417 has the capability of error detection, and can read back complete data from damaged bar codes, and the error recovery rate can reach 50% at most. Each PDF417 code is formed by stacking 3-90 rows, namely layers, for the convenience of scanning, static empty areas are arranged around the PDF417 code, and are divided into a horizontal static empty area and a vertical static empty area which are at least 0.020 inch, as shown in figure 1.
Each layer in the PDF417 code includes the following five parts: a start code, a left mark area, a data area, a right mark area, and an end area; wherein, the start code: at the far left of the row; a left marking area: after the start code, a symbol character indicating each layer; a data area: can accommodate 1-30 data words; and (4) a right marking area: behind the data area is an indicator character; an ending area: at the rightmost side of the row.
In addition to the start code and the end code, the constituent characters of the left mark area, the data area and the right mark area are called codes (codewords), each of which is composed of 17 Modules (Modules), each of which can be divided into 4 lines or black lines and 4 blank or white lines, each line not exceeding 6 Modules wide at most. Each PDF417 code has different data sizes, and the number of rows, the number of data modules per row, and the number of words can be varied from 1 to 30, and the composition of the words is shown in FIG. 2.
Because the amount of information in the barcode is variable and flexible, each PDF417 dimensional barcode can be printed with different aspect ratios and densities by being applied to different physical devices to meet the requirements of printing conditions and scanning conditions. Wherein, each module width X is one of the most important dimensions in PDF417 code, the minimum limit of X value is 0.0075 inches, about 0.191mm, and the value of X is fixed in the same bar code symbol.
The minimum height and length of the PDF417 can be calculated from the following equation:
W=(17C+69)X+2Q
H=R×Y+2Q
wherein W is the width of the bar code; h is the height of the bar code; x is the width of the bar code module; y is the number of layers; c is the total number of the symbol characters in each layer, and comprises left and right mark areas; r is the layer height; q is the size of the dead zone.
An important characteristic of the PDF417 two-dimensional bar code is that the error correction capability of the PDF417 two-dimensional bar code is high, which is related to the amount of data that can be stored in each bar code, and the PDF417 code divides the error correction capability into nine levels, which is from 0 to 8, the higher the level, the stronger the error correction capability, but the less the amount of data that can be stored, and generally suggests to program at least 10% of check words.
Based on the PDF417 bar code, the basic idea of the invention is as follows: detecting the distribution of black and white pixel points in the official document image, and searching the start code and the end area of the official document bar code; detecting the distribution of black and white pixel points between the start code and the end area to obtain the black or white color of each module in each layer of the document bar code; and identifying and reading the information of the official document bar code according to the binary value corresponding to each module color.
The invention is further described in detail below with reference to the drawings and the specific embodiments.
The method for identifying the bar code of the file is shown in figure 3 and comprises the following steps:
step 301: obtaining a document image;
specifically, a scanner can be used for scanning the document image, or a camera or a fax machine can be used for obtaining the document image;
step 302: detecting the distribution of black and white pixel points in the official document image, and searching the start code and the end area of the official document bar code according to the PDF417 specification;
specifically, the document image is binarized, that is: and taking the pixel point with the gray value of 0 as a black pixel point, and taking the pixel point with the gray value of 255 as a white pixel point. Firstly, detecting the distribution of black and white pixel points row by row, wherein each row is formed by a plurality of black pixel points and a plurality of white pixel points at intervals; according to the distribution proportion of the black and white pixel points, whether the distribution of the black and white pixel points meets the space ratio of black and white strips of a start code and an end area in PDF417 specification is searched, wherein the searching sequence comprises left to right and right to left; when the black and white pixel points are not found, detecting the distribution of the black and white pixel points longitudinally row by row, wherein each row is also formed by spacing a plurality of black pixel points and a plurality of white pixel points; according to the distribution proportion of the black and white pixel points, whether the distribution of the black and white pixel points meets the black and white strip space ratio of a start code and an end area in PDF417 specification is searched, and the searching sequence comprises from top to bottom and from bottom to top; when finding, recording the distribution position of black and white pixel points according with the blank ratio of the black and white bar in the start code and the end area, using the distribution position as the start code and the end area of the official document bar code of the official document, calculating the width of the start code by taking the pixel point as a unit, and ending the finding.
Step 303: detecting the distribution of black and white pixel points between the start code and the end area to obtain the color of each module in each layer of the official document bar code, and identifying and reading the information of the official document bar code according to the binary value corresponding to each module color;
specifically, black and white pixel points between the start code and the end area are detected line by line according to the positions of the start code and the end area; because the obtained image may be distorted, inclined and the like, when a row of black and white pixel points are detected, some black and white pixel points are not in the same layer in the document bar code, and in order to solve the problem, the distribution of continuous rows of black and white pixel points can be sequentially compared, wherein the rows are smaller than one module height of the document bar code in the image. Taking three lines as an example, when the distribution of black and white pixel points of three lines is the same, regarding the three lines as the same layer, selecting one line, comparing the selected line with one line of continuous three lines with the same distribution of black and white pixel points of the previous layer, and regarding the black and white pixel points of the line as belonging to the new layer when the black and white pixel points of the line are different from the black and white pixel points of the previous layer; when the black and white pixel points are the same as the previous layer, the black and white pixel points of the row are regarded as belonging to the previous layer and invalid, and the comparison of the next continuous three rows is continued; when three lines with the same black-white pixel point distribution are detected for the first time, the three lines are not compared with the previous layer and are directly regarded as one line of black-white pixel points with one line as the first layer; when the black and white pixel points of three lines are distributed differently, the three lines can not be regarded as the same layer, and the comparison of the next continuous three lines is continued; according to the method, an effective line of black and white pixel points in each layer of the document bar code is determined;
in an effective row of black-white pixel points, according to the distribution width of the black-white pixel points and the width of one module, obtaining the black or white color of each module in the layer; identifying and reading each character code in the document bar code according to binary values corresponding to the colors of the modules, wherein if black is 1 and white is 0, each character code comprises 17 modules according to one character code, the corresponding binary values are preset, and black can be set to be 1 and white can be set to be 0; black may be set to 0 and white may be set to 1.
As shown in fig. 2, according to the binary value corresponding to each module color, the character code is read as "10100111111001110", and according to the encoding rule of the character code, the character code represented by the group of binary values is read; and so on, recognizing and reading the information of each layer in the document bar code; wherein, the width of module can be obtained according to the proportion of module and initial code width, if: the start code width is 51 pixels, and the ratio of the module to the start code width is 1: 17, the width of the module is 3 pixels.
In order to implement the method, the invention further provides a device for implementing identification of a document barcode, as shown in fig. 4, the device includes: a document bar code positioning module 41 and an information reading module 42; wherein,
the document barcode positioning module 41 is configured to binarize the document image, detect the distribution of black and white pixel points in the document image, and find the start code and the end area of the document barcode according to the PDF417 specification and the distribution ratio of the black and white pixel points;
the information reading module 42 is used for detecting the distribution of black and white pixel points between the start code and the end area to obtain the black or white color of each module in each layer of the document bar code, and identifying and reading the information of the document bar code according to the binary value corresponding to each module color;
the information reading module further comprises: a layer detection module 421, a reading module 422; wherein,
the layer detection module 421 is configured to detect the distribution of black and white pixel points between the start code and the end region, determine an effective line of black and white pixel points of each layer in the document barcode by sequentially comparing the distributions of consecutive lines of black and white pixel points, and transmit the effective line of black and white pixel points of each layer to the recognition module 422;
and the recognizing and reading module 422 is used for acquiring the black or white color of each layer of each module in a row of black and white pixel points according to the distribution width of the black and white pixel points and the width of one module, and recognizing and reading the information of the official document bar code according to the binary value corresponding to the color of each module and the coding rule that one character code comprises 17 modules and character codes.
The above description is only exemplary of the present invention and should not be taken as limiting the scope of the present invention, and any modifications, equivalents, improvements, etc. that are within the spirit and principle of the present invention should be included in the present invention.
Claims (8)
1. A method for realizing identification of a document barcode is characterized by comprising the following steps:
detecting the distribution of black and white pixel points in the official document image, and searching the start code and the end area of the official document bar code;
and detecting the distribution of black and white pixel points between the start code and the end area to obtain the color of each module in each layer of the official document bar code, and identifying and reading the information of the official document bar code according to the binary value corresponding to each module color.
2. The method of claim 1, wherein the document barcode is PDF417 code.
3. The method according to claim 2, wherein the detecting the distribution of black and white pixel points in the official document image is specifically as follows:
the method comprises the steps of binarizing a document image, detecting the distribution of black and white pixel points line by line transversely, searching the distribution of the black and white pixel points according to the black and white pixel point distribution ratio of a start code and a black and white bar space ratio of an end area in PDF417 specification, detecting the distribution of the black and white pixel points line by line longitudinally when the black and white pixel points are not searched, and searching the distribution of the black and white pixel points according to the black and white bar space ratio of the start code and the black and white bar space ratio of the end area in the PDF417 specification.
4. The method of claim 3, wherein the detecting the distribution of black and white pixel points between the start code and the end region is specifically:
and detecting black and white pixel points between the start code and the end area line by line according to the positions of the start code and the end area, and sequentially comparing the distribution of three continuous lines of black and white pixel points to determine a line of black and white pixel points of each layer in the document bar code.
5. The method according to claim 4, wherein the obtaining of the black or white color of each module in each layer of the document barcode is specifically: and in a row of black and white pixel points of one layer, obtaining the black or white color of each module of the layer according to the distribution width of the black and white pixel points and the width of one module.
6. The method according to claim 5, wherein said identifying and reading the document barcode according to the binary value corresponding to each module color is embodied as: and identifying and reading each character code in the official document bar code according to the binary value corresponding to each module color and the coding rule that one character code comprises 17 modules and character codes, wherein the black is 1, and the white is 0.
7. An apparatus for recognizing a bar code of a document, the apparatus comprising: the document bar code positioning module and the information reading module are arranged on the document bar code positioning module; wherein,
the document barcode positioning module is used for detecting the distribution of black and white pixel points in the document image and searching the start code and the end area of the document barcode;
and the information reading module is used for detecting the distribution of black and white pixel points between the start code and the end area to obtain the color of each module in each layer of the document bar code, and identifying and reading the information of the document bar code according to the binary value corresponding to each module color.
8. The apparatus of claim 7, wherein the information recognition module further comprises: the layer detection module and the reading module; wherein,
the layer detection module is used for detecting the distribution of black and white pixel points between the start code and the end area, determining an effective line of black and white pixel points of each layer in the document bar code by sequentially comparing the distribution of continuous lines of black and white pixel points, and transmitting the effective line of black and white pixel points of each layer to the recognition module;
and the recognizing and reading module is used for acquiring the black or white color of each layer of each module in a row of black and white pixel points according to the distribution width of the black and white pixel points and the width of one module, and then recognizing and reading the information of the document bar code according to the binary value corresponding to each module color and the coding rule that one character code comprises 17 modules and character codes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102175230A CN102117399A (en) | 2009-12-31 | 2009-12-31 | Method and device for recognizing document barcode |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102175230A CN102117399A (en) | 2009-12-31 | 2009-12-31 | Method and device for recognizing document barcode |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102117399A true CN102117399A (en) | 2011-07-06 |
Family
ID=44216162
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009102175230A Pending CN102117399A (en) | 2009-12-31 | 2009-12-31 | Method and device for recognizing document barcode |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102117399A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105512590A (en) * | 2015-12-04 | 2016-04-20 | 天津智慧信源科技有限责任公司 | Code scrambling method for electronic code of RFID labeled product |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1742279A (en) * | 2002-12-17 | 2006-03-01 | 夏普株式会社 | Barcode recognition apparatus |
-
2009
- 2009-12-31 CN CN2009102175230A patent/CN102117399A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1742279A (en) * | 2002-12-17 | 2006-03-01 | 夏普株式会社 | Barcode recognition apparatus |
Non-Patent Citations (1)
Title |
---|
范哲意等: "基于拍摄图像的PDF417条码识别", 《北京理工大学学报》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105512590A (en) * | 2015-12-04 | 2016-04-20 | 天津智慧信源科技有限责任公司 | Code scrambling method for electronic code of RFID labeled product |
CN105512590B (en) * | 2015-12-04 | 2019-01-25 | 天津智慧信源科技有限责任公司 | A kind of scrambling method of RFID tag product electronic code |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6685095B2 (en) | Apparatus and method for decoding damaged optical codes | |
US20040026511A1 (en) | Guiding a scanning device to decode 2D symbols | |
CN104732183B (en) | A kind of bar code recognition methods based on the analysis of image sampling line half-tone information | |
US20110053639A1 (en) | Methods and devices for authenticating a product and a two-dimensional code and novel application of a two-dimensional code | |
US7949187B2 (en) | Character string recognition method and device | |
EP1278151A2 (en) | High speed image acquisition system and method | |
US5486689A (en) | Method and apparatus for decoding unresolved multi-width bar code symbology profiles | |
JP4202101B2 (en) | Barcode recognition method and recognition decoding processing apparatus | |
JP2008027029A (en) | Optical symbol, article therewith, method of attaching optical symbol to article, and method of decoding optical symbol | |
EP2544128A1 (en) | Method for creating and method for decoding two-dimensional colour code | |
US8333326B2 (en) | Stacked barcode reader and stacked barcode reading method | |
CN101874250A (en) | Enhanced virtual scan line processing | |
US9070033B2 (en) | Stack barcode reader and stack barcode reading method | |
US20060175414A1 (en) | Method for reading out symbol information and device for reading out symbol information | |
US8381983B2 (en) | Apparatus and method for reading barcode | |
CN101901329A (en) | Method and device for recognizing low-resolution barcode | |
JP5379626B2 (en) | Stack bar code information reading method and stack bar code information reading device | |
CN102117399A (en) | Method and device for recognizing document barcode | |
CN1217291C (en) | Cmnibearing information synchronous two-dimensional bar code system and reading method | |
US8403221B2 (en) | Method and apparatus for reading barcode information | |
US6164542A (en) | Method and apparatus for decoding unresolved symbol profiles produced from a reduced data set | |
CN114298078A (en) | Decoding method for stained one-dimensional bar code | |
JP5683891B2 (en) | Stacked bar code reader and stack bar code reading method | |
JP5657987B2 (en) | Stacked bar code reader and stack bar code reading method | |
CN117574931B (en) | One-dimensional bar code information generation method based on 3D structure and laser decoding equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20110706 |