A coordinate system transformation method and storage medium

Through a multi-step coordinate system transformation method, nonlinear optimization is performed using the Jacobian form of 3D-3D, 2D-3D, 3D-2D, and 2D-2D correlations, which solves the problem of low coordinate system transformation accuracy in the existing technology. problem, achieving higher accuracy and information utilization.

CN117455968BActive Publication Date: 2024-10-22PLAY FOR DREAM (SHANGHAI) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311529777.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-16
Publication Date
2024-10-22
Estimated Expiration
2043-11-16

AI Technical Summary

Technical Problem

The coordinate system transformation accuracy of the existing relocation technology is low and cannot achieve the optimal result under the current total amount of information. This is mainly because the PNP algorithm only considers a small number of interior point matching pairs, ignores the information of multiple camera frames, and uses vision. The correlation is mainly in the form of 2D-3D, failing to fully utilize 3D-3D, 3D-2D, and 2D-2D information.

Method used

A coordinate system transformation method is proposed, including data preparation, search, pose calculation, initial value acquisition, projection matching, interior point set calculation, optimal solution calculation, difference statistics and judgment steps, through multiple projection matching and iterative optimization , using the Jacobian form of 3D-3D, 2D-3D, 3D-2D, and 2D-2D correlations to perform nonlinear optimization and make full use of all visual correlation information.

Benefits of technology

The accuracy of the coordinate system transformation is improved to achieve the optimal result under the current total amount of information. Through multiple searches and optimizations, all available information is used to improve the calculation accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117455968B_ABST
    Figure CN117455968B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for coordinate system transformation, and proposes a method for nonlinear optimization directly for world coordinate system transformation that can cover multiple camera frames; the Jacobian form of 3D-3D, 2D-3D, 3D-2D, and 2D-2D associations is derived, and all visual associations can be fully utilized in the nonlinear optimization link; a dual iterative optimization strategy based on secondary projection matching and interior point same-in-same-out strategy is designed, and multiple searches can be performed in the map according to the optimization results, making full use of all information and repeatedly optimizing. The advantage of the present invention is that the calculated coordinate system transformation accuracy is higher, and the optimal result under the current total amount of information is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of visual positioning and map construction, and in particular to a coordinate system transformation method and a storage medium. Background Art

[0002] XR devices are electronic products that can provide an immersive experience in the virtual world. In XR devices, visual SLAM (Simultaneous Localization and Mapping) is the 6DoF technology it mainly relies on. It means that the device creates a map based on the images collected by the camera in a completely unknown environment under the condition that its own position is uncertain, and uses the map for autonomous positioning. Repositioning technology is a sub-direction of SLAM technology. Repositioning technology mainly refers to the use of image-based sensor information to calculate the coordinate system transformation between two SLAM maps to achieve map fusion, coordinate system merging, and three-dimensional data persistence.

[0003] The existing relocalization technology often calculates the coordinate system transformation through RANSAC+PNP, and the result calculated by PNP only considers a small number of internal point matching pairs, and cannot obtain the result based on the maximum likelihood probability. A small number of strategies will add a nonlinear optimization link after PNP, but because the basic unit of relocalization is a single camera frame, the calculated pose is the pose of a single camera frame, so it is impossible to reasonably use the information of more camera frames. In addition, the existing visual associations are often in the form of 2D-3D, ignoring the 3D-3D, 3D-2D, and 2D-2D information that can be obtained between the two maps, resulting in low accuracy of the calculated coordinate system transformation, or failing to achieve the optimal result under the current total amount of information. Summary of the invention

[0004] The present invention provides a coordinate system transformation method, which is used to solve the problems that the coordinate system transformation method in the existing repositioning has low coordinate system transformation accuracy and cannot achieve the optimal result under the current total amount of information.

[0005] In order to solve the above technical problems, the present invention discloses the following technical solutions:

[0006] The present invention provides a coordinate system transformation method, comprising a data preparation step, a search step, a posture solving step, an initial value obtaining step, a first projection matching step, an interior point set calculating step, an optimal solution calculating step, a difference statistics step, a first judgment step, a second projection matching step and a second judgment step.

[0007] The data preparation step is to prepare more than two sets of data, the data including at least one map, the map including at least one 3D point, at least one camera frame and at least one 2D point; the search step is to reposition the map heuristic search to obtain a first visual observation set, the first visual observation set including at least one matching pair; the pose solution step is based on the first visual observation set to perform preliminary pose solution to obtain a first initial value of the Lie algebra of the pose in the world coordinate system and a second visual observation set; the initial value acquisition step is used to obtain an internal point residual threshold for nonlinear optimization, recorded as the second initial value, and obtain a reprojection threshold for secondary projection matching, recorded as the third initial value; the first projection matching step is based on the first initial value and the third initial value, performing secondary projection matching on the map to obtain a first newly added visual observation set, and taking the union of the second visual observation set and the first newly added visual observation set to obtain a third visual observation set; the internal point set calculation step is based on the first initial value and the second initial value, traversing the third visual observation set, calculating the residual values ​​of the matching pairs in the third visual observation set, and judging Whether the residual value is greater than the second initial value, the first inlier set of the third visual observation set is obtained; the optimal solution calculation step is to calculate the Jacobian of the matching pairs in the first inlier set based on the first initial value and the first inlier set to obtain the residual equation, and the optimal solution is obtained by solving the residual equation through nonlinear optimization; the difference statistics step is to perform the inlier set calculation step on the third visual observation set again based on the optimal solution and the second initial value to obtain the second inlier set, and to count the differences between the first inlier set and the second inlier set to obtain the difference value; the first judgment step is to judge whether the difference value is greater than the maximum difference value, if not, to execute the next step; the second projection matching step is to obtain the fifth initial value of the reprojection threshold for secondary projection matching, based on the optimal solution and the fifth initial value, to perform secondary projection matching on the map again to obtain the second newly added visual observation set, and to count the number of elements in the second newly added visual observation set; the second judgment step is to judge whether the number of elements is greater than the maximum number of newly added observation elements, if not, to output the optimal solution of the posture and the second inlier set.

[0008] Furthermore, the first projection matching step includes a restoration step, a first traversal step and a second traversal step.

[0009] The restoring step is to restore the coordinate transformation matrix between the maps based on the first initial value, and its formula is:

[0010]

[0011] in, represents an estimated value of the first initial value, t represents a translation vector, r represents a rotation vector, R represents a rotation matrix, exp() represents an exponential mapping from a rotation vector to a rotation matrix, 0 and 1 represent different maps, and T(x) represents a coordinate transformation matrix; the first traversal step is used to traverse the first 3D point under the first map, project the first 3D point under the first map to each second camera frame under the second map using a first coordinate transformation matrix, obtain the projected first pixel coordinate, search for the first 2D point whose search pixel distance to obtain the first pixel coordinate does not exceed the third initial value, and perform a search between the first 3D point and the first 2D point The first 3D point and the first 2D point are matched, and if the match is successful, the first 3D point and the first 2D point are added to the first newly added visual observation set; the second traversal step is used to traverse the second 3D points under the second map, and use a second coordinate transformation matrix to project the second 3D points under the second map to each first camera frame under the first map to obtain the projected second pixel coordinates, search for the second 2D point whose search pixel distance does not exceed the second initial value, and match the second 3D point with the second 2D point. If the match is successful, the second 3D point and the second 2D point are added to the first newly added visual observation set.

[0012] Furthermore, the interior point set calculation step includes a residual calculation step and an interior point judgment step.

[0013] The residual calculation step is used to calculate the residual values ​​of different matching pairs in the third visual observation set; the inlier judgment step is used to judge whether the residual value is greater than the second initial value. If not, the matching pair corresponding to the residual value is added to the first inlier set.

[0014] Furthermore, the residual calculation step includes:

[0015] When the matching pair is two 3D points, the first residual value is calculated, and the formula is:

[0016]

[0017] Among them, e 33 represents the first residual value, f represents the call of the objective function, VM 33 represents the matching pair of the 3D point under the first map and the 3D point under the second map, and T represents the transpose of the vector;

[0018] When the matching pair is a 3D point and a 2D point, the second residual value is calculated, and the formula is:

[0019]

[0020] Among them, e 23Represents the second residual value, VM 23 represents the matching pair of 2D points under the first camera frame and 3D points under the second map, represents the third residual value, Represents a matching pair of 2D points under the second camera frame and 3D points under the first map; and

[0021] When the matching pair is two 2D points, the fourth residual value is calculated, and its formula is:

[0022]

[0023] Among them, e 22 Represents the fourth residual value, VM 22 Represents a matching pair of a 2D point in the first camera frame and a 2D point in the second camera frame.

[0024] Furthermore, the optimal solution calculation step includes a Jacobian calculation step, a weight factor calculation step, a residual equation calculation step and an optimal solution calculation step.

[0025] The Jacobian calculation step is used to calculate the Jacobians of different matching pairs in the second visual observation set; the weight factor calculation step is used to calculate the weight factor used to adjust the pure 2D term and the 3D term, and the formula is:

[0026]

[0027] Among them, λ max is a given threshold, ranging from 0.1 to 0.3, and G represents the matching pair VM 33 The maximum value of the serial number of the corresponding internal point set, N represents the matching pair VM 23 The maximum value of the serial number of the corresponding internal point set, Q represents the matching pair The maximum value of the serial number of the corresponding internal point set, V represents the matching pair VM 22 The maximum value of the serial number of the corresponding interior point set; the residual equation calculation step is based on the interior point sets corresponding to different matching pairs to obtain the completed residual equation, and its formula is

[0028]

[0029] Among them, F represents the residual equation, g represents the matching pair VM 33 The serial number of the corresponding internal point set, n represents the matching pair VM 23 The serial number of the corresponding internal point set, q represents the matching pair The serial number of the corresponding internal point set, v represents the matching pair VM 22 The serial number of the corresponding interior point set, x represents the first initial value; the optimal solution calculation step is to calculate the optimal estimate of x based on the residual equation, and its formula is:

[0030]

[0031] in, It represents the optimal estimate of x, that is, the optimal solution. Argmin represents the parameter value at which a function achieves the minimum value in its domain.

[0032] Furthermore, the Jacobian calculation step includes:

[0033] When the matching pair is two 3D points, the matching pair is VM 33 When , the first objective function is adopted, and its formula is

[0034]

[0035] Its Jacobian is

[0036]

[0037] in, represents the first coordinate transformation matrix, represents a 3D point in the first map, represents a 3D point in the second map, I represents a 3x3 identity matrix, represents partial differential, w0 represents the first map, w1 represents the second map, represents the rotation matrix between the first map and the second map, Indicates the translation between the first map and the second map;

[0038] When the matching pair is a 3D point and a 2D point, the matching pair is VM 23 When , the second objective function is adopted, and its formula is

[0039]

[0040] Its Jacobian is

[0041]

[0042] Among them, c m represents the first camera, represents the 2D point under the first camera, represents the coordinate transformation matrix between the first camera and the first map, represents the transformation matrix between the first camera and the first map;

[0043] When the matching pair is a 3D point and a 2D point, the matching pair is When , the third objective function is adopted, and its formula is

[0044]

[0045] Its Jacobian is

[0046]

[0047] Among them, c k Indicates the second camera, represents the rotation matrix between the second camera and the second map, represents the transposed matrix of the rotation matrix between the first map and the second map, represents the coordinate transformation matrix between the second camera and the second map, represents the 2D point under the second camera;

[0048] When the matching pair is two 2D points, the matching pair is VM 22 When , the fourth objective function is adopted, and its formula is

[0049]

[0050] Its Jacobian is

[0051]

[0052] in, represents the transpose of the 2D point under the first camera, represents the rotation matrix between the first camera and the second camera, represents the translation between the first map and the second camera, represents the translation between the first camera and the second camera, Represents the rotation matrix between the first map and the second camera.

[0053] Furthermore, the difference statistics step includes a reset step and a third traversal step.

[0054] The resetting step is to reset the difference value to 0; the third traversal step is to traverse the third visual observation set to determine whether the first interior point set and the second interior point set have the same interior points, and if not, the difference value is accumulated by 1.

[0055] Furthermore, the first determination step further includes:

[0056] When the difference value is greater than the maximum difference value, a fourth initial value of the interior point residual threshold for nonlinear optimization is obtained, and the interior point set calculation step, the optimal solution calculation step and the difference statistics step are re-executed until the difference value is less than the maximum difference value.

[0057] Furthermore, the second determination step further includes:

[0058] When it is determined that the number of elements is greater than the maximum number of newly added observed elements, take the union of the second newly added visual observation set and the third visual observation set to obtain a fourth visual observation set, and based on the second initial value and the fourth visual observation set, re-execute the interior point set calculation step, the optimal solution calculation step, the difference statistics step, the first judgment step and the second projection matching step until the number of elements is less than the maximum number of newly added observed elements.

[0059] The present invention also provides a storage medium, comprising a memory and a processor.

[0060] The memory is used to store executable program codes; the processor is used to read the executable program codes to run a computer program corresponding to the executable program codes to execute at least one step in the coordinate system transformation method.

[0061] Compared with the prior art, the present invention has at least the following technical effects:

[0062] The present invention provides a coordinate system transformation method, proposes a method that can cover multiple camera frames and directly performs nonlinear optimization on world coordinate system transformation; derives Jacobian forms of 3D-3D, 2D-3D, 3D-2D, and 2D-2D associations, and can fully utilize all visual associations in the nonlinear optimization link; designs a dual iterative optimization strategy based on secondary projection matching and interior point same-in and same-out strategy, can search multiple times in the map according to the optimization result, fully utilize all information and repeatedly optimize, so that the calculated coordinate system transformation has higher accuracy and achieves the optimal result under the current total amount of information. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0064] Figure 1 A flowchart of a coordinate system transformation method according to an embodiment of the present invention;

[0065] Figure 2 This is a flow chart of the first projection matching step described in an embodiment of the present invention;

[0066] Figure 3 A flowchart of the steps of calculating the interior point set according to an embodiment of the present invention;

[0067] Figure 4 A flowchart of the optimal solution calculation steps described in an embodiment of the present invention;

[0068] Figure 5 A flowchart of the difference statistics step described in an embodiment of the present invention;

[0069] Figure 6 It is a schematic diagram of the structure of the storage medium described in an embodiment of the present invention.

[0070] The components in the figure are marked as follows:

[0071] 100 storage medium, 110 memory, 120 processor. DETAILED DESCRIPTION

[0072] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0073] like Figure 1 As shown, in the repositioning in visual SLAM, the world coordinate systems of different maps will undergo coordinate system transformation to achieve map fusion, coordinate system merging, three-dimensional data persistence, etc. Therefore, this embodiment provides a coordinate system transformation method, including step S1) data preparation step, step S2) search step, step S3) posture solution step, step S4) initial value acquisition step, step S5) first projection matching step, step S6) internal point set calculation step, step S7) optimal solution calculation step, step S8) difference statistics step, step S9) first judgment step, step S10) second projection matching step and step S11) second judgment step.

[0074] Step S1) Data preparation step, preparing more than two sets of data, wherein the data includes at least one map, and the map includes at least one 3D point, at least one camera frame and at least one 2D point.

[0075] In this embodiment, two sets of data are prepared. One set of data includes first map data w0. There are multiple first 3D points under the map w0. etc., there are multiple first camera frames such as etc., there are multiple first 2D points such as The other set of data includes the second map data w1. There are multiple second 3D points under the second map w1, such as etc., there are multiple second camera frames such as etc., there are multiple second 2D points such as The first 2D point and the second 2D point are both unit vectors projected from the pixel point to the unit spherical coordinates, and the 2D points come from multiple camera frames, such as From the first camera frame Frame from the second camera wait.

[0076] Define the transformation between the world coordinate system of the first map w0 and the world coordinate system of the second map w1, as well as the coordinate transformation matrix between different cameras and their respective world coordinate systems:

[0077]

[0078] The other coordinate transformation matrices used in this embodiment are similar.

[0079] Step S2) A search step is performed to perform a heuristic search for relocation of the map to obtain a first visual observation set, wherein the first visual observation set includes at least one matching pair.

[0080] In this embodiment, the heuristic search link for relocating the first map w0 and the second map w1, preferably, the relocation heuristic search link can be based on the BoW algorithm, VLAD algorithm and descriptor matching based on image recall, or can be based on the direct matching algorithm based on Active Search, or a neural network algorithm based on deep learning. As long as it is an algorithm that can heuristically obtain visual observations, it can be used, and this embodiment is not limited to obtain the first visual observation set VM based on the image ori , the first visual observation set VM ori The matching pairs in include the following cases:

[0081] When two 3D points form a matching pair, the 3D point in the world coordinate system of the first map w0 is included 3D point in the world coordinate system of the second map w1 Using VM 33 Indicates; when a 2D point and a 3D point form a matching pair, it is divided into the following two cases: if the matching pair includes the first camera c m The 2D point below 3D point in the world coordinate system of the second map w1 Using VM 23 Indicates that if the matching pair includes the second camera c k The 2D point below 3D point in the world coordinate system of the first map w0 use Indicates that when two 2D points form a matching pair, including the first camera c m The 2D point below Second camera c k The 2D point below Using VM 22 express.

[0082] Step S3) a pose solution step, performing preliminary pose solution based on the first visual observation set to obtain a first initial value of the Lie algebra of the pose in the world coordinate system and a second visual observation set.

[0083] In this embodiment, the pose solution can use the RANSAC+PNP algorithm, where PNP can select P3P, P4P, GPNP, EPNP and other algorithms, or it can be an end-to-end neural network algorithm based on deep learning. As long as it can obtain the corresponding pose transformation based on visual information, it can be used. This embodiment is not limited to this. Based on the first visual observation set VM ori Perform a preliminary pose solution and calculate the first initial value x of the Lie algebra of the pose in the world coordinate system ori , x is The Lie algebra representation of the two can be converted into each other, so that the latest estimate of x That is, the first initial value x ori , let the latest visual observation set The second visual observation set

[0084] Step S4) Initial value acquisition step, obtaining the interior point residual threshold for nonlinear optimization, recorded as the second initial value, and obtaining the reprojection threshold for secondary projection matching, recorded as the third initial value.

[0085] In this embodiment, the interior point residual threshold for nonlinear optimization, i.e., the second initial value σ ori , and obtain the reprojection threshold for secondary projection matching, that is, the third initial value ε ori , and let σ=σ ori , ε=ε ori , where σ ori With ε ori are given thresholds, σ ori It depends on the given observation covariance scale. If normalized to the image plane, this value is generally selected as 1 to 2 pixels. ori Indicates the pixel distance, and this value is generally selected from 1 to 5 pixels.

[0086] Step S5) A first projection matching step is performed on the map based on the first initial value and the third initial value to obtain a first newly added visual observation set, and the second visual observation set is taken as the union with the first newly added visual observation set to obtain a third visual observation set.

[0087] In this embodiment, the specific matching algorithm of projection matching can be descriptor matching if it is based on feature point descriptors, or optical flow method, direct method, etc. if it is based on feature point tracking. As long as it is an algorithm that can obtain visual associations based on posture priors through image information, it can be used, and this embodiment does not impose any restrictions.

[0088] Based on the latest estimate of the current x and the third initial value of the current reprojection threshold ε, perform secondary projection matching on the first map w0 and the second map w1, which already belongs to The 3D points or 2D points do not participate in the matching, and the first newly added visual observation set VM is obtained sup , get the third visual observation set

[0089] The first new visual observation set VM sup represents a set of matching pairs that do not exist in the second visual observation set and are obtained by performing secondary projection matching on the first map w0 and the second map w1.

[0090] like Figure 2 As shown, step S5) the first projection matching step includes step S51) a restoration step, step S52) a first traversal step and step S53) a second traversal step.

[0091] Step S51) Restoration step, restoring the coordinate transformation matrix between the maps based on the first initial value, the formula is:

[0092]

[0093] in, represents the estimated value of the first initial value, t represents the translation vector, r represents the rotation vector, R represents the rotation matrix, exp() represents the exponential mapping of the rotation vector to the rotation matrix, 0 and 1 represent different maps, T(x) represents the coordinate transformation matrix, and the first coordinate transformation matrix is ​​obtained And the second coordinate transformation matrix

[0094] Step S52) A first traversal step is to traverse the first 3D point under the first map, project the first 3D point under the first map to each second camera frame under the second map using a first coordinate transformation matrix, obtain the projected first pixel coordinate, search for the first 2D point whose search pixel distance does not exceed the third initial value to obtain the first pixel coordinate, match the first 3D point with the first 2D point, and if the match is successful, add the first 3D point and the first 2D point to the first newly added visual observation set.

[0095] Step S53) A second traversal step is performed, traversing the second 3D points under the second map, projecting the second 3D points under the second map to each first camera frame under the first map using a second coordinate transformation matrix, obtaining the projected second pixel coordinates, searching for the second 2D point whose search pixel distance does not exceed the second initial value, matching the second 3D point with the second 2D point, and if the match is successful, adding the second 3D point and the second 2D point to the first newly added visual observation set.

[0096] Step S6) Inlier point set calculation step, based on the first initial value and the second initial value, traverse the third visual observation set, calculate the residual value of the matching pairs in the third visual observation set, determine whether the residual value is greater than the second initial value, and obtain the first inlier point set of the third visual observation set.

[0097] In this embodiment, based on the latest estimated value of the current x and the second initial value σ of the current internal point residual threshold, from the second visual observation set Calculate the current first interior point set

[0098] like Figure 3 As shown, specifically, step S6) the inlier set calculation step includes step S61) the residual calculation step and step S62) the inlier point judgment step.

[0099] Step S61) A residual calculation step is to calculate the residual values ​​of different matching pairs in the third visual observation set.

[0100] Step S62) Inlier point determination step, determining whether the residual value is greater than the second initial value, and if not, adding the matching pair corresponding to the residual value to the first inlier point set.

[0101] In this embodiment, traverse the third visual observation set Calculate the residual of each matching pair using the corresponding objective function below, and then compare it with the second initial value σ to determine whether it is an inlier. If so, add it to the first inlier set Inside.

[0102] According to different matching pairs, specifically, step S61) the residual calculation step includes:

[0103] When the matching pair is two 3D points, the first residual value is calculated, and the formula is:

[0104]

[0105] Among them, e 33represents the first residual value, f represents the call of the objective function, VM 33 represents the matching pair of the 3D point under the first map and the 3D point under the second map, and T represents the transpose of the vector;

[0106] When the matching pair is a 3D point and a 2D point, the second residual value is calculated, and the formula is:

[0107]

[0108] Among them, e 23 Represents the second residual value, VM 23 represents the matching pair of 2D points under the first camera frame and 3D points under the second map, represents the third residual value, Represents a matching pair of 2D points under the second camera frame and 3D points under the first map; and

[0109] When the matching pair is two 2D points, the fourth residual value is calculated, and its formula is:

[0110]

[0111] Among them, e 22 Represents the fourth residual value, VM 22 Represents a matching pair of a 2D point in the first camera frame and a 2D point in the second camera frame.

[0112] Specifically, when the matching pair is two 3D points, that is, the matching pair is VM 33 When e 33 Is it less than the second initial value σ? If so, determine whether the VM 33 The two 3D points are considered as inner points, and the two 3D points are added to the first inner point set When the matching pair is a 3D point and a 2D point, that is, the matching pair is VM 23 or When e 23 and Is it less than the second initial value σ? If so, determine that the 3D point and the 2D point are interior points, and add the 3D point and the 2D point to the first interior point set When the matching pair is two 2D points, that is, the matching pair is VM 22 When e 22 Is it less than the second initial value σ? If so, determine whether the VM 22 The two 2D points are considered as inner points, and the two 2D points are added to the first inner point set

[0113] Step S7) an optimal solution calculation step, calculating the Jacobian of the matching pairs in the first interior point set based on the first initial value and the first interior point set, obtaining a residual equation, and solving the residual equation by nonlinear optimization to obtain an optimal solution.

[0114] In this embodiment, based on the latest estimated value of x and the current first interior point set Construct a nonlinear optimization problem to obtain the optimal solution for posture transformation In this embodiment, different matching pairs use different residual forms.

[0115] like Figure 4 As shown, step S7) the optimal solution calculation step includes step S71) the Jacobian calculation step, step S72) the weight factor calculation step, step S73) the residual equation calculation step and step S74) the optimal solution calculation step.

[0116] Step S71) Jacobian calculation step, calculating the Jacobian of different matching pairs in the second visual observation set.

[0117] Specifically, the Jacobian calculation step includes:

[0118] When the matching pair is two 3D points, the matching pair is VM 33 When , the first objective function is adopted, and its formula is

[0119]

[0120] Its Jacobian is

[0121]

[0122] in, represents the first coordinate transformation matrix, represents a 3D point in the first map, represents a 3D point in the second map, I represents a 3x3 identity matrix, represents partial differential, w0 represents the first map, w1 represents the second map, represents the rotation matrix between the first map and the second map, Indicates the translation between the first map and the second map;

[0123] When the matching pair is a 3D point and a 2D point, the matching pair is VM 23 When , the second objective function is adopted, and its formula is

[0124]

[0125] Its Jacobian is

[0126]

[0127] Among them, c m represents the first camera, represents the 2D point under the first camera, represents the coordinate transformation matrix between the first camera and the first map, represents the transformation matrix between the first camera and the first map;

[0128] When the matching pair is a 3D point and a 2D point, the matching pair is When , the third objective function is adopted, and its formula is

[0129]

[0130] Its Jacobian is

[0131]

[0132] Among them, c k Indicates the second camera, represents the rotation matrix between the second camera and the second map, represents the transposed matrix of the rotation matrix between the first map and the second map, represents the coordinate transformation matrix between the second camera and the second map, represents the 2D point under the second camera;

[0133] When the matching pair is two 2D points, the matching pair is VM 22 When , the fourth objective function is adopted, and its formula is

[0134]

[0135] Its Jacobian is

[0136]

[0137] in, represents the transpose of the 2D point under the first camera, represents the rotation matrix between the first camera and the second camera, represents the translation between the first map and the second camera, represents the translation between the first camera and the second camera, Represents the rotation matrix between the first map and the second camera.

[0138] Step S72) weight factor calculation step, which is used to calculate the weight factor for adjusting the pure 2D item and the 3D item. The formula is:

[0139]

[0140] Among them, λ max is a given threshold, ranging from 0.1 to 0.3, and G represents the matching pair VM 33 The maximum value of the serial number of the corresponding internal point set, N represents the matching pair VM 23 The maximum value of the serial number of the corresponding internal point set, Q represents the matching pair The maximum value of the serial number of the corresponding internal point set, V represents the matching pair VM 22 The maximum value of the sequence number of the corresponding interior point set.

[0141] Step S73) Residual equation calculation step, based on the interior point sets corresponding to different matching pairs, the completed residual equation is obtained, and its formula is:

[0142]

[0143] in,

[0144]

[0145] F represents the residual equation, g represents the matching pair VM 33 The serial number of the corresponding internal point set, n represents the matching pair VM 23 The serial number of the corresponding internal point set, q represents the matching pair The serial number of the corresponding internal point set, v represents the matching pair VM 22 The serial number of the corresponding interior point set, x represents the first initial value.

[0146] Step S74) Optimal solution calculation step, based on the residual equation, calculate the optimal estimate of x, the formula is:

[0147]

[0148] in, It represents the optimal estimate of x, that is, the optimal solution. Argmin represents the parameter value at which a function achieves the minimum value in its domain.

[0149] Step S8) A difference statistics step is performed, based on the optimal solution and the second initial value, the inlier set calculation step is performed again on the third visual observation set to obtain a second inlier set, and the difference between the first inlier set and the second inlier set is counted to obtain a difference value.

[0150] In this embodiment, based on the optimal solution With the second initial value σ, from the second visual observation set The second interior point set is calculated from Count the first internal point set With the second interior point set The difference between them, get the difference value Diff opt .

[0151] like Figure 5 As shown, step S8) the difference statistics step includes step S81) a reset step and step S82) a third traversal step.

[0152] Step S81) Reset step, reset the difference value to 0, that is, the difference value Diff opt Reset to 0;

[0153] Step S82) A third traversal step, traversing the third visual observation set, determining the first interior point set With the second interior point set Is there an identical internal point? If not, the difference value Diff opt Accumulate 1.

[0154] Step S9) The first judgment step is to judge whether the difference value is greater than the maximum difference value. If not, execute the next step.

[0155] In this embodiment, when the difference value Diff opt Greater than the maximum difference value When , the fourth initial value σ=σ·s of the interior point residual threshold for nonlinear optimization is obtained σ , re-execute step S6) the interior point set calculation step, step S7) the optimal solution calculation step and step S8) the difference statistics step until the difference value is less than the maximum difference value, that is,

[0156] Refers to the maximum difference value, generally 1 to 10 can be selected, s σ It refers to the adjustment scale of the inlier residual threshold, which is usually 1.1 to 1.5.

[0157] Step S10) In the second projection matching step, a fifth initial value of the reprojection threshold used for secondary projection matching is obtained, and based on the optimal solution and the fifth initial value, secondary projection matching is performed on the map again to obtain a second newly added visual observation set, and the number of elements in the second newly added visual observation set is counted.

[0158] In this embodiment, the fifth initial value ε of the reprojection threshold of the secondary projection matching is obtained as follows: ε , perform a secondary projection matching on the first map w0 and the second map w1 again to obtain the second newly added visual observation set VM sup, count the second newly added visual observation set VM sup The number of elements in Diff VM .

[0159] Step S11) The second judgment step is to judge whether the number of elements is greater than the maximum number of newly added observation elements. If not, the optimal solution of the posture and the second internal point set are output.

[0160] In this embodiment, when the number of elements Diff VM Greater than the maximum number of newly added observation elements , take the union of the second newly added visual observation set and the third visual observation set to obtain a fourth visual observation set. At this time, the interior point residual threshold for nonlinear optimization is taken as the second initial value σ=σ ori Based on the second initial value and the fourth visual observation set, re-execute step S6) the interior point set calculation step, step S7) the optimal solution calculation step, step S8) the difference statistics step, step S9) the first judgment step and step S10) the second projection matching step until the number of elements is less than the maximum number of newly added observation elements, that is, Then output the optimal solution of the pose transformation And the second interior point set

[0161] Refers to the maximum number of newly added observation elements, generally 20 or more can be selected, s ε Refers to the reprojection threshold adjustment scale, which can generally be selected below 1.

[0162] like Figure 6 As shown, the present invention further provides a storage medium 100 , including a memory 110 and a processor 120 .

[0163] The memory 110 is used to store executable program codes; the processor 120 is used to read the executable program codes to run a computer program corresponding to the executable program codes to perform at least one step in the coordinate system transformation method.

[0164] The advantages of the present invention are that a coordinate system transformation method is provided, and a method for directly performing nonlinear optimization on the world coordinate system transformation that can cover multiple camera frames is proposed; the Jacobian form of 3D-3D, 2D-3D, 3D-2D, and 2D-2D associations is derived, and all visual associations can be fully utilized in the nonlinear optimization link; a dual iterative optimization strategy based on secondary projection matching and the same-in-and-out strategy of interior points is designed, and multiple searches can be performed in the map according to the optimization results, all information is fully utilized and repeatedly optimized, so that the calculated coordinate system transformation has higher accuracy and achieves the optimal result under the current total amount of information.

[0165] The above is a detailed introduction to a coordinate system transformation method and storage medium provided in an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the technical solution and core idea of ​​the present invention. Ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A coordinate system transformation method, characterized in that: include: A data preparation step, preparing two or more sets of data, wherein the data includes at least one map, and the map includes at least one 3D point, at least one camera frame, and at least one 2D point; A searching step of performing a heuristic search for relocation on the map to obtain a first visual observation set, wherein the first visual observation set includes at least one matching pair; A posture solving step, based on the visual information, obtains an algorithm for the corresponding posture transformation, performs preliminary posture solving on the first visual observation set, obtains a first initial value of the Lie algebra of the posture in the world coordinate system and a second visual observation set; Initial value acquisition step, obtaining an interior point residual threshold for nonlinear optimization, recorded as a second initial value, and obtaining a reprojection threshold for secondary projection matching, recorded as a third initial value; A first projection matching step, based on the first initial value and the third initial value, performing secondary projection matching on the map to obtain a first newly added visual observation set, and taking a union of the second visual observation set and the first newly added visual observation set to obtain a third visual observation set; The first projection matching step comprises: The restoration step is to restore the coordinate transformation matrix between the maps based on the first initial value, and the formula is: in, represents the estimated value of the first initial value, t represents the translation vector, r represents the rotation vector, R represents the rotation matrix, exp() represents the exponential mapping of the rotation vector to the rotation matrix, 0 and 1 represent different maps, and T(x) represents the coordinate transformation matrix; A first traversal step, traversing the first 3D point under the first map, projecting the first 3D point under the first map to each second camera frame under the second map using a first coordinate transformation matrix, obtaining the projected first pixel coordinate, searching for the first 2D point whose search pixel distance does not exceed the third initial value, matching the first 3D point with the first 2D point, and if the match is successful, adding the first 3D point and the first 2D point to the first newly added visual observation set; and A second traversal step, traversing the second 3D points under the second map, projecting the second 3D points under the second map to each first camera frame under the first map using a second coordinate transformation matrix, obtaining the projected second pixel coordinates, searching for the second 2D point whose search pixel distance does not exceed the second initial value, matching the second 3D point with the second 2D point, and adding the second 3D point and the second 2D point to the first newly added visual observation set if the match is successful; an inlier set calculation step, based on the first initial value and the second initial value, traversing the third visual observation set, calculating the residual value of the matching pairs in the third visual observation set, judging whether the residual value is greater than the second initial value, and obtaining a first inlier point set of the third visual observation set; an optimal solution calculation step, calculating the Jacobian of the matching pairs in the first interior point set based on the first initial value and the first interior point set to obtain a residual equation, and solving the residual equation by nonlinear optimization to obtain an optimal solution; The optimal solution calculation step comprises: A Jacobian calculation step, calculating the Jacobians of different matching pairs in the second visual observation set; The weight factor calculation steps are used to adjust the weight factors of pure 2D items and 3D items. The formula is: Among them, λmax is a given threshold, ranging from 0.1 to 0.3, and G represents the matching pair VM 33 The maximum value of the serial number of the corresponding internal point set, N represents the matching pair VM 23 The maximum value of the serial number of the corresponding internal point set, Q represents the matching pair The maximum value of the serial number of the corresponding internal point set, V represents the matching pair VM 22 The maximum value of the serial number of the corresponding interior point set; The residual equation calculation steps are based on the internal point sets corresponding to different matching pairs to obtain the completed residual equation, which is: Among them, F represents the residual equation, g represents the matching pair VM 33 The serial number of the corresponding interior point set, matching VM 33 represents the matching pair of 3D points under the first map and the 3D points under the second map, and n represents the matching pair VM 23 The serial number of the corresponding interior point set, matching VM 23 represents the matching pair of 2D points in the first camera frame and 3D points in the second map, and q represents the matching pair The serial number of the corresponding interior point set, matching pair represents the matching pair of 2D points in the second camera frame and 3D points in the first map, and v represents the matching pair VM 22 The serial number of the corresponding interior point set, matching VM 22 represents a matching pair of a 2D point in the first camera frame and a 2D point in the second camera frame, and x represents a first initial value; and The optimal solution calculation step is to calculate the optimal estimate of x based on the residual equation, and the formula is: in, It represents the optimal estimate of x, that is, the optimal solution. Argmin represents the parameter value of a function that achieves the minimum value in its domain. a difference statistics step, based on the optimal solution and the second initial value, performing the inlier set calculation step again on the third visual observation set to obtain a second inlier point set, and counting the differences between the first inlier point set and the second inlier point set to obtain a difference value; The first judgment step is to judge whether the difference value is greater than the maximum difference value, if not, to execute the next step; The second projection matching step is to obtain a fifth initial value of the reprojection threshold for secondary projection matching, Based on the optimal solution and the fifth initial value, performing secondary projection matching on the map again to obtain a second newly added visual observation set, and counting the number of elements in the second newly added visual observation set; and The second judgment step is to judge whether the number of elements is greater than the maximum number of newly added observed elements. If not, Output the optimal solution of the posture and the second interior point set.

2. The coordinate system transformation method according to claim 1, characterized in that: The interior point set calculation step comprises: a residual calculation step, calculating residual values ​​of different matching pairs in the third visual observation set; and The inlier point determination step determines whether the residual value is greater than the second initial value, and if not, adds the matching pair corresponding to the residual value to the first inlier point set.

3. The coordinate system transformation method according to claim 2, characterized in that: The residual calculation step comprises: When the matching pair is two 3D points, the first residual value is calculated, and the formula is: Among them, e 33 represents the first residual value, f represents the call of the objective function, VM 33 represents the matching pair of the 3D point under the first map and the 3D point under the second map, and T represents the transpose of the vector; When the matching pair is a 3D point and a 2D point, the second residual value is calculated, and the formula is: Among them, e 23 Represents the second residual value, VM 23 represents the matching pair of 2D points under the first camera frame and 3D points under the second map, represents the third residual value, Represents a matching pair of 2D points under the second camera frame and 3D points under the first map; and When the matching pair is two 2D points, the fourth residual value is calculated, and its formula is: Among them, e 22 Represents the fourth residual value, VM 22 Represents a matching pair of a 2D point in the first camera frame and a 2D point in the second camera frame.

4. The coordinate system transformation method according to claim 1, characterized in that: The Jacobian calculation step includes: When the matching pair is two 3D points, the matching pair is VM 33 When , the first objective function is adopted, and its formula is Its Jacobian is in, represents the first coordinate transformation matrix, represents a 3D point in the first map, represents a 3D point in the second map, I represents a 3x3 identity matrix, represents partial differential, w0 represents the first map, w1 represents the second map, represents the rotation matrix between the first map and the second map, Indicates the translation between the first map and the second map; When the matching pair is a 3D point and a 2D point, the matching pair is VM 23 When , the second objective function is adopted, and its formula is Its Jacobian is Among them, cm represents the first camera, represents the 2D point under the first camera, represents the coordinate transformation matrix between the first camera and the first map, represents the transformation matrix between the first camera and the first map; When the matching pair is a 3D point and a 2D point, the matching pair is When , the third objective function is adopted, and its formula is Its Jacobian is Among them, ck represents the second camera, represents the rotation matrix between the second camera and the second map, represents the transposed matrix of the rotation matrix between the first map and the second map, represents the coordinate transformation matrix between the second camera and the second map, represents the 2D point under the second camera; and When the matching pair is two 2D points, the matching pair is VM 22 When , the fourth objective function is adopted, and its formula is Its Jacobian is in, represents the transpose of the 2D point under the first camera, represents the rotation matrix between the first camera and the second camera, represents the translation between the first map and the second camera, represents the translation between the first camera and the second camera, Represents the rotation matrix between the first map and the second camera.

5. The coordinate system transformation method according to claim 1, characterized in that: The difference statistics step comprises: a resetting step, resetting the difference value to 0; and The third traversal step is to traverse the third visual observation set to determine whether the first interior point set and the second interior point set have the same interior points. If not, the difference value is accumulated by 1.

6. The coordinate system transformation method according to claim 1, characterized in that: The first determination step further includes: When the difference value is greater than the maximum difference value, a fourth initial value of the interior point residual threshold for nonlinear optimization is obtained, and the interior point set calculation step, the optimal solution calculation step and the difference statistics step are re-executed until the difference value is less than the maximum difference value.

7. The coordinate system transformation method according to claim 1, characterized in that: The second determination step further includes: When it is determined that the number of elements is greater than the maximum number of newly added observed elements, take the union of the second newly added visual observation set and the third visual observation set to obtain a fourth visual observation set, and based on the second initial value and the fourth visual observation set, re-execute the interior point set calculation step, the optimal solution calculation step, the difference statistics step, the first judgment step and the second projection matching step until the number of elements is less than the maximum number of newly added observed elements.

8. A storage medium, characterized in that: include: A memory for storing executable program codes; as well as A processor reads the executable program code to run a computer program corresponding to the executable program code to execute at least one step of the coordinate system transformation method according to any one of claims 1 to 7.