A method and system for positioning indoor parking lots based on visual SLAM

Through the joint calibration of the monocular camera and the inertial measurement unit, combined with the SIFT algorithm and extended Kalman filter, the bag-of-words model is used for loop detection, which solves the large positioning error and anti-interference ability of the existing technology when the feature points or Apriltag ID information are used alone. Weak problems are achieved and more accurate indoor parking lot positioning and mapping are achieved.

CN118262336BActive Publication Date: 2024-09-03NANCHANG AUTOMOTIVE INST OF INTELLIGENCE & NEW ENERGY
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202410685784.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-09-03
Estimated Expiration
2044-05-30

AI Technical Summary

Technical Problem

In the existing technology, when feature point information is directly used or Apriltag's ID information is used alone to update and position indoor parking lot maps, it can easily lead to large positioning errors, weak anti-interference capabilities, and difficulty in covering every frame of image, resulting in data loss problems. .

Method used

A monocular camera and an inertial measurement unit are used for joint calibration, combined with the SIFT algorithm to extract feature points and Apriltag's ID information, extended Kalman filtering is used for map optimization, and a bag-of-words model is used for loop detection, and feature points and ID information are fused to achieve More accurate indoor parking lot positioning.

Benefits of technology

By fusing feature points and ID information, positioning errors are reduced, anti-interference capabilities are improved, data coverage is enhanced, more accurate indoor parking lot positioning and mapping is achieved, and noise in the SLAM process is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118262336B
    Figure CN118262336B
Patent Text Reader

Abstract

The present invention discloses a method and system for positioning an indoor parking lot based on visual SLAM, which belongs to the field of intelligent transportation. The method comprises: using a monocular camera to collect Apriltag image data, using a vehicle-mounted inertial measurement unit (IMU) to obtain vehicle IMU data; extracting feature point information and Apriltag ID information in the image, solving IMU data to obtain vehicle posture information; realizing visual odometer between the previous and next frames through feature point information and Apriltag ID information; using an extended Kalman filter algorithm for back-end optimization according to the vehicle posture information; using a bag-of-words model for loop detection, updating the map, and realizing indoor parking lot mapping and vehicle positioning. The present invention realizes accurate indoor parking lot mapping and positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of intelligent transportation, and more particularly relates to a method and system for positioning an indoor parking lot based on visual SLAM. Background Art

[0002] With the development of society and science and technology, the rapid increase in demand for vehicles has brought about a series of problems. Intelligent transportation systems have become an important way to solve many problems. Unmanned vehicles are an important part of intelligent transportation systems, and reliable mapping and positioning capabilities play a vital role in autonomous cruise control, collision warning and path planning. For example, indoor parking lot mapping and positioning can provide richer information for path planning and positioning of vehicles in indoor parking lots for autonomous parking and calling cars.

[0003] SLAM technology is a key point and hotspot in the field of autonomous navigation and positioning, and has broad application prospects in the field of intelligent transportation. AprilTag is a visual benchmark library that is widely used in the fields of AR, robotics, and camera calibration. At present, most visual SLAMs directly use feature point information or use Apriltag ID information alone to achieve map updates and positioning. The single feature point information has weak anti-interference ability, and the single Apriltag ID information is difficult to cover every frame of the image, resulting in data loss and large errors. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide an indoor parking lot positioning method and system based on visual SLAM, so as to solve the problem of large positioning error caused by directly using feature point information or solely using Apriltag ID information to realize map update and positioning in the prior art.

[0005] The embodiment of the present invention is implemented as follows:

[0006] A method for positioning an indoor parking lot based on visual SLAM, the method comprising:

[0007] Step 1: Use a monocular camera to collect Apriltag image data, and use an inertial measurement unit to obtain the vehicle's IMU data information; the image data includes an indoor parking lot image including multiple Apriltags; the IMU data includes vehicle posture, angular velocity and linear acceleration information;

[0008] Step 2: jointly calibrate the monocular camera and the inertial measurement unit to the vehicle coordinate system;

[0009] Step 3: Preprocess the parking lot image acquired by the monocular camera, extract feature points in the parking lot image using the SIFT algorithm, and obtain the April tag position and its ID in the parking lot image;

[0010] Step 4: Preprocess the IMU data to calculate the vehicle's position information;

[0011] Step 5: For the acquired feature points and ID information, combined with the vehicle posture information, an extended Kalman filter is used to perform map optimization;

[0012] Step 6: Use the bag-of-words model to perform loop detection, update the map, and realize indoor parking lot mapping and vehicle positioning.

[0013] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the monocular camera is a 180-degree wide-angle camera, and the inertial measurement unit is a vehicle-mounted inertial measurement unit.

[0014] Furthermore, in the indoor parking lot positioning method based on visual SLAM, the method of jointly calibrating the monocular camera and the inertial measurement unit to the vehicle coordinate system described in step 2 includes:

[0015] S201, setting an inertial measurement unit coordinate system and a vehicle coordinate system, wherein the front of the vehicle is uniformly taken as the Y axis, the left is the X axis, the upward is the Z axis, and the origins are the center of the inertial measurement unit and the center of the vehicle respectively;

[0016] S202, calibrate the monocular camera, obtain the internal and external parameters of the monocular camera according to the Zhang Zhengyou calibration method, convert the pixel coordinate data into the camera coordinate system according to formula (1), and then use multiple calibration objects to manually measure the coordinates of the camera in the vehicle coordinate system. V -X V Y V Z V The coordinates under the camera coordinate system and the position in the camera coordinate system are used to obtain the rotation matrix R according to formula (2): C and the translation vector T C ;

[0017] (1)

[0018] (2)

[0019] Where: Xc, Yc, Zc are the coordinate values ​​of the calibration object in the camera coordinate system, Xv, Yv, Zv are the coordinate values ​​of the calibration object in the vehicle coordinate system, R C , T C are respectively the rotation matrix and translation matrix of the data from the camera coordinate system to the vehicle coordinate system, f is the focal length of the camera, 1 / dx and 1 / dyIndicates: the number of pixels per unit length in the x and y directions, which can be a decimal; γ is the distortion factor, which is 0; u 0 、v 0 Respectively represent the horizontal and vertical pixel numbers of the difference between the center pixel coordinates of the image and the pixel coordinates of the image origin, and u and v are the coordinate values ​​of the calibration object on the image;

[0020] S203, calibrating the inertial measurement unit to the vehicle coordinate system, selecting multiple points, and measuring their coordinates in the inertial measurement unit coordinate system. I -X I Y I Z I The coordinates in the vehicle coordinate system O V -X V Y V Z V The coordinates in the rotation matrix R are obtained according to formula (3) I and the translation vector T I , calibrated to the vehicle coordinate system;

[0021] (3)

[0022] Where: R I , T I are the rotation matrix and translation matrix of the data from the inertial measurement unit coordinate system to the vehicle coordinate system, X I , Y I , Z I is the coordinate value of the calibration object in the inertial measurement unit coordinate system.

[0023] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the method of preprocessing the parking lot image acquired by the monocular camera in step 3, extracting feature points in the parking lot image using the SIFT algorithm, and obtaining the Apriltag position and its ID in the parking lot image includes:

[0024] S301, the preprocessing includes Gaussian smoothing and DoG feature map calculation;

[0025] S302, extracting feature points from the parking lot image using a SIFT algorithm: identifying potential scale- and rotation-invariant interest points in the parking lot image using a Gaussian differential function, locating key points and determining feature directions based on the interest points, determining the main directions of the feature points using a gradient histogram of the feature point neighborhood, generating a description operator in the feature point neighborhood, generating a 4x4x8-dimensional SIFT feature vector, and performing pairwise comparisons through the SIFT feature vectors of the key points to find several pairs of feature points that match each other;

[0026] S303, obtaining the position of April tag and its ID in the parking lot image: graying and binarizing the parking lot image, and using the Sobel operator to perform edge detection to obtain a binary edge image, performing polygon analysis on the binary edge image until all binary points are traversed, using a polygon convex hull search algorithm to calculate the convex hull of each polygon itself, and finding the area of ​​the convex hull and its polygon, comparing the area of ​​the convex hull and its polygon, excluding the polygon when the area of ​​the polygon is larger than the area of ​​the convex hull, retaining the remaining polygons that meet the conditions, using the Douglas-Peucker algorithm to perform quadrilateral approximation on the remaining polygons, and finally decoding the detected internal patterns of the quadrilaterals to obtain the digital ID corresponding to each pattern.

[0027] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the method of using extended Kalman filtering to optimize the map by combining the acquired feature points and ID information with the vehicle posture information in step 5 is as follows:

[0028] S501, predicting the joint state estimation of the current moment's posture and feature points based on the feature point information, ID information and vehicle posture information in the parking lot image at the previous moment, wherein the joint state of the current moment's posture and feature points represents the mean, and the variance is solved by the motion change matrix, and the specific steps are as follows:

[0029] Constructing basic equations: Assume discrete time , the vehicle's position is , the vehicle moves from the previous moment to the next moment, then the vehicle's motion equation is: ;

[0030] Suppose the information of the feature point is , the inertial measurement unit is at position Detected , then the observation equation is: ;

[0031] in, represents the position at time k, is the motion of the vehicle estimated by the feature points, The information and ID information of the feature points obtained by the inertial measurement unit are represented, and the covariance matrix of the state and error at time k+1 is predicted based on the optimal state estimate at time k:

[0032] (4)

[0033] (5)

[0034] Formula (4) is the state test equation, where: is the optimal estimate of the system state at time k, is the optimal estimate of the state at time k System input at time Prediction of the system state at time k+1;

[0035] Formula (5) is the error covariance matrix prediction equation, where is the optimal estimate of the system state at time k The corresponding error covariance matrix is, is the prediction of the system state The corresponding error covariance matrix is, It is the equation The Jacobian matrix of is the covariance matrix of the system process noise at time k;

[0036] S502, based on the actual characteristic points and ID information of the system at time k+1, the prediction result of the system state at time k+1 obtained in the previous step is optimized to obtain the optimal estimate of the system state at time k+1, as follows:

[0037] (6)

[0038] in, is the optimal estimate of the system state at time k+1, is the Kalman gain matrix, which is calculated as follows:

[0039] (7)

[0040] in, It is the equation The Jacobian matrix of is the covariance matrix of the measurement noise at time k+1;

[0041] S503, continue to update the error covariance matrix at time k+1, the formula is as follows:

[0042] (8)

[0043] Where I is the identity matrix, is the optimal estimate of the system state at time k+1 The corresponding error covariance matrix.

[0044] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, step 6 adopts the bag-of-words model for loop detection, and the specific steps are as follows:

[0045] S601, construct a dictionary containing the feature points and ID information, that is, a set of words, expressed as:

[0046] (9)

[0047] S602, determine the words in a frame of image and form a bag-of-words vector, which is expressed as follows:

[0048] (10)

[0049] Among them, 1 means the word exists, and 0 means it does not exist. Respectively represent the first feature point and the first ID information, Represent the nth feature point and nth ID information respectively;

[0050] S603, comparing the difference between the description vectors F of the two frames of images, and the similarity is greater than a preset threshold The two images are taken as a detected loop and the map is updated to achieve indoor parking lot mapping and vehicle positioning.

[0051] Another object of the present invention is to provide an indoor parking lot positioning system based on visual SLAM, characterized in that the system comprises:

[0052] Acquisition module: used to collect Apriltag image data using a monocular camera and acquire the vehicle's IMU data information using an inertial measurement unit; the image data includes an indoor parking lot image including multiple Apriltags; the IMU data includes vehicle posture, angular velocity and linear acceleration information;

[0053] Calibration module: used for jointly calibrating the monocular camera and the inertial measurement unit to the vehicle coordinate system;

[0054] Preprocessing module: used to preprocess the parking lot image acquired by the monocular camera, extract feature points in the parking lot image using SIFT algorithm, and acquire the April tag position and ID in the parking lot image;

[0055] Calculation module: used to pre-process the IMU data and calculate the position and posture information of the vehicle;

[0056] Optimization module: used to optimize the map by using extended Kalman filter based on the acquired feature points and ID information and vehicle posture information;

[0057] Positioning module: used to use the bag-of-words model for loop detection, update maps, and realize indoor parking lot mapping and vehicle positioning.

[0058] Furthermore, in the above-mentioned indoor parking lot positioning system based on visual SLAM, the monocular camera is a 180-degree wide-angle camera, and the inertial measurement unit is a vehicle-mounted inertial measurement unit.

[0059] Another object of the present invention is to provide a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of any of the methods described above.

[0060] Another object of the present invention is to provide an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.

[0061] The present invention overcomes the shortcomings of single information being easily interfered with and data being easily lost by fusing image feature point information and Apriltag ID information as the initial information of the image. The fused initial information can be accurately and effectively extracted from the image, and the fused initial data information is optimized by using extended Kalman filtering, thereby overcoming the shortcomings of large error and low precision of the linear model, being more in line with the actual situation, and further reducing the noise in the SLAM process. The bag-of-words model is used for loop detection, and a dictionary containing the fusion of feature points and image ID information is constructed, thereby overcoming the shortcomings of large loop detection error and difficulty in looping caused by single feature point information. Most SLAMs use linear models, ignoring the fact that the actual situation is mostly nonlinear data. The problem that most visual SLAMs in the prior art directly use feature point information or use Apriltag ID information alone to achieve map update and positioning is solved. The single feature point information has weak anti-interference ability, and the single Apriltag ID information is difficult to cover each frame of the image, resulting in data loss, thereby leading to the problem of large positioning error. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 A flowchart of an indoor parking lot positioning method based on visual SLAM proposed in the first embodiment of the invention;

[0063] Figure 2 This is a structural block diagram of an indoor parking lot positioning system based on visual SLAM proposed in the second embodiment of the present invention. DETAILED DESCRIPTION

[0064] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0065] Embodiment 1

[0066] like Figure 1As shown, the indoor parking lot positioning method based on visual SLAM proposed in the first embodiment of the present invention includes steps 1 to 6.

[0067] Step 1: Use a monocular camera to collect Apriltag image data, and use an inertial measurement unit to obtain the vehicle's IMU data information; the image data includes an indoor parking lot image including multiple Apriltags; the IMU data includes vehicle posture, angular velocity and linear acceleration information.

[0068] The monocular camera may be a 180-degree wide-angle camera, and the inertial measurement unit may be a vehicle-mounted inertial measurement unit.

[0069] Step 2: Jointly calibrate the monocular camera and the inertial measurement unit to the vehicle coordinate system.

[0070] Among them, the inertial measurement unit coordinate system and the vehicle coordinate system are set, wherein the front of the vehicle is uniformly taken as the Y axis, the left is the X axis, the upward is the Z axis, and the origin is the center of the inertial measurement unit (sensor) and the center of the vehicle respectively;

[0071] The monocular camera is calibrated. According to the Zhang Zhengyou calibration method, the internal and external parameters of the monocular camera are obtained. According to formula (1), the pixel coordinate data is converted to the camera coordinate system, and then multiple calibration objects are used to manually measure the coordinates of the camera in the vehicle coordinate system. V -X V Y V Z V The coordinates under the camera coordinate system and the position in the camera coordinate system are used to obtain the rotation matrix R according to formula (2): C and the translation vector T C ;

[0072] (1)

[0073] (2)

[0074] Where: Xc, Yc, Zc are the coordinate values ​​of the calibration object in the camera coordinate system, Xv, Yv, Zv are the coordinate values ​​of the calibration object in the vehicle coordinate system, R C , T C are respectively the rotation matrix and translation matrix of the data from the camera coordinate system to the vehicle coordinate system, f is the focal length of the camera, 1 / dx and 1 / dy Indicates: the number of pixels per unit length in the x and y directions, which can be a decimal; γ is the distortion factor, which is 0; u 0 、v 0Respectively represent the horizontal and vertical pixel numbers of the difference between the center pixel coordinates of the image and the pixel coordinates of the image origin, and u and v are the coordinate values ​​of the calibration object on the image;

[0075] The inertial measurement unit is calibrated to the vehicle coordinate system, and multiple points are selected to measure their relative positions in the inertial measurement unit coordinate system. I -X I Y I Z I The coordinates in the vehicle coordinate system O V -X V Y V Z V The coordinates in the rotation matrix R are obtained according to formula (3) I and the translation vector T I , calibrated to the vehicle coordinate system;

[0076] (3)

[0077] Where: R I , T I are the rotation matrix and translation matrix of the data from the inertial measurement unit coordinate system to the vehicle coordinate system, X I , Y I , Z I is the coordinate value of the calibration object in the inertial measurement unit coordinate system.

[0078] Step 3: Preprocess the parking lot image acquired by the monocular camera, extract feature points in the parking lot image using the SIFT algorithm, and obtain the April tag position and ID in the parking lot image.

[0079] Specifically, the preprocessing includes Gaussian smoothing and DoG feature map calculation;

[0080] The SIFT algorithm is used to extract feature points in the parking lot image: Gaussian differential function is used to identify potential scale- and rotation-invariant interest points in the parking lot image, key points are located and feature directions are determined based on the interest points. Specifically, at each candidate position, a finely fitted model is used to determine the position and scale, and then the main direction of the feature point is determined using the gradient histogram of the feature point neighborhood, and a description operator is generated in the vicinity of the feature point to generate a 4x4x8-dimensional SIFT feature vector. The SIFT feature vectors of each key point are compared pairwise to find several pairs of feature points that match each other, so that the correspondence between scenes can be established and the movement of the camera, that is, the movement of the vehicle, can be estimated;

[0081] In addition, based on the information of adjacent images, the rough camera motion can be estimated to provide a good initial value for the back end. This application is a monocular camera that can only obtain 2D pixel coordinates. Therefore, based on two sets of 2D points, the camera motion is estimated using epipolar geometry. Specifically, the position change of the external point P relative to the camera is calculated through two adjacent frames of images. Then, P is taken as an unchanging external point, and the change of the camera coordinate system relative to P is inferred, thereby positioning the camera.

[0082] Find the epipolar constraint: In the coordinate system of the first frame, let the spatial coordinates of P be [X, Y, Z] T According to the pinhole camera model, the two pixels available are The pixel position is:

[0083] ;

[0084] in, is the pixel point of P in the first frame image, is the pixel point of P on the second frame image, K is the camera internal parameter, R , t For the camera motion of the two coordinate systems, the rotation and translation matrix of the first frame coordinate system to the second frame coordinate system is used. is a constant factor. Eliminate the constant factor and write it in the second coordinate to get .

[0085] Pick ,here is the coordinate of the two pixels on the normalized plane, and substituting it into the above coordinates, we can get + t , do the outer product of both sides with t, and we get . Multiply both sides by have, , from the meaning of the outer product, we can know that the vector Perpendicular to , so the inner product is 0, then we have , which is called the epipolar constraint. Substituted into the epipolar constraint formula, we have , which is also an epipolar constraint.

[0086] make is called the essential matrix, then the epipolar constraint is expressed as ;

[0087] make is called the fundamental matrix, then the epipolar constraint can be expressed as .

[0088] Through the essential matrix E and the fundamental matrixF To solve the camera's pose, first find out the pixel positions of paired feature points E or F Then according to E or F Find R , t .

[0089] Solve the pose based on the essential matrix: According to the definition, the essential matrix is ​​a 3×3 matrix with 9 unknowns. This patent uses the classic eight-point method to estimate E , as follows:

[0090] For a pair of matching points, their normalized coordinates are According to the epipolar constraint, we get:

[0091]

[0092] Expand the matrix E and write it in vector form: , then the above formula can be written as . Expand the other feature points in a similar way and combine them to get the following formula:

[0093] ;

[0094] Then, singular value decomposition (SVD) is used to solve E . Let the SVD of E be: , where U and V are orthogonal matrices, is the singular value matrix, are the singular values ​​of the decomposition.

[0095] In SVD decomposition, for any E, there are four possible solutions for R and t:

[0096]

[0097]

[0098]

[0099]

[0100] Among them, Rz(π / 2) represents the rotation matrix obtained by rotating R 90 degrees around the Z axis. Only in the first group of solutions, P There are positive depths in both cameras. According to the rotation and translation matrix R,t between two consecutive frames, the movement of the camera between the two frames can be obtained, so the movement trajectory of the camera can be estimated from the consecutive video frames.

[0101] Obtain the location of Apriltag and its ID in the parking lot image: grayscale and binarize the parking lot image, and use the Sobel operator for edge detection. For the obtained binary edge image, polygon analysis is required. First, the edge structure is used to analyze the nested relationship, and the edge is used to represent the original image. The algorithm starts from the starting point, edits the edge pixels, and searches for edge points of the same type as the starting point. When scanning to the starting point, the polygon is closed and the operation is repeated to the next starting point until all binary points are traversed. Points with less than 4 edges are excluded, and those that meet the conditions are further processed. The polygon convex hull search algorithm is used to calculate the convex hull of each polygon itself, and the area of ​​the convex hull and its polygon is calculated. The area of ​​the convex hull and its polygon is compared. When the area of ​​the polygon is larger than the area of ​​the convex hull, the polygon is excluded. Non-convex polygons and polygons that do not meet the ratio of the polygon area to the convex hull area greater than 0.8 can be effectively excluded. The remaining polygons that meet the conditions are retained, and the Douglas-Peucker algorithm is used to approximate the remaining polygons into quadrilaterals. Finally, the detected internal patterns of the quadrilaterals are decoded to obtain the digital ID corresponding to each pattern.

[0102] Step 4: Preprocess the IMU data to calculate the vehicle's position information;

[0103] Step 5: For the acquired feature points and ID information, combined with the vehicle posture information, an extended Kalman filter is used to perform map optimization.

[0104] Specifically, based on the feature point information, ID information and vehicle posture information in the parking lot image at the previous moment, the joint state estimation of the posture and feature points at the current moment is predicted, wherein the joint state of the posture and feature points at the current moment represents the mean, and the variance is solved by the motion change matrix. The specific steps are as follows:

[0105] Constructing basic equations: Assume discrete time , the vehicle's position is , the vehicle moves from the previous moment to the next moment, then the vehicle's motion equation is: ;

[0106] Suppose the information of the feature point is , the inertial measurement unit is at position Detected , then the observation equation is: ;

[0107] in, represents the position at time k, is the motion of the vehicle estimated by the feature points, The information and ID information of the feature points obtained by the inertial measurement unit are represented, and the covariance matrix of the state and error at time k+1 is predicted based on the optimal state estimate at time k:

[0108] (4)

[0109] (5)

[0110] Formula (4) is the state test equation, where: is the optimal estimate of the system state at time k, is the optimal estimate of the state at time k System input at time Prediction of the system state at time k+1;

[0111] Formula (5) is the error covariance matrix prediction equation, where is the optimal estimate of the system state at time k The corresponding error covariance matrix is, is the prediction of the system state The corresponding error covariance matrix is, It is the equation The Jacobian matrix of is the covariance matrix of the system process noise at time k;

[0112] According to the actual characteristic points and ID information of the system at time k+1, the prediction result of the system state at time k+1 obtained in the previous step is optimized to obtain the optimal estimate of the system state at time k+1, as follows:

[0113] (6)

[0114] in, is the optimal estimate of the system state at time k+1, is the Kalman gain matrix, which is calculated as follows:

[0115] (7)

[0116] in, It is the equation The Jacobian matrix of is the covariance matrix of the measurement noise at time k+1;

[0117] Continue to update the error covariance matrix at time k+1, the formula is as follows:

[0118] (8)

[0119] Where I is the identity matrix, is the optimal estimate of the system state at time k+1 The corresponding error covariance matrix.

[0120] Step 6: Use an improved bag-of-words model to perform loop detection, update the map, and realize indoor parking lot mapping and vehicle positioning.

[0121] Specifically, a dictionary containing the feature points and ID information is constructed, that is, a set of words, which is expressed as:

[0122] (9)

[0123] Determine the words in a frame of image and form a bag-of-words vector, as shown in the following formula:

[0124] (10)

[0125] Among them, 1 means the word exists, and 0 means it does not exist. Respectively represent the first feature point and the first ID information, Represent the nth feature point and nth ID information respectively;

[0126] Compare the difference between the description vectors F of the two frames of images, and the similarity is greater than the preset threshold The two images are taken as a detected loop and the map is updated to achieve indoor parking lot mapping and vehicle positioning.

[0127] In summary, the indoor parking lot positioning method based on visual SLAM in the above-mentioned embodiment of the present invention overcomes the shortcomings of single information being easily interfered and data being easily lost by fusing image feature point information and Apriltag ID information as the initial information of the image. It can accurately and effectively extract the fused initial information from the image, and use the extended Kalman filter to optimize the fused initial data information, overcome the shortcomings of large error and low precision of the linear model, better conform to the actual situation, and further reduce the noise in the SLAM process. The bag-of-words model is used for loop detection, and a dictionary containing the fusion of feature points and image ID information is constructed, which overcomes the shortcomings of large loop detection error and difficulty in looping caused by single feature point information. Most SLAMs use linear models, ignoring the fact that most actual situations are nonlinear data. It solves the problem that most visual SLAMs in the prior art directly use feature point information or use Apriltag ID information alone to achieve map update and positioning. The single feature point information has weak anti-interference ability, and the single Apriltag ID information is difficult to cover each frame of the image, resulting in data loss, which leads to the problem of large positioning error.

[0128] Embodiment 2

[0129] See also Figure 2 , which is an indoor parking lot positioning system based on visual SLAM proposed by the present invention. It is characterized in that: the system comprises:

[0130] Acquisition module 100: used to collect Apriltag image data using a monocular camera and acquire IMU data information of the vehicle using an inertial measurement unit; the image data includes an indoor parking lot image including multiple Apriltags; the IMU data includes vehicle posture, angular velocity and linear acceleration information;

[0131] Calibration module 200: used to jointly calibrate the monocular camera and the inertial measurement unit to the vehicle coordinate system;

[0132] Preprocessing module 300: used to preprocess the parking lot image acquired by the monocular camera, extract feature points in the parking lot image using SIFT algorithm, and acquire the April tag position and ID in the parking lot image;

[0133] The calculation module 400 is used to pre-process the IMU data and calculate the position and posture information of the vehicle;

[0134] Optimization module 500: for optimizing the map by using extended Kalman filtering based on the acquired feature points and ID information in combination with vehicle posture information;

[0135] Positioning module 600: used to use the bag-of-words model to perform loop detection, update the map, and realize indoor parking lot mapping and vehicle positioning.

[0136] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the monocular camera is a 180-degree wide-angle camera, and the inertial measurement unit is a vehicle-mounted inertial measurement unit.

[0137] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the calibration module is specifically used for:

[0138] S201, setting an inertial measurement unit coordinate system and a vehicle coordinate system, wherein the front of the vehicle is uniformly taken as the Y axis, the left is the X axis, the upward is the Z axis, and the origins are the center of the inertial measurement unit and the center of the vehicle respectively;

[0139] S202, calibrate the monocular camera, obtain the internal and external parameters of the monocular camera according to the Zhang Zhengyou calibration method, convert the pixel coordinate data into the camera coordinate system according to formula (1), and then use multiple calibration objects to manually measure the coordinates of the camera in the vehicle coordinate system. V -X V Y V Z VThe coordinates under the camera coordinate system and the position in the camera coordinate system are used to obtain the rotation matrix R according to formula (2): C and the translation vector T C ;

[0140] (1)

[0141] (2)

[0142] Where: Xc, Yc, Zc are the coordinate values ​​of the calibration object in the camera coordinate system, Xv, Yv, Zv are the coordinate values ​​of the calibration object in the vehicle coordinate system, R C , T C are respectively the rotation matrix and translation matrix of the data from the camera coordinate system to the vehicle coordinate system, f is the focal length of the camera, 1 / dx and 1 / dy Indicates: the number of pixels per unit length in the x and y directions, which can be a decimal; γ is the distortion factor, which is 0; u 0 、v 0 Respectively represent the horizontal and vertical pixel numbers of the difference between the center pixel coordinates of the image and the pixel coordinates of the image origin, and u and v are the coordinate values ​​of the calibration object on the image;

[0143] S203, calibrating the inertial measurement unit to the vehicle coordinate system, selecting multiple points, and measuring their coordinates in the inertial measurement unit coordinate system. I -X I Y I Z I The coordinates in the vehicle coordinate system O V -X V Y V Z V The coordinates in the rotation matrix R are obtained according to formula (3) I and the translation vector T I , calibrated to the vehicle coordinate system;

[0144] (3)

[0145] Where: R I , T I are the rotation matrix and translation matrix of the data from the inertial measurement unit coordinate system to the vehicle coordinate system, X I , Y I , Z I is the coordinate value of the calibration object in the inertial measurement unit coordinate system.

[0146] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the preprocessing module is specifically used for:

[0147] S301, the preprocessing includes Gaussian smoothing and DoG feature map calculation;

[0148] S302, extracting feature points from the parking lot image using a SIFT algorithm: identifying potential scale- and rotation-invariant interest points in the parking lot image using a Gaussian differential function, locating key points and determining feature directions based on the interest points, determining the main directions of the feature points using a gradient histogram of the feature point neighborhood, generating a description operator in the feature point neighborhood, generating a 4x4x8-dimensional SIFT feature vector, and performing pairwise comparisons through the SIFT feature vectors of the key points to find several pairs of feature points that match each other;

[0149] S303, obtaining the position of April tag and its ID in the parking lot image: graying and binarizing the parking lot image, and using the Sobel operator to perform edge detection to obtain a binary edge image, performing polygon analysis on the binary edge image until all binary points are traversed, using a polygon convex hull search algorithm to calculate the convex hull of each polygon itself, and finding the area of ​​the convex hull and its polygon, comparing the area of ​​the convex hull and its polygon, excluding the polygon when the area of ​​the polygon is larger than the area of ​​the convex hull, retaining the remaining polygons that meet the conditions, using the Douglas-Peucker algorithm to perform quadrilateral approximation on the remaining polygons, and finally decoding the detected internal patterns of the quadrilaterals to obtain the digital ID corresponding to each pattern.

[0150] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the optimization module is specifically used for:

[0151] S501, predicting the joint state estimation of the current moment's posture and feature points based on the feature point information, ID information and vehicle posture information in the parking lot image at the previous moment, wherein the joint state of the current moment's posture and feature points represents the mean, and the variance is solved by the motion change matrix, and the specific steps are as follows:

[0152] Constructing basic equations: Assume discrete time , the vehicle's position is , the vehicle moves from the previous moment to the next moment, then the vehicle's motion equation is: ;

[0153] Suppose the information of the feature point is , the inertial measurement unit is at position Detected , then the observation equation is: ;

[0154] in, represents the position at time k, is the motion of the vehicle estimated by the feature points, The information and ID information of the feature points obtained by the inertial measurement unit are represented, and the covariance matrix of the state and error at time k+1 is predicted based on the optimal state estimate at time k:

[0155] (4)

[0156] (5)

[0157] Formula (4) is the state test equation, where: is the optimal estimate of the system state at time k, is the optimal estimate of the state at time k System input at time Prediction of the system state at time k+1;

[0158] Formula (5) is the error covariance matrix prediction equation, where is the optimal estimate of the system state at time k The corresponding error covariance matrix is, is the prediction of the system state The corresponding error covariance matrix is, It is the equation The Jacobian matrix of is the covariance matrix of the system process noise at time k;

[0159] S502, based on the actual characteristic points and ID information of the system at time k+1, the prediction result of the system state at time k+1 obtained in the previous step is optimized to obtain the optimal estimate of the system state at time k+1, as follows:

[0160] (6)

[0161] in, is the optimal estimate of the system state at time k+1, is the Kalman gain matrix, which is calculated as follows:

[0162] (7)

[0163] in, It is the equation The Jacobian matrix of is the covariance matrix of the measurement noise at time k+1;

[0164] S503, continue to update the error covariance matrix at time k+1, the formula is as follows:

[0165] (8)

[0166] Where I is the identity matrix, is the optimal estimate of the system state at time k+1 The corresponding error covariance matrix.

[0167] Furthermore, in the above-mentioned indoor parking lot positioning method based on visual SLAM, the positioning module is specifically used for:

[0168] S601, construct a dictionary containing the feature points and ID information, that is, a set of words, expressed as:

[0169] (9)

[0170] S602, determine the words in a frame of image and form a bag-of-words vector, which is expressed as follows:

[0171] (10)

[0172] Among them, 1 means the word exists, and 0 means it does not exist. Respectively represent the first feature point and the first ID information, Represent the nth feature point and nth ID information respectively;

[0173] S603, comparing the difference between the description vectors F of the two frames of images, and the similarity is greater than a preset threshold The two images are taken as a detected loop and the map is updated to achieve indoor parking lot mapping and vehicle positioning.

[0174] Embodiment 3

[0175] Another aspect of the present invention further provides a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of the method described in the first embodiment above.

[0176] Embodiment 4

[0177] Another aspect of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first embodiment when executing the program.

[0178] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0179] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0180] More specific examples (a non-exhaustive list) of computer-readable storage media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0181] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0182] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does 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.

[0183] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A visual SLAM-based indoor parking lot positioning method, characterized by: The steps include: Step 1: Use a monocular camera to collect Apriltag image data, and use an inertial measurement unit to obtain the vehicle's IMU data information; the image data includes an indoor parking lot image including multiple Apriltags; the IMU data includes vehicle posture, angular velocity and linear acceleration information; Step 2: jointly calibrate the monocular camera and the inertial measurement unit to the vehicle coordinate system; Step 3: Preprocess the parking lot image acquired by the monocular camera, extract feature points in the parking lot image using the SIFT algorithm, and obtain the April tag position and its ID in the parking lot image; Step 4: Preprocess the IMU data to calculate the vehicle's position information; Step 5: For the acquired feature points and ID information, combined with the vehicle posture information, an extended Kalman filter is used to perform map optimization; Step 6: Use the bag-of-words model to perform loop detection, update the map, and realize indoor parking lot mapping and vehicle positioning; Step 3 preprocesses the parking lot image acquired by the monocular camera, extracts feature points in the parking lot image using the SIFT algorithm, and obtains the April tag position and its ID in the parking lot image, including: S301, the preprocessing includes Gaussian smoothing and DoG feature map calculation; S302, extracting feature points from the parking lot image using a SIFT algorithm: identifying potential scale- and rotation-invariant interest points in the parking lot image using a Gaussian differential function, locating key points and determining feature directions based on the interest points, determining the main directions of the feature points using a gradient histogram of the feature point neighborhood, generating a description operator in the feature point neighborhood, generating a 4x4x8-dimensional SIFT feature vector, and performing pairwise comparisons through the SIFT feature vectors of the key points to find several pairs of feature points that match each other; S303, obtaining the position of April tag and its ID in the parking lot image: graying and binarizing the parking lot image, and using the Sobel operator to perform edge detection to obtain a binary edge image, performing polygon analysis on the binary edge image until all binary points are traversed, using a polygon convex hull search algorithm to calculate the convex hull of each polygon itself, and finding the area of ​​the convex hull and its polygon, comparing the area of ​​the convex hull and its polygon, excluding the polygon when the area of ​​the polygon is larger than the area of ​​the convex hull, retaining the remaining polygons that meet the conditions, using the Douglas-Peucker algorithm to perform quadrilateral approximation on the remaining polygons, and finally decoding the detected internal patterns of the quadrilaterals to obtain the digital ID corresponding to each pattern; In step 5, the obtained feature points and ID information are combined with the vehicle posture information and the extended Kalman filter is used to perform map optimization as follows: S501, predicting the joint state estimation of the current moment's posture and feature points based on the feature point information, ID information and vehicle posture information in the parking lot image at the previous moment, wherein the joint state of the current moment's posture and feature points represents the mean, and the variance is solved by the motion change matrix, and the specific steps are as follows: Constructing basic equations: Assume discrete time , the vehicle's position is , the vehicle moves from the previous moment to the next moment, then the vehicle's motion equation is: ; Suppose the information of the feature point is , the inertial measurement unit is at position Detected , then the observation equation is: ; in, represents the position at time k, is the motion of the vehicle estimated by the feature points, The information and ID information of the feature points obtained by the inertial measurement unit are represented, and the covariance matrix of the state and error at time k+1 is predicted based on the optimal state estimate at time k: (4) (5) Formula (4) is the state test equation, where: is the optimal estimate of the system state at time k, is the optimal estimate of the state at time k System input at time Prediction of the system state at time k+1; Formula (5) is the error covariance matrix prediction equation, where is the optimal estimate of the system state at time k The corresponding error covariance matrix is, is the prediction of the system state The corresponding error covariance matrix is, It is the equation The Jacobian matrix of is the covariance matrix of the system process noise at time k; S502, based on the actual characteristic points and ID information of the system at time k+1, the prediction result of the system state at time k+1 obtained in the previous step is optimized to obtain the optimal estimate of the system state at time k+1, as follows: (6) in, is the optimal estimate of the system state at time k+1, is the Kalman gain matrix, which is calculated as follows: (7) in, It is the equation The Jacobian matrix of is the covariance matrix of the measurement noise at time k+1; S503, continue to update the error covariance matrix at time k+1, the formula is as follows: (8) Where I is the identity matrix, is the optimal estimate of the system state at time k+1 The corresponding error covariance matrix; Step 6 uses the bag-of-words model to perform loop detection. The specific steps are as follows: S601, construct a dictionary containing the feature points and ID information, that is, a set of words, expressed as: (9) S602, determine the words in a frame of image and form a bag-of-words vector, which is expressed as follows: (10) Among them, 1 means the word exists, and 0 means it does not exist. Respectively represent the first feature point and the first ID information, Represent the nth feature point and nth ID information respectively; S603, comparing the difference between the description vectors F of the two frames of images, and the similarity is greater than a preset threshold The two images are taken as a detected loop and the map is updated to achieve indoor parking lot mapping and vehicle positioning.

2. The indoor parking lot positioning method based on visual SLAM according to claim 1 is characterized in that: The monocular camera is a 180-degree wide-angle camera, and the inertial measurement unit is a vehicle-mounted inertial measurement unit.

3. The indoor parking lot positioning method based on visual SLAM according to claim 1 is characterized in that: The step 2 of jointly calibrating the monocular camera and the inertial measurement unit to the vehicle coordinate system includes: S201, setting an inertial measurement unit coordinate system and a vehicle coordinate system, wherein the front of the vehicle is uniformly taken as the Y axis, the left is the X axis, the upward is the Z axis, and the origins are the center of the inertial measurement unit and the center of the vehicle respectively; S202, calibrate the monocular camera, obtain the internal and external parameters of the monocular camera according to the Zhang Zhengyou calibration method, convert the pixel coordinate data into the camera coordinate system according to formula (1), and then use multiple calibration objects to manually measure the coordinates of the camera in the vehicle coordinate system. V -X V Y V Z V The coordinates under the camera coordinate system and the position in the camera coordinate system are used to obtain the rotation matrix R according to formula (2): C and the translation vector T C ; (1) (2) Where: Xc, Yc, Zc are the coordinate values ​​of the calibration object in the camera coordinate system, Xv, Yv, Zv are the coordinate values ​​of the calibration object in the vehicle coordinate system, R C , T C are respectively the rotation matrix and translation matrix of the data from the camera coordinate system to the vehicle coordinate system, f is the focal length of the camera, 1 / dx and 1 / dy Indicates: the number of pixels per unit length in the x-direction and the y-direction, which can be a decimal; γ is the distortion factor, which is 0; u0 and v0 represent the horizontal and vertical pixel numbers of the difference between the center pixel coordinates of the image and the pixel coordinates of the image origin, respectively; u and v are the coordinate values ​​of the calibration object on the image; S203, calibrating the inertial measurement unit to the vehicle coordinate system, selecting multiple points, and measuring their coordinates in the inertial measurement unit coordinate system. I -X I Y I Z I The coordinates in the vehicle coordinate system O V -X V Y V Z V The coordinates in the rotation matrix R are obtained according to formula (3) I and the translation vector T I , calibrated to the vehicle coordinate system; (3) Where: R I , T I are the rotation matrix and translation matrix of the data from the inertial measurement unit coordinate system to the vehicle coordinate system, X I , Y I , Z I is the coordinate value of the calibration object in the inertial measurement unit coordinate system.

4. An indoor parking lot positioning system based on visual SLAM, characterized by: For implementing the indoor parking lot positioning method based on visual SLAM according to any one of claims 1 to 3, the system comprises: Acquisition module: used to collect Apriltag image data using a monocular camera and acquire the vehicle's IMU data information using an inertial measurement unit; the image data includes an indoor parking lot image including multiple Apriltags; the IMU data includes vehicle posture, angular velocity and linear acceleration information; Calibration module: used for jointly calibrating the monocular camera and the inertial measurement unit to the vehicle coordinate system; Preprocessing module: used to preprocess the parking lot image acquired by the monocular camera, extract feature points in the parking lot image using SIFT algorithm, and acquire the April tag position and ID in the parking lot image; Calculation module: used to pre-process the IMU data and calculate the position and posture information of the vehicle; Optimization module: used to optimize the map by using extended Kalman filter based on the acquired feature points and ID information and vehicle posture information; Positioning module: used to use the bag-of-words model for loop detection, update maps, and realize indoor parking lot mapping and vehicle positioning.

5. The indoor parking lot positioning system based on visual SLAM according to claim 4 is characterized in that: The monocular camera is a 180-degree wide-angle camera, and the inertial measurement unit is a vehicle-mounted inertial measurement unit.

6. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

7. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the method according to any one of claims 1 to 3 are implemented when the processor executes the program.

Citation Information

Patent Citations

  • Visual inertial navigation SLAM method based on ground plane hypothesis

    CN108717712A

  • IMU onboard vision attitude fusion method based on Kalman filtering

    CN110032201A

  • Method for detecting feasible region based on camera and laser radar

    CN113205604A

  • Automatic mapping and high-precision positioning method for parking lot

    CN113220818A

  • Reference object-based positioning method, positioning device and movable platform

    CN113706620A