TWO-DIRECTIONAL BAR CODE SYMBOL AND ITS ENCODING & DECODING METHOD

Information

  • Patent Application
  • 20070272755
  • Publication Number
    20070272755
  • Date Filed
    May 23, 2007
    17 years ago
  • Date Published
    November 29, 2007
    17 years ago
Abstract
This present invention discloses one type of two-dimensional bar code and its encoding and decoding method. The two-dimensional bar code is represented as circular element modules (CEMs), between which there are spaces. As a CEM remains a CEM after deep defocusing imaging, it can be restored well to be the same shape as that of a CEM after the filtering by the Unsharp Mask. This design enables the image processing algorithm to become insensitive to the selection of the binarization threshold value. Since there is space between modules, it is less likely that the adjacent modules will stick together after binarization so that each module can be positioned independently. The present invention is very reliable for reading and decoding even under imaging conditions of deep defocusing and low illumination. Its features include easy-to-read, strong error correction capability and low requirement for reading devices, which makes it a potential popular application.
Description

DESCRIPTION OF THE DRAWINGS


FIG. 1 Illustration of a two-dimensional bar code symbol.



FIG. 2 Flow chart of the decoding process.



FIG. 3 Original two-dimensional bar code image captured during the decoding process.



FIG. 4 Enhanced image of the original two-dimensional bar code image in FIG. 3.



FIG. 5 Illustration of the image after binarization of the enhanced image in FIG. 4.



FIG. 6 Border image after the edge detection of the image in FIG. 5.



FIG. 7 Illustration of the outcome image after the close bar tracing on the border image.



FIG. 8 Illustration of the CEM identification on the outcome image after the close bar tracing.



FIG. 9 Reconstructed two-dimensional bar code symbol.



FIG. 10 Illustration of how to define a certain pixel's adjacent pixels during the edge detection.





DETAILED DESCRIPTION

The following paragraphs provide a further detailed description of the present invention exemplified with detailed implementation and the attached drawings.


This design adopts circular element modules (CEM), between which there are spaces. As a CEM remains a CEM after deep defocusing imaging, it can be restored well to be the same shape as that of a CEM after the filtering by the Unsharp Mask. This design enables the image processing algorithm to become insensitive to the selection of the binarization threshold, for the reason that although the threshold affects the size of the CEM after binarization, the center coordinates of the CEM will not shift with the change of the threshold, furthermore, since there is space between modules, it is less likely that the adjacent modules will stick together after binarization so that each module can be positioned independently.


As shown in FIG. 1, the targeted bar code is composed of 12×9 solid CEMs with same sizes and same distances between each other. The distance between the centers of said two adjacent CEMs is larger than the diameter of a CEM. The CEM can select two color with one as background color and the other front ground color. Sufficient difference is maintained between the brightness of the front ground color and that of the background color to ensure the bar code readability. Multiple colors can also be adopted for the CEMs. Its 4:3 shape proportion is also compactable with the height and width of the image generated by mobile phone camera, thus all image pixels can be utilized in a most effective way. In the mean time, it only needs to determine whether it has turned 180 degrees, thus reduces half of the calculation to identify the bar code direction, compared with the rectangular bar code.


The four CEMs at the four corners of the bar code symbol are set to be front ground color, while the rest 104 CEMs are used to store data. The front ground color CEMs store bit ‘1’, while the background color CEMs store bit 0′. The 104 CEMs can store 104 bit data in total, the first 80 of which are used to store valid data while the remaining 24 bit store error correction data. Error correction data is generated by the following means: the 80 bit information data is divided into 10 groups with 8 bits in each group, thus 10 8-bit information data codewords will be produced. These 10 codewords are then operated using Reed-Solomon error correction algorithm of GF (256) to create 3 8-bit error correction codewords (24 bit in total). The 13 codewords are arranged in a way as shown in FIG. 1, where the adjacent 8 element modules with the same color store one codeword. The colors s are simply to label the grouped codewords and have nothing to do with its reading. 3 error correction codewords can correct error of only one codeword. In other words, 3 error correction codewords can correct errors of only 8 element modules that belong to the same codeword. Without regard to the defacement on the bar code, this error correction capability is sufficient (the one-dimensional bar code that has only the check functionality can also be used effectively.) In order to utilise the correction capability of the 24 redundant bits, BCH correction codes can be selected to correct up to 11 bit data in any position by using the 24 BCH check bits, and thus a bar code symbol even with defacement of 10% area can also be readable.


The requirement for the quiet zone: the quiet zone is the close-by surrounding area of the bar code symbol. Decoding requires a two-dimensional reading device and has certain requirements for the quiet zone to ensure successful decoding. The present invention does not set up special identification and positioning mode; thus the width of four CEMs must be maintained for the quiet zone. In order to diminish the requirements for the size of the quiet zone, a close bar can be added to the bar code symbol as an aspect for identification.


As shown in FIG. 2, the decoding process is defined as identification of the bar code symbol from the image taken with mobile phones and restoration of the encoded data from a bar code. The image is composed of two-dimensional pixel matrix. In order to standardize the expression, the images taken with the mobile phones are set to be 8 bit gray scale images, in which every pixel's brightness is defined with a 8-bit numeral. The value ranges from 0 to 255, while the brightness of the corresponding images ranges from the darkest to the whitest.


I. Image Enhancement


The bar code image taken in short shooting distance with a mobile phone, as shown in FIG. 3, is blurry and has low contrast. As the targeted aspects of the CEMs in the image are inconspicuous and difficult to identify, the image needs to be enhanced. Unsharp Mask algorithm is used to enhance images, which is often used in digital image processing domain to enhance images. Its theory is to apply two-directional Gaussian Lowpass Filtering on the original image to obtain a blurry image, which will be removed from the original image to achieve an image with enhanced contrast, as shown in FIG. 4. If the original image is F(x, y), and image U (x, y) is achieved after applying Gaussian Lowpass Filtering, then the enhanced image will be V(x,y)=F(x,y)+K (F(x,y)−U(x,y)), where K is the amplification coefficient, and the empiric values range from 1 to 4. The larger the K is, the more effective the enhancement, but the noise in the image will also be zoomed in.


II. Binarization


The enhanced image requires binarization processing. Set a threshold value T (0<T<255), and the pixels that has a brightness larger than T are classified as White while the others Black. As the pixel brightness has a larger dynamic range after the image enhancement, where background brightness is close to a maximum value of 255 and the brightness of the CEM pixels is close to a minimum value of 0, it is easy to choose a static or dynamic threshold T. The image after binarization processing is shown in FIG. 5.


III. Edge Detection


Edge detection is applied to the image after binarization processing. The edge is defined as pixels with a pixel value of zero whose 8 adjacent pixels include non-zero pixel(s). The definition of a certain pixel's adjacent pixels is shown in FIG. 10, where the pixel is numbered 0, with its adjacent pixels numbered from 1 to 8. If a pixel is the border pixel then it is labeled as the maximum brightness 255, otherwise 0. Edge detection is to obtain the border image by performing border identification on all pixels in the image after binarization processing. The outcome image after the edge detection on each element module is shown in FIG. 6.


IV. Close Bar Tracing


Close bar tracing is operated on the border image obtained from the edge detection in the above said step 3. The steps are:

    • a. scanning the border image in the left-to-right and top-to-bottom direction until the first border pixel is met, which will be set as the start pixel of the border tracing. If there is no border pixel is found, it indicates the end of the processing.
    • b. placing the start pixels coordinates in array Q and labeling it as zero to indicate it has been traced.
    • c. identifying if any of the 8 pixels adjacent to the start pixel contains a border pixel; if yes, either one of the pixels will be selected randomly as the starting point of next trace, then jumping to step b; otherwise, the tracing is ended, and the pixel coordinates list in array Q represents a close bar as well as the border of the targeted CEMs to be selected. Cleaning the pixel coordinates list stored in array Q and jumping to step a.


As shown in FIG. 7, the border of the CEM image is detected at the end of the processing, but at the same time part of the dark noise spots is mixed in the outcome.


V. CEM Identification


This step is intended to eliminate part of the noise data from the detection outcome from step 4, which means discarding the non-circle close bar. The identification of the noise data is based on the geometric aspects of circles. As for a close bar, add up the pixel X-coordinates of all border points of the close bar, and divide the sum by the number of border points, which produces u—the pixel X-coordinate of the center point of the close bar; then add up the pixel Y-coordinates of all border points of the close bar, and divide the sum by the number of border points, which produces v—the pixel Y-coordinate of the center point of the close bar. Start from the pixel coordinates (u, v) and scan the diameter of the close bar in 4 directions, which produces 4 length values d1, d2, d3, d4 as shown in FIG. 8. Calculate the average diameter d=(d1+d2+d3+d4)/4 and define the circle normalization as N=|d−d1|/d+|d−d2|/d+|d−d3|/d+|d−d4|/d. The smaller the N value is, the more reliable that the close bar is a circle. Calculate the N value of each close bar. Discard the close bars whose N value from the actual test result is larger than the set threshold value TN. The rest of the close bars are considered as the border of the bar code CEMs.


VI. Distinguish and Eliminate Those CEMs that Belong to Different Bar Code Symbols

Not all CEMs in the image belong to one two-dimensional bar code. Therefore it is necessary to collect a group of CEMs that belong to the same two-dimensional bar code. First of all, define the length difference of 2 circles: assume that one circle's diameter is D1 while the other D2. The length difference of these two circles will be Ldif=|D1−D2|/max (D1, D2). The width of the bar code quiet zone is the total of diameters of M CEMs, which means that there must be a clear area that has a width of M CEM diameters around the bar code. There are different requirements for sizes of the quiet zones in different bar code system. Here the so-called Crystal Increment method is used to distinguish and eliminate those CEMs that belong to different bar code symbols


First, select the CEM that is closest to the center point of the image as the seed CEM. Put those CEMs that are less than M distant from this seed CEM and have a length difference Ldif less than the predefined value into the subgroup. After the first round of increment, use the CEMs that are just put into the subgroup as seed CEMs to repeat the increment process until no new CEMs is to be added to the group.


By now, the bar code has been segmented from the image, and the CEMs of the bar code are also positioned. The following steps are to determine the coordinates of each CEMs in the bar code.


VII. Positioning


Based on the close bar coordinates of each CEM in the image, calculate the smallest enclosing rectangle of the CEM group obtained from Step 6, and draw a horizontal line and a vertical line across the center point of this rectangle, which will divide the CEMs into 4 zones: top left, top right, bottom left and bottom right zones. Each zone will have a spot that is most distant from the center point of the smallest enclosing rectangle and such spot is just the positioning CEM of this particular zone. Thus, the image coordinates of the four positioning CEMs from the top, bottom, left and right of the bar code are determined.


The bar code symbol coordinates of the positioning CEMs at the four corners are set as (0, 0), (11, 0), (0, 8) and (11, 8). Based on the symbol coordinates and image coordinates of the four positioning CEMs', the following coordinate correction formulas can be worked out, and then the symbol coordinates of other CEMs can be determined by using such coordinate correction formulas worked out and the image coordinates of the center points of such other CEMs:






x′=K
0
*x+K
1
*x*y+K
2
*y+K
3;






y′=K
4
*x+K
5
*x*y+K
6
*y+K
7;


where (x′, y′) is the symbol coordinates of each CEM, while (x, y) is the image coordinates of the center point of the same CEM; substitute the symbol coordinates of the positioning CEMs at the four corners in the bar code symbol and their image coordinates into the above formulas, which will produce 8 linear equations each with 8 unknowns; the 8 coefficients K0˜K7 can be obtained by resolving this system of equations; the coordinate correction formulas are then worked out by substituting K0˜K7 to the equations. The symbol coordinates of each CEM can be then determined by substituting the image coordinates of the center of the same CEM into the coordinate correction formulas worked out. Normally, the results of x′ and y′ are not integers and should be rounded.


VIII. Restoration and Error Correction of Codewords


As shown in FIG. 9, set the value for each bit of the codeword based on the codeword bit arrangement of the bar code CEMs during the encoding process and each CEM's coordinates in the bar code symbol calculated in Step 7, the codewords that match any of the CEMs will have a bit value of 1; otherwise 0. Error correction processing on the codewords is performed using Reed-Solomon Error Correction algorithm. There are 3 error correction codewords among the 13 codewords, thus one error can be corrected. A codeword with only one error in any bit is regarded as an error. If the error correction processing is successfully completed, decoding is successful and 10 data codewords will be output.

Claims
  • 1. A two-dimensional bar code, comprising a bar code symbol having element modules with different optical reflectance that are arranged on a fundus, wherein each of said element modules is a circular element module (CEM), between which there is space.
  • 2. A two-dimensional bar code as recited in claim 1, wherein said CEMs are solid CEMs with same sizes and same distances between each other.
  • 3. A two-dimensional bar code as recited in claim 1, wherein a distance between centers of two adjacent CEMs is larger than a diameter of a CEM.
  • 4. A two-dimensional bar code as recited in claim 1, wherein said bar code symbol has a matrix of 12×9 CEMs.
  • 5. A two-dimensional bar code as recited in claim 1, wherein said bar code symbol's shape proportion is 4:3.
  • 6. A two-dimensional bar code as recited in claim 1, wherein said bar code symbol is surrounded with a close bar.
  • 7. A two-dimensional bar code as recited in claim 1, wherein there is a quiet zone with the width of four CEMs at the outermost region of said bar code symbol.
  • 8. A two-dimensional bar code as recited in claim 4, wherein the CEMs at each of four corners are positioning element modules, of which the coordinates are (0, 0), (11, 0), (0, 8), and (11, 8) respectively the remainder of the element modules being divided into 13 groups: said coordinates (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1) and (2, 2) are Group 1; said coordinates (0, 3), (0, 4), (0, 5), (1, 3), (1, 4), (1, 5), (2, 4) and (2, 5) are Group 2; said coordinates (0, 6), (0, 7), (0, 8), (1, 6), (1, 7), (1, 8), (2, 6) and (2, 7) are Group 3; said coordinates (0, 9), (0, 10), (1, 9), (1, 10), (1, 11), (2, 9), (2, 10) and (2, 11) are Group 4; said coordinates (3, 0), (3, 1), (4, 0), (4, 1), (4, 2), (5, 0), (5, 1) and (5, 2) are Group 5; said coordinates (2, 3), (3, 2), (3, 3), (3, 4), (3, 5), (4, 3), (4, 4) and (4, 5) are Group 6; said coordinates (2, 8), (3, 6), (3, 7), (3, 8), (3, 9), (4, 6), (4, 7) and (4, 8) are Group 7; said coordinates (3,10), (3,11), (4,9), (4,10), (4,11), (5,9), (5,10) and (5,11) are Group 8; said coordinates (6,0), (6,1), (6,2), (7,0), (7,1), (7,2), (8,1) and (8,2) are Group 9; said coordinates (6,3), (6,4), (7,3), (7,4), (7,5), (8,3), (8,4) and (8,5) are Group 10; said coordinates (5,3), (5,4), (5,5), (5,6), (5,7), (5,8), (6,5) and (6,6) are Group 11; said coordinates (6,7), (6,8), (7,6), (7,7), (7,8), (8,6), (8,7) and (8,8) are Group 12; and said coordinates (6,9), (6,10), (6,11), (7,9), (7,10), (7,11), (8,9) and (8,10) are Group 13.
  • 9. A two-dimensional bar code encoding method for using a two-dimensional bar code as recited in any of claim 1 to claim 8, the method comprising the following steps to encode a binary data stream and output a bar code symbols: A. said binary data stream is segmented into information data codewords that have a specific bit length; B. said information data codewords are operated using an error correcting algorithm to produce error correction codewords; C. said information data codewords and error correction codewords are turned into a bar code symbol that contains CEMs as its element modules between which there are spaces.
  • 10. An encoding method as recited in claim 9, wherein said bar code symbol contains a matrix of 12×9 CEMs, of which CEMs at each of four corners are positioning elements; among the remaining 104 CEMs, the first 80 are used to store information data while the remaining 24 are used to store error correction data.
  • 11. An encoding method as recited in claim 10, wherein said error correction codewords are generated by the following steps: the 80 bit information data is divided into 10 groups with 8 bits in each group, thus 10 8-bit information data codewords are generated; and these 10 codewords are operated using the error correcting algorithm to create 3 8-bit error correction codewords.
  • 12. An encoding method as recited in claim 11, wherein a Reed-Solomon error correcting algorithm is used for said error correcting algorithm.
  • 13. An encoding method as recited in claim 12, wherein said error correction codewords are based on BCH error correction code.
  • 14. A two-dimensional bar code decoding method, comprising the following steps: 1) capturing an image of a bar code symbol, 2) performing binarization processing on the captured bar code symbol image, 3) obtaining a border image by performing edge detection on circular element modules (CEMs), 4) tracing a close bar of the border image, 5) CEMs identification, 6) distinguishing and eliminating those CEMs that belong to different bar code symbols, 7) positioning, and 8) codeword restoration and error correction.
  • 15. A decoding method as recited in claim 14, further comprising between said step 1) and step 2), step 1′) image enhancement processing of the captured bar code symbol image.
  • 16. A decoding method as recited in claim 14, wherein, a border pixel obtained from said edge detection process in said step 3) is defined as a pixel with a pixel value of zero whose 8 adjacent pixels include non-zero pixel(s); said edge detection is to obtain the border image by performing border identification on all pixels in a binarization image, and the border pixel is labeled as highest brightness 255 while the rest 0.
  • 17. A decoding method as recited in claim 14, wherein, the process of tracing the close bar of the border image in said step 4) includes: 4.1) from top-to-bottom scanning each line of the border image in a left-to-right direction until a first border pixel is met, which will be set as start pixel of the tracing; if there is no border pixel is found, it indicates the end of the processing;4.2) placing coordinates of the start pixel in an array Q and setting a start pixel value to zero to indicate that the start pixel has been traced;4.3) identifying if any of 8 pixels adjacent to the start pixel is a border pixel; if yes, one of the border pixels will be selected randomly as a starting point of a next tracing, and then jumping to step 42); otherwise, the process of tracing is ended, and the coordinates listed in array Q represents a close bar, store a pixel coordinates list, clean the array Q and jump to step 41).
  • 18. A decoding method as recited in claim 14, wherein, the process of CEMs identification in said step 5) includes: 5.1) adding up pixel X-coordinates of all border points of the close bar, and dividing the sum by the number of border points, which produces u, which is the pixel X-coordinate of the center point of the close bar; then adding up pixel Y-coordinates of all border points of the close bar, and dividing the sum by the number of border points, which produces v, which is the pixel X-coordinate of the center point of the close bar;5.2) starting from the pixel coordinates (u, v) and scanning the diameter of the close bar in 4 directions, which produces 4 length values d1, d2, d3, and d4;5.3) averaging out the diameter as d=(d1+d2+d3+d4)/4 and defining a circle normalization as N=|d−d1|/d+|d−d2|/d+|d−d3|/d+|d−d4|/d;5.4) calculating the N value for each close bar; discarding the close bar whose N value is larger than the set threshold TN, the rest of the close bars are considered as the border of the bar code CEMs.
  • 19. A decoding method as recited in claim 14, wherein the process of distinguishing and eliminating those CEMs that belong to different bar code symbols in said step 6) includes: 6.1) obtaining a length difference of 2 CEMs: assuming that one CEM's diameter is D1 while the other D2, then the length difference of these two CEMs will be Ldif=|D1−D2|/max(D1,D2); assuming that the width of the bar code quiet zone is the total of diameters of M CEMs and the length difference of the circles is Ldif;6.2) selecting the CEM that is closest to the center point of the image as a seed CEM; putting those CEMs that are less than M distant from this seed CEM and have a length difference Ldif less than the predefined value into subgroup;6.3) after first round of increment, using CEMs that are newly added into to the subgroup as seed CEMs to repeat the increment process until no new CEMs are to be added to the subgroup.
  • 20. A decoding method as recited in claim 14, wherein the positioning process in said step 7) includes: 7.1) finding a positioning CEM at each of four corners of the bar code symbol;7.2) setting coordinates of the positioning CEM at each of four corners;7.3) calculating coordinates of each CEM using a coordinate correction formula.
  • 21. A decoding method as recited in claim 14, wherein the process in said step 8) includes: according to a codeword bit arrangement of the bar code symbol during an encoding process and each CEM's coordinates in the bar code symbol, setting a value for each bit of each codeword; any bit of codewords that match the CEMs will have a bit value of 1, otherwise 0; using a Reed-Solomon error correcting algorithm to process the codewords; data characters will be generated after successful error correction.
  • 22. A decoding method as recited in claim 20, wherein the specific process of said step 7.1) includes: calculating a smallest circum-rectangle of a CEM group based on the close bar coordinates of each CEM, and drawing a horizontal line and a vertical line across center coordinates of this rectangle, which will divide the CEMs into 4 zones, including top left, top right, bottom left and bottom right zones; each zone will have a spot that is most distant from the center coordinates of the rectangle and this spot will be the positioning CEM of this particular zone.
  • 23. A decoding method as recited in claim 20 or 22, wherein the specific process of said step 7.2) includes: setting the coordinates of the positioning CEMs at the four corners in the bar code symbol as (0, 0), (11, 0), (0, 8) and (11, 8).
  • 24. A decoding method as recited in claim 20, wherein the specific process of said step 7.3) includes: using the coordinates correction formulas x′=K0*x+K1*x*y+K2*y+K3;y′=K4*x+K5*x*y+K6*y+K7;where (x′, y′) is the symbol coordinates of each CEM in the bar code symbol, while (x, y) is image coordinates of the center point of a same CEM in the image; substituting the symbol coordinates and the image coordinates of the positioning CEMs at the four corners in the bar code symbol into the above formulas; the 8 coefficients K0˜K7 can be obtained by resolving this system of equations; calculating the symbol coordinates of each CEM in the bar code symbol by substituting the image coordinates of a center of the same CEM in the image into the above formulas.
  • 25. A decoding method as recited in claim 23, wherein the specific process of said step 7.3) includes: using the coordinates correction formulas x′=K0*x+K1*x*y+K2*y+K3;y′=K4*x+K5*x*y+K6*y+K7;where (x′, y′) is the symbol coordinates of each CEM in the bar code symbol, while (x, y) is the image coordinates of the center point of a same CEM in the image; substituting the symbol coordinates and the image coordinates of the positioning CEMs at the four corners in the bar code symbol into the above formulas; the 8 coefficients K0-K7 can be obtained by resolving this system of equations; calculating the symbol coordinates of each CEM in the bar code symbol by substituting the image coordinates of a center of the same CEM in the image into the above formulas.
Priority Claims (1)
Number Date Country Kind
200610021095.0 May 2006 CN national