The present application claims priority from the Chinese Invention Patent Application No. 202110670789.1 filed Jun. 17, 2021, and the disclosure of which is incorporated herein by reference in its entirety.
This application relates to the field of electronic technologies, and more specifically, to a monocular visual simultaneous localization and mapping (SLAM) data processing method, apparatus, terminal, and non-transitory computer-readable storage medium for implementing the same.
In recent years, the simultaneous localization and mapping (SLAM) technology has been playing an important role in localization in an unknown environment, and particularly in a scenario in which technologies such as GPS dependent on the external environment to provide localization assistance cannot be used. At present, in monocular SLAM, the positions and postures of acquisition visions are generally deduced according to changes in feature points in two photos of a same object obtained under different acquisition visions. However, during the selection of the feature points in the two photos to obtain the positions and postures of the acquisition visions, there are usually problems such as mismatches, incomplete matching, and invalid matching in the process of feature point matching. As a result, the obtained positions and postures of the acquisition visions are inaccurate, thereby affecting the accuracy of localization.
Implementations of this application provide a monocular visual simultaneous localization and mapping (SLAM) data processing method, apparatus, terminal, and non-transitory computer-readable storage medium for implementing the same.
The data processing method provided in the implementations of this application includes: obtaining rotation angular velocities and accelerations of a camera cyclically; obtaining a plurality of feature point pairs in two frames of images acquired by the camera, and obtaining pixel coordinate values of feature points in the feature point pairs, where each of the feature point pairs includes two feature points that correspond to a same feature of a same object and that are respectively in the two frames of images; constructing epipolar constrict equations and calculating to-be-selected rotation matrices and to-be-selected displacement matrices according to pixel coordinate values and the epipolar constraint equations; obtaining a reference rotation matrix of the camera according to the rotation angular velocities of the camera, and obtaining a reference displacement matrix of the camera according to the accelerations of the camera; and filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the reference rotation matrix of the camera and the reference displacement matrix of the camera.
The data processing apparatus provided in the implementations of this application includes an obtaining module and a filtering module. The obtaining module is configured to: obtain rotation angular velocities and accelerations of a camera cyclically; obtain a plurality of feature point pairs in two frames of images acquired by the camera, and obtain pixel coordinate values of feature points, where each of the feature point pairs includes two feature points that correspond to a same feature of a same object and that are in the two frames of images acquired by the camera; obtain to-be-selected rotation matrices and to-be-selected displacement matrices according to the pixel coordinate values; and obtain a reference rotation matrix of the camera according to the rotation angular velocities of the camera, and obtain a reference displacement matrix of the camera according to the accelerations of the camera. The filtering module is configured to filter the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the reference rotation matrix of the camera and the reference displacement matrix of the camera.
The terminal provided in the implementations of this application includes a camera, one or more processors, a memory, and one or more programs. The camera is configured to acquire an image. The one or more programs are stored in the memory and executed by the one or more processors, where the programs include instructions for performing the data processing method according to any one of the following: obtaining rotation angular velocities and accelerations of a camera cyclically; obtaining a plurality of feature point pairs in two frames of images acquired by the camera, and obtaining pixel coordinate values of feature points in the feature point pairs, where each of the feature point pairs includes two feature points that correspond to a same feature of a same object and that are respectively in the two frames of images; constructing epipolar constrict equations and calculating to-be-selected rotation matrices and to-be-selected displacement matrices according to pixel coordinate values and the epipolar constraint equations; obtaining a reference rotation matrix of the camera according to the rotation angular velocities of the camera, and obtaining a reference displacement matrix of the camera according to the accelerations of the camera; and filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the reference rotation matrix of the camera and the reference displacement matrix of the camera.
The non-transitory computer-readable storage medium provided in the implementations of this application includes a computer program, the computer program, when executed by one or more processors, causing the one or more processors to perform the following data processing method: obtaining rotation angular velocities and accelerations of a camera cyclically; obtaining a plurality of feature point pairs in two frames of images acquired by the camera, and obtaining pixel coordinate values of feature points in the feature point pairs, where each of the feature point pairs includes two feature points that correspond to a same feature of a same object and that are respectively in the two frames of images; constructing epipolar constrict equations and calculating to-be-selected rotation matrices and to-be-selected displacement matrices according to pixel coordinate values and the epipolar constraint equations; obtaining a reference rotation matrix of the camera according to the rotation angular velocities of the camera, and obtaining a reference displacement matrix of the camera according to the accelerations of the camera; and filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the reference rotation matrix of the camera and the reference displacement matrix of the camera.
The data processing method, the data processing apparatus, the terminal, and the non-transitory computer-readable storage medium provided in the implementations of this application can accurately select a combination of to-be-selected rotation matrix and to-be-selected displacement matrix in a monocular visual SLAM method, to ensure that accurate posture and position are obtained by using the monocular visual SLAM method and improve the accuracy of localization. The to-be-selected rotation matrix and the to-be-selected displacement matrix are obtained from a plurality of to-be-selected rotation matrices and a plurality of to-be-selected displacement matrices according to epipolar constraint relationships of the feature point pairs in the two frames of images, and are configured to determine a pose of the camera.
Additional aspects and advantages of the implementations of this application will be partially given in the following descriptions, some of which will become apparent from the following descriptions or may be learned through practices of the implementations of this application.
The foregoing and/or additional aspects and advantages of this application will become apparent and comprehensible from the descriptions of the implementations below with reference to the accompanying drawings.
The following describes the implementations of this application in detail. Examples of the implementations are shown in the accompanying drawings, and same or similar reference signs in all the accompanying drawings indicate same or similar components or components having same or similar functions. The implementations that are described below with reference to the accompanying drawings are exemplary, and are only used to explain the implementations of this application and cannot be construed as a limitation to the implementations of this application.
The visual simultaneous localization and mapping (SLAM) technology is a technology that a terminal (a camera, a robot, a mobile platform, or the like) perceives an environment (captures an images or a video of the environment) during movement to locate the terminal. Particularly, in an unknown environment, or in an environment in which navigation devices such as a GPS cannot be used, the visual SLAM technology can be applied to build a map of the current environment according to environment information acquired by the terminal, and accurately determine the position of the terminal in the current environment (the map of the current environment).
Monocular visual SLAM, or monocular SLAM, is a technology to perform SLAM merely using a single camera (vision sensor). The monocular visual SLAM requires the camera to capture at least two frames of images, and to perform data processing on pixel coordinate values of a plurality of feature points corresponding to a same feature of a same object in the two frames of images to build a map of a current environment and obtain a pose of the camera, thereby locating the position of the camera in the current environment (the map of the current environment) according to the pose of the camera.
Referring to
01: Obtaining rotation angular velocities and accelerations of a camera 40 cyclically;
02: Obtaining a plurality of feature point pairs in two frames of images acquired by the camera 40, and obtaining pixel coordinate values of feature points in the feature point pairs, where each of the feature point pairs includes two feature points that correspond to a same feature of a same object and that are respectively in the two frames of images;
03: Obtaining to-be-selected rotation matrices and to-be-selected displacement matrices according to the pixel coordinate values;
04: Obtaining a reference rotation matrix of the camera 40 according to the rotation angular velocities, and obtaining a reference displacement matrix of the camera 40 according to the accelerations; and
05: Filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the reference rotation matrix and the reference displacement matrix.
Referring to
The terminal 100 may be a smartphone, a computer, a mobile platform, a smart watch, a smart bracelet, a smart helmet, or another device, which is not limited herein. The mobile platform may be an unmanned mobile platform such as an unmanned aerial vehicle, an unmanned vehicle, an unmanned ship, and autonomous patrol/surveillance system, or may be a manned mobile platform such as a vehicle, an airplane, or a ship. In one embodiment, the camera 40 may be integrally integrated on the terminal 100. In another embodiment, the camera 40 may be independent from the terminal 100 and detachably mounted on the terminal 100. No limitations are made hereto.
Referring to
In the data processing method provided in the implementations of this application, data processing is performed on the obtained rotation angular velocities and accelerations of the camera 40, to obtain the reference rotation matrix and the reference displacement matrix of the camera 40. In addition, data processing is performed on the obtained pixel coordinate values of the feature points, to obtain the to-be-selected rotation matrices and the to-be-selected displacement matrices, where there are a plurality of to-be-selected rotation matrices and a plurality of to-be-selected displacement matrices. Furthermore, data processing is performed on the reference rotation matrix, the reference displacement matrix, the to-be-selected rotation matrices, and the to-be-selected displacement matrices, to select one rotation matrix and one displacement matrix from the plurality of to-be-selected rotation matrices and the plurality of to-be-selected displacement matrices. The filtered-out rotation matrix and the filtered-out displacement matrix are used as a pose of the camera 40 at a current position, so as to accurately locate the camera 40.
Referring to
Specifically, referring to
Referring to
In this implementation of this application, on the one hand, the to-be-selected rotation matrices and the to-be-selected displacement matrices are obtained by using a monocular visual SLAM method according to the pixel coordinate values of the feature points in the feature point pairs; and on the other hand, the rotation angular velocities and the accelerations of the camera 40 are detected by using hardware devices such as a gyroscope and an accelerometer, to obtain the reference rotation matrix of the camera 40 according to the rotation angular velocities, and obtain the reference displacement matrix of the camera 40 according to the accelerations. Finally, the to-be-selected rotation matrices and the to-be-selected displacement matrices are filtered according to the reference rotation matrix and the reference displacement matrix. The rotation angular velocities and the accelerations of the camera 40 are detected by the hardware device based on actual photographing directions of the camera 40. Therefore, by filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the reference rotation matrix and the reference displacement matrix, the filtering accuracy can be ensured, so that an accurate to-be-selected rotation matrix and to-be-selected displacement matrix are selected, thereby obtaining an accurate pose of the camera 40, and improving the accuracy of localization.
Descriptions are further provided below with reference to the accompanying drawings.
Referring to
Referring to
Referring to
011: Performing equal-period acquisition according to a fixed sampling frequency and record an acquisition time stamp.
Referring to
Referring to
Referring to
An acquisition period includes an acquisition period T1 corresponding to finishing one rotation angular velocity acquisition and an acquisition period T2 corresponding to finishing one acceleration acquisition. Equal-period acquisition specifically refers to that intervals of acquisition periods T1 are equal, and/or intervals of periods T2 are equal. For example, if the sampling frequency f2 of acquiring the acceleration is 2 times/second, and the acquisition period T2 corresponding to each time of sampling is 0.5 seconds, the acceleration is sampled twice within 1 second, and the duration for each acquisition is 0.5 seconds.
Recording the acquisition time stamp includes recording an acquisition time stamp Q1 corresponding to a moment at which the rotation angular velocity is acquired and an acquisition time stamp Q2 corresponding to a moment at which the acceleration is acquired. Taking the acquisition time stamp Q1 as an example, the acquisition time stamp Q1 may be a start moment of the acquisition period T1 of acquiring the rotation angular velocity, or an end moment of the acquisition period T1, or a moment between the start moment and the end moment of the acquisition period T1, which is not limited herein. Similarly, the acquisition time stamp Q2 may be a start moment of the acquisition period T2 of acquiring the acceleration, or an end moment of the acquisition period T2, or a moment between the start moment and the end moment of the acquisition period T2, which is not limited herein.
Referring to
012: Perform acquisition according to a variable period and record an acquisition time stamp.
Referring to
Referring to
Referring to
Referring to
The two frames of images specifically refer to two obtained frames of images which are temporally adjacent. Taking acquiring the acceleration of the camera 40 as an example. A time period of obtaining the acceleration may be represented as the acquisition period T2 corresponding to finishing one acceleration acquisition. The time period of obtaining the acceleration falls within the time period of acquiring the two frames of images, which may specifically refer to that the start moment of the acquisition period T2 is later than or equal to a first moment t1 of acquiring the first frame of image P1, and the end moment of the acquisition period T2 is earlier than a second moment t2 of acquiring the second frame of image P2. For example, if the camera 40 acquires the image P1 at the 1st second, and acquires the image P2 at the 2nd second, and the sampling frequency f2 of acquiring the acceleration is 1 time/second, the acceleration is acquired once in the time period of acquiring the two frames of images, and the acquisition period T2 corresponding to acquiring the acceleration needs to be less than or equal to 1 second, so that the time period of obtaining the acceleration falls within the time period of acquiring the two frames of images. If the acquisition period T2 corresponding to acquiring the acceleration is 0.5 seconds, the start moment of the acquisition period T2 cannot be earlier than the 1st second at the earliest. Otherwise, part of the acquisition period T2 will fall beyond the time period of acquiring the image P1 and the image P2. In addition, the start moment of the acquisition period T2 cannot be later than the 1.5th second at the latest. Otherwise, the end moment of the acquisition period T2 will be later than the 2nd second, causing part of the acquisition period T2 to fall beyond the time period of acquiring the image P1 and the image P2. The time period of obtaining the rotation angular velocity of the camera 40 is similar to the time period of obtaining the acceleration mentioned above, which is not described in detail herein.
Referring to
Referring to
041: Integrating the rotation angular velocities to calculate a plurality of Euler angles of the camera 40, and integrating the plurality of Euler angles to calculate the reference rotation matrix of the camera 40; and
042: Integrating the accelerations to calculate the reference displacement matrix of the camera 40.
Referring to
Referring to
Referring to
In one embodiment, at least two accelerations are acquired between the first moment t1 corresponding to acquiring the first frame of image P1 and the second moment t2 corresponding to acquiring the second frame of image P2. The processors 30 obtain the first moment t1 and the second moment t2, and filter out acquisition time stamps Q2,n between the first moment t1 and the second moment t2 from a plurality of acquisition time stamps Q2 of acquiring the accelerations, where n is a natural number greater than or equal to 1. According to the acquisition time stamps Q2,n, accelerations An respectively corresponding to the acquisition time stamps Q2,n can be determined. The accelerations An are integrated to calculate a reference displacement matrix Wm of the camera 40.
Referring to
Therefore, regardless of the accuracy of a rotation angle of the camera 40 that can be obtained according to the reference rotation matrix Rm, and regardless of the accuracy of displacement of the camera 40 that can be obtained according to the reference displacement matrix Wm, at least a pose of the camera 40 corresponding to the reference rotation matrix Rm and the reference displacement matrix Wm can correspond to the photographing directions of the camera 40 shown in
Referring to
In one embodiment, Gaussian filter may be performed on the two frames of images acquired by the camera 40, and a Hessian matrix is constructed, to preliminarily generate interest points with obvious edge features and/or obvious brightness features in the two frames of images, where an interest point is a pixel point. In addition, corresponding scale spaces are respectively constructed for the two frames of images, and a comparison is performed between a feature value of an interest point and a feature value of an adjacent pixel point in a three-dimensional neighborhood of the scale space. If the feature value of the interest point is the greatest, the interest point is retained as a to-be-matched point. The feature value may include an edge feature value, a brightness feature, or the like, which is not limited herein. After a plurality of to-be-matched points in the two frames of images are obtained, Euclidean distances between a to-be-matched point in one frame of image and to-be-matched points in an other frame of image are respectively calculated. A to-be-matched point corresponding to a shortest Euclidean distance in the other frame of image and the to-be-matched point form a feature point pair. The two to-be-matched points forming the feature point pair are two feature points. By analogy, to-be-matched points in the other frame of image respectively matching to-be-matched points in the frame of image are calculated to obtain a plurality of feature point pairs in the two frames of images acquired by the camera 40. The manner of obtaining the feature point pairs is not limited to the manner in this embodiment, and no limitations are made hereto.
Referring to
021: Obtaining original coordinate values of each of the feature points in each feature point pair in the corresponding image; and
022: Normalizing the original coordinate values to obtain pixel coordinate values of each feature point in the feature point pair.
Referring to
Referring to
Referring to
Referring to
031: Constructing epipolar constraint equations; and
032: Calculating the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the pixel coordinate values and the epipolar constraint equations.
Referring to
Referring to
Referring to
that is [x1x2 x1y2 x1 y1x2 y1y2 x2 y2 1]·e=0 Wherein, e=[e1 e2 e3 e4 e5 e6 e7 e8 e9]T indicates the degree of freedom of the essential matrix E.
In an implementation of this application, n epipolar constraint equations respectively corresponding to n feature point pairs can be constructed, and the degree of freedom e in the foregoing equation can be calculated according to the n epipolar constraint equations, to calculate solutions of the epipolar constraint equations. Wherein, n is a natural number greater than or equal to 8. Taking n=8 as an example, (x1i,y1i,1) is used to indicate pixel coordinate values of a feature point of the ith feature point pair in the first frame of image, and (x2i,y2i,1) is used to indicate pixel coordinate values of a feature point of the ith feature point pair in the second frame of image, where i=1, 2, 3, 4, 5, 6, 7, or 8. 8 epipolar constraint equations corresponding to 8 feature point pairs have the following relationship:
The essential matrix E can be obtained by individually substituting pixel coordinate values of feature points in the 8 feature point pairs into the foregoing equation. Singular value decomposition is performed on the obtained essential matrix E to obtain the following relationship: E=UΣVT, and Rs1=URz(π/2)VT, Rs2=URz(π/−2)VT, Ws1=±URz( 7/2)UT, and Ws2=±URz(π/−2)UT are respectively obtained. The to-be-selected rotation matrices include Rs1 and Rs2, and the to-be-selected displacement matrices include Ws1 and Ws2. Rz(Ø) indicates a corresponding rotation matrix R rotating around the z-axis in the three-dimensional spatial coordinate system by a particular angle. In the foregoing equation, Ø=±π/2. URz(π/2)UT and −URz(π/2)UT represent a same displacement matrix, so that any one of URz(π/2)UT and −URz(π/2)UT may be used as the to-be-selected displacement matrix Ws1. Similarly, any one of URz(π/−2) UT and −URz(π/−2)UT may be used as the to-be-selected displacement matrix Ws2.
Referring to
Referring to
051: Obtaining a reference rotation vector of the reference rotation matrix, a reference displacement vector of the reference displacement matrix, to-be-selected rotation vectors of the to-be-selected rotation matrices, and to-be-selected displacement vectors of the to-be-selected displacement matrices;
052: Obtaining rotation vector angles between the reference rotation vector and the to-be-selected rotation vectors, and obtain displacement vector angles between the reference displacement vector and the to-be-selected displacement vectors; and
053: Filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the rotation vector angles and the displacement vector angles.
Referring to
Referring to
Specifically, for the rotation matrix R, there is the following relationship: RλR=cos θ λR+(1+cos θ)λR|λ2K+sin θ KλR, where K is a rotation axis unit vector, and λR is a rotation vector corresponding to the rotation matrix R. There is the following relationship between the rotation matrix R and the rotation vector λR: λRθ=RλR. The vector λRθ is a vector obtained after the vector λR rotates by an angle of θ. The rotation vector λR corresponding to the rotation matrix R can be determined according to the foregoing two relations. In this way, a reference rotation vector λRm corresponding to the reference rotation matrix Rm can be obtained according to the reference rotation matrix Rm; a to-be-selected rotation vector λRs1 corresponding to the to-be-selected rotation matrix Rs1 can be obtained according to the to-be-selected rotation matrix Rs1; and a to-be-selected rotation vector λRs2 corresponding to the to-be-selected rotation matrix Rs2 can be obtained according to the to-be-selected rotation matrix Rs2.
Further, the to-be-selected rotation matrix Rs1=URz(π/2)VT, and the to-be-selected rotation matrix Rs2=URz(π/−2)VT. The to-be-selected rotation vector λRs1 and to-be-selected rotation vector λRs2 can be determined as a pair of opposite vectors according to the relationship between Rs1 and Rs2.
For the displacement matrix W, the displacement matrix W is a product of components of a displacement vector λW in the x-axis, y-axis, and z-axis in the three-dimensional spatial coordinate system in essence. Therefore, if the displacement matrix W is known, the displacement matrix W can be directly converted into the corresponding displacement vector λW. In this way, a reference displacement vector λWm corresponding to the reference displacement matrix Wm can be obtained according to the reference displacement matrix Wm; a to-be-selected displacement vector λWs1 corresponding to the to-be-selected displacement matrix Wi can be obtained according to the to-be-selected displacement matrix Ws1; and a to-be-selected displacement vector λWs2 corresponding to the to-be-selected displacement matrix Ws2 can be obtained according to the to-be-selected displacement matrix Ws2.
Further, the to-be-selected displacement matrix Ws1=±URz(π/2)UT, and the to-be-selected displacement matrix Ws2=±URz(π/−2)UT. The to-be-selected displacement vector λWs1 and to-be-selected displacement vector λWs2 can be determined as a pair of opposite vectors according to the relationship between Ws1 and Ws2.
After the reference rotation vector λRm, the to-be-selected rotation vector λRs1, and the to-be-selected rotation vector λRs2 are obtained, a rotation vector angle θR1 between the reference rotation vector λRm and the to-be-selected rotation vector λRs1 and a rotation vector angle θR2 between the reference rotation vector λRm and the to-be-selected rotation vector λRs1 can respectively be obtained, so that the to-be-selected rotation matrix can be selected according to the rotation vector angle θR1 and the rotation vector angle θR2. After the reference displacement vector λWm, the to-be-selected displacement vector λWs1, and the to-be-selected displacement vector λWs2 are obtained, a displacement vector angle θW1 between the reference displacement vector λWm and the to-be-selected displacement vector λWs1 and a displacement vector angle θW2 between the reference displacement vector λWm and the to-be-selected displacement vector λWs2 can respectively be obtained, so that the to-be-selected displacement matrix can be selected according to the displacement vector angle θW1 and the displacement vector angle θW2.
Referring to
0531: Obtaining a first rotation vector angle between the reference rotation vector and the first rotation vector, obtaining a second rotation vector angle between the reference rotation vector and the second rotation vector, obtaining a first displacement vector angle between the reference displacement vector and the first displacement vector, and obtaining a second displacement vector angle between the reference displacement vector and the second displacement vector;
0532: Selecting a to-be-retained one from the first rotation vector and the second rotation vector and a to-be-retained one from the first displacement vector and the second displacement vector according to the first rotation vector angle, the second rotation vector angle, the first displacement vector angle, and the second displacement vector angle; and
0533: Using the to-be-selected rotation matrix corresponding to the retained first rotation vector or the to-be-selected rotation matrix corresponding to the retained second rotation vector as a localization rotation matrix and the to-be-selected displacement matrix corresponding to the retained first displacement vector or the to-be-selected displacement matrix corresponding to the retained second displacement vector as a localization displacement matrix when the filtering succeeds.
Referring to
Referring to
Referring to
Specifically, whether a to-be-selected vector is in the same direction with a reference vector may be determined according to an angle between the to-be-selected vector and the reference vector. Taking the to-be-selected rotation vector λRs and the reference rotation vector λRm as an example. If an angle between the to-be-selected rotation vector λRs and the reference rotation vector λRm is less than 90°, the to-be-selected rotation vector λRs and the reference rotation vector λRm are considered in the same direction; otherwise, that is, if the angle between the to-be-selected rotation vector λRs and the reference rotation vector λRm is greater than or equal to 90°, the to-be-selected rotation vector λRs and the reference rotation vector λRm are considered not in the same direction. The implementations of this application are not limited to determining whether vectors are in the same direction according to whether an angle between the vectors is less than 90°, and can also use whether the angle between the vectors is less than 80°, 70°, 60°, 50°, 40°, 30°, 200 or 10°, and even whether the angle between the vectors is equal to 0° as a more strict judgment bases, which are not listed herein one by one. Similarly, whether the reference displacement vector λWm and the to-be-selected displacement vector λWs are in the same direction may be determined according to whether an angle between the reference displacement vector λWm and the to-be-selected displacement vector λWs is less than 90°.
As described above, the to-be-selected rotation vectors λRs include a first rotation vector λRs1 and a second rotation vector λRs2, a first rotation vector angle between the reference rotation vector λRm and the first rotation vector λRs1 is θR1, and a second rotation vector angle between the reference rotation vector λRm and the second rotation vector λRs2 is θR2.
The to-be-selected displacement vectors λWs include a first displacement vector λWs1 and a second displacement vector λW2, a displacement vector angle between the reference displacement vector λWm and the first displacement vector λWs1 is θW1, and a displacement vector angle between the reference displacement vector λWm and the second displacement vector λWs2 is θW2.
A to-be-retained one can be selected from the first rotation vector λRs1 and the second rotation vector λRs2 and a to-be-retained one can be selected from the first displacement vector λWs1 and the second displacement vector λWs2 according to the first rotation vector angle θR1, the second rotation vector angle θR2, the first displacement vector angle θW1, and the second displacement vector angle θW2.
Referring to
As described above, the first rotation vector λRs1 and the second rotation vector λRs2 obtained by using the monocular visual SLAM method are a pair of opposite vectors. Therefore, if the first rotation vector λRs1 and the reference rotation vector λRm are in the same direction, the second rotation vector λRs2 certainly cannot be in the same direction as the reference rotation vector λRm. Otherwise, a condition that the first rotation vector λRs1 and the second rotation vector λRs2 are a pair of opposite vectors is not met. Further, if the first rotation vector λRs1 and the reference rotation vector λRm are in the same direction, the second rotation vector λRs2 is certainly opposite to the reference rotation vector λRm. That is, a case that the angle θR2 between the second rotation vector λRs2 and the reference rotation vector λRm is equal to 900 is excluded. This is because when the angle θR2 is equal to 90°, according to the condition that the first rotation vector λRs1 and the second rotation vector λRs2 are a pair of opposite vectors, the angle θR1 between the first rotation vector λRs1 and the reference rotation vector λRm is also to be equal to 90°, which is not consistent with a condition that the first rotation vector λRs1 and the reference rotation vector λRm are in the same direction.
Therefore, when and only when the first rotation vector angle θR1 is less than 90°, and the second rotation vector angle θR2 is greater than 90°, the first rotation vector λRs1 is retained.
Similarly, if the second rotation vector λRs2 and the reference rotation vector λRm are in the same direction, the first rotation vector λRs1 is certainly opposite to the reference rotation vector λRm. Therefore, when and only when the second rotation vector angle θR2 is less than 90°, and the first rotation vector angle θR1 is greater than 90°, the second rotation vector λRs2 is retained.
Similarly, the first displacement vector λWs1 and the second displacement vector λWs2 are also a pair of opposite vectors. When and only when the first displacement vector angle θW1 is less than 90°, and the second displacement vector angle θW2 is greater than 90°, the first displacement vector λWs1 is retained; and when and only when the second displacement vector angle θW2 is less than 90°, and the first displacement vector angle θW1 is greater than 90°, the second displacement vector λWs2 is retained.
As shown in
Similarly, there are total 9 combinations of the relationship between the first displacement vector angle θW1 and 90° and the relationship between the second displacement vector angle θW2 and 90°. Only when the first displacement vector angle θW1 is less than 90° and the second displacement vector angle θW2 is greater than 90°, or when the second displacement vector angle θW2 is less than 90° and the first displacement vector angle θW1 is greater than 90°, the to-be-retained displacement vector λWs can be selected. If the relationship between the first displacement vector angle θW1 and 90° and the relationship between the second displacement vector angle θW2 and 90° belong to one of the remaining 7 combinations, filtering is considered unsuccessful, which indicates that there is an error in the to-be-selected displacement matrix Ws1 and/or the to-be-selected displacement matrix Ws2 obtained by using the monocular visual SLAM method, and the error may be caused by inaccurate feature point matching or other reasons.
When the to-be-retained rotation vector λRs can be selected and the to-be-retained displacement vector λWs can be selected, filtering is considered successful. If a retained rotation vector λRs is the first rotation vector λRs1, the to-be-selected rotation matrix Rs1 corresponding to the first rotation vector λRs1 is used as a localization rotation matrix Rd. If a retained displacement vector λWs is the first displacement vector λWs1, the to-be-selected displacement matrix Ws1 corresponding to the first displacement vector λWs1 is used as a localization displacement matrix Wd. If the retained displacement vector λWs is the second displacement vector λWs2, the to-be-selected displacement matrix Ws2 corresponding to the second displacement vector λWs2 is used as the localization displacement matrix Wd. A pose finally obtained according to the localization rotation matrix Rd and the localization displacement matrix Wd is the actual pose of the camera 40.
When the to-be-retained rotation vector λRs can be selected, but the to-be-retained displacement vector λWs is not successfully selected, or when the to-be-retained displacement vector λWs can be selected, but the to-be-retained rotation vector λRs is not successfully selected, or when both the to-be-retained rotation vector λRs and the to-be-retained displacement vector λWs are not successfully selected, steps 01, 02, 03, 04, and 05 of the data processing method provided in this application need to be performed again, until the to-be-retained rotation vector λRs and the to-be-retained displacement vector λWs can be selected.
In conclusion, through the data processing method provided in the implementations of this application, a combination of a to-be-selected rotation matrix and a to-be-selected displacement matrix for determining the pose of the camera 40 can be accurately selected from the plurality of to-be-selected rotation matrices and the plurality of to-be-selected displacement matrices obtained according to the epipolar constraint relationships of the feature point pairs in the two frames of images in the monocular visual SLAM method, thereby ensuring the accuracy of a posture and position obtained by using the monocular visual SLAM method and improving the accuracy of the localization.
Referring to
Referring to
01: Obtaining rotation angular velocities and accelerations of a camera 40 cyclically;
02: Obtaining a plurality of feature point pairs in two frames of images acquired by the camera 40, and obtaining pixel coordinate values of feature points in the feature point pairs, where each of the feature point pairs includes two feature points that correspond to a same feature of a same object and that are respectively in the two frames of images;
03: Obtaining to-be-selected rotation matrices and to-be-selected displacement matrices according to the pixel coordinate values;
04: Obtaining a reference rotation matrix of the camera 40 according to the rotation angular velocities, and obtain a reference displacement matrix of the camera 40 according to the accelerations; and
05: Filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the reference rotation matrix and the reference displacement matrix.
In another example, the computer program 401, when executed by the one or more processors 30, causes the one or more processors 30 to perform the following data processing method:
01: Obtaining rotation angular velocities and accelerations of a camera 40 cyclically;
021: Obtaining original coordinate values of each of the feature points in each feature point pair in the corresponding image;
022: Normalizing the original coordinate values to obtain pixel coordinate values of each feature point in the feature point pair;
031: Constructing epipolar constraint equations;
032: Calculating the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the pixel coordinate values and the epipolar constraint equations;
04: Obtaining a reference rotation matrix of the camera 40 according to the rotation angular velocities, and obtaining a reference displacement matrix of the camera 40 according to the accelerations;
051: Obtaining a reference rotation vector of the reference rotation matrix, a reference displacement vector of the reference displacement matrix, to-be-selected rotation vectors of the to-be-selected rotation matrices, and to-be-selected displacement vectors of the to-be-selected displacement matrices;
052: Obtaining rotation vector angles between the reference rotation vector and the to-be-selected rotation vectors, and obtaining displacement vector angles between the reference displacement vector and the to-be-selected displacement vectors; and
053: Filtering the to-be-selected rotation matrices and the to-be-selected displacement matrices according to the rotation vector angles and the displacement vector angles.
In the description of this specification, description of reference terms such as “some implementations”, “in an example” or “exemplarily” means including specific characteristics, structures, materials, or features described in the implementation or example in at least one implementation or example of this application. In this specification, schematic descriptions of the foregoing terms are not necessarily with respect to the same implementation or example. In addition, the described specific characteristics, structures, materials, or features may be combined in a proper manner in any one or more implementations or examples. In addition, a person skilled in the art may integrate or combine different embodiments or examples described in the specification and features of the different embodiments or examples as long as they are not contradictory to each other.
Any process or methods the flowcharts or described herein in another manner may be understood as indicating a module, a segment, or a part including code of one or more executable instructions for implementing a particular logical function or process step. In addition, the scope of preferred implementations of this application includes other implementations which do not follow the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. This should be understood by a person skilled in the art to which the embodiments of this application belong.
Although the implementations of this application are shown and described above, it may be understood that the foregoing implementations are exemplary, and cannot be understood as a limitation to this application. A person of ordinary skill in the art may make changes, modifications, replacements, and variations to the foregoing implementations without departing from the scope of this application.
Number | Date | Country | Kind |
---|---|---|---|
202110670789.1 | Jun 2021 | CN | national |
Number | Name | Date | Kind |
---|---|---|---|
8594370 | Schamp | Nov 2013 | B2 |
8676498 | Ma | Mar 2014 | B2 |
9251590 | Sharp | Feb 2016 | B2 |
10162362 | Tsai | Dec 2018 | B2 |
11181379 | Babu | Nov 2021 | B2 |
20200218929 | Li | Jul 2020 | A1 |
20220070433 | Lee | Mar 2022 | A1 |
20220147053 | Lin | May 2022 | A1 |
Number | Date | Country |
---|---|---|
108648215 | Oct 2018 | CN |
110084832 | Aug 2019 | CN |
Entry |
---|
Espacenet English translation of CN 108648215A (Year: 2022). |
Espacenet English translation of CN 110084832A (Year: 2022). |