Coding method, coding pattern, coding pattern reading method and shooting device

By adopting new encoding methods and encoding graphics, using the asymmetric distributed configuration of four positioning blocks and Reed-Solomon error correction coding, the problem that existing QR codes cannot meet the needs of larger error correction capacity in some application scenarios is solved, and an efficient and economical coding solution is achieved.

CN112187284BActive Publication Date: 2025-04-04HANGZHOU HIKROBOT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910606064.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-05
Publication Date
2025-04-04
Estimated Expiration
2040-05-10

AI Technical Summary

Technical Problem

Existing QR codes cannot meet the needs of greater error correction capacity in some application scenarios, and there are problems with authorization costs and production costs during the use and production of QR codes.

Method used

A new encoding method and encoding graphics are adopted to achieve accurate and fast positioning of the encoding graphics and rapid information reading through the asymmetric distribution configuration of four positioning blocks, and bit exclusive-or processing is used using Reed-Solomon error correction encoding and data mask matrix to improve the noise resistance of the encoding area.

Benefits of technology

It realizes a coding solution that meets the needs of greater error correction capacity without increasing authorization and production costs, and improves the scope of application and efficiency of coding graphics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112187284B_ABST
    Figure CN112187284B_ABST
Patent Text Reader

Abstract

The present invention discloses a coding method, a coding graphic, a coding graphic reading method and a photographing device. In the present invention, three of the four positioning blocks in the coding graphic are respectively located at the three corners of the coding graphic, and the other positioning block is only tangent to the edge of the coding graphic, forming an asymmetric distribution configuration of the four positioning blocks. The present invention replaces the existing two-dimensional code standard, saves the authorization cost and production cost required for the existing two-dimensional code generation software, and is not limited to the use restrictions of the existing two-dimensional code generation software. The present invention realizes accurate and rapid positioning of the coding graphic, which is conducive to quickly finding the starting coding block position in the coding area. The present invention can set the size of the coding graphic area and the size of the coding area therein according to the amount of data in the application scenario, so as to flexibly set the data information recorded by the coding graphic. The coding method of the coding area in the present invention is simple, and the efficiency is high for scenes with a small amount of coding data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of calibration technology, and in particular to a coding method, a coding graphic, a coding graphic reading method and a shooting device. Background Art

[0002] In industrial production and machine vision applications, in order to determine the information (such as coordinates) of some key positions in workpieces, mechanisms or scenes, it is necessary to label specific locations. During processing, by finding the label position in the image and parsing the content of the label, the relevant information of the position of the point indicated by the label can be determined, which helps to reduce the difficulty of subsequent processing. By processing the information contained in the label, it is helpful for the mechanism and software algorithm to automatically and efficiently complete specific functions. This method of using labels is widely used in scenarios such as mobile robot positioning, visual navigation, calibration plate assisted positioning, and motion estimation.

[0003] QR code is a commonly used label with advantages such as high information density and high readability, and has been widely used in daily life and industrial production. QR code can store more information than traditional barcode, so it can accommodate a certain amount of redundant information and improve the code's anti-noise performance. According to the different error correction mechanisms, the QR codes currently used can be divided into two categories: one is to calculate the error correction code using the data code itself, and fill it in the matrix together with the data to form a complete QR code. The good mathematical properties of the error correction code play an important role in the decoding stage. Its typical representatives are QR code and DM code, which can generally correct 15% to 30% of codeword errors.

[0004] The error correction capacity of QR code and DM code is fixed. As the error correction performance improves, the size of the QR code increases. The QR code standard provides four error correction levels: L, M, H, and Q, with a maximum error tolerance of about 30%; the error tolerance of DM code is less than 30%. If the actual usage scenario requires a larger error correction capacity, it will not be met.

[0005] Another type of matrix code uses probability theory for error correction. This type of code does not explicitly add error correction codes, but uses a certain screening mechanism to pre-select a group of codewords with the largest possible code distance from a large number of codewords for encoding. Since the codeword space is relatively sparse, the probability that a codeword is received as another codeword is very low. Based on this feature, the received codeword can also be corrected. Typical representatives of this type of code are AprilTag code and ArUco code.

[0006] April code and ArUco code do not have independent positioning graphics, but decode by comparing the image with the QR code library through the best match. The disadvantages of this code are: first, in order to maximize the distance of the allowed codewords, it is necessary to screen from a large number of codewords, which is time-consuming and inconvenient to expand; second, the decoding process uses template matching for decoding, and the time consumption increases linearly with the number of templates, and it is difficult to cover all complex situations using templates.

[0007] Existing QR codes require the use of QR code generation software under existing rules, which increases the licensing and production costs of QR codes. Summary of the invention

[0008] In view of this, the present invention provides a coding method, a coding graphic, a coding graphic reading method, a photographing device, a non-volatile computer-readable storage medium and an electronic device to replace the existing two-dimensional code and save the authorization cost and production cost of the two-dimensional code.

[0009] The technical solution of the present invention is achieved in this way:

[0010] A coding method, comprising:

[0011] receiving data to be encoded;

[0012] Encoding the data to be encoded to generate encoded data;

[0013] Recording the coded data in a coded graph;

[0014] Wherein, the coding pattern is a square, including:

[0015] A first positioning block, wherein the first positioning block is located in a first corner area of ​​the coding pattern;

[0016] A second positioning block, the second positioning block is located in a second corner area of ​​the coding pattern, wherein the second corner area and the first corner area are not located on the same diagonal line of the coding pattern;

[0017] A third positioning block, the third positioning block is located in a third corner area of ​​the coding pattern, wherein the third corner area and the second corner area are located on the same diagonal line of the coding pattern;

[0018] a fourth positioning block, the fourth positioning block being located in the coding pattern;

[0019] A coding area, the coding area is located in an area of ​​the coding pattern that is not occupied by the first positioning block, the second positioning block, the third positioning block, and the fourth positioning block, and the coding area records the coding data; wherein,

[0020] In the quadrilateral formed by the center of the first positioning block, the center of the second positioning block, the center of the third positioning block and the center of the fourth positioning block, the inner angle at the position of the fourth positioning block is the largest inner angle among the four inner angles of the quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block.

[0021] Preferably, encoding the data to be encoded includes:

[0022] The data to be encoded is encoded using a Reed-Solomon RS error correction coding method.

[0023] Preferably, after generating the coded data and before recording the coded data in a coding graph, the method further comprises:

[0024] The encoded data is subjected to bitwise XOR processing with the data mask matrix.

[0025] Preferably, the first positioning block is tangent to the first edge of the coding pattern and the second edge of the coding pattern at the same time;

[0026] The second positioning block is tangent to the second edge of the coding pattern and the third edge of the coding pattern at the same time;

[0027] The third positioning block is tangent to the first edge of the coding pattern and the fourth edge of the coding pattern at the same time;

[0028] The fourth positioning block is only tangent to the fourth edge of the coding pattern.

[0029] Preferably, the first positioning block, the second positioning block, the third positioning block and the fourth positioning block are the same in shape and size.

[0030] Preferably, the first positioning block, the second positioning block, the third positioning block and the fourth positioning block are all concentrically arranged in the shape of a plurality of circular rings of alternating colors.

[0031] Preferably, the coding area is composed of a data dot matrix, and the coding blocks in the data dot matrix are square dots or circular dots.

[0032] Preferably, the coding blocks include coding blocks of two colors that are distinguished from each other, wherein the coding blocks of one color represent 0, and the coding blocks of the other color represent 1.

[0033] Preferably, the step of recording the coded data in a coding graph comprises:

[0034] A row of coding blocks closest to the second edge in the coding area is used as a starting coding row, and a row of coding blocks closest to the fourth edge in the coding area is used as a last coding row. In each row of coding blocks, the coding block closest to the first edge is used as a starting coding block, and the coding block closest to the third edge is used as a last coding block. The coded data is recorded in the coding area in order from the starting coding row to the last coding row.

[0035] Preferably, in the process of recording the coded data in the coding area:

[0036] When forming a coding line truncated by the fourth positioning block, the fourth positioning block is skipped to form coding blocks in the coding line.

[0037] Preferably, before recording the coded data in the coded graph, the method further comprises:

[0038] The side length of the coding pattern is determined according to the number of bits of the coding data, the side length of each coding block in the coding area and the side length of the area occupied by any positioning block.

[0039] Preferably, the side length of the coding pattern is positively correlated with the number of bits of the coding data, the side length of each coding block in the coding area, and the side length of the area occupied by any positioning block.

[0040] A coding pattern, the coding pattern is a square, comprising:

[0041] A first positioning block, wherein the first positioning block is located in a first corner area of ​​the coding pattern;

[0042] A second positioning block, the second positioning block is located in a second corner area of ​​the coding pattern, wherein the second corner area and the first corner area are not located on the same diagonal line of the coding pattern;

[0043] A third positioning block, the third positioning block is located in a third corner area of ​​the coding pattern, wherein the third corner area and the second corner area are located on the same diagonal line of the coding pattern;

[0044] a fourth positioning block, the fourth positioning block being located in the coding pattern;

[0045] A coding area, the coding area is located in an area of ​​the coding pattern that is not occupied by the first positioning block, the second positioning block, the third positioning block, and the fourth positioning block, and the coding area records readable information; wherein,

[0046] In the quadrilateral formed by the center of the first positioning block, the center of the second positioning block, the center of the third positioning block and the center of the fourth positioning block, the inner angle at the position of the fourth positioning block is the largest inner angle among the four inner angles of the quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block.

[0047] Preferably, the first positioning block is tangent to the first edge of the coding pattern and the second edge of the coding pattern at the same time;

[0048] The second positioning block is tangent to the second edge of the coding pattern and the third edge of the coding pattern at the same time;

[0049] The third positioning block is tangent to the first edge of the coding pattern and the fourth edge of the coding pattern at the same time;

[0050] The fourth positioning block is only tangent to the fourth edge of the coding pattern.

[0051] Preferably, the first positioning block, the second positioning block, the third positioning block and the fourth positioning block are the same in shape and size.

[0052] Preferably, the first positioning block, the second positioning block, the third positioning block and the fourth positioning block are all concentrically arranged in the shape of a plurality of circular rings of alternating colors.

[0053] Preferably, the coding area is composed of a data dot matrix, and the coding blocks in the data dot matrix are square dots or circular dots.

[0054] Preferably, the coding blocks include coding blocks of two colors that are distinguished from each other, wherein the coding blocks of one color represent 0, and the coding blocks of the other color represent 1.

[0055] A method for reading a coded graphic, comprising:

[0056] Acquire an image containing a coding pattern, wherein the image is obtained by photographing a surface of an object containing the coding pattern;

[0057] In the image, four positioning blocks in the coded pattern are identified;

[0058] Determine a mapping relationship of the coded pattern from the image to a plane without perspective distortion according to the four positioning blocks, and transform the coded pattern in the image to the plane without perspective distortion according to the mapping relationship to form a front view of the coded pattern;

[0059] In the front view of the coding pattern, the information recorded in the coding pattern is obtained by reading the coding area recording the readable recorded information;

[0060] Wherein, in the image, identifying four positioning blocks in the coded pattern includes:

[0061] The positioning block at the maximum inner angle position of the four inner angles of the quadrilateral formed by the central coordinates of the four positioning blocks is determined as the fourth positioning block, the positioning block whose two sides of the maximum inner angle are closest to the fourth positioning block is determined as the third positioning block, the positioning block whose two sides of the maximum inner angle are farthest from the fourth positioning block is determined as the second positioning block, and the remaining positioning blocks are determined as the first positioning blocks.

[0062] Preferably, the mapping relationship of the coded pattern from the image to the plane without perspective distortion is determined according to the four positioning blocks, and is obtained by the following method:

[0063] Determine the mapping relationship of the coded graphic from the image to the plane without perspective distortion based on the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the plane without perspective distortion.

[0064] Preferably, the coding area is located in the coding pattern and is not occupied by the first positioning block, the second positioning block, the third positioning block and the fourth positioning block.

[0065] Preferably, the following method is used to identify the four positioning blocks in the coding pattern:

[0066] In the coded graphic, four graphic objects of the same shape and size are determined as the four positioning blocks.

[0067] Preferably, it further comprises:

[0068] Four graphic objects in the shape of multiple circular rings, all of which are concentrically arranged and have alternating colors, are determined as the four positioning blocks.

[0069] Preferably, the quadrilateral is constructed by the following method:

[0070] The center coordinates of the four positioning blocks are extracted, and the center coordinates of the four positioning blocks are connected in sequence to form the quadrilateral.

[0071] Preferably, in the square plane area without perspective distortion:

[0072] The first positioning block is located in a first corner area of ​​the square plane area;

[0073] The second positioning block is located in a second corner area of ​​the square plane area which is not on the same diagonal line as the first corner area;

[0074] The third positioning block is located in a third corner area of ​​the square plane area which is on the same diagonal line as the second corner area;

[0075] The position of the fourth positioning block is one of a set of positions of fourth positioning blocks that satisfies the following conditions:

[0076] The fourth positioning block is located in the square plane area, and in the target quadrilateral formed by the center of the first positioning block, the center of the second positioning block, the center of the third positioning block and the center of the fourth positioning block, the inner angle at the position of the fourth positioning block is the largest inner angle among the four inner angles of the target quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block.

[0077] Preferably, determining the mapping relationship of the coded pattern from the image to the plane without perspective distortion according to the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the plane without perspective distortion comprises:

[0078] Acquire a homography matrix corresponding to the mapping relationship according to the central coordinates of the first positioning block, the central coordinates of the second positioning block, the central coordinates of the third positioning block, and the central coordinates of the fourth positioning block in the image, and the central coordinates of the first positioning block, the central coordinates of the second positioning block, the central coordinates of the third positioning block, and the central coordinates of the fourth positioning block in a plane without perspective distortion;

[0079] The step of transforming the coded graphic in the image into the plane without perspective distortion to form a front view of the coded graphic according to the mapping relationship comprises:

[0080] By utilizing the homography matrix, all pixel points of the coding pattern in the image are projected and transformed onto the plane without perspective distortion to form a front view of the coding pattern.

[0081] Preferably, in the front view of the coded graphic, obtaining the information recorded in the coded graphic by reading the coded area recording the readable recorded information comprises:

[0082] Among the four edges of the coding pattern in the front view of the coding pattern, the edge tangent to both the first positioning block and the third positioning block is set as the first edge, the edge tangent to both the first positioning block and the second positioning block is set as the second edge, the edge tangent only to the second positioning block is set as the third edge, and the edge tangent to both the third positioning block and the fourth positioning block is set as the fourth edge;

[0083] A row of coding blocks closest to the second edge in the coding area is taken as a starting coding row, and a row of coding blocks closest to the fourth edge in the coding area is taken as a last coding row. In each row of coding blocks, the coding block closest to the first edge is taken as a starting coding block, and the coding block closest to the third edge is taken as a last coding block. Information of each coding block is read from the starting coding block to the last coding block in each coding row in order from the starting coding row to the last coding row, so as to obtain information recorded in the coding graph.

[0084] Preferably, when reading a coding line truncated by the fourth positioning block, the fourth positioning block is skipped to read coding blocks in the coding line.

[0085] Preferably, after reading the coding area, the information recorded in the coding pattern is obtained by the following method:

[0086] Performing error correction decoding on the coded information obtained by reading the coded area to obtain a corrected codeword and the number of errors;

[0087] If the number of errors does not exceed the error correction capacity, the error-corrected codeword is output.

[0088] Preferably, before performing the error correction decoding, the method further includes:

[0089] The encoding information is subjected to bitwise XOR processing with the data mask matrix.

[0090] A photographing device, comprising a photographing unit and a processor;

[0091] The photographing unit is used to photograph the surface of the object containing the coded pattern to obtain an image containing the coded pattern;

[0092] The processor is used to:

[0093] In the image, four positioning blocks in the coded pattern are identified;

[0094] Determine a mapping relationship of the coded pattern from the image to a plane without perspective distortion according to the four positioning blocks, and transform the coded pattern in the image to the plane without perspective distortion according to the mapping relationship to form a front view of the coded pattern;

[0095] In the front view of the coding pattern, the information recorded in the coding pattern is obtained by reading the coding area recording the readable information.

[0096] A non-volatile computer-readable storage medium storing instructions, characterized in that when the instructions are executed by a processor, the processor executes the steps in any one of the encoding methods described above.

[0097] A non-volatile computer-readable storage medium storing instructions, characterized in that when the instructions are executed by a processor, the processor executes the steps in the coded graphic reading method as described in any one of the above.

[0098] An electronic device, comprising:

[0099] at least one processor; and,

[0100] a memory communicatively connected to the at least one processor; wherein,

[0101] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps in the coding method of the coded graphic as described in any one of the above items.

[0102] An electronic device, comprising:

[0103] at least one processor; and,

[0104] a memory communicatively connected to the at least one processor; wherein,

[0105] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps in the coding pattern reading method as described in any one of the above items.

[0106] As can be seen from the above scheme, the coding method, coding graphics, coding graphics reading method, shooting device, non-volatile computer-readable storage medium and electronic device of the present invention replace the existing two-dimensional code standard, save the authorization cost and production cost required for the existing two-dimensional code generation software, and are not limited to the use restrictions of the existing two-dimensional code generation software. In addition, in the present invention, three of the four positioning blocks are respectively located at the three corners of the coding graphics, and the other positioning block is only tangent to the edge of the coding graphics, forming an asymmetric distribution configuration of four positioning blocks, so that the present invention utilizes the asymmetric distribution configuration of the four positioning blocks to achieve accurate and rapid positioning of the coding graphics, ensuring accurate reading of the coding area, and at the same time, the present invention uses four positioning blocks of asymmetric distribution configuration to set the direction of the coding graphics, which is conducive to quickly finding the starting coding block position in the coding area, and the rapid reading of the information recorded in the coding area is achieved by reading each row of coding blocks from top to bottom and from left to right at a time. In addition, in the present invention, the asymmetric setting structure of the four positioning blocks carries direction information. The direction of the coding graphic can be determined by using these four asymmetric positioning blocks, which can overcome the problem of being unable to determine the direction of the coding graphic due to the mirror problem caused by the symmetrical setting. Further, when reading data in both the positive and negative directions of the coding graphic, the direction of the coding graphic can be identified, thereby achieving the purpose of reading data in both the positive and negative directions of the same coding graphic, and increasing the scope of application of the coding graphic. The present invention can set the size of the coding graphic area and the size of the coding area therein according to the amount of data in the application scenario, so as to flexibly set the data information recorded by the coding graphic. The Reed-Solomon error correction mechanism is used in the present invention, so that the coding area has error-proof performance, and can correct errors that do not exceed the error correction capacity. The coding method of the coding area in the present invention is simple, and it is more efficient for scenarios with a small amount of coding data. BRIEF DESCRIPTION OF THE DRAWINGS

[0107] Figure 1A A schematic diagram of a coding diagram according to an embodiment of the present invention;

[0108] Figure 1B A schematic diagram of a coding diagram according to an embodiment of the present invention;

[0109] Figure 2 is a flow chart of an encoding method according to an embodiment of the present invention;

[0110] Figure 3 Schematic diagram of arrangement of data codes and error correction codes in the coding area of ​​a coding pattern in an embodiment of the present invention;

[0111] Figure 4 A flow chart of a method for reading a coded pattern according to an embodiment of the present invention;

[0112] Figure 5Schematic diagram of the whole process from initial determination of data to be encoded to final completion of encoding in an embodiment of the present invention;

[0113] Figure 6 It is a flowchart of the whole process from determining the coding graphic specification to finally completing the decoding in an embodiment of the present invention;

[0114] Figure 7 FIG. 4 is a schematic diagram of a photographing device according to an embodiment of the present invention.

[0115] Figure 8 Schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0116] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0117] like Figure 1A , Figure 1B The coding pattern of the embodiment of the present invention is shown. The coding pattern 1 is a square and includes a first positioning block 11, a second positioning block 12, a third positioning block 13 and a fourth positioning block 14. The first positioning block 11, the second positioning block 12 and the third positioning block 13 are respectively located in the first corner area, the second corner area and the third corner area of ​​the coding pattern 1, wherein the second corner area and the first corner area are not located on the same diagonal line of the coding pattern 1, and the third corner area and the second corner area are located on the same diagonal line of the coding pattern 1, that is, the second corner area and the third corner area are two corner areas on the same diagonal line of the coding pattern 1, as shown in FIG. Figure 1A , Figure 1B In the illustrated embodiment, the first corner region is the upper left corner region, the second corner region is the upper right corner region, and the third corner region is the lower left corner region, wherein the upper right corner region and the lower left corner region are two corner regions on the diagonal line from the upper right corner to the lower left corner of the coding pattern 1. The fourth positioning block 14 is located in the coding pattern 1.

[0118] like Figure 1A , Figure 1B As shown, the coding pattern 1 further includes a coding area 15, which is located in the area of ​​the coding pattern 1 not occupied by the first positioning block 11, the second positioning block 12, the third positioning block 13 and the fourth positioning block 14, and the coding area 15 records readable information.

[0119] like Figure 1A , Figure 1BAs shown, in the quadrilateral formed by the center of the first positioning block 11, the center of the second positioning block 12, the center of the third positioning block 13 and the center of the fourth positioning block 14, the inner angle at the position of the fourth positioning block 14 is the largest inner angle among the four inner angles of the quadrilateral, and the distance between the center of the fourth positioning block 14 and the center of the third positioning block 13 is smaller than the distance between the center of the fourth positioning block 14 and the center of the second positioning block 12. That is, the center of the fourth positioning block 14 is connected to the center of the third positioning block 13, named as the first connecting line, and the center of the fourth positioning block 14 is connected to the center of the second positioning block 12, named as the second connecting line, then the angle between the first connecting line and the second connecting line is the largest inner angle in the quadrilateral, the distance between the center of the fourth positioning block 14 and the center of the third positioning block 13 is named as the first distance, and the distance between the center of the fourth positioning block 14 and the center of the second positioning block 12 is named as the second distance, then the first distance is smaller than the second distance.

[0120] More specifically, if Figure 1A , Figure 1B As shown, in the embodiment of the present invention, the coding pattern 1 has a first edge 16, a second edge 17, a third edge 18 and a fourth edge 19, and the first edge 16 perpendicularly intersects the second edge 17, the second edge 17 perpendicularly intersects the third edge 18, the third edge 18 perpendicularly intersects the fourth edge 19, and the fourth edge 19 perpendicularly intersects the first edge 16, as shown in FIG. Figure 1A , Figure 1B As shown, the first edge 16 is the left edge of the coding graphic 1 , the second edge 17 is the upper edge of the coding graphic 1 , the third edge 18 is the right edge of the coding graphic 1 , and the fourth edge 19 is the lower edge of the coding graphic 1 .

[0121] The edge of the first positioning block 11 is tangent to the first edge 16 and the second edge 17 at the same time, the edge of the second positioning block 12 is tangent to the second edge 17 and the third edge 18 at the same time, the edge of the third positioning block 13 is tangent to the first edge 16 and the fourth edge 19 at the same time, and the edge of the fourth positioning block 14 is only tangent to the fourth edge 19.

[0122] In an optional embodiment, the first positioning block 11, the second positioning block 12, the third positioning block 13 and the fourth positioning block 14 are of the same shape and size. In an optional embodiment, the first positioning block 11, the second positioning block 12, the third positioning block 13 and the fourth positioning block 14 are all concentrically arranged and have a plurality of circular ring shapes of alternating colors, such as Figure 1A , Figure 1BIn other optional embodiments, the first positioning block 11, the second positioning block 12, the third positioning block 13 and the fourth positioning block 14 can also be regular triangles, squares or other regular polygonal rings. In other optional embodiments, the first positioning block 11, the second positioning block 12, the third positioning block 13 and the fourth positioning block 14 can also be solid positioning blocks, such as circular blocks, square blocks or polygonal blocks.

[0123] In an optional embodiment, the direction of the second edge 17 is set as up, the direction of the first edge 16 is set as left, the direction of the third edge 18 is set as right, and the direction of the fourth edge 19 is set as down, then the direction of the coded graphic 1 can be determined, and the direction of the coded graphic 1 can be determined according to the four positioning blocks.

[0124] like Figure 1A , Figure 1B As shown, the coding area 15 is composed of a data dot matrix. The coding blocks in the data dot matrix are square dots (such as Figure 1A as shown) or circular dots (as Figure 1B shown).

[0125] In an optional embodiment, the coding block includes coding blocks of two colors that are distinguished from each other, wherein the coding block of one color represents 0 and the coding block of the other color represents 1. Figure 1A , Figure 1B In the example shown, black and white coding blocks are used. In other embodiments, coding blocks of different color combinations other than black and white may be used, such as red and white, black and yellow, blue and yellow, etc. The selection of coding block colors gives priority to the ease of reading the coding area 15 to avoid misreading caused by the color values ​​of two colors being too close. Figure 1A , Figure 1B In the illustrated embodiment, a black coding block may be represented as 1 and a white coding block may be represented as 0, or a black coding block may be represented as 0 and a white coding block may be represented as 1.

[0126] In an alternative embodiment, Figure 1A , Figure 1B The order of recording the information in the encoding area 15 in the embodiment shown is: from the first row of the data dot matrix adjacent to the second edge 17 (such as Figure 1A , Figure 1B Starting from the first row from the top in FIG. 1 , along the side close to the first edge 16 (such as Figure 1A , Figure 1B ) to the side close to the third edge 18 (such as Figure 1A , Figure 1B The right side of the sequence record information, that is, Figure 1A , Figure 1B As shown, the information is first recorded in the first row of the data dot matrix in order from left to right, then recorded in the second row of the data dot matrix in order from left to right, and so on, and finally recorded in the last row of the data dot matrix in order from left to right. Figure 1A , Figure 1B As shown, since the fourth positioning block 14 divides the coding blocks of the last few rows into two parts, the information is recorded in the order of each row of coding blocks in these rows of coding blocks. First, the coding blocks in the row located on the left side of the fourth positioning block 14 are recorded from left to right, and then the fourth positioning block 14 is skipped and the coding blocks in the row located on the right side of the fourth positioning block 34 are recorded from left to right.

[0127] The embodiment of the present invention also provides an encoding method, such as Figure 2 As shown, the encoding method includes:

[0128] Step 11, receiving data to be encoded;

[0129] Step 12: Encode the data to be encoded to generate encoded data;

[0130] Step 13: record the coded data in the coded graph.

[0131] The coding pattern is the coding pattern 1 described in the above embodiments, and its structure is shown in FIG. Figure 1A , Figure 1B As shown, please refer to the description of the above embodiments for details, which will not be repeated here.

[0132] In an optional embodiment, step 13 of recording the coded data in the coded graph includes:

[0133] A row of coding blocks closest to the second edge in the coding area is taken as the starting coding row, and a row of coding blocks closest to the fourth edge in the coding area is taken as the last coding row. In each row of coding blocks, the coding block closest to the first edge is taken as the starting coding block, and the coding block closest to the third edge is taken as the last coding block. The coded data is recorded in the coding area in order from the starting coding row to the last coding row.

[0134] Further, in an optional embodiment, in the process of recording the coded data in the coding area:

[0135] When forming a coding line truncated by the fourth positioning block, the fourth positioning block is skipped to form coding blocks in the coding line.

[0136] In an optional embodiment, before recording the coded data in the coded graph in step 13, the coding method of the embodiment of the present invention further includes:

[0137] The side length of the coding pattern is determined according to the number of bits of the coding data, the side length of each coding block in the coding area and the side length of the area occupied by any positioning block.

[0138] In an optional embodiment, the side length of the coding pattern is positively correlated with the number of bits of the coding data, the side length of each coding block in the coding area, and the side length of the area occupied by any positioning block.

[0139] Specifically, in an optional embodiment, a formula is used to express the relationship between the side length of the coding pattern and the number of bits of the coded data, the side length of each coding block in the coding area, and the side length of the area occupied by any positioning block. The side length of the area occupied by any positioning block is recorded as m, the bit width of the data to be encoded is recorded as k, and the preset bit width of the error correction capacity is recorded as 2t, then:

[0140]

[0141] Wherein, a is the side length of the coding area or coding pattern.

[0142] If the width of the quiet zone around the coded pattern is taken into account, then

[0143]

[0144] Wherein, a' is the total side length of the coding area or coding pattern plus the surrounding quiet zone, and q is the width of the quiet zone.

[0145] In an optional embodiment, encoding the data to be encoded in step 12 includes:

[0146] The data to be encoded is encoded using RS (Reed-Solomon) error correction coding method.

[0147] In an optional embodiment, after generating the coded data in step 12 and before recording the coded data in the coded graph in step 13, the coding method of the embodiment of the present invention further includes:

[0148] Perform bitwise XOR operation on the encoded data and the data mask matrix.

[0149] For details about the RS error correction coding method and the bit-wise difference processing using the data mask matrix, please refer to the subsequent description.

[0150] Taking a specific embodiment as an example, recording the data to be encoded in the encoding area may include the following steps.

[0151] Step a1: input the data to be encoded.

[0152] Step a2: Calculate the Galois Field generator polynomial, where the Galois Field basis is 2. The generator polynomial is expressed as the product of 2t linear polynomials.

[0153]

[0154] Step a3: perform Reed-Solomon error correction coding.

[0155] Assume the data code polynomial is:

[0156]

[0157] Then the error correction code polynomial is x 2t The remainder when d(x) is divided by the polynomial g(x).

[0158] Arrange the error correction code after the data code, such as Figure 3 As shown, error correction coding is completed. Alternatively, the error correction code can be placed before the data code.

[0159] Step a4: convert the data code and error correction code into a bit stream, where each bit in the bit stream corresponds to each coding block in the coding area. Different colors of the coding blocks represent different information in the bit stream, where black represents 0 and white represents 1. Alternatively, white represents 0 and black represents 1.

[0160] Step a5: Apply the data mask matrix to obtain the final coding result, that is, the color of each coding block. In order to prevent the same color coding blocks from clustering in the coding area, a data mask matrix with alternating 0 and 1 is applied to the coding area. The formula of the data mask matrix is:

[0161] mask = (row + col) % 2

[0162] Among them, row is the row number of the coding block, col is the column number of the coding block, and mask is the mask value. Mask is XORed with the coding block value at the corresponding position to obtain the final coding result. The advantage of using the data mask matrix for bitwise XOR operation is that it can reduce the black and white aggregation of black and white blocks when the coding area is relatively large, and improve the segmentation efficiency during decoding.

[0163] Step a6: fill the coding blocks into the coding area in sequence.

[0164] like Figure 4 As shown, combined with Figure 1A , Figure 1B The coding pattern shown in the figure, the coding pattern reading method of the embodiment of the present invention mainly includes:

[0165] Step 21, obtaining an image containing the coded pattern, wherein the image is obtained by photographing the surface of the object containing the coded pattern;

[0166] Step 22: In the image, identify four positioning blocks in the coded pattern;

[0167] Step 23: determining a mapping relationship of the coded pattern from the image to the plane without perspective distortion according to the four positioning blocks, and transforming the coded pattern in the image to the plane without perspective distortion according to the mapping relationship to form a front view of the coded pattern;

[0168] Step 24: In the front view of the coded pattern, the information recorded in the coded pattern is obtained by reading the coded area recording the readable recorded information.

[0169] In an optional embodiment, step 22 of identifying four positioning blocks in the coded pattern in the image further includes:

[0170] The positioning block at the maximum inner angle position of the four inner angles of the quadrilateral formed by the center coordinates of the four positioning blocks is determined as the fourth positioning block, the positioning block whose two sides of the maximum inner angle are closest to the fourth positioning block is determined as the third positioning block, the positioning block whose two sides of the maximum inner angle are farthest from the fourth positioning block is determined as the second positioning block, and the remaining positioning blocks are determined as the first positioning blocks.

[0171] In an optional embodiment, in step 22, the following method is used to identify four positioning blocks in the coding pattern:

[0172] In the coded graphic, four graphic objects of the same shape and size are determined as the four positioning blocks.

[0173] Combination Figure 1A , Figure 1B As shown, the first positioning block 11, the second positioning block 12, the third positioning block 13 and the fourth positioning block 14 are of the same size and shape, which facilitates the identification of each positioning block. Then, in step 22, the same means (method) is used to complete the identification of the four positioning blocks.

[0174] In an optional embodiment, in step 22, the above method of identifying four positioning blocks in the coded pattern further includes:

[0175] Four graphic objects in the shape of multiple circular rings, all of which are concentrically arranged and have alternating colors, are determined as four positioning blocks.

[0176] like Figure 1A or Figure 1B As shown, the first positioning block 11, the second positioning block 12, the third positioning block 13 and the fourth positioning block 14 are all concentrically arranged and have multiple circular ring shapes of alternating colors. Such concentrically arranged and alternately arranged multiple circular ring shapes can be distinguished from the characteristics of the surrounding environment (such as the coding area), which can improve the recognition success rate.

[0177] In an optional embodiment, in step 22, the quadrilateral is constructed by the following method:

[0178] The center coordinates of the four positioning blocks are extracted, and the center coordinates of the four positioning blocks are connected in sequence to form a quadrilateral.

[0179] See also Figure 1A or Figure 1B As shown, in step 22, after the four positioning blocks in the coding pattern are just identified, it is not known which is the first positioning block 11, which is the second positioning block 12, which is the third positioning block 13, and which is the fourth positioning block 14, so the direction of the coding pattern cannot be determined yet. In the subsequent process of step 22, the fourth positioning block 14 is first determined by judging the inner angle of the quadrilateral constructed by connecting the central coordinates of the four positioning blocks (the inner angle of the position of the fourth positioning block 14 is the maximum inner angle of the quadrilateral), and then the third positioning block 13 and the second positioning block 12 are determined by judging the distance between the two positioning blocks adjacent to the fourth positioning block 14 in the quadrilateral and the fourth positioning block 14 (the third positioning block 13 is closer to the fourth positioning block 14 than the second positioning block 12), and finally, the positioning block opposite to the fourth positioning block 14 in the remaining quadrilateral is determined as the first positioning block 11. The reading order of the coding blocks in the coding area can be further determined. For example, the side where the first positioning block 11 and the second positioning block 12 are located can be positioned upward, and the side where the first positioning block 11 and the third positioning block 13 are located can be positioned left. When reading the coding area, the data blocks of each row are read from top to bottom, and in each row of data blocks, each data block is read from left to right. It can be seen that the embodiment of the present invention realizes the use of the asymmetric distribution characteristics of the four positioning blocks to determine the direction of the coding pattern and determine the reading order of the coding area.

[0180] The layout of the four positioning blocks in the embodiment of the present invention adopts an asymmetric design. After step 22, the relative position relationship of the four positioning blocks is determined, that is, it is determined which is the first positioning block 11, which is the second positioning block 12, which is the third positioning block 13, and which is the fourth positioning block 14. The relative position relationship of the first positioning block 11, the second positioning block 12, the third positioning block 13, and the fourth positioning block 14 is used to determine the direction of the coding pattern. In the subsequent steps, the direction of the coding pattern can be used to determine the reading order of each coding block in the coding area. It can be seen that in the embodiment of the present invention, the asymmetric setting structure of the four positioning blocks carries direction information. The direction of the coding pattern can be determined by using these four asymmetric positioning blocks, which can overcome the problem of being unable to determine the direction of the coding pattern due to the mirror problem caused by the symmetrical setting, so that the embodiment of the present invention does not need to use an additional mirror detection step to determine the direction of the coding pattern.

[0181] In an optional embodiment, the mapping relationship of the coded pattern from the image to the plane without perspective distortion is determined according to the four positioning blocks in step 23, and is obtained by the following method:

[0182] Determine the mapping relationship of the encoded graphic from the image to the plane without perspective distortion based on the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the image, as well as the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the plane without perspective distortion.

[0183] In an alternative embodiment, in a square planar region without perspective distortion:

[0184] The first positioning block is located in a first corner area of ​​the square plane area;

[0185] The second positioning block is located in a second corner region of the square plane region which is not on the same diagonal line as the first corner region;

[0186] The third positioning block is located in a third corner area of ​​the square plane area which is on the same diagonal line as the second corner area;

[0187] The position of the fourth positioning block is one of a set of positions of fourth positioning blocks that satisfies the following conditions:

[0188] The fourth positioning block is located in the square plane area, and in the target quadrilateral formed by the center of the first positioning block, the center of the second positioning block, the center of the third positioning block and the center of the fourth positioning block, the inner angle at the position of the fourth positioning block is the largest inner angle among the four inner angles of the target quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block.

[0189] The coordinates of the fourth positioning block satisfying that the distance between the center of the fourth positioning block and the center of the third positioning block is less than the distance between the center of the fourth positioning block and the center of the second positioning block are a set. Preferably, the positional relationship between the four positioning blocks in the square plane area without perspective distortion should be consistent with the positional relationship between the four positioning blocks in the above-mentioned coding pattern embodiment of the present invention. Preferably, the quadrilateral formed by the four positioning blocks in the square plane area without perspective distortion is similar or congruent to the quadrilateral formed by the four positioning blocks in the above-mentioned coding pattern embodiment of the present invention.

[0190] In an optional embodiment, the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block, and the center coordinates of the fourth positioning block in the plane without perspective distortion in step 23 are set by the following method:

[0191] Step b1, setting the first target block in the first corner area of ​​the square plane area without perspective distortion;

[0192] Step b2, setting the second target block in the second corner area of ​​the square plane area;

[0193] Step b3, setting the third target block in a third corner area in the square plane area that is on the same diagonal line as the second corner area;

[0194] Step b4, setting the fourth target block in the square plane area, so that in the target quadrilateral formed by the center of the first target block, the center of the second target block, the center of the third target block and the center of the fourth target block, the inner angle at the location of the fourth target block is the largest inner angle among the four inner angles of the target quadrilateral, and the distance between the center of the fourth target block and the center of the third target block is smaller than the distance between the center of the fourth target block and the center of the second target block;

[0195] Step b5, set the center coordinates of the first target block to the center coordinates of the first positioning block in the plane without perspective distortion, set the center coordinates of the second target block to the center coordinates of the second positioning block in the plane without perspective distortion, set the center coordinates of the third target block to the center coordinates of the third positioning block in the plane without perspective distortion, and set the center coordinates of the fourth target block to the center coordinates of the fourth positioning block in the plane without perspective distortion.

[0196] In the embodiment of the present invention, the information recorded in the coding area is finally read in the front view of the coding graphic without perspective distortion. Therefore, it is necessary to transform the captured coding graphic from the captured image to the front view of the coding graphic without perspective distortion. In this transformation, it is necessary to determine or set the target point of this transformation in advance and save it to ensure the smooth execution of the subsequent graphic transformation. In the embodiment of the present invention, after the above steps b1 to b5, the target coordinates of the transformation of the four positioning blocks are determined in the square plane area. Therefore, no matter what angle the coding graphic is photographed, as long as the first positioning block 11, the second positioning block 12, the third positioning block 13, and the fourth positioning block 14 can be identified and determined, the target coordinates of the center of each positioning block obtained after the above steps b1 to b5 and pre-stored in advance in the front view of the coding graphic without perspective distortion can be immediately used to determine the mapping relationship of the coding graphic from the image to the front view of the coding graphic and perform image transformation.

[0197] In an optional embodiment, the mapping relationship of the coded pattern from the image to the plane without perspective distortion is determined according to the four positioning blocks in step 23, and is obtained by the following steps:

[0198] Step 231, determine the mapping relationship of the coded graphic from the image to the plane without perspective distortion based on the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the plane without perspective distortion.

[0199] In an optional embodiment, step 231 determines the mapping relationship of the coded pattern from the image to the plane without perspective distortion according to the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block, and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block, and the center coordinates of the fourth positioning block in the plane without perspective distortion, including:

[0200] According to the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the plane without perspective distortion, a homography matrix corresponding to the mapping relationship is obtained.

[0201] In an optional embodiment, the step 23 of transforming the coded graphic in the image into a plane without perspective distortion to form a front view of the coded graphic according to the mapping relationship includes:

[0202] Step 232: Use the homography matrix to project all pixel points of the coded graphic in the image onto a plane without perspective distortion to form a front view of the coded graphic.

[0203] In an optional embodiment, in step 24, the coding area is located in the coding pattern and is not occupied by the first positioning block, the second positioning block, the third positioning block and the fourth positioning block.

[0204] In an optional embodiment, in step 24, in the front view of the coded graphic, by reading the coded area recording the readable recorded information, the information recorded in the coded graphic is obtained, including:

[0205] Step 241: among the four edges of the coding pattern in the front view of the coding pattern, the edge tangent to both the first positioning block and the third positioning block is set as the first edge, the edge tangent to both the first positioning block and the second positioning block is set as the second edge, the edge tangent only to the second positioning block is set as the third edge, and the edge tangent to both the third positioning block and the fourth positioning block is set as the fourth edge;

[0206] Step 242: take a row of coding blocks closest to the second edge in the coding area as the starting coding row, take a row of coding blocks closest to the fourth edge in the coding area as the last coding row, in each row of coding blocks, take the coding block closest to the first edge as the starting coding block, take the coding block closest to the third edge as the last coding block, and read the information of each coding block from the starting coding block to the last coding block in each coding row in order from the starting coding row to the last coding row to obtain the information recorded in the coding graphic.

[0207] See also Figure 1A , Figure 1B As shown, in an optional embodiment, from Figure 1A , Figure 1B The top row of code blocks shown in the figure starts reading each row of code blocks in sequence until the bottom row of code blocks is completely read. In each row of code blocks, each code block is read from left to right.

[0208] In an optional embodiment, in step 242, when reading the coding line truncated by the fourth positioning block, the fourth positioning block is skipped to read the coding blocks in the coding line.

[0209] In an optional embodiment, in step 24, after reading the coding area, the information recorded in the coding pattern is further obtained by the following method:

[0210] Step 243, performing error correction decoding on the coded information obtained by reading the coded area to obtain a corrected code word and the number of errors;

[0211] Step 244: If the number of errors does not exceed the error correction capacity, the corrected codeword is output.

[0212] In an optional embodiment, the error correction decoding used in step 243 is RS (Reed-Solomon) error correction decoding.

[0213] In an optional embodiment, before performing the error correction decoding of step 243 and after obtaining the information recorded in the coding pattern in step 242, step 24 further includes:

[0214] Perform bitwise XOR operation on the encoded information and the data mask matrix.

[0215] Regarding the bitwise XOR processing in the embodiment of the present invention, supplementary explanations are as follows.

[0216] In the encoding process, the real data to be recorded in the encoding area is subjected to bitwise XOR processing with the data mask matrix to obtain a coding area pattern that avoids black and white aggregation. In the decoding process, the coding area pattern is also subjected to bitwise XOR processing with the data mask matrix. In addition, the data mask matrix used in encoding is the same as the data mask matrix used in decoding, because XOR follows the following associative law:

[0217] a⊕(a⊕b)=(a⊕a)⊕b

[0218] Therefore, if a is defined as the data mask matrix and b is defined as the real data to be recorded in the coding area during encoding, then (a⊕b) on the left side of the above equation represents the bitwise XOR processing of the real data and the data mask matrix during encoding. If the result of (a⊕b) is defined as c, then c represents the coding area graph that avoids black and white aggregation. Then the content on the left side of the above equation is

[0219] a⊕(a⊕b)=a⊕c

[0220] The a⊕c on the right side of the above formula represents the bitwise XOR processing of the coding area graphic and the data mask matrix during decoding.

[0221] From the above two formulas, we can know

[0222] a⊕c=a⊕(a⊕b)=(a⊕a)⊕b

[0223] It is known to those skilled in the art that the XOR value of the same value is 0, that is, in the above formula a⊕a=0, then

[0224] a⊕c=a⊕(a⊕b)=(a⊕a)⊕b=0⊕b

[0225] It is known to those skilled in the art that 0 is XORed with a non-zero number and is equal to the non-zero number. If b is a non-zero number, then

[0226] a⊕c=a⊕(a⊕b)=(a⊕a)⊕b=0⊕b=b

[0227] Among them, because b is defined as the data to be recorded in the coding area during encoding, it can be seen from the above formula that in the decoding process, the original encoded real data can be obtained by performing bitwise XOR processing on the coding area graphic and the data mask matrix (the same as the data mask matrix used during encoding).

[0228] Therefore, in a preferred embodiment, the same data mask matrix is ​​used in the encoding process and the decoding process to perform bitwise XOR processing on the real data to be recorded in the encoding area and the encoding area, respectively, so that the original encoding information recorded in the encoding area can be obtained during decoding.

[0229] Figure 5 The whole process flow from the initial determination of the data to be encoded to the final completion of the encoding using the encoding method of the embodiment of the present invention is shown. Figure 5 As shown, the process includes:

[0230] Step c1: Determine the maximum number of bits of the data to be encoded according to application requirements.

[0231] In industrial applications, different application scenarios have different requirements for the data capacity in the coded graphics. In an optional embodiment, for the coded graphics formed by the coding method of the coded graphics of the embodiment of the present invention with auxiliary positioning function, the stored data is usually a set of decimal numbers representing position coordinates. The position coordinates can be represented by row and column indexes and unit distances, or only by actual physical coordinates. Before making the coded graphics, it is first necessary to clarify the minimum number of decimal digits required to represent the scene coordinates.

[0232] Step c2: Select appropriate error correction capacity and determine the size of the coding pattern.

[0233] The error correction capacity here is the same as that of the traditional QR code, which refers to the number of erroneous codewords that the decoder can correct when the codeword (coding block in the coding area) is changed due to the influence of lighting, distortion, image noise, etc. The error correction capacity reflects the anti-noise performance of the coding graphic. In industrial applications, different scenarios have different requirements for the error correction capacity of coding graphics. In some scenarios, the imaging environment can be better controlled, and the probability of errors in the coding graphics is small. At this time, the requirements for error correction capacity are relatively low; in other scenarios, the imaging environment is complex and changeable, and the probability of errors in the coding graphics is high. At this time, the requirements for error correction capacity are relatively high, and more error correction codes are required to ensure decoding performance. Before coding the coding graphics, it is necessary to evaluate the required error correction capacity t according to the characteristics of the coding graphic use environment. Based on the determined number of data codes k and the number of error correction codes 2t, the side length a of the coding graphics can be calculated:

[0234]

[0235] Among them, m is the side length of the area occupied by the positioning block. Figure 1A , Figure 1B In the coding diagram of the illustrated embodiment, m represents the diameter of the outermost ring of the positioning ring, and ceil(x) represents the smallest integer not less than x.

[0236] If the width q of the quiet zone around the coded pattern is taken into account, then

[0237]

[0238] Step c3: input the data to be encoded.

[0239] Step c4: Calculate the Galois Field generator polynomial, where the Galois Field basis is 2. The generator polynomial is expressed as the product of 2t linear polynomials.

[0240]

[0241] Step c5: perform Reed-Solomon error correction coding.

[0242] Assume the data code polynomial is:

[0243]

[0244] The error correction codeword polynomial is x 2t The remainder obtained by dividing d(x) by the polynomial g(x). Arrange the error correction code after the data code, such as Figure 3 As shown, error correction coding is completed. Alternatively, the error correction code can be placed before the data code.

[0245] Step c6, converting the data code and error correction code into a bit stream. The smallest unit in the coding area is the coding block, and different colors of the coding block represent different information, where black represents 0 and white represents 1. Alternatively, white represents 0 and black represents 1. Encoding is achieved by converting decimal code words into binary bit streams. During the conversion, each two decimal digits are converted as a group. After all code words are converted, they are spliced ​​together in relative order to form a coded bit stream.

[0246] Step c7, apply the data mask matrix to perform bitwise XOR processing to obtain the final coding result. In order to prevent the same color coding blocks from agglomerating in the coding area, a data mask matrix with alternating 0 and 1 is applied to the coding area. The formula of the data mask matrix is:

[0247] mask = (row + col) % 2

[0248] Where row is the row number of the coding block, col is the column number of the coding block, and mask is the mask value. Mask is XORed with the coding block value at the corresponding position to obtain the final coding result.

[0249] Step c8: Fill the coding blocks into the coding area in sequence. Figure 1A , Figure 1B As shown, when filling the coding blocks, start from the first coding block in the upper left corner of the coding area (i.e., the coding block adjacent to the first positioning block 11 and the second edge 17), and fill in the order from left to right and from top to bottom. When filling each row of coding blocks isolated by the fourth positioning block 14 in the last few rows, first fill in the coding blocks on the left side of the fourth positioning block 14 in the row from left to right, then skip the fourth positioning block 14, and continue to fill in the coding blocks on the right side of the fourth positioning block 14 in the row from left to right until all coding blocks are filled.

[0250] Step c9, draw the positioning block.

[0251] In an optional embodiment, the positioning block adopts Figure 1A , Figure 1BThe positioning ring shape shown in the figure has the same width of concentric black and white bands in the positioning ring, the outermost is a black ring, and the innermost is a white circle. In an optional embodiment, the radius of the inner white circle is 3 / 8 of the radius of the outer black circle. In other embodiments, other radius ratios may also be used.

[0252] Step c10, complete the encoding and output the pattern of the final encoded graphic.

[0253] Figure 6 The whole process flow from determining the coding pattern specification to finally completing the decoding is shown in the coding pattern reading method of the embodiment of the present invention. Figure 6 As shown, the process includes:

[0254] Step d1, determine the specification of the coding pattern. Decoding needs to be performed according to the specification of the coding pattern when it was encoded, and the specification mainly includes: the number of data codes, the number of error correction codes, the size of the positioning block, etc.

[0255] Step d2: extract the center coordinates of the four positioning blocks of the coded pattern in the image containing the coded pattern.

[0256] against Figure 1A , Figure 1B In the embodiment shown, the four positioning blocks are located by using the Hough transform method in an optional embodiment. Figure 1A , Figure 1B The four circular positioning blocks shown in the figure are screened by using the number of concentric circles in each positioning block and the relationship between the radius to determine the center coordinates of each positioning block in the image containing the coded pattern. Among them, the Hough transform method is an existing method, and the determination of the center of gravity coordinates of the concentric circles by screening by using the number of concentric circles in each positioning block and the relationship between the radius can be implemented by using existing technology, which will not be repeated here.

[0257] Step d3: determine the order of the four positioning blocks.

[0258] In this step, determining the order of the four positioning blocks is to determine the first positioning block, the second positioning block, the third positioning block and the fourth positioning block among the four positioning blocks.

[0259] In this step, the asymmetry of the positions of the four positioning blocks is used to determine the first positioning block, the second positioning block, the third positioning block and the fourth positioning block. Figure 1A , Figure 1BIn the illustrated embodiment, in the quadrilateral formed by the four positioning blocks, the angle formed by the two adjacent sides of the positioning block at the lower right corner is the largest inner angle among the four inner angles of the quadrilateral. Therefore, the inner angles in the quadrilateral corresponding to the four positioning blocks are calculated respectively, and the positioning block at the position of the largest inner angle (the lower right corner of the quadrilateral) is determined as the fourth positioning block. Furthermore, the positioning block whose two sides of the largest inner angle are closest to the fourth positioning block is determined as the third positioning block (the positioning block at the lower left corner of the quadrilateral), the positioning block whose two sides of the largest inner angle are farthest from the fourth positioning block is determined as the second positioning block (the positioning block at the upper right corner of the quadrilateral), and the remaining positioning blocks are determined as the first positioning block (the positioning block at the upper left corner of the quadrilateral).

[0260] Step d4: Calculate the homography matrix based on the center coordinates of the four positioning blocks in the image and the corresponding coordinates of the four positioning blocks in the plane without perspective distortion. Use the homography matrix to project all the pixels in the coding graphic area to the plane without perspective distortion to obtain the coding graphic image with perspective distortion removed, that is, the front view of the coding graphic.

[0261] Step d5: inside the coding graphic area in the front view of the coding graphic, a threshold value method is used to obtain a binary image of the coding graphic.

[0262] Step d6: Calculate the length of the coding block in the coding area according to the side length of the positioning block and the side length of the coding area. Divide the grid with the coding block length as the step length, and read the bit value of each grid. In practice, the decision threshold T can be set as needed. When the number of white pixels in the grid exceeds T, it is judged as a white module, otherwise it is judged as a black module. Figure 1A , Figure 1B As shown, starting from the coding block adjacent to the first positioning block 11 and the second edge 17, the code words of each coding block are read in sequence according to the encoding order (i.e., each row of coding blocks is read from left to right and from top to bottom) until all code words are read.

[0263] Step d7: Use the mask to perform bitwise XOR processing on the codewords of each coding block to obtain the information before masking.

[0264] Step d8: Perform Reed-Solomon error correction decoding to obtain an error correction result.

[0265] The error correction result includes the corrected codeword and the number of errors.

[0266] Step d9: Determine whether the decoding is successful based on the number of errors calculated in step d8. If the number of errors exceeds the error correction capacity t, the error correction decoding cannot be completed, and step d10 is executed; otherwise, the decoding is successful, and step d11 is executed.

[0267] Step d10: Since the number of errors is greater than the error correction capacity, a decoding failure result is output.

[0268] Step d11: Decoding is successful, and the error-corrected codeword is output.

[0269] The coded pattern in the embodiment of the present invention can be formed on a calibration plate to assist in positioning the calibration plate during the camera calibration process, wherein the coded area in the coded pattern can record the coordinates (index coordinates or physical coordinates) of the marking points of the coded pattern and / or relevant information of the calibration plate (such as the physical distance between feature points in the calibration plate), etc.

[0270] The embodiment of the present invention also provides a photographing device, such as Figure 7 As shown, the shooting device includes a shooting unit 31 and a processor 32. The shooting unit 31 is used to shoot the surface of an object containing a coded pattern to obtain an image containing the coded pattern. The processor 32 is used to: in the image containing the coded pattern, identify four positioning blocks in the coded pattern; determine the mapping relationship of the coded pattern from the image to the plane without perspective distortion according to the four positioning blocks, and transform the coded pattern in the image to the plane without perspective distortion to form a front view of the coded pattern according to the mapping relationship; in the front view of the coded pattern, by reading the coded area recording the readable recorded information, obtain the information recorded in the coded pattern.

[0271] An embodiment of the present invention further provides a non-volatile computer-readable storage medium, which stores instructions. When the instructions are executed by a processor, the processor executes the steps in the coding method of the coded graphics as described in the above embodiments.

[0272] An embodiment of the present invention further provides a non-volatile computer-readable storage medium, which stores instructions. When the instructions are executed by a processor, the processor executes the steps in the coded graphic reading method as described in the above embodiments.

[0273] The embodiment of the present invention also provides an electronic device, the structure of which can be seen in Figure 8 As shown, the electronic device includes: at least one processor 41; and a memory 42 communicatively connected to the at least one processor 41; wherein the memory 42 stores instructions executable by the at least one processor 41, and the instructions are executed by the at least one processor 41 so that the at least one processor 41 performs the steps in the coding method of the coded graphic as described in any one of the above embodiments.

[0274] The embodiment of the present invention also provides an electronic device, the structure of which can also be seen in Figure 8As shown, the electronic device includes: at least one processor 41; and a memory 42 communicatively connected to the at least one processor 41; wherein the memory 42 stores instructions executable by the at least one processor 41, and the instructions are executed by the at least one processor 41 so that the at least one processor 41 performs the steps in the coded graphic reading method as described in any one of the above embodiments.

[0275] In the coding method, coding graphics, coding graphics reading method, photographing device, non-volatile computer-readable storage medium and electronic device embodiment of the embodiment of the present invention, the existing two-dimensional code standard is replaced, the authorization cost and production cost required for the use of existing two-dimensional code generation software are saved, and it is not limited to the use restrictions of the existing two-dimensional code generation software. In addition, in the embodiment of the present invention, three of the four positioning blocks are respectively located at the three corners of the coding graphics, and the other positioning block is only tangent to the edge of the coding graphics, forming an asymmetric distribution configuration of the four positioning blocks, so that the embodiment of the present invention utilizes the asymmetric distribution configuration of the four positioning blocks to achieve accurate and rapid positioning of the coding graphics, ensuring accurate reading of the coding area, and at the same time, the embodiment of the present invention uses the four positioning blocks of the asymmetric distribution configuration to set the direction of the coding graphics, which is conducive to quickly finding the starting coding block position in the coding area, and the rapid reading of the information recorded in the coding area is achieved by reading each row of coding blocks from top to bottom and from left to right at a time. In addition, in the embodiment of the present invention, the asymmetric setting structure of the four positioning blocks carries direction information. The direction of the coding pattern can be determined by using these four asymmetric positioning blocks, which can overcome the problem of being unable to determine the direction of the coding pattern due to the mirror problem caused by the symmetrical setting. Further, when reading data in both the positive and negative directions of the coding pattern, the direction of the coding pattern can be identified, thereby achieving the purpose of reading data in both the positive and negative directions of the same coding pattern, and increasing the scope of application of the coding pattern. The embodiment of the present invention can set the size of the coding pattern area and the size of the coding area therein according to the amount of data in the application scenario, so as to flexibly set the data information recorded by the coding pattern. The Reed-Solomon error correction mechanism is used in the embodiment of the present invention, so that the coding area has error-proof performance and can correct errors that do not exceed the error correction capacity. The coding method of the coding area in the embodiment of the present invention is simple, and it is more efficient for scenarios with a small amount of coding data.

[0276] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A coding method, characterized in that: include: receiving data to be encoded; Encoding the data to be encoded to generate encoded data; Recording the coded data in a coded graph; The coding pattern is a square, comprising: A first positioning block, wherein the first positioning block is located in a first corner area of ​​the coding pattern; A second positioning block, the second positioning block is located in a second corner area of ​​the coding pattern, wherein the second corner area and the first corner area are not located on the same diagonal line of the coding pattern; A third positioning block, the third positioning block is located in a third corner area of ​​the coding pattern, wherein the third corner area and the second corner area are located on the same diagonal line of the coding pattern; a fourth positioning block, the fourth positioning block being located in the coding pattern; A coding area, the coding area is located in an area of ​​the coding pattern that is not occupied by the first positioning block, the second positioning block, the third positioning block, and the fourth positioning block, and the coding area records the coding data; in, In a quadrilateral formed by the centers of the first positioning block, the second positioning block, the third positioning block and the fourth positioning block, the inner angle at which the fourth positioning block is located is the largest inner angle among the four inner angles of the quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block, so that the first positioning block, the second positioning block, the third positioning block and the fourth positioning block form an asymmetric distribution configuration, for: Determine the mapping relationship of the coded pattern from the image to the plane without perspective distortion according to the four positioning blocks, and transform the coded pattern in the image to the plane without perspective distortion according to the mapping relationship to form a front view of the coded pattern, In the process of reading the coded data based on the front view of the coded pattern, an edge tangent to both the first positioning block and the third positioning block is identified as a first edge, an edge tangent to both the first positioning block and the second positioning block is identified as a second edge, an edge tangent only to the second positioning block is identified as a third edge, and an edge tangent to both the third positioning block and the fourth positioning block is identified as a fourth edge; A row of coding blocks in the coding area closest to the second edge is used as a starting coding row, and a row of coding blocks in the coding area closest to the fourth edge is used as a last coding row, In each row of coding blocks, the coding block closest to the first edge is used as the starting coding block, and the coding block closest to the third edge is used as the last coding block, The information of each coding block is read from the starting coding block to the last coding block in each coding line in sequence from the starting coding line to the last coding line to obtain the information recorded in the coding pattern.

2. The encoding method according to claim 1, characterized in that Encoding the data to be encoded includes: The data to be encoded is encoded using a Reed-Solomon RS error correction coding method.

3. The encoding method according to claim 1, characterized in that After generating the coded data and before recording the coded data in the coded graph, the method further comprises: The encoded data is subjected to bitwise XOR processing with the data mask matrix.

4. The encoding method according to claim 1, characterized in that: The first positioning block is tangent to the first edge of the coding pattern and the second edge of the coding pattern at the same time; The second positioning block is tangent to the second edge of the coding pattern and the third edge of the coding pattern at the same time; The third positioning block is tangent to the first edge of the coding pattern and the fourth edge of the coding pattern at the same time; The fourth positioning block is only tangent to the fourth edge of the coding pattern.

5. The encoding method according to claim 1, characterized in that: The first positioning block, the second positioning block, the third positioning block and the fourth positioning block are the same in shape and size.

6. The encoding method according to claim 1, characterized in that: The first positioning block, the second positioning block, the third positioning block and the fourth positioning block are all concentrically arranged in the shape of a plurality of circular rings of alternating colors.

7. The encoding method according to claim 1, characterized in that: The coding area is composed of a data dot matrix, and the coding blocks in the data dot matrix are square dots or circular dots.

8. The encoding method according to claim 7, characterized in that: The coding blocks include coding blocks of two colors that are distinguished from each other, wherein the coding blocks of one color represent 0 and the coding blocks of the other color represent 1.

9. The encoding method according to claim 5, characterized in that: The step of recording the coded data in a coding graph comprises: A row of coding blocks closest to the second edge in the coding area is used as a starting coding row, and a row of coding blocks closest to the fourth edge in the coding area is used as a last coding row. In each row of coding blocks, the coding block closest to the first edge is used as a starting coding block, and the coding block closest to the third edge is used as a last coding block. The coded data is recorded in the coding area in order from the starting coding row to the last coding row.

10. The encoding method according to claim 9, characterized in that: In the process of recording the coded data in the coding area: When forming a coding line truncated by the fourth positioning block, the fourth positioning block is skipped to form coding blocks in the coding line.

11. The encoding method according to claim 1, characterized in that: Before recording the coded data in the coded graph, the method further comprises: The side length of the coding pattern is determined according to the number of bits of the coding data, the side length of each coding block in the coding area and the side length of the area occupied by any positioning block.

12. The encoding method according to claim 11, characterized in that: The side length of the coding pattern is positively correlated with the number of bits of the coding data, the side length of each coding block in the coding area, and the side length of the area occupied by any positioning block.

13. A method for reading a coded pattern, comprising: Acquire an image containing a coding pattern, the image being obtained by photographing a surface of an object containing a coding pattern, the coding pattern being a square, and comprising: A first positioning block, wherein the first positioning block is located in a first corner area of ​​the coding pattern; A second positioning block, the second positioning block is located in a second corner area of ​​the coding pattern, wherein the second corner area and the first corner area are not located on the same diagonal line of the coding pattern; A third positioning block, the third positioning block is located in a third corner area of ​​the coding pattern, wherein the third corner area and the second corner area are located on the same diagonal line of the coding pattern; a fourth positioning block, the fourth positioning block being located in the coding pattern; A coding area, the coding area is located in an area of ​​the coding pattern that is not occupied by the first positioning block, the second positioning block, the third positioning block, and the fourth positioning block, and the coding area records readable information; in, In a quadrilateral formed by the center of the first positioning block, the center of the second positioning block, the center of the third positioning block and the center of the fourth positioning block, the inner angle at which the fourth positioning block is located is the largest inner angle among the four inner angles of the quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block, so that the first positioning block, the second positioning block, the third positioning block and the fourth positioning block form an asymmetric distribution configuration; In the image, four positioning blocks in the coded pattern are identified; Determine a mapping relationship of the coded pattern from the image to a plane without perspective distortion according to the four positioning blocks, and transform the coded pattern in the image to the plane without perspective distortion according to the mapping relationship to form a front view of the coded pattern; In the front view of the coding pattern, the information recorded in the coding pattern is obtained by reading the coding area recording the readable recorded information; in, The step of identifying four positioning blocks in the coding pattern in the image includes: The positioning block at the maximum inner angle position among the four inner angles of the quadrilateral formed by the center coordinates of the four positioning blocks is determined as the fourth positioning block, The positioning blocks of the two sides of the maximum inner angle closest to the fourth positioning block are determined as the third positioning blocks, The positioning block whose two sides of the maximum inner angle are farthest from the fourth positioning block is determined as the second positioning block, Determine the remaining positioning block as the first positioning block; In the front view of the coding pattern, by reading the coding area recording the readable recorded information, the information recorded in the coding pattern is obtained, including: Among the four edges of the coding pattern in the front view of the coding pattern, the edge tangent to both the first positioning block and the third positioning block is identified as the first edge, the edge tangent to both the first positioning block and the second positioning block is identified as the second edge, the edge tangent to only the second positioning block is identified as the third edge, and the edge tangent to both the third positioning block and the fourth positioning block is identified as the fourth edge; A row of coding blocks in the coding area closest to the second edge is used as a starting coding row, and a row of coding blocks in the coding area closest to the fourth edge is used as a last coding row, In each row of coding blocks, the coding block closest to the first edge is used as the starting coding block, and the coding block closest to the third edge is used as the last coding block, The information of each coding block is read from the starting coding block to the last coding block in each coding line in sequence from the starting coding line to the last coding line to obtain the information recorded in the coding pattern.

14. The method for reading a coded pattern according to claim 13, characterized in that: The first positioning block is tangent to the first edge of the coding pattern and the second edge of the coding pattern at the same time; The second positioning block is tangent to the second edge of the coding pattern and the third edge of the coding pattern at the same time; The third positioning block is tangent to the first edge of the coding pattern and the fourth edge of the coding pattern at the same time; The fourth positioning block is only tangent to the fourth edge of the coding pattern.

15. The method for reading a coded pattern according to claim 13, characterized in that: The first positioning block, the second positioning block, the third positioning block and the fourth positioning block are the same in shape and size.

16. The method for reading a coded pattern according to claim 13, characterized in that: The first positioning block, the second positioning block, the third positioning block and the fourth positioning block are all concentrically arranged in the shape of a plurality of circular rings of alternating colors.

17. The method for reading a coded pattern according to claim 13, characterized in that: The coding area is composed of a data dot matrix, and the coding blocks in the data dot matrix are square dots or circular dots.

18. The method for reading a coded pattern according to claim 17, characterized in that: The coding blocks include coding blocks of two colors that are distinguished from each other, wherein the coding blocks of one color represent 0 and the coding blocks of the other color represent 1.

19. The method for reading a coded pattern according to claim 13, characterized in that: The mapping relationship of the coded pattern from the image to the plane without perspective distortion is determined according to the four positioning blocks, and is obtained by the following method: Determine the mapping relationship of the coded graphic from the image to the plane without perspective distortion based on the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the plane without perspective distortion.

20. The method for reading a coded pattern according to claim 13, characterized in that: The coding area is located in the coding pattern and is not occupied by the first positioning block, the second positioning block, the third positioning block and the fourth positioning block.

21. The method for reading a coded pattern according to claim 13, characterized in that: The four positioning blocks in the coding pattern are identified by the following method: In the coded graphic, four graphic objects of the same shape and size are determined as the four positioning blocks.

22. The method for reading a coded pattern according to claim 21, characterized in that: Further including: Four graphic objects in the shape of multiple circular rings, all of which are concentrically arranged and have alternating colors, are determined as the four positioning blocks.

23. The method for reading a coded pattern according to claim 13, characterized in that: The quadrilateral is constructed as follows: The center coordinates of the four positioning blocks are extracted, and the center coordinates of the four positioning blocks are connected in sequence to form the quadrilateral.

24. The method for reading a coded pattern according to claim 19, characterized in that: In the square plane area without perspective distortion: The first positioning block is located in a first corner area of ​​the square plane area; The second positioning block is located in a second corner area of ​​the square plane area which is not on the same diagonal line as the first corner area; The third positioning block is located in a third corner area of ​​the square plane area which is on the same diagonal line as the second corner area; The position of the fourth positioning block is one of a set of positions of fourth positioning blocks that satisfies the following conditions: The fourth positioning block is located in the square plane area, and in the target quadrilateral formed by the center of the first positioning block, the center of the second positioning block, the center of the third positioning block and the center of the fourth positioning block, the inner angle at the position of the fourth positioning block is the largest inner angle among the four inner angles of the target quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block.

25. The method for reading a coded pattern according to claim 19, characterized in that: The determining of the mapping relationship of the coded pattern from the image to the plane without perspective distortion according to the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block, and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block, and the center coordinates of the fourth positioning block in the plane without perspective distortion includes: According to the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in the image, and the center coordinates of the first positioning block, the center coordinates of the second positioning block, the center coordinates of the third positioning block and the center coordinates of the fourth positioning block in a plane without perspective distortion, a homography matrix corresponding to the mapping relationship is obtained.

26. The method for reading a coded pattern according to claim 25, characterized in that: The step of transforming the coded graphic in the image into the plane without perspective distortion to form a front view of the coded graphic according to the mapping relationship comprises: By utilizing the homography matrix, all pixel points of the coding pattern in the image are projected and transformed onto the plane without perspective distortion to form a front view of the coding pattern.

27. The method for reading a coded pattern according to claim 26, characterized in that: When reading the coding line truncated by the fourth positioning block, the fourth positioning block is skipped to read the coding blocks in the coding line.

28. The method for reading a coded pattern according to claim 13, characterized in that: After reading the coding area, the information recorded in the coding pattern is obtained by the following method: Performing error correction decoding on the coded information obtained by reading the coded area to obtain a corrected codeword and the number of errors; If the number of errors does not exceed the error correction capacity, the error-corrected codeword is output.

29. The method for reading a coded pattern according to claim 28, characterized in that: Before performing the error correction decoding, the method further includes: The encoding information is subjected to bitwise XOR processing with the data mask matrix.

30. A photographing device, comprising a photographing unit and a processor, characterized in that: The shooting unit is used to shoot the surface of an object containing a coding pattern to obtain an image containing the coding pattern, wherein the coding pattern is a square and includes: A first positioning block, wherein the first positioning block is located in a first corner area of ​​the coding pattern; A second positioning block, the second positioning block is located in a second corner area of ​​the coding pattern, wherein the second corner area and the first corner area are not located on the same diagonal line of the coding pattern; A third positioning block, the third positioning block is located in a third corner area of ​​the coding pattern, wherein the third corner area and the second corner area are located on the same diagonal line of the coding pattern; a fourth positioning block, the fourth positioning block being located in the coding pattern; A coding area, the coding area is located in an area of ​​the coding pattern that is not occupied by the first positioning block, the second positioning block, the third positioning block, and the fourth positioning block, and the coding area records readable information; in, In a quadrilateral formed by the center of the first positioning block, the center of the second positioning block, the center of the third positioning block and the center of the fourth positioning block, the inner angle at which the fourth positioning block is located is the largest inner angle among the four inner angles of the quadrilateral, and the distance between the center of the fourth positioning block and the center of the third positioning block is smaller than the distance between the center of the fourth positioning block and the center of the second positioning block, so that the first positioning block, the second positioning block, the third positioning block and the fourth positioning block form an asymmetric distribution configuration; The processor is used to: In the image, four positioning blocks in the coded pattern are identified; Determine a mapping relationship of the coded pattern from the image to a plane without perspective distortion according to the four positioning blocks, and transform the coded pattern in the image to the plane without perspective distortion according to the mapping relationship to form a front view of the coded pattern; In the front view of the coding pattern, the information recorded in the coding pattern is obtained by reading the coding area recording the readable recorded information. in, In the front view of the coding pattern, by reading the coding area recording the readable recorded information, the information recorded in the coding pattern is obtained, including: Among the four edges of the coding pattern in the front view of the coding pattern, the edge tangent to both the first positioning block and the third positioning block is identified as the first edge, the edge tangent to both the first positioning block and the second positioning block is identified as the second edge, the edge tangent to only the second positioning block is identified as the third edge, and the edge tangent to both the third positioning block and the fourth positioning block is identified as the fourth edge; A row of coding blocks in the coding area closest to the second edge is used as a starting coding row, and a row of coding blocks in the coding area closest to the fourth edge is used as a last coding row, In each row of coding blocks, the coding block closest to the first edge is used as the starting coding block, and the coding block closest to the third edge is used as the last coding block, The information of each coding block is read from the starting coding block to the last coding block in each coding line in sequence from the starting coding line to the last coding line to obtain the information recorded in the coding pattern.

31. A non-volatile computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by a processor, the processor is caused to perform the steps in the encoding method according to any one of claims 1 to 12.

32. A non-volatile computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by a processor, the processor is caused to perform the steps in the code pattern reading method according to any one of claims 13 to 29.

33. An electronic device comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps in the coding method of any one of claims 1 to 12.

34. An electronic device comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps in the code pattern reading method according to any one of claims 13 to 29.

Citation Information

Patent Citations

  • Novel array-type two-dimension code encoding and decoding methods

    CN102999772A

  • Information processing method and apparatus, and storage medium

    WO2018177127A1