Image matching method, device, computer equipment and medium

Through the image matching method of computational geometry, the translation and rotation points and the target rotation angle are used to solve the large error problem caused by the least squares method and achieve higher precision image matching.

CN115546151BActive Publication Date: 2025-09-23SHENZHEN LINGYUN VISION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211229034.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-09
Publication Date
2025-09-23
Estimated Expiration
2042-10-09

AI Technical Summary

Technical Problem

In the prior art, when determining the detection deviation of the object to be tested by the least square method, there is a problem of large error and possible matching failure.

Method used

An image matching method based on computational geometry is adopted. By obtaining the initial iterative data and performing translation and rotation, the target iterative data is determined using the rotation point and the target rotation angle, and the matching data is determined when the preset termination conditions are met.

Benefits of technology

The error between the measurement data and the template data is reduced, and the matching accuracy and efficiency are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115546151B_ABST
    Figure CN115546151B_ABST
Patent Text Reader

Abstract

The present application relates to the field of image processing technology, and more specifically, to an image matching method, apparatus, computer equipment, and medium, which can solve the problem of large detection errors of objects to be tested to a certain extent. By obtaining the initial iterative data of the object to be tested; and translating the initial iterative data through a translation vector, alternative iterative data can be determined, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is the data of the template image of the object to be tested; further, based on the rotation point and the target rotation angle, target iterative data can be determined; wherein the rotation point is determined based on the alternative iterative data and the template data, and the target rotation angle is determined based on the rotation point, the alternative iterative data, and the template data; when the target iterative data meets the preset termination condition, the matching data can be determined; the embodiment of the present application is based on the matching method of computational geometry to improve the error between the measurement data and the template data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image matching method, apparatus, computer equipment, and medium. Background Art

[0002] With the development of vision technology, it has become an important means to achieve industrial automation, intelligent control, and inspection. In visual inspection applications, the conformity of an object can be determined by matching the rigid body motion (also known as rigid body transformation) between the measured data and the template data.

[0003] In the implementation of some matching methods between the measurement data of the object to be measured and the template data (the template data is the data of the template image), the deviation between the measurement data of the object to be measured and the template data is mainly determined by the least squares method (that is, the minimum average deviation), and the size of the object to be measured is determined by the deviation.

[0004] However, determining the deviation by the least square method results in a large error in the detection of the object to be tested. Summary of the Invention

[0005] In order to solve the problem that the deviation determined by the least squares method leads to large detection errors of the object to be tested, the present application provides an image matching method, apparatus, computer equipment and medium.

[0006] The embodiment of the present application is implemented as follows:

[0007] A first aspect of the embodiments of the present application provides an image matching method, comprising the following steps:

[0008] Obtaining initial iterative data of the object to be measured, where the initial iterative data is determined by performing a rigid body transformation on the measured data of the object to be measured according to the least squares method;

[0009] translating the initial iterative data by a translation vector to determine candidate iterative data, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is data of a template image of the object to be measured;

[0010] Determining target iteration data based on a rotation point and a target rotation angle; wherein the rotation point is determined based on the candidate iteration data and the template data, and the target rotation angle is determined based on the rotation point, the candidate iteration data, and the template data;

[0011] When the target iteration data meets the preset termination condition, the matching data is determined.

[0012] In conjunction with the first aspect, in one possible implementation, the rotation point is determined based on the candidate iterative data and the template data, and the target rotation angle is determined based on the rotation point, the candidate iterative data, and the template data, including:

[0013] Determine an initial vector based on the alternative iteration data and the template data;

[0014] When the initial vector meets the preset modulus condition, the candidate vector is selected from the initial vector;

[0015] Based on the alternative vector, determine the rotation point;

[0016] A target rotation angle is determined based on the candidate iteration data, the template data, and the rotation point.

[0017] In conjunction with the first aspect, in a possible implementation, when the candidate vectors include a first vector, a second vector, and a third vector, determining the rotation point based on the candidate vectors includes:

[0018] When the first vector is equal to the inverse vector of the second vector, the rotation point is calculated as follows:

[0019]

[0020] Where R is the coordinate of the rotation point, P1 is the coordinate of the point corresponding to the first vector in the measurement data, and P2 is the coordinate of the point corresponding to the second vector in the measurement data;

[0021] When the first vector is greater than or less than the inverse vector of the second vector, the rotation point is calculated as follows:

[0022]

[0023]

[0024] Where, R=(R X , R Y ) are the coordinates of the rotation point, P1 = (u1, v1) are the coordinates of the point corresponding to the first vector in the measurement data, P2 = (u2, v2) are the coordinates of the point corresponding to the second vector in the measurement data, P3 = (u3, v3) are the coordinates of the point corresponding to the third vector in the measurement data, c k is the product of the alternative vector and the corresponding point of the alternative vector in the measurement data, that is, c k =Q k ·P k , k=1,2,3.

[0025] In conjunction with the first aspect, in one possible implementation, determining the target rotation angle based on the candidate iteration data, the template data, and the rotation point includes:

[0026] Determine reference data based on candidate iteration data, template data, measurement data, and rotation points;

[0027] Based on the reference data, determining that a maximum positive value in the reference data corresponds to a maximum value of the initial rotation angle, and determining that a minimum negative value in the reference data corresponds to a minimum value of the initial rotation angle;

[0028] The target rotation angle is determined according to whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet the preset judgment condition.

[0029] In conjunction with the first aspect, in one possible implementation, determining the target rotation angle based on whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet a preset judgment condition includes:

[0030] If the maximum value of the initial rotation angle and the minimum value of the initial rotation angle are equal and both are not zero, the target rotation angle is equal to the maximum value of the initial rotation angle;

[0031] If the maximum value of the initial rotation angle and the minimum value of the initial rotation angle are not equal and both are not zero, the target rotation angle is the angle corresponding to when the absolute value of the maximum positive value in the reference data is equal to the absolute value of the minimum negative value.

[0032] In conjunction with the first aspect, in a possible implementation, when the target iteration data satisfies a preset termination condition, determining matching data includes:

[0033] When the target iteration data satisfies the preset termination condition, a matching point set is determined, where the matching point set is composed of the target iteration data that satisfies the preset termination condition;

[0034] Select the minimum target iteration data from the matching point set as the target matching data.

[0035] In conjunction with the first aspect, in a possible implementation, the preset termination condition includes:

[0036] The maximum deviation between the template data and the target iteration data is less than the preset deviation;

[0037] The number of iterations of the target iteration data is greater than the preset number of iterations;

[0038] The deviation between two consecutive target iteration data is less than the preset minimum deviation value.

[0039] A second aspect of the embodiments of the present application provides an image matching device, including an acquisition module and an execution module;

[0040] An acquisition module is used to obtain initial iterative data of the object to be measured, where the initial iterative data is determined by performing a rigid body transformation on the measurement data of the object to be measured according to the least squares method;

[0041] an execution module, configured to translate the initial iterative data by a translation vector to determine candidate iterative data, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is data of a template image of the object to be measured;

[0042] The execution module is further configured to determine target iteration data based on a rotation point and a target rotation angle; wherein the rotation point is determined based on the candidate iteration data and the template data, and the target rotation angle is determined based on the rotation point, the candidate iteration data, and the template data;

[0043] The execution module is further used to determine the matching data when the target iteration data meets the preset termination condition.

[0044] A third aspect of an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the image matching method of the first aspect are implemented.

[0045] A fourth aspect of an embodiment of the present application provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes the steps of the image matching method of the first aspect.

[0046] The beneficial effects of the present application are as follows: by obtaining the initial iterative data of the object to be measured, the initial iterative data is determined after the rigid body transformation of the measurement data of the object to be measured according to the least squares method; and by translating the initial iterative data through the translation vector, the alternative iterative data can be determined, wherein the translation vector is determined based on the initial iterative data and the template data, and the template data is the data of the template image of the object to be measured; further, based on the rotation point and the target rotation angle, the target iterative data can be determined; wherein the rotation point is determined based on the alternative iterative data and the template data, and the target rotation angle is determined based on the rotation point, the alternative iterative data and the template data; when the target iterative data meets the preset termination condition, the matching data can be determined; the embodiment of the present application is based on the matching method of computational geometry, and the point pair deviation between the measurement data and the template data is smaller than the point pair deviation obtained by the least squares method, thereby improving the error between the measurement data and the template data. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0048] Figure 1A schematic diagram of the process of the image matching method according to an embodiment of the present application is shown;

[0049] Figure 2 A schematic diagram showing a process for determining a rotation point and a target rotation angle in an embodiment of the present application is shown;

[0050] Figure 3 A schematic diagram of a process for determining a target rotation angle in an embodiment of the present application is shown;

[0051] Figure 4 A schematic diagram of the process of determining matching data in an embodiment of the present application is shown;

[0052] Figure 5 A schematic flow chart of another image matching method according to an embodiment of the present application is shown;

[0053] Figure 6 A structural diagram of an image matching device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0054] In order to make the purpose, implementation mode and advantages of the present application clearer, the exemplary implementation mode of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, not all of the embodiments.

[0055] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.

[0056] In the specification and claims of this application and the accompanying drawings, the terms "first," "second," "third," etc. are used to distinguish similar or similar objects or entities, and are not necessarily intended to limit a particular order or sequence, unless otherwise noted. It should be understood that the terms used in this manner are interchangeable under appropriate circumstances.

[0057] The terms "comprise," "comprises," and "having," and any variations thereof, are intended to cover but not exclude inclusion; for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0058] In the field of visual images, taking 2D visual images as an example, the measurement data (the set of measurement points of the object to be measured obtained in real time) X = {X1, X2...X n} and template data (data point set of the template image of the object to be tested) Z = {Z1, Z2...Z nMatching alignment: By determining the deviation between the measurement data X and Z, it is determined whether the specifications and dimensions of the object to be measured (such as a part, etc.) are appropriate, or whether the specifications and dimensions of the object to be measured are close to the ideal measurement values ​​of the template data.

[0059] In the related art, the least squares method is mainly used to determine the deviation between the measurement data of the object to be measured and the template data, and to determine whether the specifications and dimensions of the object to be measured are appropriate through the deviation. When the average deviation is small, there may still be situations where the values ​​in some areas are too large, or the values ​​in some areas are too small. There may also be situations where the matching fails due to the non-orthogonality of the matrix calculated by the least squares method. Therefore, determining the deviation through the least squares method will result in a large error in the detection of the object to be measured.

[0060] To solve the above technical problems, the embodiments of the present application provide an image matching method, apparatus, computer equipment and medium, which obtains the initial iterative data of the object to be measured, which is determined by rigid body transformation of the measurement data of the object to be measured according to the least squares method; and translates the initial iterative data through a translation vector, so as to determine the alternative iterative data, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is the data of the template image of the object to be measured; further, based on the rotation point and the target rotation angle, the target iterative data can be determined; wherein the rotation point is determined based on the alternative iterative data and the template data, and the target rotation angle is determined based on the rotation point, the alternative iterative data and the template data; when the target iterative data meets the preset termination condition, the matching data can be determined. The embodiments of the present application are based on the method of computational geometry to reduce the error between the measurement data and the template data.

[0061] The following describes in detail an image matching method, apparatus, computer device, and medium according to an embodiment of the present application in conjunction with the accompanying drawings.

[0062] Figure 1 FIG. 1 shows a flow chart of the image matching method according to an embodiment of the present application. Figure 1 As shown, an embodiment of the present application provides an image matching method.

[0063] The image matching method comprises the following steps:

[0064] S110 , obtaining initial iterative data of the object to be measured, where the initial iterative data is determined by performing a rigid body transformation on the measurement data of the object to be measured according to the least square method.

[0065] The measurement data is obtained by collecting real-time image data of the object to be measured, and may include data sets of characteristic shapes such as S-shape, arc, and ellipse.

[0066] The measurement data of the object to be measured X={X1,X2…X nThrough rigid body transformation (rotation matrix and translation vector), the initial iterative data X of the object to be tested is obtained ori , initial iteration data X ori It can be calculated by the following formula:

[0067] X ori =R·X+T

[0068] Where X is the measurement data, R is the rotation matrix, and T is the translation vector.

[0069] S120 , translating the initial iterative data using a translation vector to determine candidate iterative data, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is data of a template image of the object to be measured.

[0070] The translation vector U is determined based on the initial iteration data and the template data. The translation vector U can be determined by the following methods, specifically including:

[0071] First, the first variable data is determined based on the initial iteration data and the template data. The first variable data M is calculated by the following formula:

[0072] M k ={Z k -X orik}, k = 1, 2…n

[0073] Where n is the number of points in the measured data, X orik is the point in the initial iteration data, Z k is the point in the template data, M k is the vector in the first variable data.

[0074] Secondly, through the vector M in the first variable data k The center of the minimum circumscribed circle of is used to determine the translation vector U.

[0075] Finally, the initial iterative data is translated by the translation vector U to determine the alternative iterative data X trans .

[0076] S130 . Determine target iteration data based on the rotation point and the target rotation angle, wherein the rotation point is determined based on the candidate iteration data and the template data, and the target rotation angle is determined based on the rotation point, the candidate iteration data, and the template data.

[0077] The second variable data is determined based on the alternative iterative data and the template data; the initial vectors in the second variable data can be sorted according to their moduli, and the sorting order can be from the largest to the smallest modulus, starting from the largest modulus, to determine A alternative vectors, where A is greater than or equal to 3; the rotation point is determined through the alternative vectors.

[0078] Reference data is also determined based on the alternative iteration data, template data, alternative vectors and rotation points, and the target rotation angle is determined through the reference data, wherein the reference data can be determined through a step function and have positive and negative variable data.

[0079] The candidate iteration data is rotated around the rotation point by the target rotation angle to obtain the target iteration data.

[0080] Figure 2 A schematic diagram of the process of determining the rotation point and the target rotation angle in an embodiment of the present application is shown as follows: Figure 2 As shown, the embodiment of the present application provides a method for determining a rotation point and a target rotation angle, including the following steps:

[0081] S301: Determine an initial vector based on candidate iteration data and template data.

[0082] According to the alternative iteration data and the template data, the second variable data is determined. The second variable data N is obtained by the following calculation:

[0083] N k ={Z k -X transk}, k = 1, 2…n

[0084] Where n is the number of points in the measured data, X transk is the point in the alternative iteration data, Z k is the point in the template data, N k is the vector in the first variable data.

[0085] It should be noted that the vector N in the first variable data k is the initial vector.

[0086] S302: When the initial vector meets the preset module length condition, select candidate vectors from the initial vector.

[0087] The modulus of each initial vector in the second variable data N is determined, and the moduli of the initial vectors are sorted, and A initial vectors with the largest moduli are selected as candidate vectors, where A is greater than or equal to 3.

[0088] S303: Determine a rotation point based on the candidate vector.

[0089] The rotation point is determined by taking the two largest vectors among the candidate vectors and all the candidate vectors.

[0090] When A is equal to 3, the alternative vector P i =(u i , v i ), where i = 1, 2, 3, and the candidate vector corresponds to the measurement data Xi .

[0091] That is, when the candidate vectors include the first vector, the second vector, and the third vector, and the first vector is greater than or equal to the second vector, and the second vector is greater than or equal to the third vector, determining the rotation point based on the candidate vectors includes the following steps:

[0092] When the first vector is equal to the inverse vector of the second vector, the rotation point is calculated as follows:

[0093]

[0094] Where R is the coordinate of the rotation point, P1 is the coordinate of the point corresponding to the first vector in the measurement data, and P2 is the coordinate of the point corresponding to the second vector in the measurement data;

[0095] When the first vector is greater than or less than the inverse vector of the second vector, the rotation point is calculated as follows:

[0096]

[0097]

[0098] Where, R=(R X , R Y ) are the coordinates of the rotation point, P1 = (u1, v1) are the coordinates of the point corresponding to the first vector in the measurement data, P2 = (u2, v2) are the coordinates of the point corresponding to the second vector in the measurement data, P3 = (u3, v3) are the coordinates of the point corresponding to the third vector in the measurement data, c i is the product of the alternative vector and the corresponding point of the alternative vector in the measurement data, that is, c i =X i ·P i , i=1,2,3.

[0099] In some embodiments, A may be equal to 4. In this case, the candidate vectors include a first vector, a second vector, a third vector, and a fourth vector, and the rotation point is determined by the candidate vectors.

[0100] like Figure 2 As shown, the method further includes: S304, determining a target rotation angle based on the candidate iteration data, the template data and the rotation point.

[0101] Reference data is determined based on the alternative iteration data, template data, alternative vectors and rotation points, and the target rotation angle is determined through the reference data, wherein the reference data can be determined through a step function and have positive and negative variable data.

[0102] Figure 3 FIG. 4 shows a flow chart of determining the target rotation angle in an embodiment of the present application. Figure 3 As shown, the target rotation angle determination provided by the embodiment of the present application includes the following steps:

[0103] S341. Determine reference data based on the candidate iteration data, template data, measurement data, and rotation point.

[0104] The variables consisting of the alternative iteration data, template data, measurement data and rotation points are processed by a step function to determine the reference data, reference data Q. The values ​​in the reference data Q can be obtained by the following calculation formula:

[0105] Q k =sgn(N k ·(X k -X r ))|N k |, N k ={Z k -X transk}, k = 1, 2…n

[0106] Where Q k are the values ​​in the reference data, N k According to the alternative iteration data X transk and template data Z k Determine the vector of data for the second variable, X r is the rotation point, X k is the point in the corresponding measurement data.

[0107] It should be noted that N is obtained by the step function k ·(X k -X r ) integer variable and get its positive and negative signs; that is, when N k ·(X k -X r ) is greater than zero, 1 is obtained through the step function; when N k ·(X k -X r ) is equal to zero, 0 is obtained through the step function; when N k ·(X k -X r ) is less than zero, -1 is obtained through the step function.

[0108] Among them, for the positive maximum value Q in the reference data max , the corresponding vector is N max , for the negative minimum value Q in the reference data min , the corresponding vector is N min .

[0109] S342: Based on the reference data, determine that the maximum positive value in the reference data corresponds to the maximum value of the initial rotation angle, and determine that the minimum negative value in the reference data corresponds to the minimum value of the initial rotation angle.

[0110] The maximum positive value Q in the reference data max , corresponding to the maximum value of the initial rotation angle θ max For X k -X r and Z k -X r Similarly, the minimum negative value Q in the reference data can be determined min The corresponding minimum value of the initial rotation angle θ min .

[0111] S343: Determine the target rotation angle according to whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet a preset judgment condition.

[0112] The target rotation angle is determined based on whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet a preset judgment condition, including:

[0113] If the maximum value of the initial rotation angle θ max is zero, and |Q max |>|Q min |, or, the minimum value of the initial rotation angle θ min is zero, and |Q max |<|Q min |, exit the judgment of the initial rotation angle. The initial angle at this time is the optimal configuration.

[0114] If the maximum value of the initial rotation angle θ max and the minimum value of the initial rotation angle θ min The target rotation angle is equal to the maximum value of the initial rotation angle, that is, θ = θ max .

[0115] If the maximum value of the initial rotation angle θ max and the minimum value of the initial rotation angle θ min The target rotation angle is the angle corresponding to the absolute value of the maximum positive value and the absolute value of the minimum negative value in the reference data are equal.

[0116] In some embodiments, it is assumed that |Q max |>|Q min |, if in θ max After rotation, we get |N max |<|N min |, then there exists a target rotation angle θ∈(0, θ max), so that |N max |=|N min |, in this case, the target rotation angle θ can be quickly found by bisection. Similarly, in |Q max |<|Q min |, then there exists a target rotation angle θ∈(0, θ min ), so that |N max |=|N min |; This application does not limit the method of searching and determining the target rotation angle θ in the above process.

[0117] like Figure 1 As shown, the method further includes: S140, when the target iteration data meets the preset termination condition, determining the matching data.

[0118] Figure 4 A schematic diagram of the process of determining matching data in an embodiment of the present application is shown. Figure 4 As shown, the matching data determination in the embodiment of the present application includes the following steps:

[0119] S401 : When the target iterative data satisfies a preset termination condition, a matching point set is determined, where the matching point set is composed of the target iterative data that satisfies the preset termination condition.

[0120] The preset termination conditions include:

[0121] The maximum deviation between the template data and the target iteration data is less than the preset deviation;

[0122] The number of iterations of the target iteration data is greater than the preset number of iterations;

[0123] The deviation between two consecutive target iteration data is less than a preset minimum deviation value, wherein the preset minimum deviation value is greater than zero.

[0124] In some embodiments, in the above-mentioned preset termination conditions, the preset number of iterations can be preset to be larger, and the preset minimum deviation value can be preset to be smaller.

[0125] The process of each target iteration data determination is as follows:

[0126] If the maximum deviation between the template data and the target iteration data is less than the preset deviation, the target iteration data is added to the matching point set. If the maximum deviation between the template data and the target iteration data is greater than or equal to the preset deviation, it is determined whether the number of iterations of the target iteration data is greater than the preset number of iterations.

[0127] If the number of iterations of the target iterative data is greater than the preset number of iterations, exit the loop; if the number of iterations of the target iterative data is less than or equal to the preset number of iterations, determine whether the deviation between two consecutive target iterative data is less than the preset minimum deviation value.

[0128] If the deviation between two consecutive target iteration data is less than the preset minimum deviation value, exit the loop; if the deviation between two consecutive target iteration data is greater than or equal to the preset minimum deviation value, replace the initial iteration data in step 120 with the target iteration data, and continue iterating.

[0129] like Figure 4 As shown, S402, select the smallest target iteration data from the matching point set as the target matching data.

[0130] The embodiment of the present application uses computational geometry to obtain a maximum value of the point pair deviation between the measurement data and the template data that is smaller than the point pair deviation obtained by the least squares method, and at the same time can improve the matching efficiency, that is, obtain the matching result through fewer iterations.

[0131] Figure 5 FIG. 1 is a flow chart diagram showing another image matching method according to an embodiment of the present application. Figure 5 As shown, the image matching method includes the following steps:

[0132] According to the least squares rigid body transformation between the measurement data and the module data, the measurement data is transformed into the initial iteration data; the translation vector is determined according to the initial iteration data and the module data, and the initial iteration data determines the alternative iteration data through the translation vector; three alternative vectors with the maximum module length and their corresponding three measurement points in the measurement data are obtained according to the alternative iteration data and the module data; it is determined whether the first vector and the second vector in the alternative vector are collinear and opposite in direction, if so, the first vector and the second vector determine the rotation point; if not, the product of the first vector, the second vector and the third vector and the alternative vector and the measurement point determines the rotation point; based on the alternative iteration data, the template data and the rotation point, the target rotation angle is determined; the alternative iteration data is rotated around the rotation point by the target rotation angle to obtain the target iteration data; it is determined whether the preset termination condition is met, that is, the maximum deviation between the template data and the target iteration data is less than the preset deviation preset; the number of iterations of the target iteration data is greater than the preset number of iterations; the deviation between two consecutive target iteration data is less than the preset minimum deviation value, if so, the matching data is output; if not, the target iteration data replaces the initial iteration data and the iteration continues.

[0133] The embodiment of the present application provides an image matching method, which obtains initial iterative data of the object to be measured, which is determined by rigid-body transformation of the measured data of the object to be measured according to the least squares method; and translates the initial iterative data through a translation vector, so as to determine alternative iterative data, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is the data of the template image of the object to be measured; further, based on the rotation point and the target rotation angle, it is possible to determine the target iterative data; wherein the rotation point is determined based on the alternative iterative data and the template data, and the target rotation angle is determined based on the rotation point, the alternative iterative data and the template data; when the target iterative data meets the preset termination condition, the matching data can be determined. The embodiment of the present application is based on a computational geometry method to reduce the error between the measured data and the template data.

[0134] Figure 6 FIG. 1 shows a schematic diagram of the structure of an image matching device according to an embodiment of the present application. Figure 6 As shown, the image matching device 600 includes an acquisition module 610 and an execution module 620 .

[0135] The acquisition module is used to obtain the initial iterative data of the object to be measured. The initial iterative data is determined by performing a rigid body transformation on the measurement data of the object to be measured according to the least square method.

[0136] An execution module is used to translate the initial iterative data through a translation vector to determine the alternative iterative data, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is the template data of the object to be measured; it is also used to determine the target iterative data based on the rotation point and the target rotation angle; wherein the rotation point is determined based on the alternative iterative data and the template data, and the target rotation angle is determined based on the rotation point, the alternative iterative data and the template data; it is also used to determine the matching data when the target iterative data meets the preset termination condition.

[0137] In some embodiments, the execution module includes a first submodule, which is used to determine the rotation point and the target rotation angle, specifically for:

[0138] Determine an initial vector based on the alternative iteration data and the template data;

[0139] When the initial vector meets the preset modulus condition, the candidate vector is selected from the initial vector;

[0140] Based on the alternative vector, determine the rotation point;

[0141] A target rotation angle is determined based on the candidate iteration data, the template data, and the rotation point.

[0142] In some embodiments, when the candidate vectors include a first vector, a second vector, and a third vector, the first submodule is configured to determine the rotation point based on the candidate vectors, specifically to:

[0143] When the first vector is equal to the inverse vector of the second vector, the rotation point is calculated as follows:

[0144]

[0145] Where R is the coordinate of the rotation point, P1 is the coordinate of the point corresponding to the first vector in the measurement data, and P2 is the coordinate of the point corresponding to the second vector in the measurement data;

[0146] When the first vector is greater than or less than the inverse vector of the second vector, the rotation point is calculated as follows:

[0147]

[0148]

[0149] Where, R=(R X , R Y ) are the coordinates of the rotation point, P1 = (u1, v1) are the coordinates of the point corresponding to the first vector in the measurement data, P2 = (u2, v2) are the coordinates of the point corresponding to the second vector in the measurement data, P3 = (u3, v3) are the coordinates of the point corresponding to the third vector in the measurement data, c k is the product of the alternative vector and the corresponding point of the alternative vector in the measurement data, that is, c k =Q k ·P k , k=1,2,3.

[0150] In some embodiments, the execution module includes a second submodule, which is configured to determine a target rotation angle based on the candidate iteration data, the template data, and the rotation point, specifically including:

[0151] Determine reference data based on candidate iteration data, template data, measurement data, and rotation points;

[0152] Based on the reference data, determining that a maximum positive value in the reference data corresponds to a maximum value of the initial rotation angle, and determining that a minimum negative value in the reference data corresponds to a minimum value of the initial rotation angle;

[0153] The target rotation angle is determined according to whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet the preset judgment condition.

[0154] In some embodiments, the second submodule is configured to determine the target rotation angle according to whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet a preset judgment condition, specifically including:

[0155] If the maximum value of the initial rotation angle and the minimum value of the initial rotation angle are equal and both are not zero, the target rotation angle is equal to the maximum value of the initial rotation angle;

[0156] If the maximum value of the initial rotation angle and the minimum value of the initial rotation angle are not equal and both are not zero, the target rotation angle is the angle corresponding to when the absolute value of the maximum positive value in the reference data is equal to the absolute value of the minimum negative value.

[0157] In some embodiments, the execution module includes a third submodule, which is configured to determine matching data when the target iteration data satisfies a preset termination condition, specifically including:

[0158] When the target iterative data satisfies a preset termination condition, a matching point set is determined. The matching point set is composed of the target iterative data that satisfies the preset termination condition. The preset termination condition includes:

[0159] The maximum deviation between the template data and the target iteration data is less than the preset deviation; the number of iterations of the target iteration data is greater than the preset number of iterations; the deviation between two consecutive target iteration data is less than the preset minimum deviation value.

[0160] Select the minimum target iteration data from the matching point set as the target matching data.

[0161] An embodiment of the present application provides an image matching device, including an acquisition module and an execution module. By acquiring the initial iterative data of the object to be measured, the initial iterative data is determined after the measurement data of the object to be measured is rigidly transformed according to the least squares method; and by translating the initial iterative data through a translation vector, alternative iterative data can be determined, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is the data of the template image of the object to be measured; further, based on the rotation point and the target rotation angle, target iterative data can be determined; wherein the rotation point is determined based on the alternative iterative data and the template data, and the target rotation angle is determined based on the rotation point, the alternative iterative data and the template data; when the target iterative data meets the preset termination condition, matching data can be determined. The embodiment of the present application is based on the method of computational geometry to reduce the error between the measurement data and the template data.

[0162] The computer device also provided in the embodiment of the present application includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program. The computer program is used to implement the above-mentioned image matching method. The implementation principle and technical effects are similar to those of the above-mentioned method embodiment and will not be repeated here.

[0163] An embodiment of the present application also provides a computer storage medium, on which a computer program is stored. The computer program is used by a processor to execute the above-mentioned image matching method. Its implementation principle and technical effects are similar to those of the above-mentioned method embodiment and will not be repeated here.

[0164] The following paragraphs will compare and list the Chinese terms involved in this application specification and their corresponding English terms to facilitate reading and understanding.

[0165] For ease of explanation, the above description has been made in conjunction with specific embodiments. However, the above discussion of some embodiments is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are intended to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.

Claims

1. An image matching method, characterized in that: include: Acquiring initial iterative data of the object to be measured, wherein the initial iterative data is determined by performing a rigid body transformation on the measurement data of the object to be measured according to the least squares method; translating the initial iterative data by a translation vector to determine alternative iterative data, wherein the translation vector is determined based on the initial iterative data and template data, and the template data is data of a template image of the object to be measured; Determining an initial vector according to the candidate iteration data and the template data; When the initial vector meets the preset modulus condition, selecting a candidate vector from the initial vector; Determining a rotation point based on the candidate vector; When the candidate vectors include a first vector, a second vector, and a third vector, the rotation point is determined based on the candidate vectors. When the first vector is equal to the inverse vector of the second vector, the rotation point is calculated according to the following formula: Wherein, R is the coordinate of the rotation point, P1 is the coordinate of the point corresponding to the first vector in the measurement data, and P2 is the coordinate of the point corresponding to the second vector in the measurement data; When the first vector is greater than or less than the inverse vector of the second vector, the rotation point is calculated according to the following formula: Where, R=(R X , R Y ) are the coordinates of the rotation point, P1 = (u1, v1) are the coordinates of the point corresponding to the first vector in the measurement data, P2 = (u2, v2) are the coordinates of the point corresponding to the second vector in the measurement data, P3 = (u3, v3) are the coordinates of the point corresponding to the third vector in the measurement data, c k is the product of the candidate vector and the corresponding point of the candidate vector in the measurement data, that is, c k =Q k ·P k , k=1,2,3; determining a target rotation angle based on the candidate iteration data, the template data, and the rotation point; Determining target iteration data based on a rotation point and a target rotation angle; wherein the rotation point is determined based on the candidate iteration data and the template data, and the target rotation angle is determined based on the rotation point, the candidate iteration data, and the template data; When the target iteration data meets a preset termination condition, matching data is determined.

2. The image matching method according to claim 1, wherein: The determining of the target rotation angle based on the candidate iteration data, the template data and the rotation point includes: determining reference data based on the candidate iteration data, the template data, the measurement data, and the rotation point; Based on the reference data, determining that a maximum positive value in the reference data corresponds to a maximum value of the initial rotation angle, and determining that a minimum negative value in the reference data corresponds to a minimum value of the initial rotation angle; The target rotation angle is determined according to whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet a preset judgment condition.

3. The image matching method according to claim 2, characterized in that: The determining of the target rotation angle according to whether the maximum value of the initial rotation angle and / or the minimum value of the initial rotation angle meet a preset judgment condition includes: If the maximum value of the initial rotation angle and the minimum value of the initial rotation angle are equal and both are not zero, the target rotation angle is equal to the maximum value of the initial rotation angle; If the maximum value of the initial rotation angle and the minimum value of the initial rotation angle are not equal and are both non-zero, the target rotation angle is the angle corresponding to when the absolute value of the positive maximum value in the reference data is equal to the absolute value of the negative minimum value.

4. The image matching method according to claim 1, wherein: When the target iteration data meets a preset termination condition, determining matching data includes: When the target iterative data satisfies a preset termination condition, determining a matching point set, wherein the matching point set is composed of the target iterative data that satisfies the preset termination condition; The smallest target iteration data is selected from the matching point set as target matching data.

5. The image matching method according to claim 4, characterized in that: The preset termination conditions include: The maximum deviation between the template data and the target iteration data is less than a preset deviation; The number of iterations of the target iteration data is greater than the preset number of iterations; The deviation between two consecutive target iteration data is less than the preset minimum deviation value.

6. An image matching device, characterized in that: include: An acquisition module, configured to acquire initial iterative data of the object to be measured, wherein the initial iterative data is determined by performing a rigid body transformation on the measurement data of the object to be measured according to a least squares method; an execution module, configured to translate the initial iterative data by a translation vector to determine alternative iterative data, wherein the translation vector is determined based on the initial iterative data and template data, the template data being template data of the object under test; and determine an initial vector based on the alternative iterative data and the template data; When the initial vector meets the preset modulus condition, selecting a candidate vector from the initial vector; Determining a rotation point based on the candidate vector; When the candidate vectors include a first vector, a second vector, and a third vector, the rotation point is determined based on the candidate vectors. When the first vector is equal to the inverse vector of the second vector, the rotation point is calculated according to the following formula: Wherein, R is the coordinate of the rotation point, P1 is the coordinate of the point corresponding to the first vector in the measurement data, and P2 is the coordinate of the point corresponding to the second vector in the measurement data; When the first vector is greater than or less than the inverse vector of the second vector, the rotation point is calculated according to the following formula: Where, R=(R X , R Y ) are the coordinates of the rotation point, P1 = (u1, v1) are the coordinates of the point corresponding to the first vector in the measurement data, P2 = (u2, v2) are the coordinates of the point corresponding to the second vector in the measurement data, P3 = (u3, v3) are the coordinates of the point corresponding to the third vector in the measurement data, c k is the product of the candidate vector and the corresponding point of the candidate vector in the measurement data, that is, c k =Q k ·P k , k=1,2,3; determining a target rotation angle based on the candidate iteration data, the template data, and the rotation point; The execution module is further configured to determine target iteration data based on a rotation point and a target rotation angle; wherein the rotation point is determined based on the candidate iteration data and the template data, and the target rotation angle is determined based on the rotation point, the candidate iteration data, and the template data; The execution module is further configured to determine matching data when the target iteration data meets a preset termination condition.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the image matching method according to any one of claims 1 to 5 are implemented.

8. A computer storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the steps of the image matching method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Steel structure deformation detection method and device, computer equipment and storage medium

    CN114841965A