Patent ID: 12229630

DESCRIPTION OF THE EMBODIMENTS

Referring toFIG.1, a reading device10for a two-dimensional code may be various electronic devices, such as a smartphone, a tablet computer, a laptop computer, an industrial computer, a server, a gaming console, a multimedia business machine, etc. In addition, the reading device10for the two-dimensional code is not limited to the above electronic devices.

The reading device10may include an image capturing device11, a storage circuit12, and a processor13. The image capturing device11may capture an external image. Specifically, the external image may be a two-dimensional code image101. For example, the image capturing device11may include an image sensor. The image sensor may include an optical lens element and a photo sensor. The image capturing device11may be built in the reading device10or may be connected to the reading device10through a line.

The storage circuit12is configured to store data. For example, the storage circuit12may include a volatile storage circuit and a non-volatile storage circuit. The volatile storage circuit is configured for volatile data storage. For example, a volatile storage circuit may include a random access memory (RAM) or a similar volatile storage medium. The non-volatile storage circuit is configured for non-volatile data storage. For example, a non-volatile storage circuit may include a read only memory (ROM), a solid state drive (SSD), a hard disk drive (HDD), a flash memory, an embedded multimedia card (eMMC), a universal flash storage (UFS) device, or a similar non-volatile storage medium.

The processor13is coupled to the image capturing device11and the storage circuit12. The processor13may be configured to handle the entirety or a portion of the operation of the reading device10. For example, the processor13may include a central processing unit (CPU) or other programmable general purpose or specific purpose microprocessors, a digital signal processor (DSP), a programmable controller, an application specific integrated circuit (ASIC), a programmable logic device (PLD), a similar device, or a combination of the devices.

The processor13may capture the two-dimensional code image101by using the image capturing device11and store the two-dimensional code image101in the storage circuit12. The two-dimensional code image101may present a two-dimensional code. The two-dimensional code may serve to carry or present encoded information that is graphic (also referred to as graphic encoded information). For example, the two-dimensional code may be printed on a carrier, such as a piece of paper, or displayed on a display. The image capturing device11may obtain the two-dimensional code image101by scanning the two-dimensional code on the carrier or the display. In an embodiment, the two-dimensional code is also referred to as a graphic code.

In an embodiment, the two-dimensional code in the two-dimensional code image101is in a default state. For example, when the image capturing device11scans the two-dimensional code from a perspective of squarely facing the carrier or the display of the two-dimensional code, the two-dimensional code of the two-dimensional code image101captured by the image capturing device11may be in the default state. The processor13may analyze the two-dimensional code in the default state (e.g., decode the graphic encoded information in the two-dimensional code) to obtain the encoded information (i.e., the graphic encoded information) carried in the two-dimensional code. Then, the processor13may perform a corresponding operation (also referred to as a default operation) according to the encoded information. For example, in accordance with the encoded information obtained by analyzing the two-dimensional code, the processor13may start a browser application and present web page contents, etc., corresponding to a uniform resource locater (URL) by using the browser application. In addition, the processor13may also perform other types of operations in accordance with the encoded information obtained by analyzing the two-dimensional code, such as starting other types of applications. The disclosure is not particularly limited in this regard.

In an embodiment, the two-dimensional code in the two-dimensional code image101may also be in a skewed state. For example, when the image capturing device11scans the two-dimensional code from a perspective not squarely facing the carrier or the display of the two-dimensional code, the two-dimensional code of the two-dimensional code image101captured by the image capturing device11may be in the skewed state. For example, in the skewed state of the two-dimensional code, the graphic encoded information carried or presented by the two-dimensional code may at least be partially distorted. In such situation, the processor13is unable to perform the operation corresponding to the two-dimensional code directly in accordance with the two-dimensional code in the skewed state (or the distorted graphic encoded information) in the two-dimensional code image101.

In an embodiment, the processor13may restore the two-dimensional code in the skewed state to the default state through image processing for the two-dimensional code in the skewed state in the two-dimensional code image101beforehand, so that the processor13may perform the corresponding operation in accordance with the two-dimensional code in the default state.

In an embodiment, the two-dimensional code in the two-dimensional code image101may include an outer frame and a position mark. That is, in a single two-dimensional code presented in the two-dimensional code image101, the total number of each of the outer frame and the position mark may be one. However, the disclosure is not limited thereto. In an embodiment, the total numbers of the outer frame and the position mark in one two-dimensional code may be adjusted based on actual practice, and the disclosure is not particularly limited in this regard. The outer frame may serve to define the range or the boundary of the two-dimensional code presented in the two-dimensional code image101. The position mark may serve to position the two-dimensional code presented in the two-dimensional code image101.

In an embodiment, when the two-dimensional code in the two-dimensional code image101is in the default state, the outer frame in the two-dimensional code may have a default shape, and the position mark in the two-dimensional code is in a default position. For example, the default shape of the outer frame may be one of a circular shape, an odd-numbered regular polygonal shape, and an even-numbered regular polygonal shape, and the disclosure is not particularly limited in this regard. In addition, the position mark may include a round dot or other patterns. The disclosure is not particularly limited in this regard, either.

In an embodiment, when the two-dimensional code in the two-dimensional code image101is not in the default state (i.e., the two-dimensional code is in the skewed state), the shape of the outer frame and/or the position of the position mark in the two-dimensional code may be changed. Therefore, in the skewed state of the two-dimensional code, the outer frame of the two-dimensional code may not exhibit the default shape, and/or the position mark in the two-dimensional code may not be located at the default position. Therefore, in such case, the processor13may not be able to correctly identify the distorted graphic encoded information in the two-dimensional code.

In an embodiment, the two-dimensional code in the two-dimensional code image101is in the skewed state. The processor13may detect the outer frame and the position mark of the two-dimensional code in the skewed state in the two-dimensional code image101. Then, the processor13may restore the two-dimensional code in the skewed state to the default state in accordance with the outer frame and the position mark. Then, the processor13may perform the default operation in accordance with the two-dimensional code in the default state.

In an embodiment, the processor13may perform a shape restoring operation on the two-dimensional code in the skewed state in the two-dimensional code image101. The shape restoring operation may restore the deformed outer frame in the two-dimensional code, together with the two-dimensional code itself (including the graphic encoded information), to the default shape. For example, in the shape restoring operation, the processor13may obtain descriptive data relating to the shape of the outer frame in the skewed state. The processor13may obtain a rotation offset angle (also referred to as a first rotation offset angle) of the two-dimensional code in the skewed state relative to a coordinate axis (also referred to as a first coordinate axis) in accordance with the descriptive data. Then, the processor13may correct (i.e., restore) the two-dimensional code in accordance with the first rotation offset angle, so as to restore the outer frame of the two-dimensional code, together with the two-dimensional code itself, to the default shape.

In an embodiment, the descriptive data may serve to schematically depict the deformation of the outer frame in the skewed state. For example, the descriptive data may include a first reference value and a second reference value. In an embodiment, when the default shape of the outer frame is circular, the first reference value may correspond to a major axis length of the outer frame, and the second reference value may correspond to a minor axis length of the outer frame after the outer frame is deformed. In an embodiment, when the default shape of the outer frame is odd-numbered regular polygonal, the first reference value may correspond to a distance between a vertex of the outer frame and a side opposite to the vertex, and the second reference value may correspond to the length of the side after the outer frame is deformed. Alternatively, in an embodiment, when the default shape of the outer frame is even-numbered regular polygonal, the first reference value may correspond to a distance between a side (also referred to as a first side) of the outer frame and another side (also referred to a second side) opposite to the first side, and the second reference value may correspond to the length of the second side after the outer frame is deformed.

In an embodiment, the processor13may obtain the first rotation offset angle in accordance with a value ratio between the first reference value and the second reference value. The processor13may perform a matrix operation on pixel values corresponding to respective pixel positions in the two-dimensional code image101in accordance with a rotation matrix corresponding to the first rotation offset angle. Based on the operation result of the matrix operation, the processor13may restore the outer frame of the two-dimensional code in the skewed state, together with the two-dimensional code itself, to the default state.

In an embodiment, the processor13may perform an angle restoring operation on the two-dimensional code in the skewed state in the two-dimensional code image101. The angle restoring operation may restore the position mark whose position is changed in the two-dimensional code to the default position. For example, in the angle restoring operation, the processor13may obtain a rotation offset angle (also referred to as a second rotation offset angle) of the two-dimensional code relative to a coordinate axis (also referred to as a second coordinate axis) in accordance with the position of the position mark in the two-dimensional code in the skewed state. Then, the processor13may correct (rotate, for example) the two-dimensional code in accordance with the second rotation offset angle to restore the position mark to the default position. For example, the processor13may perform a matrix operation on pixel values corresponding to the respective pixel positions in the two-dimensional code image101in accordance with a rotation matrix corresponding to the second rotation offset angle. Based on the operation result of the matrix operation, the processor13may restore the position mark of the two-dimensional code in the skewed state to the default position. It should be noted that the operation of restoring the position mark to the default position may be equivalent to restoring (rotating, for example) the two-dimensional code in the skewed state to a default angle state of the two-dimensional code.

In an embodiment, when the default shape of the outer frame of the two-dimensional code is odd-numbered regular polygonal or even-numbered regular polygonal, the processor13may, before performing the shape restoring operation on the two-dimensional code in the skewed state, perform a preliminary correction operation on the two-dimensional code to facilitate the efficiency of the shape restoring operation and/or angle restoring operation that are performed afterwards. In the preliminary correction operation, the processor13may rotate the two-dimensional code, so that a side of the outer frame of the two-dimensional code is parallel to the second coordinate axis.

According to an embodiment, in the preliminary correction operation, when the side of the outer frame of the two-dimensional code is parallel to the second coordinate axis, the processor13may further move at least a portion of the pattern of the two-dimensional code in a direction parallel to the second coordinate axis, so that a line connecting the side and a vertex of the outer frame is parallel to another coordinate axis (also referred to as a third coordinate axis). Such operation may facilitate the shape restoring operation and/or the angle restoring operation that are performed afterwards.

In the following, the correction of the two-dimensional code is described by using a two-dimensional code with a circular outer frame, a two-dimensional code with an odd-numbered regular polygonal outer frame, and a two-dimensional code with an even-numbered regular polygonal outer frame as examples. However, in other embodiments, the outer frame of the two-dimensional code may also have other shapes, and the disclosure is not particularly limited in this regard.

The following describes the correction of the two-dimensional code with a circular outer frame.

Referring toFIG.2A, the two-dimensional code20has an outer frame21and a position mark22. In the default state of the two-dimensional code20, the default shape of the outer frame21is circular (the length of the radius thereof is R), and the default position of the position mark22is located on Y-axis in a three-dimensional space. It is noted that the size of the outer frame21and the default position of the position mark22may be adjusted based on practice, and the disclosure is not particularly limited in this regard. In addition, graphic encoded information21carried by the two-dimensional code20may be presented in a circular area surrounded by the outer frame21, and the disclosure is not particularly limited by the default position of the graphic encoded information210in the two-dimensional code20and the contents of the graphic encoded information210.

Referring toFIG.2B, it is assumed that the two-dimensional code20is in the skewed state. For example, the two-dimensional code20in the skewed state inFIG.2Bmay be obtained by rotating the two-dimensional code20in the default state as shown inFIG.2Aby a specific angle along at least one of X-axis, Y-axis, and Z-axis in the three-dimensional space. For example, by rotating the two-dimensional code20the default state as shown inFIG.2Arespectively by θ(x) degrees, θ(y) degrees, and θ(z) degrees using X-axis, Y-axis, and Z-axis in the three-dimensional space as rotation axes, the shape of the outer frame21of the two-dimensional code in the skewed state inFIG.2Bis changed from a circular shape (i.e., the default shape) into an elliptical shape, and the position of the position mark22is also changed. Here, θ(x) degrees, θ(y) degrees, and θ(z) degrees may respectively be arbitrary values from0to360. In addition, the graphic encoded information210inFIG.2Bis also in a skewed and/or distorted state.

In an embodiment, the processor13may detect the outer frame21and the position mark22of the two-dimensional code20in the skewed state as shown inFIG.2B. In accordance with the detected outer frame21, the processor13may perform the shape restoring operation on the two-dimensional code20in the skewed state. For example, in the shape restoring operation, the processor13may obtain descriptive data relating to the shape of the outer frame21in the skewed state. For example, the descriptive data may include the first reference value and the second reference value. For example, the first reference value may correspond to a length R1of the major axis of the elliptical shape exhibited in the outer frame21, and the second reference value may correspond to a length R2of the minor axis of the elliptical shape presented by the outer frame21. In addition, the first reference value and the second reference value may schematically indicate the deformation of the outer frame21in the skewed state, such as a length ratio between the major axis and the minor axis of the outer frame21in the skewed state.

In an embodiment, the processor13may set a major axis direction and a minor axis direction exhibited in the outer frame21as a new X-axis (i.e., X′-axis) and a new Y-axis (i.e., Y′-axis), and a new Z-axis (i.e., Z′-axis) may be set at the center inside the outer frame21, as shown inFIG.2B. In accordance with the first reference value and the second reference value, the processor13may obtain the rotation offset angle (i.e., the first rotation offset angle) of the two-dimensional code20in the skewed state relative to X′-axis (i.e., the first coordinate axis). The first rotation offset angle may indicate the degrees by which the outer frame21in the circular shape in the default state is rotated using X′-axis as the rotation axis in the three-dimensional space to obtain the outer frame21in the elliptical shape as shown inFIG.2B.

In an embodiment, the processor13may refer to a value ratio between the first reference value and the second reference value (i.e., the value ratio between the length R1and the length R2) to obtain the first rotation offset angle through calculation or by using a lookup table. Then, the processor13may correct the two-dimensional code20in the skewed state inFIG.2Bby using a rotation matrix corresponding to the first rotation offset angle.

Referring toFIG.2C, after correcting the two-dimensional code20in the skewed state as shown inFIG.2Bin accordance with the rotation matrix corresponding to the first rotation offset angle, the outer frame21of the two-dimensional code20, together with the two-dimensional code20itself (including the graphic encoded information210), may be restored to the default shape (i.e., circular shape). Then, the processor13may perform the angle restoring operation on the two-dimensional code20that is still in the skewed state as shown inFIG.2C. For example, in the angle restoring operation, the processor13may obtain a rotation offset angle (i.e., the second rotation offset angle) of the two-dimensional code20relative to Z′-axis (i.e., the second coordinate axis) in accordance with the position of the position mark22in the two-dimensional code20. For example, the processor13may adopt phase correlation to obtain the second rotation offset angle in accordance with the position of the position mark22in the two-dimensional code20. Then, the processor13may correct (e.g., rotate) the two-dimensional code20in accordance with a rotation matrix corresponding to the second rotation offset angle to restore the position mark22to the default position inFIG.2A. It should be noted that the operation of restoring the position mark22to the default position may be equivalent to restoring (rotating, for example) the two-dimensional code20in the skewed state to the default angle state of the two-dimensional code20, as shown inFIG.2A. So far, the correction (or restoring) of the two-dimensional code20(including the graphic encoded information210) with a circular outer frame is completed. In addition, the processor13as shown inFIG.1may analyze (e.g., decode) the graphic encoded information210carried or presented by the corrected two-dimensional code20and perform the default operation in accordance with the analysis result.

The following describes the correction of the two-dimensional code with an odd-numbered regular polygonal outer frame.

Referring toFIG.3A, the two-dimensional code30has an outer frame31and a position mark32. In the default state of the two-dimensional code30, the default shape of the outer frame31is regular triangular, and the default position of the position mark32is located on Y-axis in a three-dimensional space. For example, the outer frame31may have sides301to303and vertexes A to C. The sides301to303form a regular triangle, and the vertexes A to C are respectively the three vertexes of the regular triangle. It should be noted that the default shape of the outer frame31may also be other odd-numbered regular polygonal shapes, and/or the default position of the position mark32may also be adjusted based on practice. The disclosure is not particularly limited in this regard. In addition, graphic encoded information31carried by the two-dimensional code30may be presented in a triangular area surrounded by the outer frame31, and the disclosure is not particularly limited by the default position of the graphic encoded information310in the two-dimensional code30and the contents of the graphic encoded information310.

Referring toFIG.3B, it is assumed that the two-dimensional code30is in the skewed state. For example, the two-dimensional code30in the skewed state as shown inFIG.3Bmay be obtained by rotating the two-dimensional code30in the default state as shown inFIG.3Aby θ(x) degrees, θ(y) degrees, and θ(z) degrees using X-axis, Y-axis, and Z-axis in the three-dimensional space as the rotation axes. In addition, the graphic encoded information310inFIG.3Bis also in a skewed and/or distorted state.

In an embodiment, the processor13may detect the outer frame31and the position mark32of the two-dimensional code30in the skewed state as shown inFIG.3B. In accordance with the detected outer frame31, the processor13may perform the preliminary correction operation on the two-dimensional code30in the skewed state. In the preliminary correction operation, the processor13may rotate the two-dimensional code30, so that the side302of the outer frame31of the two-dimensional code30is parallel to X-axis (i.e., the second coordinate axis), as shown inFIG.3C. In addition, the processor13may obtain or establish a line304connecting the vertex A and the side302.

Referring toFIG.3DfollowingFIG.3C, in the preliminary correction operation, the processor13may further move at least a portion of the pattern of the two-dimensional code30in a direction parallel to X-axis, so that the line304is parallel to Y-axis (i.e., the third coordinate axis). Then, the processor13may further move the entire two-dimensional code30in a direction parallel to X-axis, so that the line304is aligned to Y-axis (i.e., allowing the line304to coincide or be overlapped with Y-axis), as shown inFIG.3E.

InFIG.3E, the two-dimensional code30is still in the skewed state. For example, inFIG.3E, the two-dimensional code30is an isosceles triangle, but not a regular triangle. Therefore, inFIG.3E, the processor13may perform the shape restoring operation on the two-dimensional code30in the skewed state. For example, in the shape restoring operation, the processor13may obtain descriptive data relating to the shape of the outer frame31in the skewed state. For example, the descriptive data may include the first reference value and the second reference value. For example, the first reference value may correspond to the distance (i.e., the length of the line304) between the vertex A and the side302opposite to the vertex A, and the second reference value may correspond to the length of the side302. In addition, the first reference value and the second reference value may schematically indicate the deformation of the outer frame31in the skewed state. For example, the first reference value and the second reference value may indicate the schematic mode of the isosceles triangle presented when the outer frame31is in the skewed state.

In an embodiment, in accordance with the first reference value and the second reference value, the processor13may obtain the rotation offset angle (i.e., the first rotation offset angle) of the two-dimensional code30in the skewed state relative to X-axis (i.e., the first coordinate axis). The first rotation offset angle may indicate the degrees by which the outer frame31in the regular triangular shape in the default state as shown inFIG.3Ais rotated using X-axis as the rotation axis in the three-dimensional space to obtain the outer frame31in the isosceles triangular shape as shown inFIG.3E.

In an embodiment, the processor13may refer to a value ratio between the first reference value and the second reference value (i.e., the value ratio between the length of the line304and the length of the side302) to obtain the first rotation offset angle through calculation or by using a lookup table. Then, the processor13may correct the two-dimensional code30in the skewed state inFIG.3Eby using a rotation matrix corresponding to the first rotation offset angle.

Referring toFIG.3F, after correcting the two-dimensional code30in the skewed state as shown inFIG.3Ein accordance with the rotation matrix corresponding to the first rotation offset angle, the outer frame31of the two-dimensional code30, together with the two-dimensional code30itself (including the graphic encoded information310), may be restored to the default shape (i.e., regular triangular shape). Then, the processor13may perform the angle restoring operation on the two-dimensional code30that is still in the skewed state as shown inFIG.3F. For example, in the angle restoring operation, the processor13may obtain a rotation offset angle (i.e., the second rotation offset angle) of the two-dimensional code30relative to Z-axis (i.e., the second coordinate axis) in accordance with the position of the position mark32in the two-dimensional code30. For example, the processor13may adopt phase correlation to obtain the second rotation offset angle in accordance with the position of the position mark32in the two-dimensional code30. The second rotation offset angle may indicate the degrees by which the two-dimensional code30in the default shape that is a regular triangular shape as shown inFIG.3Ais rotated using Z-axis as the rotation axis in the three-dimensional space to rotate the position mark32in the two-dimensional code30to the position of the position mark32inFIG.3F. Then, the processor13may correct (e.g., rotate) the two-dimensional code30in accordance with a rotation matrix corresponding to the second rotation offset angle to restore the position mark32to the default position inFIG.3A. It should be noted that the operation of restoring the position mark32to the default position may be equivalent to restoring (rotating, for example) the two-dimensional code30in the skewed state to the default angle state of the two-dimensional code30, as shown inFIG.3A. So far, the correction (or restoring) of the two-dimensional code30(including the graphic encoded information310) having the outer frame in the odd-numbered regular polygonal shape (e.g., a regular triangular shape) is completed. Then, the processor13as shown inFIG.1may analyze (e.g., decode) the graphic encoded information310carried or presented by the corrected two-dimensional code30and perform the default operation in accordance with the analysis result.

The following describes the correction of the two-dimensional code with an even-numbered regular polygonal outer frame.

Referring toFIG.4A, the two-dimensional code40has an outer frame41and a position mark42. In the default state of the two-dimensional code40, the default shape of the outer frame41is regular hexagonal, and the mark position42is located at the default position. For example, the outer frame41may have sides401to406and vertexes A to F. The sides401to406form a regular hexagon, and the vertexes A to F are respectively the six vertexes of the regular hexagon. It should be noted that the default shape of the outer frame41may also be other even-numbered regular polygonal shapes, and/or the default position of the position mark42may also be adjusted based on practice. The disclosure is not particularly limited in this regard. In addition, graphic encoded information410carried by the two-dimensional code40may be presented in a regular hexagonal area surrounded by the outer frame41, and the disclosure is not particularly limited by the default position of the graphic encoded information410in the two-dimensional code40and the contents of the graphic encoded information410.

Referring toFIG.4B, it is assumed that the two-dimensional code40is in the skewed state. For example, the two-dimensional code40in the skewed state as shown inFIG.4Bmay be obtained by rotating the two-dimensional code40in the default state as shown inFIG.4Aby θ(x) degrees, θ(y) degrees, and θ(z) degrees using X-axis, Y-axis, and Z-axis in the three-dimensional space as the rotation axes. In addition, the graphic encoded information410inFIG.4Bis also in a skewed and/or distorted state.

In an embodiment, the processor13may detect the outer frame41and the position mark42of the two-dimensional code40in the skewed state as shown inFIG.4B. In accordance with the detected outer frame41, the processor13may perform the preliminary correction operation on the two-dimensional code40in the skewed state. In the preliminary correction operation, the processor13may rotate the two-dimensional code40, so that the side403of the outer frame41of the two-dimensional code40is parallel to X-axis (i.e., the second coordinate axis), as shown inFIG.4C. In addition, the processor13may obtain or establish a line407connecting the side403and the side406. The side403is opposite to the side406.

Referring toFIG.4DfollowingFIG.4C, in the preliminary correction operation, the processor13may further move at least a portion of the pattern of the two-dimensional code40in a direction parallel to X-axis, so that the line407is parallel to Y-axis (i.e., the third coordinate axis). Then, the processor13may further move the entire two-dimensional code40in a direction parallel to X-axis, so that the line407is aligned to Y-axis (i.e., allowing the line407to coincide or be overlapped with Y-axis), as shown inFIG.4E.

InFIG.4E, the two-dimensional code40is still in the skewed state. For example, inFIG.4E, the two-dimensional code40is in a squeezed hexagonal shape, instead of a regular hexagonal shape. Therefore, inFIG.4E, the processor13may perform the shape restoring operation on the two-dimensional code40in the skewed state. For example, in the shape restoring operation, the processor13may obtain descriptive data relating to the shape of the outer frame41in the skewed state. For example, the descriptive data may include the first reference value and the second reference value. For example, the first reference value may correspond to the distance (i.e., the length of the line407) between the side403(i.e., the first side) and the side406(i.e., the second side), and the second reference value may correspond to the length of the side403. Alternatively, in an embodiment, the second reference value may also correspond to the distance between the vertex B and the vertex E. In addition, the first reference value and the second reference value may schematically indicate the deformation of the outer frame41in the skewed state. For example, the first reference value and the second reference value may indicate the schematic mode of the squeezed hexagon presented when the outer frame41is in the skewed state.

In an embodiment, in accordance with the first reference value and the second reference value, the processor13may obtain the rotation offset angle (i.e., the first rotation offset angle) of the two-dimensional code40in the skewed state relative to X-axis (i.e., the first coordinate axis). The first rotation offset angle may indicate the degrees by which the outer frame41in the regular hexagonal shape in the default state as shown inFIG.4Ais rotated using X-axis as the rotation axis in the three-dimensional space to obtain the outer frame41in the squeezed hexagonal shape as shown inFIG.4E.

In an embodiment, the processor13may refer to a value ratio between the first reference value and the second reference value (e.g., the value ratio between the length of the line407and the length of the side403) to obtain the first rotation offset angle through calculation or by using a lookup table. Then, the processor13may correct the two-dimensional code40in the skewed state inFIG.4Eby using a rotation matrix corresponding to the first rotation offset angle.

Referring toFIG.4F, after correcting the two-dimensional code40in the skewed state as shown inFIG.4Ein accordance with the rotation matrix corresponding to the first rotation offset angle, the outer frame41of the two-dimensional code40, together with the two-dimensional code40itself (including the graphic encoded information410), may be restored to the default shape (i.e., regular hexagonal shape). Then, the processor13may perform the angle restoring operation on the two-dimensional code40that is still in the skewed state as shown inFIG.4F. For example, in the angle restoring operation, the processor13may obtain a rotation offset angle (i.e., the second rotation offset angle) of the two-dimensional code40relative to Z-axis (i.e., the second coordinate axis) in accordance with the position of the position mark42in the two-dimensional code40. For example, the processor13may adopt phase correlation to obtain the second rotation offset angle in accordance with the position of the position mark42in the two-dimensional code40. The second rotation offset angle may indicate the degrees by which the two-dimensional code40in the default shape that is a regular hexagonal shape as shown inFIG.4Ais rotated using Z-axis as the rotation axis in the three-dimensional space to rotate the position mark42in the two-dimensional code40to the position of the position mark42inFIG.4FThen, the processor13may correct (e.g., rotate) the two-dimensional code40in accordance with a rotation matrix corresponding to the second rotation offset angle to restore the position mark42to the default position inFIG.4A. It should be noted that the operation of restoring the position mark42to the default position may be equivalent to restoring (rotating, for example) the two-dimensional code40in the skewed state to the default angle state of the two-dimensional code40, as shown inFIG.4A. Then (or after restoration), the processor13as shown inFIG.1may analyze (e.g., decode) the graphic encoded information410carried or presented by the corrected two-dimensional code40and perform the default operation in accordance with the analysis result.

It should be noted that, in the above embodiments, a regular triangular shape and a regular hexagonal shape are respectively used as examples of the odd-numbered polygonal shape and the even-numbered polygonal shape. However, the disclosure is not limited thereto. In other embodiments, other types of odd-numbered polygonal shapes or even-numbered polygonal shapes may also be chosen as the default shape of the outer frame of the two-dimensional code. Besides, when other types of odd-numbered polygonal shapes or even-numbered polygonal shapes are adopted as the outer frame of the two-dimensional code, the two-dimensional code may also be corrected based on corresponding operational logics. Thus, details of relevant operations have been set forth above and will not be repeated in the following.

Referring toFIG.5, in Step S501, a two-dimensional code image is captured by using an image capturing device, and the two-dimensional code image presents a two-dimensional code in a skewed state. In Step S502, an outer frame and a position mark of the two-dimensional code in the skewed state in the two-dimensional code image are detected. In Step S503, the two-dimensional code in the skewed state is restored to a default state in accordance with the outer frame and the position mark. In Step S504, a default operation is performed in accordance with the two-dimensional code in the default state.

Details of the respective steps inFIG.5have been set forth above and therefore will not be repeated in the following. It should be noted that the respective steps inFIG.5may be implemented as multiple programming codes or circuits. The disclosure is not particularly limited in this regard. In addition, the method inFIG.5may be used together with the above embodiments or used alone. The disclosure is not particularly limited in this regard.

In view of the foregoing, even if the two-dimensional code captured by the user is in a skewed state, the two-dimensional code (including the graphic encoded information in the two-dimensional code) may also be restored to the default state by using the outer frame and the position mark that hardly take up any space of the code layout area inside the two-dimensional code. Then, the default operation may be performed automatically in accordance with the two-dimensional code (i.e., the graphic encoded information) in the default state. Compared with the conventional coding/decoding techniques for two-dimensional codes, the reading method and the reading device for the two-dimensional code according to the embodiments of the disclosure are capable of effectively facilitating the efficiency in using the two-dimensional code.

It will be apparent to those skilled in the art that various modifications and variations can be made to the disclosed embodiments without departing from the scope or spirit of the disclosure. In view of the foregoing, it is intended that the disclosure covers modifications and variations provided that they fall within the scope of the following claims and their equivalents.