Fast visual synchronous positioning and mapping method based on bidirectional optical flow

Through the bidirectional optical flow and uniform motion model, combined with ORB feature points, it solves the problem of feature point matching occupying computing resources in the visual SLAM algorithm, achieves efficient simultaneous positioning and mapping, and improves real-time performance and computing efficiency.

CN118587281AInactive Publication Date: 2024-09-03ZHEJIANG UNIV OF TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410616106.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-09-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing visual SLAM algorithms occupy a large amount of computing resources for feature point extraction and matching in the tracking thread, affecting real-time performance. Especially on embedded platforms where computing resources are scarce, it is difficult to achieve efficient simultaneous positioning and mapping.

Method used

The bidirectional optical flow method is used to match adjacent frames, and false matches are filtered through reverse optical flow. The uniform motion model and ORB feature points are combined to reduce the steps of feature point extraction and matching and improve real-time performance.

Benefits of technology

Without losing accuracy, the real-time performance of the SLAM algorithm is significantly improved, the waste of computing resources is reduced, the tracking efficiency is improved, the real-time performance is nearly doubled, and it is suitable for platforms with shortage of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587281A
    Figure CN118587281A
Patent Text Reader

Abstract

A rapid visual synchronous positioning and mapping method based on bidirectional optical flow comprises the following steps: firstly, sensing environment information through a camera, default-creating first three frames as key frames, and initializing a motion model to obtain an initial prediction pose; secondly, carrying out optical flow tracking and matching, filtering outer points by using reverse optical flow, judging whether a key frame is created or not according to a matching result, if not, carrying out re-projection optimization on a pose by using a matching result of bidirectional optical flow, and if so, extracting ORB feature points from the current frame, carrying out matching and tracking by reusing features, and then carrying out re-optimization; and then, sending to a local map for processing, establishing more accurate pose and matching, directly sending to a next frame for tracking without creating a key frame according to the previous judgment, creating the key frame for tracking the next frame if the key frame is required, sending the key frame to a back-end optimization module, and tracking a global map to obtain a final result. According to the invention, the efficiency and real-time performance of the system can be improved under the condition that the precision is not lost basically.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of robot positioning technology, and more specifically, to a fast visual synchronous positioning and mapping method for real-time tracking of moving objects based on bidirectional optical flow. Background Art

[0002] With the rapid development of mobile robots and autonomous driving, Simultaneous Localization And Mapping (SLAM), one of its core technologies, has also received more research. According to the different sensors used, it can be divided into laser SLAM and visual SLAM. The former has a more mature technical theory, but due to the use of lidar as a sensor, it has disadvantages such as large size, high price and single perception information. Compared with the former, the latter has stood out in recent years with its advantages such as low cost, rich perception information and strong scalability. In today's environment where perception is more important than mapping, visual SLAM can obtain more real-world information by using cameras as sensors, which is conducive to improving the accuracy of positioning and mapping.

[0003] The information obtained by the camera is often displayed in the form of an image sequence. In each frame of the image, the environmental information needs to be obtained by extracting features from the image. These features can be points, lines, and surfaces, etc. Among them, feature points are the most commonly used and the least complex. Common feature points include SIFT, SURF, ORB, etc. Among them, ORB is the most representative real-time image feature, which can solve the real-time operation problem of SLAM. The most classic ORB-SLAM series is the most typical example. The general SLAM algorithm is divided into three threads, tracking thread, local mapping thread and closed-loop detection thread. The tracking thread needs to extract image information and track in real time, which belongs to the front end. The key frames screened and created in this process are used for the subsequent two threads to build maps and optimize, which belongs to the back end. The latter two threads do not need to run in real time and are only affected by the key frame information. Therefore, the real-time performance of a SLAM algorithm is most affected by the tracking thread. For SLAM using the feature point method, in the tracking thread, the extraction and matching of feature points occupy most of the time of the entire thread. For example, ORB features are composed of key points and descriptors. Research has found that the extraction of descriptors and the use of descriptors for matching account for the vast majority of computing resources. If the descriptors of all frames are calculated, the real-time performance of the algorithm will be greatly affected. All frames are divided into ordinary frames and key frames. For ordinary frames, descriptors only play a matching role and will not be used for positioning and mapping. Descriptors will only play a role in key frames.

[0004] Therefore, if reliable key point correspondence can be established without using descriptors, the real-time performance can be greatly improved and the amount of calculation can be reduced without much loss of accuracy. The greatly reduced amount of calculation can be suitable for embedded platforms with scarce computing resources. Therefore, this kind of synchronous positioning and mapping method with low computing resource requirements and high real-time performance is needed in practical applications. Summary of the invention

[0005] In order to overcome the shortcomings of the prior art and to solve the problem of extracting descriptors in ordinary frames and using the descriptors to match two frames, the present invention provides a fast visual synchronous positioning and mapping method based on bidirectional optical flow, which uses optical flow to match adjacent frames, and then uses reverse optical flow to filter out erroneous matches, and uses a uniform motion model to set the initial pose of the current frame, and uses the initial value of the pose to minimize the reprojection error, thereby improving the real-time performance of the SLAM algorithm without losing accuracy.

[0006] The technical solution proposed by the present invention is as follows:

[0007] A fast visual synchronous positioning and mapping method based on bidirectional optical flow, the method comprising the following steps:

[0008] Step (1), obtain environmental information through the camera, collect RGB image information, send the image to the tracking thread for processing, and obtain camera parameters at the same time;

[0009] Step (2), using the tracking thread to initialize, extracting ORB feature points from the first three frames of images after entering the tracking thread and completing the initialization, creating the first three frames as key frames, obtaining the poses of the initial three frames, obtaining real-time speed information based on the pose relationship between the three frames, initializing the motion model, and setting the initial predicted pose of the current frame based on the motion model;

[0010] Step (3): if the previous frame is a key frame, the feature points of the key frame are used; if the previous frame is a normal frame, the points tracked by the optical flow of the previous frame are used to directly perform optical flow tracking on the subsequent frames, and the initial predicted pose is used as a priori to obtain the key point matching relationship between adjacent frames, and then the reverse optical flow is used to filter out the wrong matches;

[0011] Step (4), judging whether it is necessary to create the current frame as a key frame according to the result of step (3) and the number of map points tracked by the local map of the previous frame;

[0012] Step (5), if the current frame needs to be created as a keyframe, extract new ORB feature points to match with the previous keyframe, take the predicted pose of the current frame as a priori, use the uniform motion model for tracking, and if it fails, use the reference keyframe for tracking;

[0013] Step (6), based on the matching relationship of the current frame and the prior pose, the pose is optimized by minimizing the reprojection error, the optimized external points are removed, and the remaining map points are used for local map tracking to further optimize the pose.

[0014] Furthermore, the process of step (1) is as follows: after collecting environmental information through the camera, the captured image information is sent to the tracking thread for preprocessing, and the image distortion is removed according to the read camera parameters to obtain the final image. The subsequent steps all use the image after this step.

[0015] Furthermore, the process of step (2) is as follows: first, an initialization process needs to be performed through the input image to generate the initial map and set the initial pose; because there is no information after the initialization, and pose information is needed to build a motion model, the first three frames are all set as key frames, and the reference key frames are used to track and obtain the poses of two adjacent frames T cw and T rw , T cw Indicates the pose of the current frame in the world coordinate system, T rw Represents the reference frame or the previous frame's position in the world coordinate system. The expression for obtaining the velocity V is:

[0016] V=T cr =T cw T wr (1)

[0017] Where T wr Essentially T rw The inverse of is the transformation matrix from the reference frame to the world coordinate origin, T cr is the transformation matrix between two frames, and also represents the current speed;

[0018] When a new frame enters, because the time change between frames is very small, it is assumed that the posture changes at a uniform speed, and the transformation matrix from the first frame to the second frame is the same as the transformation matrix from the second to the third frame. The posture of the newly entered frame in the world coordinate system is estimated as:

[0019] T nw =VT cw (2)

[0020] Where T nw is the pose of the new incoming frame predicted by the motion model.

[0021] Of course, the speed of the motion model is not constant, and will change according to the optimization of the posture in the subsequent step (6). The initial predicted posture calculated by the motion model will also become the initial value in step (6), accelerating the convergence of BA.

[0022] Furthermore, the process of step (3) is as follows: the feature point in the previous key frame is used as the initial tracking point, and this tracking point is mainly the key point part of the feature point. The sparse optical flow method is used for tracking. In order to reduce the impact of the spatial consistency assumption of the optical flow when the camera moves faster, an image pyramid is introduced to improve it. The image pyramid is to scale an image according to a certain factor, take the original image as the bottom original image, and obtain a pyramid mode of different resolution layers. In this way, when calculating the optical flow, a coarse to fine optical flow process will be obtained. The calculation starts from the bottom layer of the top resolution, and the result of the current layer is used as the initial prediction value of the next layer. In this way, if the camera moves too fast, assuming that the moving distance of the feature point between the two frames is 50 pixels, then in the above layers, this distance will be reduced by a multiple, strengthening the spatial consistency assumption of the optical flow. The pyramid selected in this method is 4 layers, and the scaling factor is set to 1.2; based on the grayscale invariant assumption of the optical flow, the grayscale parameter corresponding to the key point in the given reference frame is set to I r (x, y), the timestamp of the reference frame is t, and the optical flow correspondence established in the current frame is:

[0023] I c (x+dx,y+dy,t+dt)=I r (x,y,t) (3)

[0024] The formula is subjected to first-order Taylor expansion and deduced to be transformed into a matrix form:

[0025]

[0026] Where μ = dx / dt, v = dy / dt, μ and v represent the speed along the x-axis and y-axis respectively, I x and I y Respectively represented as the image grayscale change gradient along the x-axis and y-axis, I t is the change of the image grayscale of the pixel over time. The image itself contains grayscale information. The initial speed information can be obtained through the motion model in step (2) to accelerate convergence.

[0027] Change formula (4) into the following form:

[0028]

[0029] where A=[I x ,I y ],b=I t , which is converted into the speed of pixel movement between images by solving the equation;

[0030] The above is the operation on a single key point. The actual optical flow tracking is to perform a windowed search, and operate on all key points in the window. The problem can be reduced to, assuming that there are k key points in the window to form k equations, and the k equations are solved to obtain the speed of all key points in the window. The problem is converted into a least squares problem, and the objective function is modeled as:

[0031]

[0032] The above is the process of optical flow tracking. Since there are too many key points to track, it is inevitable that wrong matches will occur. Use the reverse optical flow to track again, that is, use the points tracked in the current frame to re-match the reference frame, record the coordinates of the key points tracked again, and set them as P k , the position of the key point on the original image is P k ', set the flag function for judging whether this key point is tracked successfully to F(k), the expression is:

[0033]

[0034] Where ξ is the set threshold, which means that if the position of the key point predicted by the reverse optical flow deviates from the original position by more than two pixels, the tracking of this point fails, and it is set as an outlier and filtered out. At the same time, in order to increase the probability of retrieving outliers, the pyramid structure is not used here to increase the impact of the destruction of the spatial consistency of the optical flow, which makes it easier to retrieve outliers;

[0035] In order to solve the problem that the previous frame is not a key frame, the key points tracked in the previous frame are used as the initial points for optical flow tracking. The successfully tracked and matched points will retain all their own parameters for subsequent operations, including the matched map points. This tracking method avoids extracting feature points for tracking in each frame.

[0036] Preferably, the process of step (4) is as follows: after step (3), the tracking status of the key points of the current frame will be obtained, and then it will be determined whether to create a key frame. If the local mapping thread is busy, no key frame will be created; when idle, if no key frame has been added for a long time, and the number of key points tracked by the local map of the previous frame through step (6) is much less than the number of map points in the reference key frame, a key frame will be created; when the above is not true, the number of key points tracked by the optical flow in step (3) is less than 200, and a key frame needs to be created.

[0037] Preferably, the process of step (5) is as follows: if it is determined in step (4) that the current frame needs to be created as a key frame, then ORB feature points are extracted from the current frame, and first an attempt is made to use the initial value predicted in step (2) for projection matching. If the number of matching points is greater than a certain threshold, the tracking is successful. If it fails, the reference key frame is used for tracking. It is necessary to convert the descriptor into a bag-of-words vector, and the bag-of-words vector is used to accelerate the matching of feature points between the current frame and the reference key frame.

[0038] Preferably, the process of step (6) is as follows: the pose of the successfully matched points above is optimized by minimizing the reprojection error. When no key frame is created, the successfully matched points of step (4) are used. When a key frame is created, the successfully matched points of step (5) are used as input. Step (2) is used as the initial value to be optimized. The projection model of the camera is:

[0039]

[0040] Among them, p uv Represents the homogeneous coordinates of a point, P w Represents the three-dimensional coordinates of the point in the world coordinate system, Z represents the depth of the point, and P w The z-axis coordinate of the image, K is the internal parameter of the camera, T is the initial input pose, and the problem is transformed into a least squares problem. The pose optimization by minimizing the reprojection error can be modeled as:

[0041]

[0042] Use g2o, a graph optimization library, to minimize the reprojection error and optimize the pose. The rough pose calculated in step (2) based on the motion model can be optimized by formula (9) to obtain a more accurate pose. Finally, the pose and the current frame information are tracked on a local map. The local map points corresponding to the local keyframe of the current frame are projected into the frame to obtain more matching relationships. The previous pose is optimized again to obtain the final pose of the tracking thread and the optimal matching relationship. Finally, the selected keyframe sequence is sent to the backend for optimization and the global map is updated.

[0043] The beneficial effects of this method are: avoiding the extraction of feature points from ordinary frames, using bidirectional optical flow tracking of ordinary frames to obtain a more accurate matching relationship, and only when it is determined that a key frame needs to be created based on the optical flow matching situation and the tracking situation of the current frame map points, the key frame extracted features are matched and tracked, reducing the waste of computing resources, greatly improving the tracking efficiency while having good positioning accuracy, and the real-time performance has been nearly doubled. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1It is a schematic diagram of the framework of the rapid visual synchronous positioning and mapping of bidirectional optical flow of the present invention;

[0045] Figure 2 It is a schematic diagram of the uniform motion model;

[0046] Figure 3 Schematic diagram of an image pyramid;

[0047] Figure 4 Schematic diagram of bidirectional optical flow tracking;

[0048] Figure 5 A schematic diagram of projecting 3D points. DETAILED DESCRIPTION

[0049] The present invention will be further described below in conjunction with embodiments and drawings, but the present invention is not limited thereto.

[0050] Reference Figure 1 to Figure 5 , a fast visual synchronous positioning and mapping method based on bidirectional optical flow, comprising the following steps:

[0051] Step (1): The system for implementing the method includes three modules: uniform motion model, optical flow tracking and reprojection optimization posture. A camera is used as a sensor. After collecting environmental information through the camera, the captured image information is sent to the tracking thread for preprocessing. According to the read camera parameters, the image distortion is removed to obtain the final image. The subsequent steps use the image after this step.

[0052] Step (2): First, an initialization process needs to be performed through the input image to generate the initial map and set the initial pose, because there is no information after the initialization is completed, and the pose information is needed to build the motion model. Figure 2 As shown, the first three frames are all set as key frames, and the reference key frames are used to track the poses of the two adjacent frames T cw and T rw , T cw Indicates the pose of the current frame in the world coordinate system, T rw Represents the reference frame or the previous frame's position in the world coordinate system. The expression for obtaining the velocity V is:

[0053] V=T cr =T cw T wr (10)

[0054] Where T wr Essentially T rw The inverse of is the transformation matrix from the reference frame to the world coordinate origin, T cr is the transformation matrix between two frames, and also represents the current speed;

[0055] When a new frame enters, because the time change between frames is very small, it can be assumed that the posture changes at a uniform speed. The transformation matrix from the first frame to the second frame is the same as the transformation matrix from the second to the third frame. The posture of the newly entered frame in the world coordinate system is estimated as:

[0056] T nw =VT cw (11)

[0057] Where T nw represents the pose of the incoming frame predicted by the motion model.

[0058] Of course, the speed of the motion model is not constant, and will change according to the optimization of the pose in the subsequent step (6). The initial predicted pose calculated by the motion model will also become the initial value in step (6), accelerating the convergence of BA.

[0059] Step (3): The feature point in the previous key frame is used as the initial tracking point. This tracking point is mainly the key point part of the feature point. The sparse optical flow method is used for tracking. In order to reduce the impact of the spatial consistency assumption of the optical flow when the camera moves faster, an image pyramid is introduced to improve it. The image pyramid is to scale an image according to a certain factor, take the original image as the bottom original image, and obtain a pyramid model of different resolution layers. In this way, when calculating the optical flow, a coarse to fine optical flow process will be obtained. The calculation starts from the bottom layer of the top resolution, and the result of the current layer is used as the initial prediction value of the next layer. In this way, if the camera moves too fast, assuming that the moving distance of the feature point between two frames is 50 pixels, then in the above layers, this distance will be reduced by a multiple, strengthening the spatial consistency assumption of the optical flow. The pyramid selected in this method is 4 layers, and the scaling factor is set to 1.2, such as Figure 3 As shown, based on the grayscale invariance assumption of optical flow, the grayscale parameter corresponding to the key point in the given reference frame is set to I r (x, y), the timestamp of the reference frame is t, and the optical flow correspondence established in the current frame is:

[0060] I c (x+dx,y+dy,t+dt)=I r (x,y,t) (12)

[0061] The formula is subjected to first-order Taylor expansion and deduced to be transformed into a matrix form:

[0062]

[0063] Where μ = dx / dt, v = dy / dt, μ and v represent the speed along the x-axis and y-axis respectively, I xand I y Respectively represented as the image grayscale change gradient along the x-axis and y-axis, I t is the change of the image grayscale of the pixel over time. The image itself contains grayscale information. The initial speed information can be obtained through the motion model in step (2) to accelerate convergence.

[0064] Change formula (4) into the following form:

[0065]

[0066] where A=[I x ,I y ],b=I t , which is converted into the speed of pixel movement between images by solving the equation;

[0067] The above is the operation on a single key point. The actual optical flow tracking is to perform a windowed search and operate on all key points in the window. The present invention uses a window with a length and width of 9 to operate on the key points contained in the window. That is, the problem can be reduced to, assuming that there are k key points in the window to form k equations, the k equations are solved to obtain the speed of all key points in the window, and the problem is converted into a least squares problem. The objective function is modeled as:

[0068]

[0069] The above is the process of optical flow tracking. Since there are too many key points to track, it is inevitable that wrong matches will occur. In this method, the reverse optical flow is used for re-tracking, that is, the points tracked in the current frame are used to re-match the reference frame. Bidirectional optical flow tracking is as follows: Figure 4 As shown in the figure, the solid line is the first forward optical flow tracking process, and the dotted line is the reverse optical flow tracking process. The coordinates of the key points tracked again are recorded and set as P k , the position of the key point on the original image is P′ k , set the flag function for judging whether this key point is tracked successfully to F(k), the expression is:

[0070]

[0071] Where ξ is the set threshold, which is set to 2 in this method, indicating that if the position of the key point predicted by the reverse optical flow deviates from the original position by more than two pixels, the tracking of this point fails, and it is set as an outlier and filtered out. At the same time, in order to increase the probability of retrieving outliers, the pyramid structure is not used here to increase the impact of the destruction of the spatial consistency of the optical flow, which makes it easier to retrieve outliers;

[0072] In order to solve the problem that the previous frame is not a key frame, similarly, the key points tracked in the previous frame are used as the initial points for optical flow tracking. The successfully tracked and matched points will retain all their own parameters for subsequent operations, including the matched map points. This tracking method avoids extracting feature points for tracking in each frame;

[0073] Step (4): After step (3), the tracking status of the key points of the current frame will be obtained, and then it will be determined whether to create a key frame. If the local map construction thread is busy, no key frame will be created. When idle, if no key frame has been added for a long time, and the number of key points tracked by the local map in the previous frame through step (6) is much less than the number of map points in the reference key frame, a key frame will be created. When the above is not true, the number of key points tracked by the optical flow in step (3) is less than 200, and a key frame needs to be created;

[0074] Step (5): If the current frame needs to be created as a key frame after the judgment in step (4), then ORB feature points are extracted from the current frame. First, the initial value predicted in step (2) is tried for projection matching. If the number of matching points is greater than a certain threshold, the tracking is successful. If it fails, the reference key frame is used for tracking. The descriptor needs to be converted into a bag-of-words vector, and the bag-of-words vector is used to accelerate the feature point matching between the current frame and the reference key frame.

[0075] Step (6): Optimize the pose by minimizing the reprojection error of the successfully matched points above. When no keyframe is created, the successfully matched points in step (4) are used. When a keyframe is created, the successfully matched points in step (5) are used as input, and step (2) is used as the initial value to be optimized. The projection model of the camera is:

[0076]

[0077] Among them, p uv Represents the homogeneous coordinates of a point, P w Represents the three-dimensional coordinates of the point in the world coordinate system, Z represents the depth of the point, and P w The z-axis coordinate of the image, K is the intrinsic parameter of the camera, and T is the initial pose of the input. Figure 5 The figure is a schematic diagram of the projection of 3D points. The dotted line indicates the input value, that is, the predicted position, which has a certain deviation from the actual position. Therefore, it is necessary to optimize the predicted posture and make it as close to the actual position as possible. Therefore, the problem is transformed into a least squares problem. The posture optimized by minimizing the reprojection error can be modeled as follows:

[0078]

[0079] Use g2o, a graph optimization library, to minimize the reprojection error and optimize the pose. The rough pose calculated according to the motion model in step (2) can be optimized by formula (9) to obtain a more accurate pose. Finally, the pose and the current frame information are tracked on a local map. The local map points corresponding to the local keyframe of the current frame are projected into the frame to obtain more matching relationships. The previous pose is optimized again to obtain the final pose of the tracking thread and the optimal matching relationship. Finally, the filtered keyframe sequence is sent to the backend for optimization and the global map is updated.

[0080] The following embodiments are merely simplified examples of the present invention, used to illustrate the superiority of the present invention in terms of accuracy and real-time performance of simultaneous positioning and mapping, and do not represent or limit the scope of protection of the present invention. The scope of protection of the present invention shall be subject to the claims.

[0081] Embodiment 1:

[0082] This embodiment is used to illustrate that the real-time performance of the synchronous positioning and mapping method described in the present invention is greatly improved while maintaining high accuracy. This embodiment uses the data set of TUM for testing, mainly selecting the sequence of static objects, and comparing the accuracy and tracking time consumption with the most classic feature point method ORB-SLAM2. 9 sequences are tested. Because the time consumption of each sequence is affected by the camera motion and the environment, the average time consumption of all sequences is taken. Table 1 shows the comparison of the average time consumption of the tracking method used in the present invention and ORB-SLAM2 in tracking one frame. Table 2 shows the comparison of the accuracy of the two methods, using the root mean square error as the standard, the accuracy is m, and all data are averaged after multiple measurements.

[0083] Tracking time / s ORB-SLAM2 0.023 Ours 0.012

[0084] Table 1

[0085]

[0086]

[0087] Table 2

[0088] By comparison, it can be concluded that the tracking efficiency of the present invention has been nearly doubled compared to the comparison method, and the positioning still maintains a high accuracy, and even improves on some sequences. The results of this embodiment prove that the method adopted by the present invention has achieved a significant improvement in real-time performance while maintaining high accuracy, reducing unnecessary calculations and improving the efficiency of the entire system.

[0089] The contents described in the embodiments of this specification are merely enumerations of implementation forms of the inventive concept and are for illustrative purposes only. The protection scope of the present invention should not be considered to be limited to the specific forms described in this embodiment, and the protection scope of the present invention also extends to equivalent technical means that can be thought of by ordinary technicians in this field based on the inventive concept.

Claims

1. A fast visual simultaneous localization and mapping method based on bidirectional optical flow, It is characterized in that The method comprises the following steps: Step (1), obtain environmental information through the camera, collect RGB image information, send the image to the tracking thread for processing, and obtain camera parameters at the same time; Step (2), using the tracking thread to initialize, extracting ORB feature points from the first three frames of images after entering the tracking thread and completing the initialization, creating the first three frames as key frames, obtaining the poses of the initial three frames, obtaining real-time speed information based on the pose relationship between the three frames, initializing the motion model, and setting the initial predicted pose of the current frame based on the motion model; Step (3): if the previous frame is a key frame, the feature points of the key frame are used; if the previous frame is a normal frame, the points tracked by the optical flow of the previous frame are used to directly perform optical flow tracking on the subsequent frames, and the initial predicted pose is used as a priori to obtain the key point matching relationship between adjacent frames, and then the reverse optical flow is used to filter out the wrong matches; Step (4), judging whether it is necessary to create the current frame as a key frame according to the result of step (3) and the number of map points tracked by the local map of the previous frame; Step (5), if the current frame needs to be created as a keyframe, extract new ORB feature points to match with the previous keyframe, take the predicted pose of the current frame as a priori, use the uniform motion model for tracking, and if it fails, use the reference keyframe for tracking; Step (6), based on the matching relationship of the current frame and the prior pose, the pose is optimized by minimizing the reprojection error, the optimized external points are removed, and the remaining map points are used for local map tracking to further optimize the pose.

2. The method for rapid visual synchronous positioning and mapping based on bidirectional optical flow according to claim 1, Features: The process of step (1) is as follows: After collecting environmental information through the camera, the captured image information is sent to the tracking thread for preprocessing. According to the read camera parameters, the image distortion is removed to obtain the final image. The subsequent steps use the image after this step.

3. The method for rapid visual synchronous positioning and mapping based on bidirectional optical flow according to claim 1 or 2, Features: The process of step (2) is as follows: First, an initialization process needs to be performed through the input image to generate the initial map and set the initial pose. Because there is no information after initialization, and pose information is needed to build a motion model, the first three frames are all set as key frames, and the reference key frames are used to track and obtain the poses of two adjacent frames. cw and T rw , T cw Indicates the pose of the current frame in the world coordinate system, T rw Represents the reference frame or the previous frame's position in the world coordinate system. The expression for obtaining the velocity V is: V=T cr =T cw T wr (1) Where T wr Essentially T rw The inverse of is expressed as the transformation matrix from the reference frame to the world coordinate origin, T cr That is, the transformation matrix between two frames, also expressed as the current speed; When a new frame enters, because the time change between frames is very small, assuming that the posture changes at a uniform speed, the transformation matrix from the first frame to the second frame is the same as the transformation matrix from the second to the third frame, so the posture of the newly entered frame in the world coordinate system is estimated to be: T nw =VT cw (2) Where T nw represents the pose of the incoming frame predicted by the motion model.

4. The method for rapid visual synchronous positioning and mapping based on bidirectional optical flow according to claim 1 or 2, Features: The process of step (3) is as follows: The feature point in the previous key frame is used as the initial tracking point. This tracking point is mainly the key point part of the feature point. The sparse optical flow method is used for tracking. In order to reduce the impact of the spatial consistency assumption of the optical flow when the camera moves faster, the image pyramid is introduced to improve it. The image pyramid is to scale an image according to a certain magnification, take the original image as the bottom original image, and obtain the pyramid mode of different resolution layers. In this way, when calculating the optical flow, a coarse to fine optical flow process will be obtained. The calculation starts from the bottom layer of the top resolution, and the result of the current layer is used as the initial prediction value of the next layer; in this way, if the camera moves too fast, assuming that the moving distance of the feature point between the two frames is 50 pixels, then in the above layers, this distance will be reduced by multiples, strengthening the spatial consistency assumption of the optical flow. Based on the assumption that the grayscale of the optical flow is unchanged, the grayscale parameter corresponding to the key point in the given reference frame is set to I r (x, y), the timestamp of the reference frame is t, and the optical flow correspondence established in the current frame is: I c (x+dx,y+dy,t+dt)=I r (x,y,t) (3) The formula is subjected to first-order Taylor expansion and deduced to be transformed into a matrix form as follows: Where μ = dx / dt, v = dy / dt, μ and v represent the speed along the x-axis and y-axis respectively, I x and I y Respectively represented as the image grayscale change gradient along the x-axis and y-axis, I t is the change of the image grayscale of the pixel over time. The image itself contains grayscale information. The initial speed information can be obtained through the motion model in step (2) to accelerate convergence. Change formula (4) into the following form: where A=[I x ,I y ],b=I t , which is converted into the speed of pixel movement between images by solving the equation; The above is the operation on a single key point. The actual optical flow tracking is to perform a windowed search, operate on all key points in the window, and operate on the key points contained in the window. That is, the problem can be reduced to, assuming that there are k key points in the window to form k equations, solve the k equations to obtain the speed of all key points in the window, and transform the problem into a least squares problem. The objective function is modeled as: The above is the process of optical flow tracking. Since there are too many key points to track, it is inevitable that wrong matches will occur. Use the reverse optical flow to track again, that is, use the points tracked in the current frame to re-match the reference frame, record the coordinates of the key points tracked again, and set them as P k , the position of the key point on the original image is P k ', set the flag function for judging whether this key point is tracked successfully to F(k), the expression is: Where ξ is the set threshold, which means that if the position of the key point predicted by the reverse optical flow deviates from the original position by more than two pixels, the tracking of this point fails, and it is set as an outlier and filtered out. At the same time, in order to increase the probability of retrieving outliers, the pyramid structure is not used here to increase the impact of the destruction of the spatial consistency of the optical flow, which makes it easier to retrieve outliers; In order to solve the problem that the previous frame is not a key frame, the key points tracked in the previous frame are used as the initial points for optical flow tracking. The successfully tracked and matched points will retain all their own parameters for subsequent operations, including the matched map points. This tracking method avoids extracting feature points for tracking in each frame.

5. The method for rapid visual synchronous positioning and mapping based on bidirectional optical flow according to claim 1 or 2, Features: The process of step (4) is as follows: After step (3), the tracking status of the key points of the current frame will be obtained. Subsequently, it will be determined whether to create a key frame. If the local mapping thread is busy, no key frame will be created. When idle, if no key frame has been added for a long time, and the number of key points tracked by the local map in the previous frame through step (6) is much less than the number of map points in the reference key frame, a key frame will be created. When the above is not true, the number of key points tracked by the optical flow in step (3) is less than 200, and a key frame needs to be created.

6. The method for rapid visual synchronous positioning and mapping based on bidirectional optical flow according to claim 1 or 2, Features: The process of step (5) is as follows: If it is determined in step (4) that the current frame needs to be created as a key frame, then ORB feature points are extracted from the current frame. First, an attempt is made to use the initial value predicted in step (2) for projection matching. If the number of matching points is greater than a certain threshold, the tracking is successful. If it fails, the reference key frame is used for tracking. The descriptor needs to be converted into a bag-of-words vector, and the bag-of-words vector is used to accelerate the matching of feature points between the current frame and the reference key frame.

7. The method for rapid visual synchronous positioning and mapping based on bidirectional optical flow according to claim 1 or 2, Features: The process of step (6) is as follows: The pose of the successfully matched points above is optimized by minimizing the reprojection error. When no keyframe is created, the successfully matched points in step (4) are used. When a keyframe is created, the successfully matched points in step (5) are used as input. Step (2) is used as the initial value to be optimized. The projection model of the camera is: Among them, p uv Represents the homogeneous coordinates of a point, P w Represents the three-dimensional coordinates of the point in the world coordinate system, Z represents the depth of the point, and P w The z-axis coordinate of the image, K is the internal parameter of the camera, T is the initial input pose, and the problem is transformed into a least squares problem. The pose optimization model is minimized by minimizing the reprojection error: Use g2o, a graph optimization library, to minimize the reprojection error and optimize the pose. The rough pose calculated according to the motion model in the optimization step (2) is obtained through equation (9), and a more accurate pose is obtained. Finally, the pose and the current frame information are tracked on a local map. The local map points corresponding to the local keyframe of the current frame are projected into the frame to obtain more matching relationships. The previous pose is optimized again to obtain the final pose of the tracking thread and the optimal matching relationship. Finally, the filtered keyframe sequence is sent to the backend for optimization and the global map is updated.

Citation Information

Cited By

  • Marine visual SLAM pose estimation method and device, computer equipment and storage medium

    CN119006769A

  • Binocular camera low-delay synchronization method

    CN121056583A

  • Binocular camera low latency synchronization method

    CN121056583B