Summary of the invention
The present invention is the data capacity in order to improve bar code, thereby a kind of coding/decoding method of continuous multi-system bar code is provided.
A kind of coding method of continuous multi-system bar code:
Step 1, the existing bar code standard of utilization, carry out barcode encoding by raw data, obtains the binary matrix after coding;
Step 2, the binary matrix of multiple same sizes that step 1 is obtained are fused into a matrix by the mode of element alignment;
Matrix in step 3, integrating step two and the analytic ability of bar code recognizing apparatus create color map table;
Step 4, give corresponding color by searching color map table for each element of the matrix that obtains in step 2, and generate visual multi-system bar code;
The above and below of the bar code of step 5, the multi-system that obtains in step 4 arranges respectively two identical bar codes, complete the coding of a continuous multi-system bar code, in this bar code, coded data is the cryptographic hash of sequence number and barcode encoding data, and effect is the completeness check of the sequence number in continuous bar code sequence and data as this multi-system bar code.
Existing bar code standard described in step 1 comprises the standard of bar code and two-dimensional bar code.
In step 3, select color space according to the analytic ability of bar code recognizing apparatus, and set up the mapping table of matrix element and color.
While selecting gray space according to the analytic ability of bar code recognizing apparatus in step 3, adopt the mode of Gray Classification to select color, generate gray scale multi-system bar code.
While selecting color space according to the analytic ability of bar code recognizing apparatus in step 3, use the color of mutual otherness maximum, generate colored multi-system bar code.
Two identical bar codes described in step 5 are the bar code of any a kind of Standards and formats.Bar code encoded content is the cryptographic hash of sequence number and barcode data.
A kind of coding/decoding method of continuous multi-system bar code: the decode procedure to the each multi-system bar code in continuous multi-system bar code is:
Steps A, gather continuous multi-system bar code image by scanning device or image capture device;
Step B, each bar code image is carried out to bar code identification decoding, obtain two sequence numbers that bar code is entrained of this multi-system bar code above and below;
Whether two sequence numbers that step C, determining step B obtain mate, if judged result is yes, perform step D; If judged result is no, perform step G;
Whether two sequence numbers that step D, determining step B obtain repeat with the sequence number of the multi-system bar code receiving, if judged result is yes, perform step E, if judged result is no, perform step F;
Step e, judge the whether successfully decoding of the corresponding multi-system bar code of this sequence number, if the judgment is No, perform step F; If judged result is yes, perform step G;
Step F, the bar code of multi-system is decoded, obtain decoded data storage, and complete the completeness check of data according to the cryptographic hash in bar code, complete the decoding of this multi-system bar code;
The bar code of step G, this multi-system is invalid, preserves current data, finishes the decoding of the bar code to this multi-system.
Beneficial effect: Code And Decode method of the present invention, effectively raises the data capacity of bar code; And can make full use of bar code encoding and decoding resource, and the present invention easily realizes, and extendability is strong.
Embodiment
Embodiment one, in conjunction with Fig. 1,2,10,11 and 12 explanation these embodiments, a kind of coding method of continuous multi-system bar code, the coding method of its continuous multi-system bar code is:
Step 1, the existing bar code standard of utilization, carry out barcode encoding by raw data, obtains the binary matrix after coding;
Step 2, the binary matrix of multiple same sizes that step 1 is obtained are fused into a matrix by the mode of element alignment;
Matrix in step 3, integrating step two and the analytic ability of bar code recognizing apparatus create color map table.In the time that bar code recognizing apparatus can only be identified greyscale color, the color value in color table can only be in discernible tonal range value; In the time that bar code recognizing apparatus can be identified colour, the color value in color table is value in discernible gamut of coloration.
Step 4, give corresponding color by searching color map table for each element of the matrix that obtains in step 2, and generate visual multi-system bar code;
The above and below of the bar code of step 5, the multi-system that obtains in step 4 arranges respectively two identical bar codes, and this bar code is the sequence number in continuous bar code sequence as this multi-system bar code, completes the coding of a continuous multi-system bar code.
The coding method of a kind of continuous multi-system bar code described in embodiment two, this embodiment and embodiment one, is characterized in that the existing bar code standard described in step 1 comprises the standard of bar code and two-dimensional bar code.
The coding method of a kind of continuous multi-system bar code described in embodiment three, this embodiment and embodiment one, the matrix after the coding that it is characterized in that described in step 2, step 1 being obtained is merged and is formed multi-system bar code data by the mode of element alignment.
The coding method of a kind of continuous multi-system bar code described in embodiment four, this embodiment and embodiment one, it is characterized in that selecting color space according to the analytic ability of bar code recognizing apparatus, and set up the mapping table of matrix element and color.
The coding method of a kind of continuous multi-system bar code described in embodiment five, this embodiment and embodiment one, while it is characterized in that selecting gray space according to the analytic ability of bar code recognizing apparatus, adopt the mode of Gray Classification to select color, generate gray scale multi-system bar code.
Multi-system bar code implementation method in present embodiment is on the basis of general bar code standard, introduces Gray Classification and carrys out growth data capacity formation multi-system bar code.Multi-system bar code can be divided into multi-system bar code, multi-system two-dimensional bar code.Multi-system bar code is compared common any Standards and formats bar code can significantly improve data storage capacity.
For the multi-system bar code of multiple gray shade scales, should within the scope of the gray-scale value of 0-255, evenly divide in theory, Gray Classification number is on demand determined gray-scale value.Should consider in actual applications the feature of bar code carrier, can be slightly closer for adjacent gray shade scale spacing in tonal range easy to identify, the spacing of the adjacent gray shade scale in gray area not easy to identify can be slightly far away, as shown in Figure 6.Gray scale bar code as shown in Figure 7.
The coding method of a kind of continuous multi-system bar code described in embodiment six, this embodiment and embodiment one, while it is characterized in that selecting color space according to the analytic ability of bar code recognizing apparatus, use the color of mutual otherness maximum, generate colored multi-system bar code.
Present embodiment is mainly introduced multi-system two-dimensional bar code as an example of color space mode example, colored multi-system bar code is identical with the principle of the multi-system bar code technology based on multiple gray shade scales, technology is similar.
Identify preferably multi-system bar code for the ease of image capture device, the color of use should be easy to distinguish.To use the multi-system color two dimension bar code of 8 kinds of colors as example, our principle is the color using as 8 vitta codes for 8 o'clock of taking out Euclidean distance maximum in rgb color space, these 8 kinds of colors are red, green, blues, black, white, pinkish red, blue or green and yellow, between these 8 kinds of colors, there is striking contrast, be convenient to distinguish recognition.For other applicable cases, can select suitable color according to actual conditions, reach features such as being easy to differentiation, anti-distortion.With reference to figure 3, Fig. 4 and Fig. 5.
The multi-system bar code technology of present embodiment is based on general barcode technology.Such as: adopt three any Standards and formats bar codes to represent respectively tri-Color plane of R/G/B, can generate multi-system 8 color two dimension bar codes of 8 kinds of colors by the stack of three Color plane.
When coding, can use any Standards and formats barcode technology to encode, 3 continuous barcode encoding result combinations are shown and can generate 18 colored multi-system bar code; When decoding, according to R/G/B, colored multi-system bar code is divided into three layers, gets final product to obtain 3 any Standards and formats bar codes, solve continuously these 3 data after any Standards and formats bar code and link together and just completed the decoding work of multi-system bar code.As shown in Figure 9.
Three planes represent respectively R/G/B color-values, and three planes are respectively with the form coding of any Standards and formats bar code, and in any Standards and formats bar code, the coding result of each module is that 0 or 1,0 expression is white, and 1 expression is black.For three layers of bar code, by the result shifter-adder of every layer of coding, obtain the coding result of the each module of three-dimensional code.For example, for a module, R plane coding result is that 0, G plane coding result is that 1, B plane coding result is 1, and for Three-Dimensional Bar Code, this position module coding result is 011, shows bar code according to the color of 011 correspondence; When decoding, be data 011 according to corresponding relation by the color conversion collecting, separated three planes and decode respectively, the data recombinant decoding arrives together.With reference to Figure 10, Figure 11, Figure 12.
Represent for 3 bar codes recited above that respectively the stack of R/G/B Color plane generates the technology of 1 Three-Dimensional Bar Code.In the time that the stack number of plies is not 3 layers, no longer with R/G/B layering, only need to be to unified color corresponding to each coding result of specifying of encoding and decoding.For example, in the time of 8 two-dimensional bar code stacks, can produce 2 the i.e. 256 kinds of colors of 8 powers, the three-dimensional code of 8 kinds of colors that capacity produces compared with 3 layers of Quick Response Code stack has promoted 32 times.
The expansion of this method also can be based on gray scale, and the gray scale multi-system bar code of 8 bar code stack generations can represent by 256 kinds of gray scales.
Be superposed to example with 4 layers of any Standards and formats bar code, coded system is as follows: → presentation code is:
The coding method of a kind of continuous multi-system bar code described in embodiment seven, this embodiment and embodiment one, is characterized in that two identical bar codes described in step 5 are the bar code of any a kind of Standards and formats.
The bar code sequence number in continuous bar code sequence of encoding, realizes the continuity of bar code by sequence number.Under stroboscopic scene, while decoding the stroboscopic photograph photographing, whether unanimously judge the availability of bar code by more upper and lower two sequence numbers: when consistent, bar code can be used; When inconsistent, bar code is unavailable.
Present embodiment has realized from the bar code of any Standards and formats and has changed into continuous type, multi-system bar code, in promoting bar code capacity, has realized bar code operating such and barcode standard compatibility, and method can be applied to storage and the transmission of Large Volume Data.The method proposing has advantages of easy understanding, easily realizes, easily expands.
The coding/decoding method of embodiment eight, a kind of continuous multi-system bar code: the decode procedure to the each multi-system bar code in continuous multi-system bar code is:
Steps A, gather continuous multi-system bar code image by scanning device or image capture device;
Step B, each bar code image is carried out to bar code identification decoding, obtain two sequence numbers that bar code is entrained of this multi-system bar code above and below;
Whether two sequence numbers that step C, determining step B obtain mate, if judged result is yes, perform step D; If judged result is no, perform step G;
Whether two sequence numbers that step D, determining step B obtain repeat with the sequence number of the multi-system bar code receiving, if judged result is yes, perform step E, if judged result is no, perform step F;
Step e, judge the whether successfully decoding of the corresponding multi-system bar code of this sequence number, if the judgment is No, perform step F; If judged result is yes, perform step G;
Step F, the bar code of multi-system is decoded, obtain decoded data storage, and complete the completeness check of data according to the cryptographic hash in bar code, complete the decoding of this multi-system bar code;
The bar code of step G, this multi-system is invalid, preserves current data, finishes the decoding of the bar code to this multi-system.
Continuous bar code mainly contains two types according to the difference of application, and a kind of is the bar code to printing, the continuous bar code that adopts the fast mode of sweeping to identify; Another kind of continuous bar code is to utilize the equipment such as display, shows bar code according to certain frame per second in the mode of video playback, reaches successional object.Present embodiment belongs to the latter.
The present invention has designed a kind of method of encoding and decoding of simple and effective continuous bar code.This method is that sequence number can represent with a bar code, ensures the complete and correct order of data by this sequence number for bar code increases a sequence number, and the data content of continuous bar code connects the data of each bar code by sequence number ascending order.In the time that image capture device is distinguished, if bar code shows with certain frequency with electronic display unit, may occur showing asynchronous with shooting, cause the appearance of bad frame, for avoiding this situation, the identical sequence number representing with bar code is set in the above and below of bar code, only has in the time that upper and lower two sequence numbers are identical, this bar code is just effective.The situation of repeatedly taking for same bar code, also can according to sequence number repeat unnecessary bar code is abandoned.
Coding side is that any Standards and formats bar code of one dimension is placed in multi-system bar code above and below assigned address by information codings such as the sequence numbers of bar code; Decoding end is determined sequence number by any Standards and formats bar code of identification one dimension, determines whether multi-system bar code is decoded.
For the photographing phase in bar code guarantees data integrity, need picture pick-up device to take by certain frequency, for the situation of taking display, filming frequency will reach the more than 2 times of display frequency.To detect by sequence number the processing of shooting results, repetition bar code and invalid bar code are lost.