Error correction method, visual SLAM device and computer readable storage medium
Through multi-camera feature matching and pose transformation matrix fusion, the problem of low accuracy of loop closure detection in a single camera is solved and more accurate loop closure error correction is achieved.
Patent Information
- Application Number
- CN202310227437.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2024-09-10
AI Technical Summary
Existing loopback detection technology only targets single camera input, has a small field of view, and is difficult to detect effective loopbacks when the environment has few textures. This results in accumulated errors that cannot be corrected in time, and there are fewer feature matching point pairs and low calculation accuracy.
Using a multi-frame historical key frame image group and a current key frame image group, feature matching is performed through the images captured by the first camera and the second camera, the feature points are fused to the same coordinate system, and the pose transformation matrix is obtained to correct the loop accumulation error.
It improves the error correction accuracy of loop closure detection, uses rich visual field information and more feature details to obtain a higher-precision pose transformation matrix between key frames, and accurately corrects the cumulative loop closure error.
Smart Images

Figure CN118628559A
Abstract
Description
Technical Field
[0001] The present application relates to the field of imaging technology, and in particular to an error correction method for loop detection, a visual SLAM device, and a non-volatile computer-readable storage medium. Background Art
[0002] Currently, loop detection technology is only used for single-camera input, which usually has a small field of view. When a single image is used to detect similarity with historical frames, it is difficult to detect effective loops when there are few environmental textures under the perspective of a single camera, and the accumulated errors cannot be corrected in time. At the same time, there are fewer feature matching point pairs under a single perspective, and the accuracy is not high when calculating the relative pose relationship between similar frames. Summary of the invention
[0003] Embodiments of the present application provide a loop detection error correction method, a visual SLAM device, and a non-volatile computer-readable storage medium.
[0004] The error correction method for loop detection in the embodiment of the present application includes: obtaining a multi-frame historical key frame image group and a current key frame image group, the current key frame image group includes a first current frame image and a second current frame image taken by a first camera and a second camera respectively; determining a group matching the current key frame image group in the multi-frame historical key frame image group as a matching image group, the matching image group includes a first matching image taken by a first camera and a second matching image taken by a second camera respectively; performing feature matching on feature points in the first matching image and the first current frame image to obtain a first feature point pair, and performing feature matching on feature points in the second matching image and the second current frame image to obtain a second feature point pair; fusing the first feature point pair and the second feature point pair into the same coordinate system to obtain a feature point pair set; obtaining a pose transformation matrix between the current key frame image group and the matching image group according to the feature point pair set; and using the pose transformation matrix to correct the loop accumulation error.
[0005] The visual SLAM device of the embodiment of the present application includes: a first camera, a second camera, and a visual processing module, the visual processing module is used to perform an error correction method for loop detection, and the error correction method for loop detection includes: obtaining a multi-frame historical key frame image group and a current key frame image group, the current key frame image group includes a first current frame image and a second current frame image taken by the first camera and the second camera respectively; determining a group matching the current key frame image group in the multi-frame historical key frame image group as a matching image group, the matching image group includes a first matching image taken by the first camera and a second matching image taken by the second camera respectively; performing feature matching on feature points in the first matching image and the first current frame image to obtain a first feature point pair, and performing feature matching on feature points in the second matching image and the second current frame image to obtain a second feature point pair; fusing the first feature point pair and the second feature point pair into the same coordinate system to obtain a feature point pair set; obtaining a pose transformation matrix between the current key frame image group and the matching image group according to the feature point pair set; and correcting the loop accumulation error using the pose transformation matrix.
[0006] A non-volatile computer-readable storage medium containing a computer program according to an embodiment of the present application includes: one or more processors, when the computer program is executed by the one or more processors, the processors implement instructions of an error correction method for loop detection, the error correction method for loop detection including: obtaining a multi-frame historical key frame image group and a current key frame image group, the current key frame image group including a first current frame image and a second current frame image taken by a first camera and a second camera respectively; determining a group matching the current key frame image group in the multi-frame historical key frame image group as a matching image group, the matching image group including a first matching image taken by a first camera and a second matching image taken by a second camera respectively; performing feature matching on feature points in the first matching image and the first current frame image to obtain a first feature point pair, and performing feature matching on feature points in the second matching image and the second current frame image to obtain a second feature point pair; fusing the first feature point pair and the second feature point pair into the same coordinate system to obtain a feature point pair set; obtaining a pose transformation matrix between the current key frame image group and the matching image group according to the feature point pair set; and correcting the loop closure accumulated error using the pose transformation matrix.
[0007] The error correction method for loop detection, visual SLAM device and non-volatile computer-readable storage medium of the embodiments of the present application can use images taken by two cameras to perform key frame matching, and based on the matched key frames, fuse the feature point pairs of the two cameras into a set of feature point pairs in the same coordinate system, and use the feature point pair set with richer field of view information and more feature details to obtain a more accurate inter-key frame pose transformation matrix, thereby making the loop accumulation error correction of loop detection using the pose transformation matrix more accurate.
[0008] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0010] Figure 1 is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0011] Figure 2 It is a schematic diagram of an application scenario of loop detection in certain embodiments of the present application;
[0012] Figure 3 is a schematic diagram of a current key frame image group and a matching image group in certain embodiments of the present application;
[0013] Figure 4 It is a schematic diagram of a scene in which a feature point coordinate system is fused in some embodiments of the present application;
[0014] Figure 5 is a schematic diagram of a visual SLAM device according to some embodiments of the present application;
[0015] Figure 6 is a schematic diagram of the positional relationship between the first camera and the second camera in some embodiments of the present application;
[0016] Figure 7 is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0017] Figure 8 is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0018] Fig. 9 is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0019] Fig.10is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0020] Fig.11 is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0021] Fig.12 is a schematic diagram of feature point pairs of a current key frame image group and a matching image group in certain embodiments of the present application;
[0022] Fig.13 is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0023] Fig.14 is a flowchart of an error correction method for loop closure detection in certain embodiments of the present application;
[0024] Fig.15 is a schematic diagram of a key frame sequence for loop detection in certain embodiments of the present application;
[0025] Fig.16 It is a schematic diagram of the connection relationship between the computer-readable storage medium and the processor in certain embodiments of the present application. DETAILED DESCRIPTION
[0026] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.
[0027] Robot-related technologies and industries are developing rapidly, and more diverse robot forms and smarter robot functions are gradually entering the lives of modern people. Only when a robot knows its own position and surrounding environment can it perform subsequent upper-level tasks such as navigation and interaction. In outdoor environments, robots usually use GPS navigation, but in indoor environments, GPS signals are blocked and it is difficult to accurately locate. At present, most robots use SLAM (Simultaneous Localization and Mapping, SLAM) technology to obtain information based on the sensors on the robot to build a map of the unfamiliar environment and calculate the robot's own position in the environment. With the development of image technology, SLAM technology can use the image information captured by the camera on the robot to build richer environmental information. Specifically, during the movement of the robot in the environment, the robot captures multiple frames of images to calculate the robot's own posture, so as to construct environmental information and locate its own position. However, in the process of estimating the posture of consecutive frames, each calculation will bring errors, and the result of each posture calculation is deduced based on the posture result of the previous frame image. Therefore, running the positioning algorithm for a long time will inevitably produce cumulative errors, causing the posture to deviate more and more from the true value.
[0028] In order to solve the problem of cumulative drift in positioning algorithms, loop detection technology has emerged. Loop detection technology determines whether the current frame has passed through the previous position by detecting the similarity between the current frame and the historical frame. If the current frame has passed through the position that has been passed before, loop detection can associate the current frame with similar historical frames, establish feature constraint relationships, calculate the relative position between the current frame and the historical frame, and thus estimate the cumulative drift between the historical frame and the current frame.
[0029] The current loop detection technology only targets the image input of a single camera, and has a small field of view. This means that if the environment texture under the camera's perspective is small, it is difficult to identify whether there is an environment similar to the current environment in the historical frame, which makes it difficult to detect whether the robot is on the loop path and cannot correct the accumulated error in time. In addition, when the environment texture under the camera's perspective is small, the number of feature matching pairs that can be provided is often small, resulting in low calculation accuracy when calculating the relative pose relationship between the current frame and the historical frame.
[0030] The present application provides a loop closure detection error correction method for improving the error correction accuracy of loop closure detection.
[0031] See also Figure 1 The error correction method of loop detection in the embodiment of the present application comprises the following steps:
[0032] 01: Acquire a multi-frame historical key frame image group and a current key frame image group, where the current key frame image group includes a first current frame image and a second current frame image taken by a first camera 10 and a second camera 20 respectively;
[0033] 02: Determine a group of images that matches the current key frame image group in the multiple historical key frame image groups as a matching image group, where the matching image group includes a first matching image taken by the first camera 10 and a second matching image taken by the second camera 20 respectively;
[0034] 03: Perform feature matching on the feature points in the first matching image and the first current frame image to obtain a first feature point pair, and perform feature matching on the feature points in the second matching image and the second current frame image to obtain a second feature point pair;
[0035] 04: Fuse the first feature point pair and the second feature point pair into the same coordinate system to obtain a feature point pair set;
[0036] 05: Obtain the pose transformation matrix between the current key frame image group and the matching image group according to the feature point pair set; and
[0037] 06: Use the pose transformation matrix to correct the loop closure cumulative error.
[0038] The first camera 10 and the second camera 20 are two different cameras that have been clock-synchronized, the relative position and relative angle between the first camera 10 and the second camera 20 are fixed, and the internal and external parameters of the first camera 10 and the second camera 20 are known. The horizontal field of view of the first camera 10 and the second camera 20 do not completely overlap, that is, the total horizontal field of view of the first camera 10 and the second camera 20 is greater than the horizontal field of view of the first camera 10 or the second camera 20 alone, that is, the field of view of the first camera 10 and the second camera 20 is greater than the field of view of the first camera 10 or the second camera 20 alone.
[0039] A certain frame image group is an image group consisting of a frame image taken by the first camera 10 and another frame image taken by the second camera 20 at the same time. That is, a certain frame image group refers to a combination of two frame images taken by the first camera 10 and the second camera 20 at a certain moment.
[0040] The historical key frame is an image frame from which the camera can easily extract feature points in the image captured by the historical loop. The historical key frame image group is an image group consisting of the historical key frame image captured by the first camera 10 and the corresponding historical key frame image captured by the second camera 20 at the same time. Accordingly, the current key frame image group is an image group consisting of the current key frame images captured by the first camera 10 and the second camera 20 when the current frame image is determined as a key frame. The current frame image may refer to the latest image captured by the first camera 10 and the second camera 20, or the current frame image may refer to an image that has been captured by the first camera 10 and the second camera 20 but has not yet been confirmed as a key frame image.
[0041] If the current frame image captured by the camera is determined to be a key frame, it will participate in the above loop detection correction process as an image in the current key frame image group in the loop detection correction. After the loop detection correction in which it participates is completed, the current key frame image group becomes one of the multiple historical key frame image groups. If the current frame image captured by the camera is not determined to be a key frame, the frame image can be abandoned to save image storage space. In other embodiments, the current frame image that is not determined to be a key frame can also be saved as a historical frame image for subsequent detection, which is not limited here.
[0042] Please combine Figure 2 ,For example, Figure 2 The upper figure in FIG. 1 is a historical loop trajectory of a device equipped with a first camera 10 and a second camera 20. Image group D15, image group D130, image group D310 and image group D500 captured by the first camera 10 and the second camera 20 at four positions S1, S2, S3 and S4 on the trajectory are determined as historical key frame image groups. In this embodiment, image group D15 indicates that the image group is the 15th frame image group captured by the first camera 10 and the second camera 20. Similarly, image group D130, image group D310 and image group D500 are the 130th frame, 310th frame and 500th frame image groups respectively. Figure 2 The dark lines in the figure below are the trajectory of the device's current route, and the light lines are Figure 2 The same historical loop trajectory as in the above figure, the image group D720 taken by the device at position S6 is determined as the current key frame image group. According to step 02, the current key frame image group D720 is matched with the historical key frame image group D15, the historical key frame image group D130, the historical key frame image group D310 and the historical key frame image group D500 for similarity. Among them, the historical key frame image group D130 taken at position S2 has the highest similarity with the current key frame image group D720, and the historical key frame image group D130 is determined as the matching image group P130.
[0043] Please combine Figure 3, the current key frame image group D720 includes the first current frame image dl720 and the second current frame image dr720 taken by the first camera 10, and the matching image group P130 includes the first matching image pl130 taken by the first camera 10 and the second matching image pr130 taken by the second camera 20. According to step 03, feature points are determined in the first current frame image dl720, the second current frame image dr720, the first matching image pl130 and the second matching image pr130 taken by the second camera 20, respectively, and the first current frame image dl720 and the first matching image pl130 are feature matched to obtain a first feature point pair, and the second current frame image dr720 and the second matching image are feature matched to obtain a second feature point pair.
[0044] Please combine Figure 4 , the first feature point pair and the second feature point pair correspond to the first camera 10 coordinate system and the second camera 20 coordinate system respectively. According to step 04, the first feature point pair and the second feature point pair are fused into the same coordinate system to obtain a feature point pair set. That is to say, the method of step 04 can transform the feature point matching relationship between the current key frame and the historical key frame of different camera coordinate systems into the same camera coordinate system, and the obtained feature point pair set has the constraint characteristics of the first camera 10 perspective and the second camera 20 perspective. Combined with step 05, the pose transformation matrix between the current key frame image group and the matching image group obtained by using the feature point pair set is the pose transformation relationship obtained based on the large perspective of the first camera 10 and the second camera 20, and the number of feature point pair sets obtained by fusing the first feature point pair and the second feature point pair must be greater than the number of individual first feature point pairs or individual second feature point pairs, and the feature details are more, so that the inter-frame pose relationship calculated by using the fused feature point pairs can have higher accuracy.
[0045] Combined with step 06, the pose transformation matrix between the current key frame image group and the matching image group can be used to correct the loop closure cumulative error. For example, the pose transformation matrix can be used to construct a loop closure constraint, and the constraint residual can be used to verify whether the route of the device is on the loop closure to correct the loop closure cumulative error of the loop closure detection.
[0046] In summary, compared with the single-camera loop detection method, the implementation method of the present application uses images taken by two cameras for key frame matching, and based on the matching key frames, fuses the feature point pairs of the two cameras into a set of feature point pairs in the same coordinate system, and uses a set of feature point pairs with richer field of view information and more feature details to obtain a more accurate inter-key frame pose transformation matrix, thereby making the loop accumulation error correction of loop detection using the pose transformation matrix more accurate.
[0047] See also Figure 5, the embodiment of the present application also provides a visual SLAM device 100, and the error correction method of loop detection in the embodiment of the present application can be applied to the visual SLAM device 100. That is, the visual SLAM device 100 can move in the loop path and perform loop detection, and the visual SLAM device 100 can correct the cumulative error of the loop detection using the error correction method in the embodiment of the present application. The visual SLAM device 100 includes a first camera 10, a second camera 20 and a visual processing module 50, and the visual processing module 50 is used to execute the error correction method of loop detection in the above steps 01, 02, 03, 04, 05 and 06.
[0048] In some embodiments, the visual SLAM device 100 can be a movable platform, such as a drone, an unmanned vehicle, an unmanned ship, an intelligent robot, etc. The appearance of the intelligent robot can be a simulated human form, or it can be a simulated animal such as a cat, dog, mouse, bird, insect, etc., without limitation.
[0049] In some embodiments, the visual SLAM device 100 may be a terminal device, and a person or a vehicle carrying the terminal device moves in a loop path, and performs loop detection through the visual SLAM device 100. The terminal may be an electronic device such as a mobile phone, a desktop computer, a laptop computer, a camera, a camcorder, a smart watch, etc., which is not limited here.
[0050] See also Figure 6 In some embodiments, the first camera 10 and the second camera 20 are arranged at the same level with their fields of view intersecting. In one embodiment, the first camera 10 and the second camera 20 are RGBD depth cameras, which can acquire depth information of the scene while acquiring image information.
[0051] In some embodiments, the horizontal field of view of the first camera 10 and the second camera 20 ranges from [40°, 80°], for example, the horizontal field of view is 40°, 45°, 50°, 55°, 60°, 65°, 70°, 75°, 80°, etc., which are not limited here. For example, the first camera 10 and the second camera 20 are respectively tilted 29° to the left / right relative to the horizontal midline, and the horizontal field of view of the first camera 10 and the second camera 20 is 58°. After the cross setting, a horizontal field of view of 116° can be obtained.
[0052] In some embodiments, the first camera 10 and the second camera 20 may also be disposed at different heights in the vertical direction to obtain a larger vertical field of view.
[0053] See also Figure 7 In some implementations, 01: obtaining a plurality of historical key frame image groups and a current key frame image group, including:
[0054] 011: Get the angle change and distance change of the current frame image group relative to the previous image group;
[0055] 013: when the angle change is greater than a preset angle threshold or the distance change is greater than a preset distance threshold, setting the current frame image group as the current key frame image group; and
[0056] 015: After correcting the loop accumulation error using the pose transformation matrix corresponding to the current key frame image group, the current key frame image group is set as the historical key frame image group.
[0057] Please combine Figure 5 In some embodiments, the visual processing module 50 can also be used to execute the error correction method of loop detection in the above steps 011, 013 and 015.
[0058] Step 011, step 013 and step 015 are used to determine the key frame image group. The image frame rate of the camera input is often above 30Hz. A large number of image groups can be obtained every time a certain distance is moved on the loop. However, loop detection does not actually require a too high detection frequency. Otherwise, when the camera moves a short distance and the angle changes slightly, loop detection is still performed multiple times, which consumes a lot of computing resources but does not perform loop correction. Too many key frame image groups will lead to a high frequency of loop detection, and there is a problem of excessive detection leading to low detection efficiency. Too few key frame image groups will lead to insufficient accuracy of loop detection. Therefore, it is necessary to select the corresponding image group when the posture changes as the key frame. On the one hand, it ensures that the loop detection using the key frame has sufficient accuracy, and on the other hand, it prevents the selection of too many key frames from resulting in low detection efficiency.
[0059] The change of the camera's posture is often caused by the change of the moving distance or angle. That is to say, when the angle change or distance change of adjacent frames changes greatly, there is a high probability that a significant posture change will occur, which may easily cause the next moving path to deviate from the historical loop. In step 011 and step 013, when the angle change of the current frame image group relative to the previous image group is greater than the preset angle threshold or the distance change is greater than the preset distance threshold, the current frame image group is set as the current key frame image group to mark the key frame at the node where the posture changes significantly, so as to ensure the accuracy of the key frame.
[0060] After the accumulated loop error is corrected using the pose transformation matrix corresponding to the current key frame image group, the current key frame image group is set as the historical key frame image group according to step 015. That is, the current path that has been traversed will continue to be stored as a new historical loop path, and the current key frame image group that has participated in the loop detection error correction is stored as a key frame anchor point of the new historical loop path to participate in subsequent loop detection.
[0061] See also Figure 8 In some embodiments, the error correction method for loop detection further includes:
[0062] 021: Obtain the frame interval between the current key frame image group and the most recent historical key frame image group; and
[0063] 022: When the frame interval is greater than a preset frame interval threshold, a frame matching the current key frame image group is determined in the multiple historical key frame image groups as a matching image group.
[0064] Please combine Figure 5 In some embodiments, the visual processing module 50 can also be used to execute the error correction method of loop detection in the above steps 021 and 022.
[0065] Please combine Figure 1 ,and Figure 1 Compared with the schematic process, Figure 8 In the process, step 021 and step 022 are used to replace step 02. Step 021 and step 022 are used to prevent loop detection from being performed too frequently, so as to reduce the computational burden of the system. In one embodiment, the preset frame interval threshold is 100 frames, that is, when the current image group is confirmed as the current key frame image group, it is also necessary to determine whether the frame interval between the current key frame image group and the historical key frame image group closest in time sequence is greater than 100 frames to determine whether to perform the subsequent loop detection process.
[0066] Please combine Figure 2 For example, the frame interval between the current key frame image group D720 and the historical key frame image group D500 that is closest in time sequence is 120 frames, which is greater than the preset frame interval threshold and meets the loop detection condition. Then, a frame matching the current key frame image group D720 is determined in the multiple historical key frame image groups, for example, among the historical key frame image groups D15, the historical key frame image group D130, the historical key frame image group D310 and the historical key frame image group D500, the historical key frame image group D130 is determined as the frame that best matches the current key frame image group D720, and the historical key frame image group D130 is determined as the matching image group P130.
[0067] See also Fig. 9In some implementations, step 02 or step 022 determines a group of images in multiple historical key frame image groups that matches the current key frame image group as a matching image group, including:
[0068] 023: Construct a bag-of-words model based on multiple historical key frame image groups;
[0069] 025: input the current key frame image group into the bag-of-words model to obtain similarity scores between multiple current key frame image groups and historical key frame image groups; and
[0070] 027: Determine the historical key frame image group corresponding to the highest similarity score as the matching image group.
[0071] Please combine Figure 5 In some embodiments, the visual processing module 50 can also be used to execute the error correction method of loop detection in the above steps 023, 025 and 027.
[0072] The bag-of-words model includes a pre-loaded trained bag-of-words dictionary, which can describe the features extracted from the historical key frame image group. After the current key frame image group is input into the bag-of-words model, the bag-of-words model can output a similarity score based on the features of the current key frame image group and the features of the historical key frame image group. The higher the similarity score, the higher the similarity between the historical key frame image group corresponding to the score and the input current key frame image group. Step 027 determines the historical key frame image group corresponding to the highest similarity score as the matching image group to make the matching accurate.
[0073] In some embodiments, the bag-of-words model includes a historical descriptor vector corresponding to multiple historical key frame image groups. The historical descriptor vector is a vector generated based on the bag-of-words dictionary to characterize the image meaning of the historical key frame image group, describing whether the image contains a certain type of feature.
[0074] See also Fig.10 In some implementations, 025: inputting the current key frame image group into the bag-of-words model to obtain similarity scores between multiple current key frame image groups and historical key frame image groups, including:
[0075] 0251: extract multiple fast features from the first current frame image and the second current frame image of the current key frame image group respectively;
[0076] 0253: Calculate the brief descriptors of multiple fast features to obtain the current descriptor vector of the current key frame image group; and
[0077] 0255: Calculate the similarity score based on the historical descriptor vector and the current descriptor vector.
[0078] Please combine Figure 5 In some embodiments, the visual processing module 50 can also be used to execute the error correction method of loop detection in the above steps 0251, 0253 and 0255.
[0079] Fast feature is a corner detection algorithm based on image brightness changes in computer vision, which can easily extract recognizable feature points in the scene. The brief descriptor extraction algorithm can generate a fixed-length binary vector from the input fast feature, and represent the fast feature descriptor set in the form of a vector, which is used to describe the fast features contained in the image. Inputting the current descriptor vector of the current key frame image group into the bag-of-words model can describe the meaning of the current key frame image group based on the bag-of-words dictionary, and by comparing the similarity between the historical descriptor vector and the current descriptor vector, the similarity between the current key frame image group and the historical key frame image group can be represented.
[0080] In one embodiment, the historical descriptor vector is a vector obtained by integrating the historical descriptors in the image captured by the first camera 10 and the historical descriptors in the image captured by the second camera 20 in the historical key frame image group, that is, the historical descriptor vector represents the feature set of the two frames of the entire historical key frame image group. Correspondingly, the current descriptor vector is a vector obtained by integrating the brief descriptor of the first current frame image and the brief descriptor of the second current frame image, that is, the current descriptor vector represents the feature set of the two frames of the entire current key frame image group. When comparing the similarity, the current descriptor vector and the historical descriptor vector corresponding to each historical key frame image group are compared pairwise to obtain multiple similarity scores, and the historical key frame image group corresponding to the historical descriptor vector with the highest similarity score is determined as the matching image group.
[0081] In another embodiment, the historical descriptor vector includes two, one of which represents a feature set of the historical descriptor in the image captured by the first camera 10, and the other represents a feature set of the historical descriptor in the image captured by the second camera 20. Correspondingly, the current descriptor vector includes two, one of which represents a feature set of the brief descriptor of the first current frame image, and the other represents a feature set of the brief descriptor of the second current frame image. When calculating the similarity score, the first similarity between the historical descriptor vector corresponding to the image captured by the first camera 10 and the current descriptor vector, and the second similarity between the historical descriptor vector corresponding to the image captured by the second camera 20 and the current descriptor vector are calculated respectively, and then the comprehensive score of the first similarity and the second similarity is combined, and the historical key frame image group corresponding to the highest historical descriptor vector with the highest comprehensive score of the first similarity and the second similarity is determined as the matching image group.
[0082] See also Fig.11After selecting the matching image group that matches the current key frame image group, the feature point pairs in the current key frame image and the matching image group can be fused according to the method of step 04 for subsequent loop verification and error correction.
[0083] In some embodiments, 04: fusing the first feature point pair and the second feature point pair into the same coordinate system to obtain a feature point pair set, including:
[0084] 041: Obtain the first three-dimensional feature point coordinates and the first two-dimensional feature point coordinates of the first feature point pair;
[0085] 043: Obtain the external parameter transformation matrix from the first camera 10 to the second camera 20;
[0086] 045: converting the first three-dimensional feature point coordinates into second three-dimensional feature point coordinates and second two-dimensional feature point coordinates according to the external parameter transformation matrix, wherein the coordinate system of the second three-dimensional feature point coordinates and the second two-dimensional feature point coordinates is the same as the coordinate system of the feature point coordinates of the first feature point pair;
[0087] 047: Associating the second two-dimensional feature point coordinates with the second three-dimensional feature point coordinates as a third feature point pair; and
[0088] 049: Add the second feature point and the third feature point pair to the feature point pair set.
[0089] Please combine Figure 5 In some embodiments, the visual processing module 50 can also be used to execute the error correction method of loop detection in the above steps 041, 043, 045, 047 and 049.
[0090] Please combine Fig.12 , Fig.12 It is a schematic diagram of feature point matching between the current key frame image group and the matching image group. Fig.12 The left column is the current key frame image group D1879 with the serial number being the 1879th frame. Fig.12 The right column of is a historical key frame image group with the serial number of frame 0, and the historical key frame image group is determined to be the matching image group D0. Fig.12 The above line shows the feature matching of the images captured by the first camera 10 in the previous frame image group D1879 and the matching image group D0, respectively, wherein each feature point in the current key frame image group D1879 and a matching feature point in the matching image group D0 constitute a first feature point pair (indicated by connecting lines in the figure, the same below). Fig.12The following line shows the feature matching of the images captured by the second camera 20 in the current key frame image group D1879 and the matching image group D0, respectively, wherein each feature point in the current key frame image group D1879 and a matching feature point in the matching image group D0 constitute a second feature point pair.
[0091] The first feature point pair is a pair of 2D-2D feature point pairs. Since the depth of the image is obtained when the current key frame image group is obtained, that is to say, the three-dimensional feature point coordinates of the feature points extracted from the current key frame image group are known. Combined with the two-dimensional feature point coordinates of the feature points extracted from the matching image group, the 2D-2D first feature point pair can be converted into a 3D-2D first feature point pair.
[0092] Let the first feature point of 3D-2D be the center, and the 3D feature point be P 3D_ , the 2D feature point is p 2D_ , the external parameter transformation matrix from the first camera 10 to the second camera 20 is T 1-2 .
[0093] For 3D feature points, the following formula 1 can be used to convert them into the coordinate system of the second camera 20:
[0094] Formula 1: P 3D_ = 1-2 * 3D_
[0095] Among them, P 3D_ Is P 3D_ The 3D feature points in the coordinate system of the second camera 20 are obtained by converting the first three-dimensional feature point coordinates in the coordinate system of the first camera 10 into the second three-dimensional feature point coordinates in the coordinate system of the second camera 20 .
[0096] For 2D feature points, the following formula 2 can be used to convert them into the coordinate system of the second camera 20:
[0097] Formula 2: P 2D_ =norm(T 1-2 *P 2D_ *d)
[0098] Among them, P 2D_ Is P 3D_ The 2D feature points in the coordinate system of the second camera 20 are obtained by converting the first 2D feature point coordinates in the coordinate system of the first camera 10 into the second 2D feature point coordinates in the coordinate system of the second camera 20. norm() indicates normalizing the 3D feature points to 2D feature points.
[0099] Thus, the 3D feature points and 2D feature points transformed from the coordinate system of the first camera 10 to the coordinate system of the second camera 20 are obtained by using Formula 1 and Formula 2, respectively. The coordinates of the 3D feature points are the second three-dimensional feature point coordinates, and the coordinates of the 2D feature points are the second two-dimensional feature point coordinates. Fig.12 , the coordinate system transformation will not change the matching relationship between the above 3D feature points and 2D feature points, so the transformed feature point P is still matched according to the matching relationship of the first 3D-2D feature point pair 3D_ and feature point P 2D_ , and obtain the third 3D-2D feature point pair. The third 3D-2D feature point pair is the 3D-2D feature point pair obtained by converting the first 3D-2D feature point pair in the coordinate system of the first camera 10 to the 3D-2D feature point pair in the coordinate system of the second camera 20.
[0100] According to the methods in step 041, step 043, step 045 and step 047, each first feature point pair in the coordinate system of the first camera 10 is transferred to the coordinate system of the second camera 20, and a plurality of third feature point pairs can be obtained accordingly. In combination with step 049, the third feature point pairs obtained by converting the first feature point pairs in the coordinate system of the first camera 10 to the coordinate system of the second camera 20 and the second feature point pairs originally in the coordinate system of the second camera 20 are added to the feature point pair set, which is the feature point pair set obtained by merging the first feature point pairs and the second feature point pairs into the same coordinate system. In the feature point pair set, the third feature point pair can characterize the feature relationship and feature point matching relationship of the first feature point pair, that is, the third feature point pair characterizes the feature relationship and feature point matching relationship in the image captured by the first camera 10, and combines the feature relationship and feature point matching relationship in the image captured by the second camera 20 represented by the second feature point pair, so that the feature point pair set has the feature relationship and feature point matching relationship of the images captured by the first camera 10 and the second camera 20. Compared with the first feature point pair or the second feature point pair, the feature point pair set integrates the characteristic characteristics of the fields of view of the first camera 10 and the second camera 20, and includes more viewing angles and feature details. Therefore, the pose relationship between similar frames calculated using the feature point pair set is more accurate than the pose relationship between similar frames calculated using the first feature point pair or the second feature point pair alone.
[0101] Similarly, in other embodiments, the feature point coordinates of the second feature point pair may be transformed into the coordinate system of the first camera 10 to obtain a feature point pair set in the coordinate system of the first camera 10. Alternatively, a third coordinate system independent of the coordinate system of the first camera 10 and the coordinate system of the second camera 20 may be set, and the feature point coordinates of the first feature point pair and the feature point coordinates of the second feature point pair may be transformed into the third coordinate system to obtain a feature point pair set in the third coordinate system.
[0102] In some embodiments, a PnP (Perspective-n-Point, PnP) algorithm can be used to map 3D feature points in a feature point pair set to a 2D image plane, and estimate the pose change by minimizing the reprojection error to obtain a relative pose transformation matrix of the camera between the current key frame and the matching historical key frame. The relative pose transformation matrix integrates the viewing constraints of the first camera 10 and the second camera 20, and has richer feature details and higher accuracy.
[0103] Furthermore, in some embodiments, line features or surface features may be used instead of point features for feature matching and feature fusion. For example, in another embodiment, step 03 may be modified as follows: feature matching is performed on the feature lines in the first matching image and the first current frame image to obtain the first feature line pair, and feature matching is performed on the feature lines in the second matching image and the second current frame image to obtain the second feature line pair; step 04 may be modified as follows: the first feature line pair and the second feature line pair are fused into the same coordinate system to obtain a feature line pair set; and step 05 may be modified as follows: the pose transformation matrix between the current key frame image group and the matching image group is obtained based on the feature line pair set. Using feature lines or feature surfaces for feature matching has a higher matching accuracy, and can improve the success rate and accuracy of feature fusion and subsequent calculation of the pose transformation matrix between key frames.
[0104] By using the relative pose transformation matrix between the current key frame and the matched historical key frame, a nonlinear optimization problem can be constructed to optimize the pose of the historical key frame for error correction of loop detection. However, if the rotational transformation or translational change represented by the relative pose transformation matrix is too large, it may be due to an error in loop detection, and no suitable historical key frame image group similar to the current key frame image group is matched, resulting in a large difference in the camera's viewing angle or distance between the current key frame and the historical key frame matched with it. On the other hand, if the matching relationship of the feature points in the feature point pair set is wrong, it may also cause the rotational transformation or translational change represented by the relative pose transformation matrix calculated based on the feature point pair set to be too large. Therefore, the rationality of the relative pose transformation matrix should be verified before using it for error correction of loop detection, so as to avoid using an unreasonable relative pose transformation matrix for error correction of loop detection, resulting in poor cumulative error correction effect of loop detection.
[0105] See also Fig.13 In some embodiments, the error correction method for loop detection further includes:
[0106] 071: Obtain a preset rotation threshold and a preset translation threshold; and
[0107] 072: When the rotation of the pose transformation matrix is less than the preset rotation threshold, and the translation of the pose transformation matrix is less than the preset translation threshold, the pose transformation matrix is used to correct the loop accumulation error.
[0108] Please combine Figure 5 In some embodiments, the visual processing module 50 can also be used to execute the error correction method of loop detection in the above steps 071 and 072.
[0109] The preset rotation threshold and the preset translation threshold are used to verify the rationality of the rotation change and translation change in the relative posture transformation matrix. If any one of the rotation change or translation change is greater than or equal to the corresponding rotation threshold or translation threshold, it indicates that the relative posture transformation matrix is unreasonable, and the subsequent loop detection process and loop detection error correction process should be abandoned. Only when the rotation amount of the posture transformation matrix is less than the preset rotation threshold and the translation amount of the posture transformation matrix is less than the preset translation threshold, that is, when both the rotation change and the translation change are reasonable, the subsequent loop detection is continued and the posture transformation matrix is used to correct the loop accumulation error.
[0110] In one embodiment, the preset rotation threshold is 20° and the preset translation threshold is 1m. That is, when the rotation change of the current key frame relative to the matching historical key frame is less than 20°, and the translation change of the current key frame relative to the matching historical key frame is less than 1m, the relative posture transformation matrix of the current key frame relative to the matching historical key frame is considered reasonable.
[0111] In one embodiment, when the relative posture transformation matrix is unreasonable, the current key frame is abandoned and the next acquired current key frame is used for loop detection.
[0112] See also Fig.14 In some embodiments, in step 06 or step 072, the loop closure cumulative error is corrected using the pose transformation matrix, including:
[0113] 061: Obtain the current frame pose of the current key frame image group, the matching frame pose of the matching image group, and the historical frame pose of the historical key frame image group;
[0114] 062: Obtain loop closure residual according to the pose transformation matrix, the current frame pose and the matching frame pose;
[0115] 063: Obtain key frame residuals according to historical frame poses corresponding to at least two adjacent historical frames;
[0116] 064: Obtain an optimization relationship based on the loop residual and the key frame residual;
[0117] 065: Construct Jacobian matrix based on optimization relation;
[0118] 066: Use the optimization algorithm to optimize the Jacobian matrix and obtain the optimized pose; and
[0119] 067: Correct the historical frame pose according to the optimized pose.
[0120] Please combine Figure 5 In some embodiments, the visual processing module 50 can also be used to execute the error correction method of loop detection in the above steps 061, 062, 063, 064, 065, 066 and 067.
[0121] Please combine Fig.15 , when the relative pose transformation matrix is reasonable, all historical key frames between the current key frame and the matching frame (i.e., the historical key frames that match the current key frame) are taken out as to be corrected, and a nonlinear optimization problem is constructed based on the above key frames.
[0122] For example, the current key frame is D720, the matching frame matching it is D130, and the historical key frames between the current key frame D720 and the matching frame D130 include D310 and D500.
[0123] For the current key frame D720, its loop residual can be obtained by formula 3:
[0124] Formula 3:
[0125] Among them, R loop and t loop are the rotation matrix and translation matrix of the matching frame D130, obtained from the position and posture of the matching frame D130; R cur and t cur are the rotation matrix and translation matrix of the current key frame D720, respectively, obtained from the position and posture of the current key frame D720; R cur_ and t cur_ are respectively the rotation matrix and translation matrix of the pose transformation matrix between the current key frame D720 and the matching frame D130.
[0126] For other historical key frames to be corrected, such as D310 or D500, the pose of the historical key frame to be corrected and the pose of the historical key frames adjacent to it are used to construct residual constraints to obtain the key frame residual. The key frame residual can be obtained by formula 4:
[0127] Formula 4:
[0128] Among them, the pose of the historical key frame to be corrected is T i , the corresponding rotation matrix is R i, the corresponding translation matrix is t i , the position obtained by front-end positioning is Rotate to Shift to The pose of a key frame adjacent to the historical key frame to be corrected is T j , the corresponding rotation is R j , the corresponding translation is t j , the position obtained by front-end positioning is Rotate to Shift to For example, for the historical key frame D500 to be corrected, its own pose is T 500 , the adjacent historical key frame is D310, and the pose is T 310 .
[0129] In one embodiment, a residual constraint relationship is established for the historical key frame to be corrected and its five neighboring historical key frames according to the above formula 4 to obtain multiple key frame residuals.
[0130] Combining the loop closure residual and key frame residual, the nonlinear optimization relationship can be constructed by formula 5:
[0131] Formula 5: min(error loop +error normal );
[0132] Solving the Jacobian matrix to be optimized for the above formula 5 and performing nonlinear optimization can obtain the corrected historical key frame pose, which is the optimized pose. The optimized pose is used to correct the key frame pose of the above historical key frame to be corrected, that is, setting the pose of the historical key frame to be corrected to the optimized pose to correct the historical key frame, which can make the historical key frame closer to the actual loop, thereby eliminating the loop accumulation error.
[0133] Please combine with Formula 3. In the implementation manner of the present application, the loop closure residual constraint utilizes the current frame pose that integrates the constraints of the camera fields of view of the first camera 10 and the second camera 20, and the pose transformation matrix used in the loop closure residual constraint also integrates the constraints of the camera fields of view of the first camera 10 and the second camera 20, so as to provide sufficient constraints, thereby effectively reducing the cumulative drift of the positioning algorithm.
[0134] See also Fig.16 The embodiment of the present application further provides a non-volatile computer-readable storage medium 300 including a computer program 301. When the computer program 301 is executed by one or more processors 30, the processor 30 can execute the error correction method for loop detection of any of the above embodiments.
[0135] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, a technician in the field may combine and combine different embodiments or examples described in this specification and features of different embodiments or examples, unless they are contradictory.
[0136] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0137] Although the embodiments of the present application have been shown and described above, it is to be understood that the above embodiments are exemplary and cannot be construed as limitations on the present application. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present application.
Claims
1. A loop detection error correction method, characterized in that: include: Acquire a multi-frame historical key frame image group and a current key frame image group, wherein the current key frame image group includes a first current frame image and a second current frame image taken by a first camera and a second camera respectively; Determine a group of images that matches the current key frame image group from among the multiple frames of the historical key frame image groups as a matching image group, wherein the matching image group includes a first matching image taken by a first camera and a second matching image taken by a second camera respectively; Performing feature matching on feature points in the first matching image and the first current frame image to obtain a first feature point pair, and performing feature matching on feature points in the second matching image and the second current frame image to obtain a second feature point pair; Merging the first feature point pair and the second feature point pair into the same coordinate system to obtain a feature point pair set; Acquire a pose transformation matrix between the current key frame image group and the matching image group according to the feature point pair set; and The pose transformation matrix is used to correct the loop closure accumulated error.
2. The error correction method according to claim 1, characterized in that: The step of obtaining a plurality of historical key frame image groups and a current key frame image group includes: Obtain the angle change and distance change of the current frame image group relative to the previous image group; When the angle change is greater than a preset angle threshold or the distance change is greater than a preset distance threshold, setting the current frame image group as the current key frame image group; and After correcting the loop accumulation error using the posture transformation matrix corresponding to the current key frame image group, the current key frame image group is set as the historical key frame image group.
3. The error correction method according to claim 1, characterized in that: The error correction method further comprises: Obtaining a frame interval between the current key frame image group and the historical key frame image group that is closest in time sequence; and In the case that the frame interval is greater than a preset frame interval threshold, a frame matching the current key frame image group is determined in the multiple frames of the historical key frame image group as a matching image group.
4. The error correction method according to any one of claims 1 or 3, characterized in that: The step of determining a group of images in the multiple historical key frame image groups that matches the current key frame image group as a matching image group includes: Construct a bag-of-words model based on multiple historical key-frame image groups; Inputting the current key frame image group into the bag-of-words model to obtain a plurality of similarity scores between the current key frame image group and the historical key frame image group; and The historical key frame image group corresponding to the similarity score with the highest score is determined as the matching image group.
5. The error correction method according to claim 4, characterized in that: The bag-of-words model includes historical descriptor vectors corresponding to multiple historical key frame image groups, and the step of inputting the current key frame image group into the bag-of-words model to obtain similarity scores between the multiple current key frame image groups and the historical key frame image groups includes: Extracting a plurality of fast features from the first current frame image and the second current frame image of the current key frame image group respectively; Calculating brief descriptors of a plurality of the fast features to obtain a current descriptor vector of the current key frame image group; and The similarity score is calculated based on the historical descriptor vector and the current descriptor vector.
6. The error correction method according to claim 1, characterized in that: The step of fusing the first feature point pair and the second feature point pair into the same coordinate system to obtain a feature point pair set includes: Acquire first three-dimensional feature point coordinates and first two-dimensional feature point coordinates of the first feature point pair; Get the external parameter transformation matrix from the first camera to the second camera; The first three-dimensional feature point coordinates are converted into second three-dimensional feature point coordinates and second two-dimensional feature point coordinates according to the external parameter transformation matrix, wherein the second three-dimensional feature point coordinates and the second two-dimensional feature point coordinates have the same coordinate system as the feature point coordinates of the first feature point pair; Associating the second two-dimensional feature point coordinates with the second three-dimensional feature point coordinates as a third feature point pair; and The second feature point and the third feature point pair are added to the feature point pair set.
7. The error correction method according to claim 1, characterized in that: The error correction method further comprises: Obtaining a preset rotation threshold and a preset translation threshold; and When the rotation amount of the posture transformation matrix is less than a preset rotation threshold, and the translation amount of the posture transformation matrix is less than a preset translation threshold, the posture transformation matrix is used to correct the loop accumulation error.
8. The error correction method according to any one of claims 1 or 7, characterized in that: The method of correcting the loop accumulation error by using the posture transformation matrix includes: Acquire the current frame pose of the current key frame image group, the matching frame pose of the matching image group, and the historical frame pose of the historical key frame image group; Acquire a loop closure residual according to the pose transformation matrix, the current frame pose, and the matching frame pose; Obtaining a key frame residual according to the historical frame poses corresponding to at least two adjacent historical frames; Acquire an optimization relationship according to the loop closure residual and the key frame residual; Constructing a Jacobian matrix according to the optimization relationship; Optimizing the Jacobian matrix using an optimization algorithm to obtain an optimized pose; and The historical frame pose is corrected according to the optimized pose.
9. A visual SLAM device, characterized in that: The visual SLAM device comprises: a first camera, a second camera and a visual processing module, and the visual processing module is used to execute the error correction method for loop detection described in any one of claims 1 to 8.
10. A non-volatile computer-readable storage medium containing a computer program, comprising one or more processors, and when the computer program is executed by the one or more processors, the processors are caused to implement instructions of the error correction method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Unmanned aerial vehicle positioning method and device, computer and storage medium
CN109974693A
Pose calculation method and device, storage medium and electronic equipment
CN114998433A
Cited By
Natural feature control point loop iteration camera array external parameter time sequence correction method
CN120953317A
