Image processing method and device

By acquiring the feature points, non-feature points, and edge line information of the geometric image code, the transformation matrix is ​​determined for correction, which solves the problem of low correction efficiency of geometric image codes in the prior art and achieves efficient correction and decoding.

CN120912484APending Publication Date: 2025-11-07HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510407439.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Existing technologies are inefficient in processing distorted geometric image codes, making it difficult to correct and decode them efficiently, especially in complex scenarios where the correction efficiency is low.

Method used

By acquiring feature points, non-feature points, and edge line information on the geometric image code, the transformation matrix is ​​determined for correction. More information is used to improve the accuracy of the transformation matrix, including identifying the nested contour area relationship of the position detection graphic and correcting the graphic, and selecting an appropriate number of feature points to reduce complexity.

Benefits of technology

It improves the correction and decoding efficiency of geometric image codes, shortens the correction delay, and enhances the decoding capability of geometric image codes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120912484A_ABST
    Figure CN120912484A_ABST
Patent Text Reader

Abstract

According to the image processing method and device, in the method, a first device can determine a transformation matrix used for correcting a first geometric image code according to coordinates of N feature points on the first geometric image code, coordinates of at least one non-feature point, coordinates of the N feature points in a standard code and edge line information, the information for determining the transformation matrix not only comprises the information of the N feature points, but also comprises the information of the at least one non-feature point and the edge line, that is to say, the transformation matrix can be determined by using more information on the first geometric image code, so that the accuracy of determining the transformation matrix can be improved, and the correction efficiency can be improved, for example, the correction efficiency is improved. The correction effect can be improved, and the correction time delay is shortened. Furthermore, the correction effect of the transformation matrix is better, so that the corrected geometric image code is easier to decode, namely, the decoding efficiency of the first geometric image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to a method and device for correcting a two-dimensional code. BACKGROUND

[0002] With the rapid development of information technology, geometric image codes such as two-dimensional codes and three-dimensional codes are increasingly widely used in daily life, business, logistics, finance and other fields as an important information carrier. In various applications, the above-mentioned geometric image codes usually need to be captured and decoded in order to extract the information contained therein. However, as application scenarios become increasingly diverse, the acquisition environment of geometric image codes has become more complex. In many practical scenarios, geometric image codes are printed or pasted on the surface of distorted objects such as curved surfaces and twisted surfaces, or are deformed by wrinkling of flexible attachments, and these distortions can cause geometric image codes to deform or distort. In order to efficiently decode geometric image codes, it is necessary to correct these geometric image codes first.

[0003] Although there are some methods for correcting geometric image codes at present, these methods still have problems such as low efficiency. SUMMARY

[0004] The present application provides a method and device for image processing, which can improve the correction efficiency of geometric image codes.

[0005] In a first aspect, a method for image processing is provided, which can be executed by a first device, and the method comprises: acquiring a first geometric image code to be processed; determining coordinates of N feature points on the first geometric image code, coordinates of at least one non-feature point, coordinates of the N feature points in a standard code, and edge line information corresponding to the first geometric image code, N being an integer greater than or equal to 2; determining a transformation matrix according to the coordinates of the N feature points, the coordinates of the at least one non-feature point, the coordinates of the N feature points in the standard code, and the edge line information; and correcting the first geometric image code based on the transformation matrix.

[0006] Based on the above-mentioned scheme, the first device can determine a transformation matrix for correcting the first geometric image code according to the coordinates of the N feature points on the first geometric image code, the coordinates of the at least one non-feature point, the coordinates of the N feature points in the standard code, and the edge line information. Since the information used to determine the transformation matrix includes not only the information of the N feature points, but also the information of the at least one non-feature point and the edge line, that is, more information on the first geometric image code can be used to determine the transformation matrix, the accuracy of determining the transformation matrix can be improved, thereby improving the correction efficiency, for example, the correction effect can be improved, and the correction latency can be shortened.

[0007] Further, since the correction effect of the transformation matrix is better, the corrected geometric image code is easier to be decoded, that is, the decoding efficiency of the first geometric image is improved.

[0008] Exemplarily, the first geometric image code is a quick response (QR) code or a three-dimensional code generated based on the QR code.

[0009] In combination with the first aspect, in some implementations, determining the N feature points on the first geometric image code comprises: identifying a feature pattern on the first geometric image code; identifying the feature points on the first geometric image code according to the feature pattern; and determining the N feature points from the identified feature points according to version information of the first geometric image code.

[0010] Based on the above scheme, since different versions of geometric image codes have different characteristics, selecting the corresponding feature points based on the version of the geometric image code can maximize the use of information in each version of the geometric image code, and has higher recognition efficiency.

[0011] In combination with the first aspect, in some implementations, the feature pattern comprises a position detection pattern (PDP), and identifying the feature pattern on the first geometric image code comprises: identifying a first type of nested contour on the first geometric image code, the first type of nested contour comprising an inner contour, an outer contour and a middle contour; and determining whether the first type of nested contour is a position detection pattern according to a relationship between an area of the inner contour, an area of the outer contour and an area of the middle contour in the first type of nested contour.

[0012] Based on the above scheme, the first device can identify the PDP based on the area relationship of the nested contour on the first geometric image code. In the case where the first geometric image code is distorted, although different contours may be distorted, the area changes of different contours are basically similar, so the PDP can still be accurately identified through the relationship between the proportions of the areas of the nested contours, thereby improving the efficiency of geometric image code identification.

[0013] Exemplarily, determining whether the first type of nested contour is a position detection pattern according to a relationship between an area of the inner contour, an area of the outer contour and an area of the middle contour in the first type of nested contour comprises: in a case where a difference between a proportion between the area of the inner contour in the first type of nested contour and the area of the outer contour in the first type of nested contour and (3 / 7) is less than or equal to a first threshold value, and a difference between a proportion between the area of the middle contour in the first type of nested contour and the area of the outer contour in the first type of nested contour and (5 / 7) is less than or equal to a second threshold value, determining that the first type of nested contour is a position detection pattern. 2 2 ​​

[0014] In some implementations of the first aspect, the feature pattern includes an alignment pattern (AP), and identifying the feature pattern on the first geometric image code includes: identifying a second type of nested contour on the first geometric image code, the second type of nested contour including an inner contour and an outer contour; and determining whether the second type of nested contour is the AP based on a relationship between an area of the inner contour and an area of the outer contour.

[0015] Based on the above scheme, the first device can identify the AP based on the area relationship of the nested contours on the first geometric image code. In the case of distortion of the first geometric image code, although different contours may be distorted, the changes in the areas of different contours are basically similar, so the AP can still be accurately identified by the relationship between the proportions of the areas of the nested contours, thereby improving the efficiency of geometric image code identification.

[0016] Illustratively, determining whether the second type of nested contour is the AP based on a relationship between an area of the inner contour and an area of the outer contour includes: in a case where a difference between a proportion between the area of the inner contour and the area of the outer contour in the second type of nested contour and 1 / 9 is less than a third threshold value, determining that the second type of nested contour is the AP.

[0017] In some implementations of the first aspect, the N feature points are determined from the identified feature points based on version information of the first geometric image code, including: in a case where a version number of the first geometric image code is 1, the N feature points include all corner points of a position detection pattern, wherein the feature pattern includes the position detection pattern; or in a case where the version number of the first geometric image code is any one of 2-6, the N feature points include all corner points of the position detection pattern and all corner points of an alignment pattern, wherein the feature pattern includes the position detection pattern and the alignment pattern; or in a case where the version number of the first geometric image code is any one of 7-40, the N feature points include all corner points of the position detection pattern and a center point of the alignment pattern, wherein the feature pattern includes the position detection pattern and the alignment pattern.

[0018] Based on the above scheme, in the case of a smaller version number, the points on the first geometric image code are also fewer, so all corner points of the position detection pattern or the position detection pattern and the alignment pattern can be selected as feature points. In the case of a larger version number, the points on the first geometric image code are also more, so all corner points of the position detection pattern and the center point of the alignment pattern can be selected as feature points. In this way, an appropriate number of feature points can be selected, and the complexity and latency of correction can be reduced.

[0019] In some implementations of the first aspect, the at least one non-feature point and the N feature points are uniformly distributed on the first geometric image code.

[0020] Based on the above scheme, the first device can determine the coordinates of the non-feature points based on the coordinates of the feature points, and the at least one non-feature point and the N feature points are almost uniformly distributed on the first geometric image code. In this way, more uniformly distributed point information can be used in the process of determining the transformation matrix, that is, the known information on the first geometric image code is maximized, thereby improving the accuracy of the obtained transformation matrix.

[0021] In some implementations of the first aspect, determining the edge line information includes: determining Q feature points on the first geometric image code, at least one of the Q feature points is not collinear with the feature points other than the at least one feature point, Q is an integer greater than or equal to 4; performing perspective transformation on the first geometric image code according to the coordinates of the Q feature points to obtain a second geometric image code; and determining the edge line information as at least one line segment of the edge lines of the second geometric image code.

[0022] Based on the above scheme, the first geometric image code can be preliminarily corrected by perspective transformation, and then the edge lines are selected. In this way, more regular edge lines can be selected, so that the selected edge lines can meet the requirement of horizontal and vertical as much as possible, thereby improving the accuracy of determining the transformation matrix.

[0023] In the second aspect, a device for image processing is provided. The device can be the first device. The device includes: an acquisition module configured to acquire a first geometric image code to be processed; a determination module configured to determine coordinates of N feature points on the first geometric image code, coordinates of at least one non-feature point, coordinates of the N feature points in a standard code, and edge line information corresponding to the first geometric image code, N being an integer greater than or equal to 2; the determination module is further configured to determine a transformation matrix based on the coordinates of the N feature points, the coordinates of the at least one non-feature point, the coordinates of the N feature points in the standard code, and the edge line information; and a correction module configured to correct the first geometric image code based on the transformation matrix.

[0024] In some implementations of the second aspect, the determination module is specifically configured to: identify a feature pattern on the first geometric image code; identify feature points on the first geometric image code based on the feature pattern; and determine the N feature points from the identified feature points based on version information of the first geometric image code.

[0025] With reference to the second aspect, in some implementations, the feature pattern includes a position detection pattern, and the determining module is specifically configured to: identify a first type of nested contour on the first geometric image code, the first type of nested contour including one inner contour, one outer contour, and one intermediate contour; and determine whether the first type of nested contour is the position detection pattern according to a relationship between an area of the inner contour, an area of the outer contour, and an area of the intermediate contour in the first type of nested contour.

[0026] For example, the determining module is specifically configured to: in a case where a difference between a ratio between the area of the inner contour in the first type of nested contour and the area of the outer contour in the first type of nested contour and (3 / 7) is less than or equal to a first threshold value, and a difference between a ratio between the area of the intermediate contour in the first type of nested contour and the area of the outer contour in the first type of nested contour and (5 / 7) is less than or equal to a second threshold value, determine that the first type of nested contour is the position detection pattern. 2 2 For example, the determining module is specifically configured to: in a case where a difference between a ratio between the area of the inner contour in the second type of nested contour and the area of the outer contour in the second type of nested contour and 1 / 9 is less than a third threshold value, determine that the second type of nested contour is the correction pattern.

[0027] With reference to the second aspect, in some implementations, the feature pattern includes a correction pattern, and the determining module is specifically configured to: identify a second type of nested contour on the first geometric image code, the second type of nested contour including one inner contour and one outer contour; and determine whether the second type of nested contour is the correction pattern according to a relationship between an area of the inner contour and an area of the outer contour in the second type of nested contour.

[0028] For example, the determining module is specifically configured to: in a case where a difference between a ratio between the area of the inner contour in the second type of nested contour and the area of the outer contour in the second type of nested contour and 1 / 9 is less than a third threshold value, determine that the second type of nested contour is the correction pattern.

[0029] With reference to the second aspect, in some implementations, the determining module is specifically configured to: in a case where a version number of the first geometric image code is 1, the N feature points include all corner points of the position detection pattern, wherein the feature pattern includes the position detection pattern; or in a case where the version number of the first geometric image code is any one of 2-6, the N feature points include all corner points of the position detection pattern and all corner points of the correction pattern, wherein the feature pattern includes the position detection pattern and the correction pattern; or in a case where the version number of the first geometric image code is any one of 7-40, the N feature points include all corner points of the position detection pattern and a center point of the correction pattern, wherein the feature pattern includes the position detection pattern and the correction pattern.

[0030] With reference to the second aspect, in some implementations, the at least one non-feature point and the N feature points are uniformly distributed on the first geometric image code.

[0031] ​In some implementations, the determining module is specifically configured to: determine Q feature points on the first geometric image code, at least one of the Q feature points is not collinear with the feature points other than the at least one feature point, Q is an integer greater than or equal to 4; perform perspective transformation on the first geometric image code according to the coordinates of the Q feature points to obtain a second geometric image code; and determine the edge line information as at least one line segment of an edge line of the second geometric image code.

[0032] In a third aspect, an apparatus for image processing is provided. The apparatus includes at least one processor configured to execute computer programs or instructions stored in a memory to perform the method provided in any of the above aspects or implementations thereof.

[0033] In one implementation, the apparatus is a physical device. In another implementation, the apparatus is a chip, a chip system, or a circuit, etc. used in the physical device.

[0034] Optionally, the apparatus can further include the above-mentioned memory for storing the computer programs or instructions.

[0035] Optionally, the apparatus can further include a communication interface.

[0036] In a fourth aspect, a processor is provided for performing the method provided in the above aspects.

[0037] For the sending and obtaining / receiving operations of the processor, if there is no special description, or if it does not contradict the actual role or inherent logic in the related description, it can be understood as the processor output and receive, input, etc. operations, or it can be understood as the sending and receiving operations performed by the radio frequency circuit and the antenna, which are not limited by the present application.

[0038] In a fifth aspect, a computer readable storage medium is provided. The computer readable medium stores program codes for execution by a device. The program codes include codes for performing the method provided in any of the above aspects or implementations thereof.

[0039] In a sixth aspect, a computer program product including instructions is provided. When the instructions in the computer program product are run on a computer, the computer is caused to perform the method provided in any of the above aspects or implementations thereof.

[0040] In a seventh aspect, a chip is provided. The chip includes a processor and a communication interface. The processor reads instructions stored on a memory through the communication interface and performs the method provided in any of the above aspects or implementations thereof. The communication interface can be implemented by hardware or software.

[0041] Optionally, as an implementation form, the chip further comprises a memory, and the memory stores a computer program or instructions, and the processor is configured to execute the computer program or instructions stored in the memory, and when the computer program or instructions are executed, the processor is configured to execute the method provided in any one of the aspects or the implementation forms thereof.

[0042] When the method provided in the application is executed by a chip, the application does not limit the number of chips that implement the method of the application, for example, the method can be executed by one chip, or two or more chips. Moreover, when the number of chips that implement the method of the application is two or more, the chips are not limited to the same manufacturer, and can be different manufacturers.

[0043] In an eighth aspect, a computer program is provided, which, when executed on a computer, causes the method provided in any one of the aspects or the implementation forms thereof to be executed.

[0044] It should be understood that the detailed description and beneficial effects of the second aspect to the eighth aspect and any implementation form thereof can be referred to the first aspect and any implementation form thereof. BRIEF DESCRIPTION OF DRAWINGS

[0045] Figure 1 FIG. 1 is a schematic diagram of a system architecture 100 suitable for an embodiment of the application.

[0046] Figure 2 FIG. 2 is a flowchart of an image processing method 200 provided by the application.

[0047] Figure 3 FIG. 3 is a structural diagram of a position detection pattern and a correction pattern provided by the application.

[0048] Figure 4 FIG. 4 is a schematic diagram of a selection result of a feature point provided by the application.

[0049] Figure 5 FIG. 5 is a schematic diagram of a distribution manner of a position detection pattern in a two-dimensional code provided by the application.

[0050] Figure 6 FIG. 6 is a schematic diagram of feature points and non-feature points of different versions of two-dimensional codes provided by the application.

[0051] Figure 7 FIG. 7 is a schematic diagram of an image processing method provided by the application.

[0052] Figure 8 FIG. 8 shows a processing process of different versions of two-dimensional codes.

[0053] Figure 9 FIG. 9 shows a two-dimensional code image corrected using different kernel functions.

[0054] Figure 10 is a schematic block diagram of an apparatus 900 for image processing provided by the present application.

[0055] Figure 11 is a structural schematic diagram of an apparatus 1000 for image processing provided by an embodiment of the present application. DETAILED DESCRIPTION

[0056] The technical solutions in the present application will be described below with reference to the drawings.

[0057] With the rapid development of information technology, geometric image codes such as two-dimensional codes and three-dimensional codes, as an important information carrier, are increasingly widely used in daily life, business, logistics, finance and other fields. Geometric image codes not only can efficiently store and transmit a large amount of information, but also have the advantages of low cost and simple operation, and are widely used in retail payment, commodity traceability, advertising and other scenarios. In various applications, geometric image codes usually need to be captured and decoded to extract the information contained therein. However, as the application scenarios of geometric image codes become increasingly diverse, the acquisition environment of geometric image codes becomes more complex. In many actual scenarios, geometric image codes are printed or pasted on the surface of distorted objects such as curved surfaces and twisted surfaces, or are deformed by wrinkling of flexible attachments, and these distortions can cause geometric image codes to deform or distort, thereby reducing the decoding rate of geometric image codes. In order to efficiently decode geometric image codes, it is necessary to correct these distorted geometric image codes first.

[0058] Although there are some methods for correcting geometric image codes at present, these methods still have problems such as high processing complexity, insufficient accuracy or low efficiency, especially when geometric image codes are subjected to multiple complex distortions, the correction efficiency is relatively low.

[0059] Therefore, the present application provides a method and apparatus for image processing, which can improve the correction efficiency of geometric image codes.

[0060] In the present application, the geometric image code refers to a graphic code with a fixed feature pattern and feature structure, which can also be referred to as an image symbol code, a matrix code, etc., and specifically, the geometric image code can be a two-dimensional code, a three-dimensional code, etc. Among them, the two-dimensional code refers to a pattern obtained by encoding through black and white module distribution on a two-dimensional plane (i.e., length and width), such as a QR code, a data matrix code, an Aztec code, a portable data file (PDF) 417, etc., and the three-dimensional code refers to a code that adds color or gray as a third dimension on the basis of a two-dimensional code, which can also be referred to as a color code, a visual identification code, etc., such as a three-dimensional code that can be formed by adding color on the basis of any two-dimensional code such as a QR code, a data matrix code, an Aztec code, a PDF 417, etc. The geometric image code listed in the drawings in the present application is a QR code in a two-dimensional code, but the application scenarios of the present application are not limited thereto.

[0061] Figure 1 is a schematic diagram of a system architecture 100 suitable for embodiments of the present application. As shown in Figure 1 , the system architecture 100 can include an image acquisition device 110 and an image processing device 120, the image acquisition device 110 is used to acquire a to-be-processed image 1101 to be identified and input the to-be-processed image 1101 to the image processing device 120. The image acquisition device 110 can be any device with an image shooting or acquisition function, such as a camera, a video camera, a camera, a scanner, a mobile phone, a tablet computer, or a code scanner, etc., which is used to shoot or acquire the to-be-processed image 1101. The image acquisition device 110 can also be a device with a data storage function, and the to-be-processed image 1101 is stored in the device. The type of the image acquisition device 110 is not limited in the present application. For the processing method of the geometric image code in embodiments of the present application, the to-be-processed image 1101 can be an image including a geometric image code, such as a two-dimensional code, a three-dimensional code, etc. The image processing device 120 is used to identify the to-be-processed image 1101. The image processing device 120 can be any device with an image processing function, such as a computer, a smart phone, a workstation, or other devices with a central processing unit, and can also be a chip, a circuit, etc. The type of the image processing device 120 is not limited in the present application.

[0062] In some embodiments, the above-mentioned image acquisition device 110 can be the same device as the above-mentioned image processing device 120. For example, the image acquisition device 110 and the image processing device 120 are both smart phones, or both are code scanners.

[0063] In some other embodiments, the image acquisition device 110 and the image processing device 120 can be different devices. For example, the image acquisition device 110 can be a terminal device, and the image processing device 120 can be a computer, a workstation, or the like. The image acquisition device 110 can interact with the image processing device 120 through a communication network in any communication mechanism / standard, which can be a wide area network, a local area network, a point-to-point connection, or the like, or any combination thereof.

[0064] Figure 2 is a flowchart of a method 200 of image processing provided by the present application, as shown in Figure 2 The method 200 includes the following steps.

[0065] S210, a first device acquires a first geometric image code to be processed.

[0066] The first device can be the image processing device 120 shown in Figure 1

[0067] Exemplarily, the first geometric image code can be a two-dimensional code or a three-dimensional code, for example, a QR code or a three-dimensional code formed based on a QR code, etc. Optionally, the first geometric image code has a deformation such as a wrinkle or a distortion.

[0068] Specifically, acquiring the first geometric image code to be processed can mean that the first device acquires the first geometric image code, or that the first device pre-processes the acquired image to obtain the first geometric image code to be processed.

[0069] Exemplarily, the pre-processing can be a grayscale processing or a binary processing, etc.

[0070] S220, the first device determines coordinates of N feature points on the first geometric image code, coordinates of at least one non-feature point, coordinates of the N feature points in a standard code, and edge line information corresponding to the first geometric image code, N being an integer greater than or equal to 2.

[0071] The feature points can be points with unique geometric shapes and positions in the first geometric image code, such as corner points, center points, etc.

[0072] The non-feature point is calculated based on the feature points, and can be a point on the first geometric image code or a point not on the first geometric image code.

[0073] The standard code refers to a standard geometric image code, the pattern characteristics of which are predefined, and the coordinates of each point are also predefined. Through the coordinates of the standard points, the first geometric image code can be quickly recognized and positioned.

[0074] ​The edge line information corresponding to the first geometric image code refers to information of an edge line extracted after a certain transformation is performed on the first geometric image, for example, a line segment of the edge line, a point on the edge line, and the like.

[0075] Specifically, S220 can include S221-S224.

[0076] S221, the first device determines coordinates of N feature points on the first geometric image code.

[0077] S222, the first device determines coordinates of at least one non-feature point according to the coordinates of the N feature points.

[0078] S223, the first device determines coordinates of the N feature points in a standard code.

[0079] S224, the first device determines edge line information corresponding to the first geometric image code.

[0080] S230, the first device determines a transformation matrix according to the coordinates of the N feature points, the coordinates of the at least one non-feature point, the coordinates of the N feature points in the standard code, and the edge line information.

[0081] Specifically, the first device can determine the transformation matrix according to the above-mentioned various information, which can be used to correct the distorted first geometric image code.

[0082] S240, the first device corrects the first geometric image code based on the transformation matrix.

[0083] Based on the above scheme, the first device can determine a transformation matrix for correcting the first geometric image code according to the coordinates of the N feature points on the first geometric image code, the coordinates of the at least one non-feature point, the coordinates of the N feature points in the standard code, and the edge line information. Since the information for determining the transformation matrix includes not only the information of the N feature points, but also the information of the at least one non-feature point and the edge line, that is, more information on the first geometric image code can be used to determine the transformation matrix, thereby improving the accuracy of determining the transformation matrix, and thus improving the correction efficiency, for example, improving the correction effect and shortening the correction latency.

[0084] Further, since the correction effect of the transformation matrix is better, the corrected geometric image code is easier to be decoded, that is, the decoding efficiency of the first geometric image is improved.

[0085] Optionally, after S240, the method 200 further includes S250, the first device decodes the corrected first geometric image code.

[0086] Specifically, after the correction, the first device can decode and extract valid information of the corrected first geometric image code. The specific decoding manner is not limited in the present application.

[0087] The determination manner of the transformation matrix will be described in detail below taking the first geometric image code as a QR code or a three-dimensional code formed based on the QR code as an example.

[0088] S221, the first device determines the coordinates of the N feature points on the first geometric image code, which specifically can include that the first device first identifies a feature pattern on the first geometric image code, and then identifies the feature points on the first geometric image code according to the feature pattern, for example, the feature points can include the corner points of the first geometric image code, the corner points of the feature pattern on the first geometric image code, the center points of the feature pattern on the first geometric image code, etc. Further, the first device can select N feature points from the identified feature points.

[0089] When the first geometric image code is a QR code or a three-dimensional code formed based on the QR code, the first geometric image code includes a feature pattern, which can be a PDP or a PDP and an AP.

[0090] Specifically, the PDP can also be referred to as a positioning pattern or a detection pattern, etc., which is an important positioning pattern in the geometric image code and can be used to mark the version of the geometric image code and help the scanning device determine the position and direction of the geometric image code. No matter how the geometric image code is rotated or deformed, the pattern acquisition device can quickly locate through the PDP. On a standard geometric image code, there are 3 PDPs, which are located at the upper left corner, the upper right corner and the lower left corner of the geometric image code respectively. Each PDP is composed of three nested squares, as shown in (a) of FIG. 1. Figure 3 The three squares are square ABCD, square EFGH and square IJKL. Among them, the corner points of the PDP can refer to points A, B, C and D.

[0091] The AP can also be referred to as a calibration pattern, which can be used to correct the deformation and distortion of the geometric image code that may occur in the scanning process, to ensure that the scanning device can accurately read the data. Each AP is also composed of three nested squares, similar to (a) of FIG. 1, but in actual application, the outermost square of the AP will be fused with other geometric patterns on the encoded geometric image code and cannot be identified, and generally only two squares of the AP can be identified, as shown in (b) of FIG. 1. Figure 3 The two squares that can be identified are square ABCD and square EFGH. Among them, the corner points of the AP can refer to points A, B, C and D. Figure 3

[0092] ​It should be understood that when the geometric image code is a QR code or a three-dimensional code formed based on a QR code, the number of APs included in each geometric image code and the positions of the APs are determined according to the version of the geometric image code. At present, for a QR code, the international organization for standardization / international electrotechnical commission (ISO / IEC) 18004 standard currently provides 40 versions, with version numbers from 1 to 40, and as the version number increases, the matrix size of the two-dimensional code also increases accordingly, thereby improving its storage capacity. Among them, the two-dimensional code with a version number of 2 and above has APs, and the two-dimensional code with a version number of 1 does not have APs. In this application, other geometric image codes such as three-dimensional codes can also be generated based on this standard, at this time, the three-dimensional code can also include 40 versions, among them, the three-dimensional code with a version number of 2 and above has APs, and the three-dimensional code with a version number of 1 does not have APs.

[0093] In addition, when the first geometric image code is a QR code, the standard geometric image code refers to the standard geometric image code corresponding to the QR code, and when the first geometric image code is a three-dimensional code formed based on a QR code, the standard geometric image code refers to the standard geometric image code corresponding to the three-dimensional code.

[0094] As an example, the first device can determine N feature points from the identified feature points according to the version information of the first geometric image code. In other words, when the version number of the first geometric image code is determined, the N feature points will be determined accordingly, or in other words, once the version number is determined, the corresponding feature points can be automatically selected.

[0095] For example, in the case where the version number of the first geometric image code is 1, the feature pattern only includes PDPs, and the N feature points include all the corner points of each PDP.

[0096] For example, in the case where the version number of the first geometric image code is 1, the feature pattern only includes PDPs, and the N feature points include all the corner points of each PDP.

[0097] For example, in the case where the version number of the first geometric image code is 1, the feature pattern only includes PDPs, and the N feature points include all the corner points of each PDP.

[0098] It should be understood that the N feature points can include the corner points of the first geometric image code in addition to the points in the feature pattern, wherein the corner points of the first geometric image code refer to the corner points of the four corners of the first geometric image code, and the corner points of the first geometric image code and the corner points of the PDP can have the same points, for example, 3 of the corner points of the four corners of the first geometric image code are the corner points of the PDP.

[0099] Based on the above scheme, since different versions of the geometric image code have different characteristics, the corresponding feature points are selected based on the version of the geometric image code, the information in each version of the geometric image code can be maximized, and the recognition efficiency is higher.

[0100] Figure 4 The feature points corresponding to different versions of the two-dimensional code are shown, wherein the points marked in orange are feature points, such as Figure 4 As shown in (a) of FIG. 1, for the two-dimensional code with version number 1, the selected feature points include all the corner points of the 3 PDP and the corner point of the two-dimensional code (i.e., the point of the upper right corner of the two-dimensional code in (a) of FIG. 1). Figure 4 As shown in (b) of FIG. 1, for the two-dimensional code with version number 2, the selected feature points include all the corner points of the 3 PDP, all the corner points of the 1 AP, and the corner point of the two-dimensional code (i.e., the point of the lower right corner of the two-dimensional code in (b) of FIG. 1). Figure 4 As shown in (c) of FIG. 1, for the two-dimensional code with version number 9, the selected feature points include all the corner points of the 3 PDP, the center points of the 6 APs, and the corner point of the two-dimensional code (i.e., the point of the lower right corner of the two-dimensional code in (c) of FIG. 1). Figure 4 Figure 4 Figure 3

[0101] Exemplarily, the first device identifies the PDP on the first geometric image code, which can be achieved by the following mode 1-1 or mode 1-2.

[0102] Mode 1-1: The first device identifies the first type of nested contour on the first geometric image code, the first type of nested contour includes an inner contour, an outer contour, and a middle contour, further, the first device can determine whether the first type of nested contour is a PDP according to the relationship between the area of the inner contour in the first type of nested contour, the area of the outer contour in the first type of nested contour, and the area of the middle contour in the first type of nested contour. For example, in the case that the difference between the ratio between the area of the inner contour in the first type of nested contour and the area of the outer contour in the first type of nested contour and (3 / 7) 2 The difference between the ratio between the area of the middle contour in the first type of nested contour and the area of the outer contour in the first type of nested contour and (5 / 7) 2 is less than or equal to a second threshold value, it is determined that the first type of nested contour is a PDP. Otherwise, the first type of nested contour is not a PDP.​​​

[0103] Figure 3 (a) is an example of the first type of nested contour, where square ABCD is the outer contour, square EFGH is the middle contour, and square IJKL is the inner contour. In standard geometric image codes, the ratio between the area of ​​the inner contour and the area of ​​the outer contour of the PDP is (3 / 7). 2 The ratio between the area of ​​the middle contour and the area of ​​the outer contour is (5 / 7). 2 .

[0104] The first threshold can be understood as the maximum value of the error range supported by the first device, and its value can be a predefined value. Similarly, the second threshold can also be understood as the maximum value of the error range supported by the first device, and its value can be a predefined value. In this application, by introducing the first threshold and the second threshold, a certain error capacity can be set for the first device, indicating that when the ratio between the area of ​​the inner contour and the area of ​​the outer contour in the first type of nested contour is close to (3 / 7). 2 The ratio between the area of ​​the middle contour and the area of ​​the outer contour is approximately (5 / 7). 2 When the first nested contour is determined to be a PDP, then the first type of nested contour can be identified. Optionally, the first threshold and the second threshold can be the same or different, without restriction.

[0105] Based on the above scheme, the first device can identify the PDP based on the area relationship of the nested contours on the first geometric image code. When the first geometric image code is distorted, although different contours may be distorted, the changes in the area of ​​different contours are basically similar. Therefore, the PDP can still be accurately identified by the relationship between the proportions of the areas of the nested contours, thereby improving the efficiency of geometric image code recognition.

[0106] Method 1-2: The first device identifies a first type of nested contour on the first geometric image code. The first type of nested contour includes an inner contour, an outer contour, and a middle contour. Further, the first device can determine whether the first type of nested contour is a PDP based on the relationship between the side lengths of the inner contour, the outer contour, and the middle contour. For example, when the side lengths of the inner contour, the middle contour, and the outer contour are close to 3:5:7, or when the ratio of the straight lines containing the inner contour, the middle contour, and the outer contour in the horizontal or vertical direction is close to 1:1:3:1:1, the first type of nested contour can be determined to be a PDP. Conversely, the first type of nested contour is not a PDP.

[0107] Continue with Figure 3 Taking (a) as an example, in a standard geometric image code, the proportions of the contours of the PDP along the horizontal or vertical direction are 1:1:3:1:1, and the ratio of the side lengths of the contours is 3:5:7.

[0108] Exemplarily, the first device identifies the AP on the first geometric image code, which can be implemented by the following manner 2-1 or manner 2-2.

[0109] Manner 2-1: The first device identifies a second type of nested contour on the first geometric image code, the second type of nested contour including an inner contour and an outer contour. Further, the first device can determine whether the second type of nested contour is the AP according to a relationship between an area of the inner contour and an area of the outer contour in the second type of nested contour. For example, in a case that a difference between a ratio between the area of the inner contour in the second type of nested contour and the area of the outer contour in the second type of nested contour and 1 / 9 is less than a third threshold value, it is determined that the second type of nested contour is the AP. Otherwise, the second type of nested contour is not the AP.

[0110] Figure 3 (b) of FIG. 1 is an example of the second type of nested contour, where the square ABCD is the outer contour and the square EFGH is the inner contour. On a standard geometric image code, a ratio between the area of the inner contour of the AP and the area of the outer contour is 1 / 9.

[0111] Based on the above scheme, the first device can identify the AP based on the area relationship of the nested contour on the first geometric image code. In a case that the first geometric image code is distorted, although different contours can be distorted, the area of different contours changes basically similarly, and thus the AP can still be accurately identified through the relationship between the ratio of the areas of the nested contours, thereby improving the efficiency of the geometric image code identification.

[0112] Manner 2-2: The first device identifies a second type of nested contour on the first geometric image code, the second type of nested contour including an inner contour and an outer contour. Further, the first device can determine whether the second type of nested contour is the AP according to a relationship between a side length of the inner contour and a side length of the outer contour in the second type of nested contour. For example, when a difference between the side length of the inner contour in the second type of nested contour and the side length of the outer contour in the second type of nested contour is close to 1 / 3 and is less than a third threshold value, or when a ratio of the inner contour and the outer contour in the horizontal direction or the vertical direction is close to 1:1:1, it is determined that the second type of nested contour is the AP. Otherwise, the second type of nested contour is not the AP.

[0113] Continuing to take (b) of FIG. 1 as an example, on a standard geometric image code, the ratio between the contours along the horizontal direction or the vertical direction is 1:1:1, where the ratio of the side lengths of the contours is 1:3. Figure 5

[0114] ​Optionally, in this application, the outer contour can also be referred to as the minimum "parent" contour, and the inner contour can also be referred to as the minimum "child" contour.

[0115] Optionally, before identifying the first type of nested contour and the second type of nested contour on the first geometric image code, the first device can first find the contours of the geometric image code (such as a QR code), remove duplicate or abnormal contours, for example, the contours can be found by using the open computer vision (OpenCV) library, it is detected whether the contour is close to a square, and the enclosing rectangle feature provided by the OpenCV library is used to strengthen the detection, or the contours can be found and detected by other ways, which are not limited. For each contour, find its minimum "parent" contour, that is, the outer contour, further, for the first type of nested contour, it can also be checked whether there are two internal contours in the contour, and for the second type of nested contour, it can also be checked whether there is 1 internal contour in the contour.

[0116] In addition, when identifying the first type of nested contour and the second type of nested contour on the first geometric image code, the non-corner regions on the first geometric image code can be identified. Specifically, the AP is located in the regions other than the corners on the geometric image code, so the information of the AP can be obtained by identifying these regions.

[0117] In an implementation manner, the first device can also determine the version of the first geometric image code according to the corner points of the PDP on the first geometric image code. The following describes an example in which the first geometric image code is a two-dimensional code. Figure 5

[0118] Figure 5 is a schematic diagram of a two-dimensional code provided by the present application, as shown in Figure 6 The version of the two-dimensional code can be determined by the distances AC, BD, AD, BC between the corner points A, B of the PDP in the upper left corner and the corner points C, D of the PDP in the lower left corner. Specifically:

[0119] The cross ratio can be calculated first, denoted as (ABCD) or γ, that is:

[0120] Then the parameter x is obtained,

[0121] Then the version number v is obtained, Wherein, the round(·) function represents rounding.

[0122] ​S222, the first device determines the coordinates of at least one non-feature point based on the coordinates of N feature points. This may include the first device calculating the coordinates of at least one non-feature point from the coordinates of the N feature points according to the principle of uniform distribution. In other words, the at least one non-feature point and the N feature points are almost uniformly distributed on the first geometric image code.

[0123] Optionally, the first device determines the coordinates of at least one non-feature point based on the coordinates of the N feature points. This can refer to using the coordinates of each of the N feature points, or it can refer to using the coordinates of some of the N feature points, without limitation.

[0124] For example, the first device can select multiple feature points close to the center point of the first geometric image code from among N feature points, and average the x and y coordinates of these feature points to obtain the coordinates of a non-feature point. Alternatively, the first device can select three feature points close to the center point of the first geometric image code from among the corner points of the PDP, as well as the corner points of the first geometric image code, and average the x and y coordinates of these four feature points to obtain the coordinates of another non-feature point. Or, the first device can average the x and y coordinates of N feature points to obtain the coordinates of yet another non-feature point. Here, a non-feature point can be a point on the first geometric image code, or a point not belonging to the first geometric image code; it can be located in a patterned position on the first geometric image code, or in a blank position.

[0125] Figure 6 The methods for determining feature points in different versions of QR codes are shown, such as Figure 6 As shown in (a), for a QR code with version number 1, non-feature points can be the four corner points of the QR code (such as...). Figure 6 The coordinates of points 1, 2, 3, and 4 shown in (a) are averaged to obtain the feature points. Among them, feature points 1, 2, 3, and 4 are corner points of the QR code and also some corner points of the PDP.

[0126] like Figure 6 As shown in (b), for QR codes with version numbers 2-6, the non-feature points include points 14, 15, 16, 17, and 18. Point 14 is obtained by averaging the coordinates of feature points 1, 6, 12, and 13; point 15 is obtained by averaging the coordinates of feature points 2, 3, 5, and 8; point 16 is obtained by averaging the coordinates of feature points 3, 4, 9, and 10; point 17 is obtained by averaging the coordinates of feature points 12 and 13; and point 18 is obtained by averaging the coordinates of feature points 6 and 13. Among these, feature points 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12 are PDP corner points, and feature points 1, 6, 12, and 13 are QR code corner points.

[0127] like Figure 6For the two-dimensional code with the version number being 7-13, the non-feature points include points 8, 9, 10 and 11, wherein the point 8 is obtained by averaging the coordinates of the feature points 1 and 2; the point 9 is obtained by averaging the coordinates of the feature points 3 and 4; the point 11 is obtained by averaging the coordinates of the feature points 5 and 6; and the point 10 is obtained by averaging the coordinates of the feature points 6 and 7.

[0128] It should be understood that, Figure 7 The non-feature points shown are only examples, and the number of the non-feature points is not limited in the present application. Other feature points can also be used to determine the non-feature points.

[0129] In addition, Figure 7 The middle gray part can be any pattern, depending on the encoding result and / or the version of the two-dimensional code, etc.

[0130] Based on the above scheme, the first device can determine the coordinates of the non-feature points based on the coordinates of the feature points, and at least one non-feature point and the N feature points are almost uniformly distributed on the first geometric image code. In this way, more uniformly distributed point information can be used in the process of determining the transformation matrix, that is, the known information on the first geometric image code is maximized, so that the accuracy of the obtained transformation matrix can be improved.

[0131] S223, the first device determines the coordinates of the N feature points in the standard code.

[0132] It should be understood that after the version of the geometric image code is determined, the standard code corresponding to the geometric image code will also be determined. Since the coordinates of the corner points in the standard code, the coordinates of the corner points of the PDP, the coordinates of the corner points of the AP, etc. are all predefined, therefore, through a one-to-one correspondence, the coordinates of each of the N feature points in the standard code can be found.

[0133] S224, the first device determines the edge line information corresponding to the first geometric image code, which can specifically include that the first device first determines Q feature points on the first geometric image code, and further, the first device can perform perspective transformation on the first geometric image code according to the coordinates of the Q feature points to obtain a second geometric image code, and then determine the edge line information as at least one line segment of the edge lines of the second geometric image code.

[0134] The Q feature points are Q points not on a same straight line, that is, at least one feature point in the Q feature points is not collinear with the feature points other than the at least one feature point, and Q is an integer greater than or equal to 4.

[0135] Specifically, the first device can select at least 4 points from the feature points identified on the first geometric image code, perform a perspective transformation based on the at least 4 points, and select an edge line in the second geometric image code after the perspective transformation. Wherein, the perspective transformation can convert the image from one perspective to another, so as to realize the functions of image correction, splicing, virtual projection, etc., therefore, through the perspective transformation, the first geometric image code can be preliminarily corrected, and then the edge line is selected, so that the selected edge line can be relatively regular, and the selected edge line can meet the requirement of horizontal and vertical as much as possible, so as to improve the accuracy of determining the transformation matrix.

[0136] It should be understood that the Q feature points and the N feature points are both determined from the identified feature points, and the Q feature points and the N feature points can partially coincide, can be completely the same, or can be completely different, and are not limited.

[0137] For example, taking a two-dimensional code as an example, the coordinates of the standard code are assumed to be a linear combination of high-dimensional coordinates, and the coordinates can be expressed in the following form:

[0138]

[0139] Wherein, u and v refer to the coordinates of each point in the standard two-dimensional code, [w] refers to the weight, i.e. the transformation matrix, w 11 ...w 1m represents the weight of the standard two-dimensional code on the x-axis, w 21 ...w 2m represents the weight of the standard two-dimensional code on the y-axis, and m represents the dimension, i.e. the total number of selected feature points and non-feature points. refers to the high-dimensional coordinates, i.e. the coordinate values of the standard two-dimensional code in the first to m-th dimensions.

[0140] Wherein, the high-dimensional coordinates can be obtained by calculating the kernel function from the original two-dimensional coordinates, and at this time, the above formula (1) can be expanded and expressed in the following form:

[0141]

[0142] Wherein, x and y represent the horizontal coordinate and the vertical coordinate of a point on the distorted two-dimensional code (i.e. an example of the first geometric image code), u(x, y) represents the horizontal coordinate of the point (x, y) on the distorted two-dimensional code in the standard two-dimensional code, and v(x, y) represents the vertical coordinate of the point (x, y) on the distorted two-dimensional code in the standard two-dimensional code. X represents a vector, which refers to the point (x, y), and Xi represents the coordinates (x i ,y i ) of the feature points.‖X–X i ‖ represents the Euclidean distance of (x, y) to the point Xi, represents a kernel function.

[0143] The constraint condition 1 and the constraint condition 2 are added, and the matrix [w] can be solved.

[0144] wherein the constraint condition 1 is that the distance from u(x i ,y i ) on the distorted two-dimensional code to u i on the standard two-dimensional code is minimum. That is:

[0145]

[0146] wherein n represents the total number of feature points.

[0147] The constraint condition 2 is that the edge line segment satisfies the condition of horizontal and vertical, that is, the horizontal coordinate difference of the vertical line segment in the edge line segment is minimum, and the vertical coordinate difference of the horizontal line segment in the edge line segment is minimum:

[0148]

[0149] wherein u(x k1 ,y k1 ) and u(x k2 ,y k2 ) respectively represent two end points of the kth vertical line segment, v(x k3 ,y k3 ) and u(x k4 ,y k4 ) respectively represent two end points of the kth horizontal line segment, p represents the number of vertical edge line segments, and q represents the number of horizontal edge line segments.

[0150] Exemplarily, in the above process, the kernel function may be a Gaussian, a thin-plate spline, a cubic or other kernel function, without limitation. The thin-plate spline can be represented as The Gaussian can be represented as The cubic can be represented as wherein d represents the Euclidean distance between the sample point and the feature point, and σ represents the width of the Gaussian and the decay speed of the approximation degree.

[0151] In addition, the above process takes the kernel ridge regression as an example to solve the transformation matrix, but the present application is not limited thereto.

[0152] The method 200 will be further described below in combination with Figure 7 FIG. 1. Figure 7The processing procedure of the first geometric image code, taking a two-dimensional code as an example, can include the following steps.

[0153] S1, the first device pre-processes the distorted two-dimensional code image, for example, performs gray-scale processing to obtain a gray-scale image, or performs binaryzation processing to obtain a binaryzation image.

[0154] S2, the first device extracts feature points and non-feature points. Specifically, the first device can identify the PDP and AP of the two-dimensional code, and calculate the version of the two-dimensional code through the corner points of the PDP, and select the corresponding feature points according to the version number. For example, Figure 7 As shown in (b) and (c) of FIG. 1, all the corner points extracted are feature points. Then, the positions of the corresponding non-feature points are calculated according to the version number of the two-dimensional code.

[0155] The specific process of S2 can refer to S221-S222 above.

[0156] S3, the first device performs perspective transformation on the two-dimensional code through the four corner points (which can also be said to be the corner points of three PDPs and one corner point of the two-dimensional code) of the two-dimensional code, to obtain Figure 7 the image shown in (b) and (c) of FIG. 1.

[0157] S4, the first device extracts all the edge lines, and classifies the edge lines into two groups, horizontal and vertical, according to the gradient of the edge lines.

[0158] The specific process of S3 and S4 can refer to S224 above.

[0159] S5, the first device finds the coordinates of the standard two-dimensional code corresponding to the feature points, and further, according to the coordinates of the feature points, non-feature points, standard points, and each edge line, a transformation matrix is obtained. Further, through the transformation matrix, the first device aligns the distorted two-dimensional code to the standard two-dimensional code.

[0160] The specific process of S5 can refer to S223, S230 and S240 above.

[0161] S6, the first device decodes the corrected two-dimensional code.

[0162] Figure 7 (b) of FIG. 1 takes a gray-scale image as an example, and shows the images obtained by the above steps S1-S7, Figure 7 (c) of FIG. 1 takes a binaryzation image as an example, and shows the information obtained by the above steps S1-S7, wherein, in Figure 8 (b) of FIG. 1, the distortion type is wrinkle deformation, and in Figure 4 (c) of FIG. 1, the distortion type is curved surface deformation. By Figure 8It can be seen from (b) and (c) that the scheme of the present application has good correction ability for different types of images and different distortion types.

[0163] Figure 9 On the basis of Figure 9 , the images of the corrected two-dimensional codes with version numbers 1, 4 and 9 are respectively shown, according to Figure 9 It can be seen that the present application can select different feature points for different versions of two-dimensional codes. However, even if the feature points and non-feature points selected on different versions of two-dimensional codes are different, the correction effect of the present application is still very stable.

[0164] Figure 9 The two-dimensional code images corrected using different kernel functions are shown in Figure 10 (a) of shows the images of a two-dimensional code of a gray image corrected using a thin plate spline kernel and a Gaussian kernel, Figure 10 (b) of shows the images of another two-dimensional code of a gray image corrected using a thin plate spline kernel and a Gaussian kernel, and Figure 2 It can be seen that the method of the present application can obtain good correction effect by selecting different kernel functions.

[0165] The method embodiments of the embodiments of the present application are described in detail above, and the device embodiments of the embodiments of the present application are described below. The device embodiments and the method embodiments correspond to each other, and thus the parts not described in detail in the device embodiments can be referred to the method embodiments described above.

[0166] Figure 11 is a schematic block diagram of the device 900 for image processing provided by the present application, as Figure 11 shown, the device 900 includes an acquisition module 910, a determination module 920 and a correction module 930, wherein the acquisition module 910 is configured to acquire a first geometric image code to be processed; the determination module 920 is configured to determine the coordinates of N feature points on the first geometric image code, the coordinates of at least one non-feature point, the coordinates of the N feature points in a standard code and edge line information corresponding to the first geometric image code, N being an integer greater than or equal to 2; the determination module 920 is further configured to determine a transformation matrix according to the coordinates of the N feature points, the coordinates of the at least one non-feature point, the coordinates of the N feature points in the standard code and the edge line information; and the correction module 930 is configured to perform a correction transformation on the first geometric image code based on the transformation matrix.

[0167] For more detailed descriptions of the acquisition module 910, the determination module 920 and the correction module 930, reference can be made to the related descriptions in the method embodiments shown in Figure 2 .

[0168] ​This is a schematic diagram of the structure of the image processing apparatus 1000 provided in the embodiments of this application, as shown below. ​ As shown, the device 1000 includes a processor 1010. Optionally, the device 1000 may also include an interface circuit 1020, with the processor 1010 and the interface circuit 1020 coupled to each other. It is understood that the interface circuit 1020 may be a transceiver or an input / output interface. Optionally, the device 1000 may also include a memory 1030 for storing instructions executed by the processor 1010, or storing input data required by the processor 1010 to execute instructions, or storing data generated after the processor 1010 executes instructions. Sometimes, the interface circuit 1020 may also be understood as part of the processor 1010, in which case the device 1000 includes the processor 1010.

[0169] When device 1000 is used to achieve ​ In the method shown, the processor 1010 is used to implement the functions of the acquisition module 910, the determination module 920 and the correction module 930 described above.

[0170] It is understood that the processor in the embodiments of this application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.

[0171] The method steps in the embodiments of this application can be implemented in hardware or in software instructions executable by a processor. The software instructions can consist of corresponding software modules, which can be stored in random access memory, flash memory, read-only memory, programmable read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. The storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a base station or terminal. The processor and storage medium can also exist as discrete components in a base station or terminal.

[0172] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer programs or instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments are performed. The computer can be a general purpose computer, a special purpose computer, a computer network, a network device, a user equipment or other programmable apparatus. The computer programs or instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer programs or instructions can be transferred from one website site, computer, server or data center to another website site, computer, server or data center through wired or wireless manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center and the like integrated with one or more available media. The available media can be a magnetic medium, such as a floppy disk, a hard disk, a magnetic tape; or an optical medium, such as a digital video disc; or a semiconductor medium, such as a solid state disk. The computer readable storage medium can be a volatile or non-volatile storage medium, or can include both volatile and non-volatile storage media.

[0173] In various embodiments of the present application, the terms and / or descriptions between different embodiments are consistent and can be referred to each other if there is no special description and logical conflict, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship.

[0174] In the present application, "at least one" means one or more, and "multiple" means two or more. The "and / or" describes the association relationship between the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the following cases: A exists alone, A and B exist together, B exists alone, where A and B can be singular or plural. In the literal description of the present application, the character " / ", generally represents that the front and rear associated objects are in an "or" relationship. "Including at least one of A, B and C" can mean: including A; including B; including C; including A and B; including A and C; including B and C; including A, B and C.

[0175] It should be understood that in various embodiments of the present application, the first, second and various numerical designations are only for the convenience of differentiation and do not limit the scope of the embodiments of the present application. The size of the serial number of the above processes does not mean the order of execution, and the execution order of the processes should be determined by their functions and inherent logic.

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

[0177] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

[0178] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the above-described device embodiments are merely schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or connection between the units or components shown or discussed can be indirect coupling or connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

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

[0180] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0181] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0182] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of image processing, characterized by, The method comprises: acquiring a first geometric image code to be processed; determining coordinates of N feature points on the first geometric image code, coordinates of at least one non-feature point, coordinates of the N feature points in a standard code, and edge line information corresponding to the first geometric image code, N being an integer greater than or equal to 2; determining a transformation matrix according to the coordinates of the N feature points, the coordinates of the at least one non-feature point, the coordinates of the N feature points in the standard code, and the edge line information; correcting the first geometric image code based on the transformation matrix.

2. The method of claim 1, wherein, The method of determining the N feature points on the first geometric image code comprises: identifying a feature pattern on the first geometric image code; identifying feature points on the first geometric image code according to the feature pattern; determining the N feature points from the identified feature points according to version information of the first geometric image code.

3. The method of claim 2, wherein, The feature pattern comprises a position detection pattern, and the method of identifying the feature pattern on the first geometric image code comprises: identifying a first type of nested contour on the first geometric image code, the first type of nested contour comprising an inner contour, an outer contour, and a middle contour; determining whether the first type of nested contour is the position detection pattern according to a relationship between an area of the inner contour, an area of the outer contour, and an area of the middle contour in the first type of nested contour.

4. The method of claim 3, wherein, The method of determining whether the first type of nested contour is the position detection pattern according to a relationship between an area of the inner contour, an area of the outer contour, and an area of the middle contour in the first type of nested contour comprises: a difference between a ratio of an area of the inner contour in the first type of nested contours and an area of the outer contour in the first type of nested contours and (3 / 7) 2 a difference between a ratio of an area of the intermediate contour in the first type of nested contours and an area of the outer contour in the first type of nested contours and (5 / 7) 2 the first type of nested contours is determined as the position detection pattern.

5. The method according to any one of claims 2 to 4, characterized in that, The feature pattern comprises a correction pattern, and the method of identifying the feature pattern on the first geometric image code comprises: identifying a second type of nested contour on the first geometric image code, the second type of nested contour comprising an inner contour and an outer contour; determining whether the second type of nested contour is the correction pattern according to a relationship between an area of the inner contour and an area of the outer contour in the second type of nested contour.

6. The method of claim 5, wherein, The method of determining whether the second type of nested contour is the correction pattern according to a relationship between an area of the inner contour and an area of the outer contour in the second type of nested contour comprises: in a case where a difference between a ratio between the area of the inner contour in the second type of nested contour and the area of the outer contour in the second type of nested contour and 1 / 9 is less than a third threshold value, determining that the second type of nested contour is the correction pattern.

7. The method according to any one of claims 2 to 6, characterized in that, The method of determining the N feature points from the identified feature points according to version information of the first geometric image code comprises: in a case where a version number of the first geometric image code is 1, the N feature points comprise all corner points of a position detection pattern, wherein the feature pattern comprises the position detection pattern; or in a case where the version number of the first geometric image code is any one of 2-6, the N feature points comprise all corner points of the position detection pattern and all corner points of a correction pattern, wherein the feature pattern comprises the position detection pattern and the correction pattern; or In a case where the version number of the first geometric image code is any one of 7-40, the N feature points include all corner points of a position detection pattern and a center point of a correction pattern, wherein the feature pattern includes the position detection pattern and the correction pattern.

8. The method according to any one of claims 1 to 7, characterized in that, The at least one non-feature point and the N feature points are uniformly distributed on the first geometric image code.

9. The method according to any one of claims 1 to 8, characterized in that, The edge line information is determined, including: Q feature points on the first geometric image code are determined, at least one of the Q feature points is not collinear with the feature points other than the at least one feature point, and Q is an integer greater than or equal to 4; A second geometric image code is obtained by performing perspective transformation on the first geometric image code according to the coordinates of the Q feature points; The edge line information is determined as at least one line segment of the edge lines of the second geometric image code.

10. An apparatus for image processing, characterized by Including: A unit or module for performing the method as claimed in any one of claims 1 to 9.

11. An apparatus for image processing, characterized by Including: A processor coupled with the memory, the memory being configured to store a computer program, and the processor being configured to execute the computer program stored in the memory to cause the apparatus to perform the method as claimed in any one of claims 1 to 9.

12. The apparatus of claim 11, wherein, The apparatus further includes the memory.

13. A computer-readable storage medium, characterized in that, The storage medium has stored therein a computer program or instructions, which, when executed by an image processing apparatus, implement the method as claimed in any one of claims 1 to 9.

14. A computer program product, characterised in that, Including a computer program, which, when executed, implements the method as claimed in any one of claims 1 to 9.