A two-dimensional code, a decoding method, system and storage medium thereof

By combining a central image-finding graphic block and a header information graphic block, the problem of low capacity and low decoding efficiency of traditional QR codes is solved through a new QR code design, achieving efficient storage and rapid parsing of large amounts of data.

CN120764573BActive Publication Date: 2025-11-07HUNAN QINHAI DIGITAL
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511214847.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-28
Publication Date
2025-11-07
Estimated Expiration
2045-08-28

AI Technical Summary

Technical Problem

Traditional QR codes have low capacity and space utilization, insufficient error correction capabilities, and low scanning and decoding efficiency, making them unable to meet the needs of efficient storage and rapid parsing of large amounts of data.

Method used

A novel QR code design is adopted, including a center-finding image block and a data image. The center-finding image block in the functional image can quickly lock the code surface range, and the positioning accuracy can be verified by combining the header information image block. It supports multi-QR code tiling design and uses XOR operation to process the data image, thereby improving space utilization and decoding efficiency.

Benefits of technology

It increases data storage capacity, improves space utilization and decoding speed, reduces positioning errors, and supports efficient storage and fast parsing of large amounts of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120764573B_ABST
    Figure CN120764573B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of two-dimensional code, and particularly relates to a two-dimensional code, a decoding method and system thereof and a computer readable storage medium. The two-dimensional code comprises a function pattern and a data pattern, the function pattern comprises a center image-finding positioning pattern block and at least one head information pattern block; the center image-finding positioning pattern block is arranged in a center area of the two-dimensional code, and when identification is performed, the second brightness large block of the center image-finding positioning pattern block can be used to quickly lock the code surface range, and then the center small dot is used to accurately position the coordinates; whether the image-finding pattern positioning is accurate is verified by decoding the head information pattern block, and only when the positioning is accurate, the identification of the encoding of the data pattern of the two-dimensional code is started; the present application avoids the interruption and error of data scanning caused by the slight deviation of positioning, and verifies the accuracy of the positioning in advance.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of two-dimensional codes, in particular to a two-dimensional code, a decoding method and system thereof, and a computer readable storage medium. BACKGROUND

[0002] The QR code (Quick Response Code) widely used at present is a kind of two-dimensional code, which has large storage capacity, low cost, can represent Chinese characters and images and other various text information, has strong security and anti-counterfeiting performance, and is very convenient to use, so it has been widely used in various industries. It has the advantages of high information storage density and fast reading speed, and is applied in many fields. However, with the advent of the big data era, the demand for storage and transmission of massive data is growing, and the problems of low capacity and space utilization rate of traditional QR codes have gradually become prominent. The traditional QR code still has the following technical limitations:

[0003] (1) Low capacity and space utilization rate: the traditional QR code only supports 177x177 modules, limiting the data capacity. The QR code sets a fixed large positioning pattern in the three corners, and has multiple auxiliary positioning blocks in the middle, plus version information, which occupies about 10%-15% of the code surface space, limiting the space utilization rate;

[0004] (2) Only supports binary encoding: relies on black and white pixel points, low data density, cannot utilize color or grayscale information;

[0005] (3) Insufficient error correction capability: fixed 4-level error correction code configuration, large error correction redundancy span, low space utilization rate, long character uses fixed length grouping interleaved encoding, error correction capability can only be optimal in special cases;

[0006] (4) Low scanning and decoding efficiency: point-by-point scanning and serial decoding method is difficult to handle large data processing.

[0007] The existing technology cannot meet the efficient storage and rapid analysis needs of high-definition images, video streams, large-capacity documents and other data, and there is an urgent need for a new type of matrix two-dimensional code that breaks through the traditional architecture. SUMMARY

[0008] The main purpose of the present application is to provide a two-dimensional code, a decoding method and system thereof, and a computer readable storage medium, to solve the above technical problems.

[0009] To achieve the above object, the application provides a two-dimensional code, which has a symbol size of MxM and is composed of two different brightness patterns, the two-dimensional code comprising a function pattern and a data pattern, the function pattern comprising a center image-seeking positioning pattern block with a size of NxN, and the data pattern comprising a data block surrounding the center image-seeking positioning pattern block, wherein N=8x n1+1, M=N+8x n2, n1 is a positive integer, and n2 is a positive integer greater than or equal to 2.

[0010] The center image-seeking positioning pattern block comprises a center rectangular border module with a size of 3N1x3N1 and composed of a pattern with a size of N1xN1 and a second brightness, the center of the center rectangular border module being consistent with the center of the two-dimensional code; a rectangular outer border module with a size of NxN and composed of a pattern with a size of N1xN1 and a second brightness, which is concentrically arranged around the center rectangular border module; a rectangular corner module with a size of aN1x bN1 and composed of a pattern with a second brightness, which is arranged at one inner corner of the rectangular outer border module; and a first brightness large square, which is filled with a pattern with a size of N1xN1 and a first brightness in the remaining part surrounded by the rectangular outer border module, wherein N1+aN1+N1≤(N-1) / 2, N1+bN1+N1≤N / 2, a and b are integers greater than or equal to 1, and a≠b.

[0011] The function pattern further comprises at least one header information pattern block, at least one of the header information pattern blocks being arranged immediately above, below or both above and below the center image-seeking positioning pattern block; the header information pattern block comprising version information, error correction level, code size level information, etc.

[0012] The data pattern comprises a plurality of code words arranged in the area where the data pattern is located according to the arrangement order corresponding to the version information, each code word comprising 8x n3 bits, n3 being a positive integer, and the bits being arranged in the code word according to a preset compiling order.

[0013] Preferably, the first brightness is white or transparent, the second brightness is black, N1 is one minimum size unit of the two-dimensional code, and M is 25-529.

[0014] Preferably, n1 is 2, a=3, and b=2.

[0015] Preferably, the functional pattern further comprises a clock positioning pattern block; the clock positioning pattern block is a cross positioning line, the center of the clock positioning pattern block is consistent with the center of the center image positioning pattern block; the clock positioning pattern block comprises a horizontal positioning pattern and a vertical positioning pattern extending from four sides of the center image positioning pattern block respectively; the horizontal positioning pattern is located at the horizontal center of the two-dimensional code, the vertical positioning pattern is located at the vertical center of the two-dimensional code, and the horizontal positioning pattern and the vertical positioning pattern are both formed by first brightness patterns and second brightness patterns with a size of N1×N1.

[0016] Preferably, the functional pattern further comprises a correction pattern located at at least three corners of the two-dimensional code.

[0017] Preferably, the correction pattern comprises a first correction block composed of second brightness patterns with a size of N1×N1 located at the inner corners of the two-dimensional code, a second correction block composed of first brightness patterns with a size of N1×N1 surrounding the first correction block together with the outer sides of the two-dimensional code, and a third correction block composed of second brightness patterns with a size of N1×N1 surrounding the second correction block together with the outer sides of the two-dimensional code.

[0018] Preferably, the data pattern area of the two-dimensional code is processed by XOR operation through a mask pattern.

[0019] The application also provides a decoding method of the two-dimensional code.

[0020] S1, obtaining a photographed image S, and obtaining a binary image B by reducing and performing gray scale binary conversion on the photographed image;

[0021] S2, preliminarily determining the position P of the center image positioning pattern block by searching for a point with the highest first brightness in the image B;

[0022] S3, intercepting a region image D with a preset size corresponding to the position P in the image S;

[0023] S4, positioning the center point C of the center rectangular frame module in the image D;

[0024] S5, identifying the rectangular corner module and the rectangular outer frame module in the image D to identify the entire center image positioning pattern block and calculate the inclination angle A and the size Z of the center image positioning pattern block;

[0025] S6, positioning the position of the head information pattern block and reading the head information;

[0026] S7, decoding the header information according to a preset RS error correction algorithm to determine whether decoding is successful; if decoding is successful, entering step S81;

[0027] S81, positioning is correct, entering a positioning and reading process of a data pattern.

[0028] Preferably, the method further comprises a step of acquiring boundary and size information R of the two-dimensional code, and specifically comprises:

[0029] When the two-dimensional code is a single code, reading the header information point of the two-dimensional code, obtaining size information R of the two-dimensional code, and positioning the boundary of the two-dimensional code according to the tilt angle A and the size information R;

[0030] When the two-dimensional code is a multi-code tiling design, connecting adjacent center point sites C, and a center perpendicular line of the connecting line is the boundary of the two-dimensional code.

[0031] Preferably, the functional pattern further comprises a correction pattern located at at least three corners of the two-dimensional code; and the step S7 further comprises, if decoding is not successful, entering step S9.

[0032] Step S9 comprises:

[0033] S91, searching for and identifying the correction pattern within a preset range of the boundary according to the boundary;

[0034] S92, correcting the center point site C according to the correction pattern.

[0035] Preferably, the step S92 comprises: recalculating a center point site C' of the two-dimensional code according to the correction pattern, using the center point site C' as a new center point site C, and returning to step S5.

[0036] Preferably, the functional pattern further comprises a clock positioning pattern block; the clock positioning pattern block is a cross positioning line, a center of the clock positioning pattern block is consistent with a center of the center image positioning pattern block; the clock positioning pattern block comprises a horizontal positioning pattern and a vertical positioning pattern respectively extending from four side edges of the center image positioning pattern block; the horizontal positioning pattern is located at a horizontal center of the two-dimensional code, and the vertical positioning pattern is located at a vertical center of the two-dimensional code; the horizontal positioning pattern and the vertical positioning pattern are both formed by a first brightness pattern and a second brightness pattern with a size of N1xN1 and alternately formed; the step S7 further comprises, if decoding is not successful, entering step S10; and the step S10 comprises:

[0037] S101, positioning a crosshair line position according to the center point site C and the center search image positioning pattern block, and searching for a first brightness pattern and a second brightness pattern alternately formed pattern with a size of N1xN1 extending in a single direction within a preset range around the crosshair line position, and fitting a new crosshair line;

[0038] S102, fitting a crosshair line center intersection point as a new center point site C through the new crosshair line, and returning to step S5.

[0039] Preferably, the method further comprises a step of removing the mask pattern.

[0040] The application also provides a two-dimensional code positioning system, comprising a memory, a processor, a computer program stored in the memory and executable on the processor, and the processor implements the steps of the two-dimensional code decoding method according to any one of the above.

[0041] The application also provides a computer readable storage medium storing a computer program, and the computer program is executed by a processor to implement the steps of the two-dimensional code decoding method according to any one of the above.

[0042] In view of the deficiencies in the prior art and the need for improvement, the two-dimensional code and the decoding method thereof provided by the application have at least the following advantages:

[0043] (1) The search image positioning pattern block is arranged in the center area of the two-dimensional code, and the center search image positioning pattern block is composed of a large-size second brightness square block (such as a 17x17 pixel basic unit) and a center small dot. During decoding, the code surface range can be quickly locked by the large white block based on the human visual recognition logic of "from the whole to the local", and then the coordinates can be accurately positioned by the center black dot. For the multi-two-dimensional code tiling design of data storage, the positioning effect of the center search image positioning pattern block in this embodiment is better. With the multi-two-dimensional tiling design, the larger the data amount is, the more the missing positioning points can be supplemented by the surrounding positioning points, so the larger the data amount is, the higher the space utilization rate is, and the higher the recognition rate is; the center coarse-fine combined positioning of the search image positioning pattern block reduces the space occupation and improves the positioning speed by more than 300%.

[0044] (2) The head information pattern block is arranged on the side of the search image positioning block, and the decoding of the head information pattern block is used to verify whether the search image positioning is accurate, and only when it is accurate, the decoding of the data pattern of the two-dimensional code is started; the early verification of the accurate positioning avoids the interruption and error of data scanning caused by the slight deviation of positioning.

[0045] (3) The two-dimensional code supports a larger size, and can be combined by tiling, without capacity limitation. BRIEF DESCRIPTION OF DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the application and together with the description, serve to explain the application. Obviously, the drawings described below are only some embodiments, and other drawings can be obtained according to these drawings without creative labor for those skilled in the art.

[0047] Figure 1 A schematic diagram of a two-dimensional code in an embodiment of the present application.

[0048] Figure 2 A size and function diagram of a two-dimensional code in an embodiment of the present application.

[0049] Figure 3 A structure diagram of a 25x25 size two-dimensional code in an embodiment of the present application.

[0050] Figure 4 A function diagram of a two-dimensional code in an embodiment of the present application.

[0051] Figure 5 A diagram of a center image-seeking positioning pattern block in an embodiment of the present application, wherein, Figure 5 (a) is a size diagram of a center image-seeking positioning pattern block, Figure 5 (b) is a specific structure diagram of a center image-seeking positioning pattern block.

[0052] Figure 6 A structure diagram of a two-dimensional code composed of multiple single-code two-dimensional codes in an embodiment of the present application.

[0053] Figure 7 A diagram of a region image D intercepted in a positioning process in an embodiment of the present application.

[0054] Figure 8 A diagram of a two-dimensional code boundary positioning in a multiple-code tiling example in an embodiment of the present application, wherein, Figure 8 (a) is a diagram of a two-dimensional code boundary positioned by adjacent center point sites, Figure 8 (b) is a diagram of a correction pattern for positioning four corners of a two-dimensional code.

[0055] Figure 9 A diagram of a two-dimensional code tilt angle calculation and cross positioning line identification in an embodiment of the present application, wherein, Figure 9 (a) is a diagram of a two-dimensional code tilt angle calculation, Figure 9 (b) is a diagram of a cross positioning line identification.

[0056] Figure 10Fig. 1 is a schematic diagram of a two-dimensional code in a single code example in an embodiment of the present application.

[0057] Figure 11 Fig. 2 is a schematic diagram of a data structure of a head information graphic block in an embodiment of the present application. Figure 11 Fig. 3 is a schematic diagram of a structure of the head information graphic block located above. Figure 11 Fig. 4 is a schematic diagram of a structure of the head information graphic block located below.

[0058] Figure 12 Fig. 5 is a schematic diagram of a flow of a decoding method of a two-dimensional code in an embodiment of the present application.

[0059] Figure 13 Fig. 6 is a schematic diagram of a hardware structure for running the decoding method of the two-dimensional code in an embodiment of the present application.

[0060] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0061] The technical problems solved by the embodiments of the present application, the technical solutions adopted and the technical effects achieved will be clearly and completely described with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other equivalent or obvious modified embodiments obtained by those skilled in the art without creative effort fall within the protection scope of the present application. The embodiments of the present application can be embodied in various different ways as defined and covered in the claims.

[0062] It should be noted that in the following description, many specific details are given to facilitate understanding. However, it is obvious that the implementation of the present application can be realized without these specific details.

[0063] It should be noted that in the absence of explicit limitations or conflicts, the various embodiments in the present application and the technical features therein can be combined with each other to form technical solutions.

[0064] The present application proposes a two-dimensional code with a center image positioning graphic block. During decoding, the code surface range can be quickly locked by the center image positioning graphic block based on the human visual "from the whole to the local" recognition logic, and then the coordinates are accurately positioned by the center point.

[0065] Please refer to Figures 1-11 The symbol size specification of the two-dimensional code 100 in the embodiment is MxM, which is composed of two different brightness patterns. The two-dimensional code 100 includes a function graphic and a data graphic.

[0066] The data pattern includes a plurality of code words (for example, Figure 3 The regions D1-D24 are arranged in the region of the data pattern according to the arrangement order corresponding to the version information, and each code word includes 8*n3 characters, where n3 is a positive integer, and the characters are arranged in the code word according to a preset compiling order. For example, refer to Figure 3 In this embodiment, the code word is arranged in a 2-module-wide column from the top left corner of the symbol, and arranged from left to right and from top to bottom, and a total of 8 characters are included, where the highest 32% of the error correction capacity is included.

[0067] Similar to the QR code in the prior art, the data pattern can be XOR operated with the mask pattern, and the purpose is to balance the proportion of dark and light modules in the symbol, and to reduce the appearance of patterns that affect the rapid processing of the image. Details are not described herein.

[0068] In this embodiment, the functional pattern includes a center search positioning pattern block 10 with a size of N*N, and the data pattern 200 includes a data block around the center search positioning pattern block. Where N=8*n1+1, M=N+8*n2, n1 is a positive integer, and n2 is a positive integer greater than or equal to 2.

[0069] Specifically, in this embodiment of the two-dimensional code, in a preferred example, N=17, and n1 is 2. For example, Figure 2 As shown, the two-dimensional code in this embodiment can support 25*25 to 529*529. As shown in Figure 3 As shown, in a specific example of N=17 and M=25, the two-dimensional code with a size of 25*25.

[0070] It can be understood that the larger the size of the two-dimensional code, the smaller the proportion of the center search positioning pattern block in the two-dimensional code, and the lower the speed and accuracy of positioning the center search positioning pattern block in the image. Therefore, those skilled in the art can design N and M as needed, so that on the basis of the data pattern having sufficient data storage bits, a larger center search positioning pattern block is set as much as possible. When n1 is 1, the size of the two-dimensional code supported is reduced, which is suitable for small data amount two-dimensional codes; when n1 is 3, the size of the two-dimensional code supported can be larger (greater than 529*529), which can be suitable for the case of storing larger data in a single two-dimensional code. However, the larger the size of the two-dimensional code, the greater the error in recognition and scanning, and the probability of recognition error increases significantly. Therefore, in a preferred embodiment, N=17 and n1 is 2, which takes into account both the storage capacity of the data pattern and the accuracy of scanning and recognition.

[0071] Please refer to Figure 5In the embodiment, the center image positioning pattern block 10 comprises a center module 11, a center rectangular frame module 12, a rectangular outer frame module 13, a rectangular corner module 14, and a first lightness large square 15.

[0072] Specifically, the center module 11 is composed of a first lightness pattern with a size of N1xN1, and the center of the center module 11 is consistent with the center of the two-dimensional code 100. For example, in the present example, the first lightness is white, the second lightness is black, and N1 is one minimum size unit of the two-dimensional code. The first lightness and the second lightness can also use gray or color, as long as they have sufficient distinction and can be quickly identified; the same as the identification technology of the black and white two-dimensional code, color two-dimensional code and gray two-dimensional code in the prior art, which will not be described here. N1 is one minimum size unit of the two-dimensional code, i.e. the size of 1x1; of course, in other embodiments, it can also be 2x2, 3x3, etc.

[0073] Specifically, the center rectangular frame module 12 is composed of a second lightness pattern with a size of N1xN1, and is concentrically arranged around the center module 11 with a size of 3N1x3N1. Since the center of the center module 11 is the center of the two-dimensional code 100, when the center module 11 needs to be positioned, the center rectangular frame module 12 with larger size and strong contrast with the center module 11 can be positioned first to roughly position the center, and then the center module 11 at the center of the center rectangular frame module 12 is positioned.

[0074] Specifically, the rectangular outer frame module 13 is composed of a second lightness pattern with a size of N1xN1, and is concentrically arranged around the center module 11 with a size of NxN. The rectangular outer frame module 13 is the outer frame of the center image positioning pattern block 10, which separates the center image positioning pattern block 10 from the data pattern.

[0075] Specifically, the rectangular corner module 14 is composed of a second lightness pattern with a size of aN1x bN1, and is arranged at one inner corner of the rectangular outer frame module 13. The rectangular corner module 14 is located at one inner corner of the rectangular outer frame module 13, and by positioning the rectangular corner module 14, the inclination angle of the two-dimensional code can be calculated in cooperation with the center point.

[0076] Specifically, the remaining part surrounded by the rectangular outer frame module is filled with the first lightness large square 15 composed of a first lightness pattern with a size of N1xN1.

[0077] Wherein, N1+aN1+N1≤(N-1) / 2, N1+bN1+N1≤N / 2, a, b are integers greater than or equal to 1, a≠b. Through the above size limit of a, b, the rectangular corner module 14 is far enough from the center rectangular border module 12, and the space between the rectangular corner module 14 and the center rectangular border module 12 belonging to the first lightness large block 15 is large enough.

[0078] For example, in the present embodiment, a=3, b=2. It can be understood that in other embodiments, when N=17, a, b can take values 1-4, all of which can achieve the corresponding effect.

[0079] The center image positioning pattern block 10 has a first lightness large block 15 with a large enough size (relative to the data=pattern), and in a general two-dimensional code, it is very rare for a first lightness pattern with such a large size to appear in the data pattern; in addition, since the data pattern is subjected to XOR operation with the mask pattern, it is impossible for a large size first lightness pattern to appear in the two-dimensional code. Therefore, by positioning the size of the pattern with the first lightness, the center image positioning pattern block 10 can be quickly positioned.

[0080] For example, please refer to Figure 6 , which is a multi-block two-dimensional code combination pattern formed by splicing multiple two-dimensional codes 100, which can be quickly positioned by Figure 6 and Figure 7 It can be seen directly that the white points on the image are very obvious when the image is recognized, even the naked eye can quickly locate and identify. By quickly scanning the pattern, the white points on the image can be located, thereby locating the rough position P of the center image positioning pattern block 10, and then enlarging the image near the position P to finely identify other modules of the center image positioning pattern block 10. The specific identification steps will be described in detail later.

[0081] For example, please refer to Figures 6-10 The specific image positioning principle of the center image positioning pattern block 10 is: after reducing and converting the gray value of the photographed image, find the point with the highest first lightness (white) in the image, and preliminarily determine the position P of the center image positioning pattern block; cut out the area image D of the corresponding position P in the image; identify the center rectangular border module 12 and the center module 11 in the image D to locate the center point C; then identify the rectangular corner module and the rectangular outer border module in the image D to identify the entire center image positioning pattern block and calculate the inclination angle A and size Z of the center image positioning pattern block 10, thereby positioning the two-dimensional code.

[0082] For example, please refer to Figure 7In the identification mode, if the center point (red cross position) is obtained through the rough positioning of the contour, the error is relatively large; the green X point is accurately positioned through the black block (center rectangular frame module 12) and the center white point (center module 11), and the error is relatively small. In the image D, the center image positioning pattern block 10 is selected, the center position of the black block (center rectangular frame module 12) is found out using the distance transformation, the accuracy is much higher than that of the contour positioning, and the anti-interference ability is stronger (only the calculation amount is larger); the center white point (center module 11) can be used for correcting the center point position or for accurate positioning.

[0083] The size Z of the center image positioning pattern block 10 can be calculated according to the white block contour when the region image D is finely identified.

[0084] Please refer to Figures 2-4 , the functional pattern further comprises a correction pattern 30 located at at least three corners of the two-dimensional code 100.

[0085] In the embodiment, the number of the correction patterns is 4, and the correction patterns are located at the four corners of the two-dimensional code 100.

[0086] The correction pattern 30 comprises a first correction block composed of a pattern of a second brightness with a size of N1×N1 located at an inner corner of the two-dimensional code, a second correction block composed of a pattern of a first brightness with a size of N1×N1 surrounding the first correction block together with the outer side of the two-dimensional code, and a third correction block composed of a pattern of a second brightness with a size of N1×N1 surrounding the second correction block together with the outer side of the two-dimensional code.

[0087] The boundary identification mode of the two-dimensional code includes single code and multiple code modes:

[0088] Please refer to Figure 8 , if it is a tiled two-dimensional code pattern, such as Figure 8 (a), the adjacent center point positions are connected, the center vertical line of the connection line is the boundary of the two-dimensional code, and the intersection point (red cross) of the vertical line can preliminarily locate the four corners of the two-dimensional code; such as Figure 8 (b), then the accurate four-corner positioning block (green cross point) (correction pattern 30) is found near the intersection point (red cross);

[0089] If it is a single independent two-dimensional code, the boundary of the two-dimensional code is read, the head information of the two-dimensional code is obtained, the size information R of the two-dimensional code is obtained, the boundary and the four corners of the two-dimensional code are roughly positioned according to the center point position C, the inclination angle A and the size information R, then the accurate four-corner positioning block (correction pattern 30) is found near the position of the roughly positioned four corners, and finally the four corners and the boundary of the two-dimensional code are obtained.

[0090] In addition, the four corner positioning blocks (correction pattern 30) can also be used to re-calculate the center point site, to check or correct the center point site C positioned by the center rectangular frame module 12 and the center module 11.

[0091] Please combine Figure 9 And Figure 10 The identification of the inclination angle A of the center image positioning pattern block 10 is divided into single code and multi-code two ways:

[0092] If it is a two-dimensional code pattern like Figure 9 (a), connect the adjacent center point sites, and the angle of the connecting line segment is the inclination angle A of the two-dimensional code;

[0093] If it is a single independent two-dimensional code, such as Figure 10 , the diagonal line of the center image positioning pattern block 10 and the orientation of the rectangular corner module 14 determine the rotation direction and mirror direction of the two-dimensional code, thereby positioning the two-dimensional code; The specific method is to determine the 90°, 180° and 270° rotation angles of the center image positioning pattern block 10 according to the orientation of the rectangular corner module 14; The diagonal line of the center image positioning pattern block 10 cuts the rectangular corner module 14 into left and right two parts, and since a≠b, the sizes of the left and right two parts after cutting are different, so whether the image is mirrored can be identified, thereby deciding whether mirror flipping is needed.

[0094] Please combine Figures 2-4 The function pattern further includes a clock positioning pattern 20; the clock positioning pattern 20 is a cross positioning line, and the center of the clock positioning pattern 20 is consistent with the center of the center image positioning pattern block 10.

[0095] The clock positioning pattern 20 includes horizontal positioning patterns and vertical positioning patterns respectively extending from the four sides of the center image positioning pattern block 10; the horizontal positioning pattern is located in the horizontal center of the two-dimensional code, and the vertical positioning pattern is located in the vertical center of the two-dimensional code, and the horizontal positioning pattern and the vertical positioning pattern are both formed by first brightness patterns and second brightness patterns with a size of N1×N1. Preferably, the beginning and end of the horizontal positioning pattern and the vertical positioning pattern are both dark modules (second brightness).

[0096] The clock positioning pattern 20 extends from the four sides of the center image positioning pattern block 10 respectively, does not block the center image positioning pattern block 10, and will not affect the positioning of the center image positioning pattern block 10.

[0097] The horizontal positioning pattern and the vertical positioning pattern are used to determine the density and version of the symbol, which is the same as the prior art and will not be described here again. Meanwhile, the reference position of the module coordinate is provided, which can be used to assist positioning.

[0098] Please refer to the combination of Figure 9 The principle of the clock positioning pattern 20 assisting positioning is that the center point position positioned by the center image positioning pattern block 10 is used to position the cross positioning line position, the pattern of the cross positioning line position is read, and it is judged whether it is the pattern formed by the first brightness pattern and the second brightness pattern with a size of N1XN1 alternately. If the identification is successful, it is judged that the two-dimensional code positioning is successful. If the identification is not successful, the center point position can be corrected by identifying the real cross positioning line. Specifically, the pattern formed by the first brightness pattern and the second brightness pattern with a size of N1XN1 alternately can be found in a preset range around the cross positioning line position along a single direction, and a new cross positioning line is fitted. The intersection point of the cross positioning line is fitted as a new center point position.

[0099] Specifically, please refer to Figure 8 If the center point position has no deviation, the clock line is a point value determined by black and white alternation. Therefore, the cross positioning line position positioned by the center image positioning pattern block 10 is a point value determined by black and white alternation.

[0100] If the positioning point has a deviation, the center point position is corrected according to the clock line. Since the clock line is a point value determined by black and white alternation, the extreme point of the image is found around the originally positioned clock line: for example, the coordinates of the darkest point are found around the black point of the clock line, and the coordinates of the brightest point with the highest gray scale are found around the white point. Then, the new clock line is fitted by the least square method according to the new coordinates and the old coordinates, and the intersection point (i.e. the center point) and the angle (i.e. the angle of the clock line and the rectangular coordinate system) of the two clock lines. The two clock lines correspond to the black and white alternation points on the X-axis and the Y-axis, respectively. Therefore, when calculating, only the X-coordinate fitting equation of the X-axis clock line is taken, and only the Y-axis coordinate equation of the Y-axis clock line is taken. The specific process is as follows:

[0101] 1) On the basis of the originally positioned clock line, the coordinates of each point of the clock line on the X-axis and the Y-axis are calculated, respectively;

[0102] 2) The extreme point P1 is found within a module distance around each point coordinate. For the bright point on the clock line, the coordinates of the brightest point are found, and for the dark point on the clock line, the coordinates of the darkest point are found.

[0103] 3) The straight line is fitted by the least square method for the new points on the clock line, respectively. The points with large deviations are removed according to the distance, and the point set P2 with small errors is obtained.

[0104] 4) define the four unknowns of the center point coordinate (x, y), the slope k and the module point distance d, and calculate the parametric coordinate P3 of each point on the clock line;

[0105] 5) find the parametric coordinate P3 of each point P2, and use the least square method to fit according to the minimum distance between P2 and P3, and finally calculate the four unknowns in 4), wherein (x, y) is the new coordinate center point, k is the tilt angle of the clock line (i.e. the tilt angle of the two-dimensional code), and d is the average point distance of the module.

[0106] In Figure 9 (a) and Figure 9 (b), the clock line is arranged in a regular black-white-black-white sequence adjacent to the center green line.

[0107] In the embodiment, the two-dimensional code 100 further comprises at least one head information pattern block 40, which is arranged immediately above, below or both above and below the center image-finding positioning pattern block 10.

[0108] The head information pattern block comprises version information, error correction level, code size level information.

[0109] The head information pattern block comprises version information, error correction level, code size level information. Specifically, the head information pattern block comprises an information pattern and an error correction RS code pattern; the head information pattern block comprises a left head information block and a right head information block with a size of (N-1) / 2×n4 arranged in columns on the left and right, 1≤n4≤5; the left head information block and the right head information block are separated by the vertical positioning pattern of the cross positioning line.

[0110] Please refer to Figure 3 , Figure 4 and Figure 11 In the embodiment, N=17, n1=2; the number of head information pattern blocks is 2, and they are arranged immediately above and below the center image-finding positioning pattern block respectively. Two 2-row×17-column module blocks form a head information pattern block (if the clock positioning pattern 20 exists at the same time, the head information pattern block is composed of a 2-row×8-column left head information block and a 2-row×8-column right head information block, and the 2-row×1-column in the middle is the position of the clock line), which is placed immediately above and below the center image-finding positioning pattern block.

[0111] n4=2; the total number of code bits of the head information pattern block is 32, and the left head information block and the right head information block each comprise 16 code bits.

[0112] The left head information block of the head information graphic block in the upper part has two bytes, 16 data bits; the first byte includes 8 encoding bits, and stores error correction information, including error correction level and algorithm; the second byte includes 8 encoding bits, and stores version information, including verification block number, mask pattern version and gray level number;

[0113] The remaining encoding bits of the left head information block and the right head information block store error correction data. 48 encoding bits are error correction bits calculated by RS (64, 16) encoding. 48-bit error correction data is calculated according to the RS error correction algorithm, and is added after the 16 data bits.

[0114] The following is a detailed explanation of the version and format information stored in two bytes:

[0115] The 0-7 data bits of the first byte (0~7) are the contents of the symbol, which are error correction information: Figure 11

[0116] The 0-3 data bits are the error correction level number (2-16), 2x(N+1).

[0117] The 4-6 data bits are the RS algorithm GF field value if it is global RS, 8+N; if it is local RS, it is the mode of the RS algorithm, 0 variable length RS, 1 interleaved grouping, 2 with corner point grouping, 3-7 extended reserved.

[0118] The 7th data bit is used to determine whether it is full RS or local RS, 1 variable length global RS, 0 grouping local RS.

[0119] The 8-15 data bits of the second byte (8~15) are the version information of the symbol: Figure 11

[0120] The 0-1 data bits are the remainder of the effective length ModN (0-3) or the verification block number.

[0121] The contents of the 2-4 data bits are the mask pattern version (Mask (0-7)) for selecting the pattern.

[0122] The contents of the 5-7 data bits are the gray level number, (0 black and white, 2-n level).

[0123] Preferably, the data pattern area of the two-dimensional code is processed by XOR operation through the mask pattern.

[0124] Please combine Figures 1-12 , the embodiment also provides a decoding method of the two-dimensional code as described above, comprising steps S1-S5.

[0125] ​​S1, obtain a photographed image S, and obtain a binary image B by reducing and performing gray scale binary conversion on the photographed image. The length of the image S is reduced by 5-20 times, and the image is converted into a gray scale image M (the reduced image can make the time for locating the pattern fast by tens or hundreds of times); a threshold value is determined by selecting the median value between the maximum value and the minimum value of the reflectivity of the image, the image is converted into a series of dark and light pixels by using the threshold value, and the binary image B is obtained.

[0126] S2, the position P of the center image locating pattern block is preliminarily determined by searching for a point with the highest first brightness in the image B.

[0127] S3, a region image D of a preset size corresponding to the position P in the image S is intercepted.

[0128] In steps S1-S3, please combine Figure 6 , the plurality of two-dimensional codes 100 are spliced to form a plurality of two-dimensional code combination patterns, which can be searched by Figure 7 It can be directly seen that the white points on the image are very obvious when the image is identified, and even the naked eye can quickly locate and identify. By quickly scanning the pattern, the white points on the image can be located, so that the rough position P of the center image locating pattern block 10 is located, and then the image near the position P is enlarged to finely identify other modules of the center image locating pattern block 10.

[0129] S4, the center point site C is located in the center rectangular frame module in the image D.

[0130] Preferably, the step S4 comprises locating the center rectangular frame module in the image D, and then locating the center module in the image area of the center rectangular frame module to locate the center point site C. The center point site can be directly coarsely located in the center rectangular frame module, and then the center module located in the middle is finely located to locate the center point site C. In a specific implementation manner, the final center module is finely located, which can be checking the coarsely located center point site or a supplement of the fine location.

[0131] Please combine Figure 7 , the specific image locating principle of the center image locating pattern block 10 is that after the photographed image is reduced and converted into a gray scale value, a point with the highest first brightness (white color) is found in the image to preliminarily determine the position P of the center image locating pattern block; a region image D corresponding to the position P in the image is intercepted; the center rectangular frame module 12 and the center module 11 in the image D are identified to locate the center point site C.

[0132] As Figure 7In the identification mode of the center image positioning pattern block 10, the center position of the black block (the center rectangular frame module 12) is found out by using the distance transformation, the accuracy is much higher than that of the contour positioning, and the anti-interference ability is stronger (only the calculation amount is larger), and the center white point (the center module 11) can be used for correcting the center point position or for accurate positioning.

[0133] The size Z of the center image positioning pattern block 10 can be calculated according to the white block contour when the region image D is finely identified.

[0134] S5, the rectangular corner module and the rectangular outer frame module in the image D are identified to identify the entire center image positioning pattern block and calculate the tilt angle A and the size Z of the center image positioning pattern block.

[0135] Preferably, the step S5 comprises,

[0136] The rectangular corner module in the image D is positioned, and the tilt angle A of the center image positioning pattern block is calculated according to the orientation between the rectangular corner module and the center point position C;

[0137] The rectangular outer frame module in the image D is identified to identify the center image positioning pattern block and calculate the size Z of the center image positioning pattern block;

[0138] According to the tilt angle A and the orientation of the diagonal line of the center image positioning pattern block and the rectangular corner module, the rotation direction and the mirror direction of the two-dimensional code are obtained, so that the angle of the two-dimensional code is positioned.

[0139] Please combine Figure 9 and Figure 10 The tilt angle A of the center image positioning pattern block 10 is identified in two modes of single code and multiple codes:

[0140] If it is a tiled two-dimensional code pattern, such as Figure 9 (a), the adjacent center point positions are connected, and the angle of the connecting line segment is the tilt angle A of the two-dimensional code;

[0141] If it is a single independent two-dimensional code, such as Figure 10, the diagonal line of the center search image positioning pattern block 10 and the orientation of the rectangular corner module 14 are determined, the rotation direction and the mirror direction of the two-dimensional code are obtained, and the two-dimensional code is positioned; the specific method is to determine the rotation angles of 90°, 180° and 270° of the center search image positioning pattern block 10 according to the orientation of the rectangular corner module 14; the rectangular corner module 14 is cut into left and right two parts by the diagonal line of the center search image positioning pattern block 10, and because a≠b, the sizes of the left and right two parts after cutting are different, so whether the image is mirrored can be identified, and whether mirror flipping is needed is determined.

[0142] S6, the position of the head information pattern block is positioned, and the head information is read;

[0143] S7, the head information is decoded according to the corresponding preset RS error correction algorithm, and it is judged whether the decoding is successful; if the decoding is successful, step S81 is entered;

[0144] S81, the positioning is correct, and the positioning and reading process of the data pattern is entered.

[0145] Through steps S6 and S7, whether the image positioning is accurate is verified through decoding of the head information pattern block, and after the positioning is accurate, the recognition of the data pattern of the two-dimensional code is started; if the head information reading is wrong, the positioning is necessarily inaccurate, and only when the positioning is accurate, the head information can be decoded successfully. The small deviation caused by positioning is avoided, the interruption and error of data scanning are avoided, and the accuracy of the positioning is verified in advance.

[0146] Preferably, the decoding method of the two-dimensional code further comprises the step of obtaining the boundary and size information R of the two-dimensional code, and specifically comprises:

[0147] When the two-dimensional code is a single code, the head information point of the two-dimensional code is read, the size information R of the two-dimensional code is obtained, and the boundary of the two-dimensional code is positioned according to the inclination angle A and the size information R;

[0148] When the two-dimensional code is a multi-code tiled design, the adjacent center point sites C are connected, and the central perpendicular line of the connection line is the boundary of the two-dimensional code.

[0149] The boundary recognition mode of the two-dimensional code includes two modes of single code and multi-code:

[0150] Please combine Figure 8 If it is a tiled two-dimensional code pattern, such as Figure 8 (a), the adjacent center point sites are connected, the central perpendicular line of the connection line is the boundary of the two-dimensional code, and the intersection point (red cross) of the perpendicular line can preliminarily position the four corners of the two-dimensional code; such as Figure 8(b), and then find the accurate four-corner positioning block (green cross point) near the intersection (red cross) (correction pattern 30);

[0151] If it is a single independent two-dimensional code, the boundary of the two-dimensional code, the head information of the two-dimensional code is read, the size information R of the two-dimensional code is obtained, the boundary and the four corners of the two-dimensional code are roughly positioned according to the inclination angle A and the size information R, and then the accurate four-corner positioning block (correction pattern 30) near the position of the roughly positioned four corners is found.

[0152] Please refer to Figures 2-4 and Figure 8 , the functional pattern further comprises a correction pattern 30 located at at least three corners of the two-dimensional code 100.

[0153] In this embodiment, the number of correction patterns is 4, which are respectively located at the four corners of the two-dimensional code 100.

[0154] The correction pattern 30 comprises a first correction block composed of a pattern of a second brightness with a size of N1xN1 located at the inner corner of the two-dimensional code, a second correction block composed of a pattern of a first brightness with a size of N1xN1 surrounding the first correction block together with the outer side of the two-dimensional code, and a third correction block composed of a pattern of a second brightness with a size of N1xN1 surrounding the second correction block together with the outer side of the two-dimensional code.

[0155] Preferably, the functional pattern further comprises a correction pattern located at at least three corners of the two-dimensional code; the step S7 further comprises, if the decoding is unsuccessful, entering step S9, comprising:

[0156] S91, according to the boundary, searching for the recognition of the correction pattern in a predetermined range of the boundary;

[0157] S92, correcting the center point site C according to the correction pattern.

[0158] Preferably, the step S92 comprises: recalculating the center point site C' of the two-dimensional code according to the correction pattern; using the center point site C' as a new center point site C, and returning to step S5.

[0159] The center point site is recalculated through the four-corner positioning block (correction pattern 30) to re-correct the center point site C recognized and positioned by the center rectangular frame module 12 and the center module 11; and then the center image positioning pattern block is recognized and positioned again.

[0160] Preferably, the functional pattern further comprises a clock positioning pattern block; the clock positioning pattern block is a cross positioning line, the center of the clock positioning pattern block is consistent with the center of the center image positioning pattern block; the clock positioning pattern block comprises a horizontal positioning pattern and a vertical positioning pattern extending from four sides of the center image positioning pattern block respectively; the horizontal positioning pattern is located at the horizontal center of the two-dimensional code, the vertical positioning pattern is located at the vertical center of the two-dimensional code, and the horizontal positioning pattern and the vertical positioning pattern are both formed by first brightness patterns and second brightness patterns with a size of N1xN1; the step S7 further comprises: if the decoding is unsuccessful, entering step S10; the step S10 comprises:

[0161] S101, positioning a cross positioning line position according to the center point site C and the center image positioning pattern block, and searching for a pattern formed by first brightness patterns and second brightness patterns with a size of N1xN1 alternately in a single direction within a preset range around the cross positioning line position, and fitting a new cross positioning line;

[0162] S102, fitting a cross positioning line center intersection point as a new center point site C through the new cross positioning line, and returning to step S5.

[0163] Please refer to Figure 9 The principle of the clock positioning pattern 20 auxiliary positioning is that the center point site positioned by the center image positioning pattern block 10 is used to position a cross positioning line position, and the pattern of the cross positioning line position is read and judged to identify whether it is a pattern formed by first brightness patterns and second brightness patterns with a size of N1xN1 alternately, if the identification is successful, it is judged that the two-dimensional code positioning is successful. If the identification is unsuccessful, the center point site can be corrected by identifying the real cross positioning line. Specifically, a pattern formed by first brightness patterns and second brightness patterns with a size of N1xN1 alternately in a single direction can be searched within a preset range around the cross positioning line position, and a new cross positioning line can be fitted. A cross positioning line center intersection point is fitted as a new center point site through the new cross positioning line.

[0164] Specifically, please refer to Figure 8 If the center point site has no deviation, the clock line is a black and white alternating point value, so the center point site positioned by the center image positioning pattern block 10 and the cross positioning line position positioned by the center point site are black and white alternating points.

[0165] If the positioning point is deviated, the center point is repositioned according to the clock line. Since the clock line is black and white, the point value is determined. The extreme point of the image is found around the original positioning clock line: for example, the coordinates of the darkest point are found around the black point of the clock line, and the coordinates of the brightest point are found around the white point. Then, according to the new coordinates and the old coordinates, the least square method is used to fit the new clock line, and the intersection point (i.e. the center point) and the angle (i.e. the angle of the clock line and the rectangular coordinate system) of the two clock lines are obtained. The two clock lines correspond to the black and white points on the X-axis and Y-axis respectively, so when calculating, only the X-coordinate fitting equation of the X-axis clock line is taken, and only the Y-axis coordinate equation of the Y-axis clock line is taken. The specific steps are as follows:

[0166] 1) On the basis of the original positioning clock line, the coordinates of each point on the X-axis and Y-axis clock line are calculated;

[0167] 2) Find the extreme point P1 within a module distance around each point coordinate. For the bright point on the clock line, find the coordinates of the brightest point, and for the dark point on the clock line, find the coordinates of the darkest point nearby;

[0168] 3) The least square method is used to fit a straight line for each new point on the clock line, and the points with larger deviations are removed to obtain a smaller point set P2;

[0169] 4) Define the center point coordinates (x, y), the slope k and the module point distance d as four unknowns, and calculate the parameter coordinates P3 of each point on the clock line;

[0170] 5) The parameter coordinates P3 of each point coordinate P2 are found, and the least square method is used to fit according to the minimum distance between P2 and P3. Finally, the four unknowns in 4) are calculated, where (x, y) is the new coordinate center point, k is the inclination angle of the clock line (i.e. the inclination angle of the two-dimensional code), and d is the average point distance of the module.

[0171] In Figure 8 (a) and Figure 8 (b), the clock line is arranged in a regular black-white-black-white sequence next to the center green line.

[0172] Compared with the traditional three-corner positioning, the two-dimensional code and the decoding method in the embodiment can reduce the space occupied by more than 80% of the positioning pattern, and release the code surface for data storage.

[0173] In the multiple two-dimensional code 100 tiling design, after the step S2, the position P of the center search image positioning pattern block is preliminarily determined by searching for the point with the highest first brightness in the image B, and the size of the two-dimensional code is determined by the set Ps and the set Rs; then the minimum distance between the points in the set Ps is identified, and the average distance is used to filter out the wrong position P; meanwhile, the straight line coordinate system is constructed according to the connection between the points in the set Ps, and the intersection of the straight lines is used as the corrected position P, and then the step S3 is introduced. For the data storage multiple two-dimensional code tiling design, the positioning effect of the center search image positioning pattern block in the embodiment is better. In the multiple two-dimensional tiling design, the larger the data amount is, the more the missing positioning points can be supplemented by using the surrounding positioning points, so the larger the data amount is, the higher the space utilization rate is, and the higher the recognition rate is.

[0174] Specifically, after the correct positioning in the step S81, the positioning and reading process of the data pattern is entered. Since the version information, error correction level, code size level information and the like have been read from the header information pattern block, and the positioning is correct, at this time, the two-dimensional code is scanned and read according to the scanning mode corresponding to the version, and then the decoding is compiled, which belongs to the content that can be directly and without doubt realized by the person skilled in the art according to the conventional technical means in the art and the content disclosed in the embodiment, and will not be described here.

[0175] Figure 13 is a hardware structure schematic diagram of the decoding method for running the two-dimensional code provided by an embodiment of the present application. As shown in the figure, Figure 13 the embodiment / computer 6 includes a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60, such as a program of the decoding method for running the two-dimensional code. The processor 60 implements the steps in each of the method embodiments described above when executing the computer program 62. Alternatively, the processor 60 implements the functions of each module / unit in each of the device embodiments described above when executing the computer program 62.

[0176] For example, the computer program 62 can be divided into one or more modules / units, which are stored in the memory 61 and executed by the processor 60 to complete the present application. The one or more modules / units can be a series of computer program instruction segments that can complete a specific function, which are used to describe the execution process of the computer program 62 in the computer 6.

[0177] The computer 6 can be a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The computer 6 device can include, but is not limited to, the processor 60, the memory 61. Those skilled in the art can understand, Figure 13The computer 6 is merely an example and does not limit the computer 6, which can include more or less components than shown, or combine some components, or have different components, such as the computer 6 can also include input / output devices, network access devices, buses, etc.

[0178] The processor 60 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0179] The memory 61 can be an internal storage unit of the computer 6, such as a hard disk or a memory of the computer 6. The memory 61 can also be an external storage device of the computer 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FC), etc. Further, the memory 61 can include both the internal storage unit and the external storage device of the computer 6. The memory 61 is used to store the computer program 62 and other programs and data required by the computer 6. The memory 61 can also be used to temporarily store data that has been output or will be output.

[0180] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or software. In addition, the specific name of each functional unit and module is only for the convenience of mutual distinction, and does not limit the protection scope of the present application. The specific working process of the unit and module in the above system can refer to the corresponding process in the foregoing method embodiment, which will not be described here.

[0181] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.

[0182] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0183] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / terminal device and method can be implemented by other ways. For example, the above-mentioned apparatus / terminal device embodiments are only schematic, and the division of the modules or units is only a logical function division, and there can be another division way in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0184] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0185] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0186] The integrated module / unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware, and the computer program can be stored in a computer-readable storage medium. When the processor executes the computer program, the steps of each method embodiment can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0187] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present application, and should be included in the protection scope of the present application.

Claims

1. A decoding method of a two-dimensional code, characterized by, The two-dimensional code is composed of two different brightness patterns, and the size of the two-dimensional code is MxM, wherein the two-dimensional code comprises a function pattern and a data pattern, the function pattern comprises a center locating pattern block with a size of NxN, and the data pattern comprises a data block around the center locating pattern block, wherein N=8x n1+1, M=N+8x n2, n1 is a positive integer, and n2 is a positive integer greater than or equal to 2. The center locating pattern block comprises a center rectangular frame module with a size of 3N1x3N1 composed of a pattern with a size of N1xN1 of the second brightness, the center of the center rectangular frame module is consistent with the center of the two-dimensional code, a rectangular outer frame module with a size of NxN composed of a pattern with a size of N1xN1 of the second brightness is concentrically arranged around the center rectangular frame module, a rectangular corner module with a size of aN1x bN1 composed of a pattern with the second brightness is arranged at one inner corner of the rectangular outer frame module, and the remaining part surrounded by the rectangular outer frame module is filled with a first brightness large square composed of a pattern with a size of N1xN1 of the first brightness, wherein N1+aN1+N1≤(N-1) / 2, N1+bN1+N1≤N / 2, a and b are integers greater than or equal to 1, and a≠b. The function pattern further comprises at least one header information pattern block, and at least one of the header information pattern blocks is arranged immediately above, below or simultaneously above and below the center locating pattern block; the header information pattern block comprises version information, error correction level and code size level information. The data pattern comprises a plurality of code words arranged in the area of the data pattern according to the arrangement order corresponding to the version information, each code word comprises 8x n3 bits of characters, n3 is a positive integer, and the characters are arranged in the code word according to a preset compiling order. The method comprises the steps of: S1, acquiring a photographed image S, and obtaining a binary image B after the photographed image is reduced and gray-scale binary converted; S2, finding a point with the highest first brightness in the image B to preliminarily determine the position P of the center locating pattern block; S3, intercepting a region image D of a preset size corresponding to the position P in the image S; S4, positioning a center point C of the center rectangular frame module in the image D; S5, identifying the rectangular corner module and the rectangular outer frame module in the image D to identify the entire center locating pattern block and calculate the inclination angle A and the size Z of the center locating pattern block; S6, positioning the position of the header information pattern block and reading the header information; S7, decoding the header information according to a preset RS error correction algorithm to determine whether the decoding is successful; if the decoding is successful, step S81 is entered; S81, positioning is correct, and the positioning and reading process of the data pattern is entered.

2. The decoding method of a two-dimensional code according to claim 1, characterized by, Further comprising the step of acquiring the boundary and size information R of the two-dimensional code, specifically comprising: When the two-dimensional code is a single code, the head information point of the two-dimensional code is read to obtain size information R of the two-dimensional code, and the boundary of the two-dimensional code is located according to the tilt angle A and the size information R; When the two-dimensional code is a multi-code tiling design, the center point sites C are connected to each other, and the center perpendicular line of the connection line is the boundary of the two-dimensional code.

3. The decoding method of a two-dimensional code according to claim 2, characterized by, The functional pattern further includes a correction pattern at at least three corners of the two-dimensional code; and the step S7 further includes, if the decoding is unsuccessful, entering step S9. Step S9 includes: S91, searching for the correction pattern in a preset range of the boundary according to the boundary; S92, correcting the center point site C according to the correction pattern.

4. The decoding method of a two-dimensional code according to claim 3, characterized by, The step S92 includes: recalculating the center point site C' of the two-dimensional code according to the correction pattern, using the center point site C' as a new center point site C, and returning to step S5.

5. The decoding method of a two-dimensional code according to any one of claims 1 to 4, characterized by, The functional pattern further includes a clock positioning pattern block; the clock positioning pattern block is a cross positioning line, the center of the clock positioning pattern block is consistent with the center of the center image positioning pattern block; the clock positioning pattern block includes a horizontal positioning pattern and a vertical positioning pattern respectively extending from four sides of the center image positioning pattern block; the horizontal positioning pattern is located at the horizontal center of the two-dimensional code, the vertical positioning pattern is located at the vertical center of the two-dimensional code, and the horizontal positioning pattern and the vertical positioning pattern are both formed by first brightness patterns and second brightness patterns with a size of N1×N1 and alternately formed; the step S7 further includes, if the decoding is unsuccessful, entering step S10; the step S10 includes: S101, positioning the cross positioning line position according to the center point site C and the center image positioning pattern block, searching for patterns alternately formed by first brightness patterns and second brightness patterns with a size of N1×N1 in a preset range around the cross positioning line position and extending in a single direction, and fitting a new cross positioning line; S102, fitting a cross positioning line center intersection as a new center point site C through the new cross positioning line, and returning to step S5.

6. A decoding method system of a two-dimensional code, comprising a memory, a processor, a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the decoding method of the two-dimensional code according to any one of claims 1 to 5.

7. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the decoding method of the two-dimensional code according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Aztec Code bar code decoding chip and decoding method thereof

    CN101908128A

  • Two-dimensional code identification method and system based on connected domain analysis, device and medium

    CN109993019A