Maxicode Encoding and Decoding

Maxicode Barcode Encoding Character Set

Maxicode barcode allows encoding of 256 international characters, including ASCII characters with values ​​of 0-127 and extended ASCII characters with values ​​of 128-255. In the number combination mode, 6 characters can be used to represent 9 digits. Characters used for code-switching and other control are also included in the character set of the Maxicode barcode.
 
Representation of Maxicode Symbol Characters

1. Each character consists of 6 hexagonal modules.
2. Each module represents a binary bit, the dark module represents "1" and the light module represents "0".
3. Usually six modules are arranged in 3 layers, the order is from top right to bottom left.
4. Due to the special structure of Maxicode barcode symbols, the symbol characters have a special arrangement form.
 
Code set
The character code is the value between the numeric character and the symbol character and is also the basis for error correction calculations. There are 64 characters in the Maxicode barcode, the range is 0-63, and the binary representation is 000000-111111. In each symbol character, the most significant bit is the module with the lowest number.
 
Symbol size
Each Maxicode symbol has a total of 884 hexagonal modules, which are divided into 33 layers to surround the central positioning pattern, and each layer is composed of 30 or 29 modules. There should be a blank area around the symbol. Each Maxicode barcode, including the blank area, has a fixed size of 28.14mm×26.91mm, about 1 square inch. The central positioning graphic is equivalent to the size of 90 modules.
 
Data capacity
Among the 884 hexagonal modules, 18 modules are used for positioning, and the remaining 866 are data modules. 2 unused modules are deducted. There are a total of 864 modules for data encoding and error correction. One. Contains 144 6-bit symbol characters, of which there must be at least 50 error correction characters and 1 pattern character, so the maximum data capacity is 93 characters. If purely digital characters, it can be Store 138.
 
Error correction
Maxicode barcode provides two error correction levels, Standard Error Correction, and Extended Error Correction. These two levels require different numbers of words and provide different levels of error recovery capabilities. The error resilience of SEC is 16%, and that of EEC is 25%. Which error correction level is used is specified by mode characters.
 
Maxicode mode
As mentioned earlier, each Maxicode barcode has 1 mode character, which is used to define the symbol data and error structure. The code of the mode is part of the main message.
The UPS code specification originally launched in 1992 only had two modes:
 
1. Mode 0: The main message is a structured recipient message, and the secondary message can be programmed with up to 84 capital English letters, numbers, and punctuation.
 
2. Mode 1: The main message plus the secondary message can be programmed up to 93 capital English letters, or numbers, punctuation marks.
 
However, the above two modes have been abolished. Mode 0 is replaced by Mode 2 and Mode 3, and Mode 1 is replaced by Mode 4. The new model and content stipulated by AIMUSA are:
 
3. Mode 2: The main message is a structured recipient message plus a digital postal code, and the secondary message can be programmed with up to 84 characters.
 
4. Mode 3: The main message is a structured recipient message plus an alphanumeric postal code, and the secondary message can contain up to 84 characters.
 
Mode 2 and Mode 3 are suitable for transport operators, where the symbol indicates the destination address and service type defined by the recipient. The first 120 bits of the symbol use Extended Error Correction to represent the recipient's structured information, while the rest of the symbol uses Standard Error Correction to represent other information.
 
5. Mode 4: The main message plus the secondary message can be programmed up to 93 characters.
Mode 4 is a standard symbol, which indicates that Extended Error Correction is used in the main message part and Standard Error Correction is used in the secondary message part. There are 93 data characters in this mode.
 
6. Mode 5: The main message plus the secondary message can be programmed with at most 77 characters.
Mode 5 is the full Extended Error Correction mode, which instructs to use Extended Error Correction in both the main message and the secondary message. The symbol has 77 data characters.
 
7. Mode 6: The main message plus the secondary message can be programmed with up to 93 characters.
Mode 6 is the scanner programming mode. The message indicated by the indicator symbol is used for scanner programming. The main message uses Extended Error Correction, and the secondary message uses Standard Error Correction.
 
The above-mentioned "character" refers to a 6-bit symbol character. At present, the mode character actually only uses 4 bits such as No. 3~6, ​​which are placed in the first symbol character of the symbol.
 
Maxicode Barcode Decoding Steps
1. Grab an image containing Maxicode barcode tags.
2. Position to the bull's eye (concentric circle positioning figure).
3. Adjust the size of the captured Maxicode barcode image.
4. Cover the bull's eye (the bull's eye is turned blank).
5. Strengthen the edges of each hexagon.
6. Perform a forward scan action.
7. Locate the three bright spots in the scan (the upper left corner of the virtual hexagon).
8. Perform a reverse scan action.
9. After calculating the direction of the label, decide to use the bearing cluster of that direction.
10. Use the reverse scan image to locate the center of each hexagon, and then compare it with the original image.
11. Rebuild the binary order.
12. Perform error detection and correction to obtain the original message.