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
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
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
I. Image Enhancement
The bar code image taken in short shooting distance with a mobile phone, as shown 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
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
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:
As shown in
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
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
Number | Date | Country | Kind |
---|---|---|---|
200610021095.0 | May 2006 | CN | national |