Vision-based chemical inspection robot three-dimensional scene mapping method
Through multi-objective navigation algorithm and dense mapping technology, combined with semantic segmentation network to eliminate dynamic feature points, the problem of insufficient real-time and accuracy of vSLAM technology in chemical inspection robots is solved, and efficient three-dimensional scene mapping is achieved.
Patent Information
- Application Number
- CN202411283021.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing visual simultaneous localization and mapping (vSLAM) technology has shortcomings in real-time performance and accuracy in chemical inspection robots. Direct SLAM calculations are complex, Dense SLAM calculations are complex and not suitable for real-time applications, and DynaSLAM semantic segmentation delays lead to a decrease in real-time performance. , RDS-SLAM loses accuracy while improving real-time performance.
A multi-objective navigation algorithm is used to collect RGB images and depth images, key frames are obtained through feature extraction and tracking matching, dynamic feature points are eliminated using dense mapping and semantic segmentation networks, a graph optimization model is used for global BA optimization, and a three-dimensional image is output.
On the premise of retaining the real-time nature of the algorithm, the accuracy of the three-dimensional scene mapping of the chemical inspection robot is effectively improved, and the accuracy and stability in dynamic scenes are improved.
Smart Images

Figure CN118799503A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision, and in particular relates to a vision-based three-dimensional scene mapping method for a chemical inspection robot. Background Art
[0002] In recent years, with the development of technologies such as the Internet of Things, artificial intelligence, and big data, the chemical industry has undergone profound changes. The use of some intelligent devices has made the chemical manufacturing process safer and more efficient. Among them, chemical inspection robots have attracted more and more attention. However, at present, the research on chemical inspection robots in laboratory scenarios is not in-depth enough. Visual simultaneous localization and mapping (vSLAM) is a technology that has been applied in various fields, including robot autonomous navigation, augmented reality, autonomous driving, virtual reality, etc. This technology can effectively improve the perception ability of inspection robots in unknown environments, thereby improving inspection efficiency. vSLAM includes Feature-based SLAM, Direct SLAM, Dense SLAM, Graph-Based SLAM, DynaSLAM, RDS-SLAM, etc. These methods use various sensors, such as monocular, RGB-D or stereo cameras to capture necessary data such as RGB, depth, etc. to estimate the camera's pose and generate map points. Indicators for measuring whether the performance of a SLAM system is good include real-time performance and accuracy. Direct SLAM directly uses the photometric information of the image to estimate the camera pose, and can handle dense scenes and environments with less texture. However, directly optimizing photometric consistency involves a lot of calculations and is not suitable for real-time applications. Dense SLAM uses dense matching methods (such as stereo vision, optical flow, etc.) to estimate the depth of the image and generate a dense 3D point cloud. The computational complexity is high and it is also not suitable for real-time applications. DynaSLAM uses the same thread solution for the semantic segmentation algorithm and the pose estimation algorithm, which causes the pose estimation algorithm to spend a lot of time waiting for the results of the semantic segmentation algorithm, and also causes the real-time performance of the SLAM system to decrease. RDS-SLAM uses a four-thread structure, opens a separate thread for the semantic segmentation algorithm, only segments the key frames, and establishes a dynamic feature point probability propagation model between frames. Although this method improves the real-time performance of the entire system, it loses accuracy.
[0003] In order to solve the above technical problems, the present invention proposes a vision-based three-dimensional scene mapping method for a chemical inspection robot. Summary of the invention
[0004] In response to the above technical problems, the present invention provides a vision-based three-dimensional scene mapping method for a chemical inspection robot.
[0005] The technical solution adopted by the present invention to solve the technical problem is: A three-dimensional scene mapping method for a chemical inspection robot based on vision, the method comprising the following steps: S100: Controls the chemical inspection robot to collect RGB and depth images of the scene through a multi-target navigation algorithm; S200: extract features from the RGB image and the depth map, initialize the camera pose and map points, track and relocate the feature points, and extract key frames according to preset extraction conditions; S300: Update the attributes of the newly added map points, update the co-view link relationship, insert the keyframe into the current active sub-map, and process the keyframe in the list; S400: matching the RGB image and the depth map in the key frame list to obtain three-dimensional point cloud information, performing point cloud stitching and filtering on the three-dimensional point cloud information, and constructing a dense point cloud; S500: Perform global BA optimization using the graph optimization model, stitch the obtained three-dimensional point cloud, and output a three-dimensional image of the scene.
[0006] Preferably, S100 includes: Based on the multi-target point navigation algorithm of Rviz, a new robot operating system communication node is added. The received target point information is stored through this communication node. After the robot completes the navigation of the previous target point, the information of the next target point is sent to the robot chassis control node, so that the robot can automatically collect the RGB image and depth image of the scene.
[0007] Preferably, the extraction conditions preset in S200 include: a1: mMaxFrames frames have passed since the last keyframe was inserted, where mMAXFrames is the preset maximum value; a2: mMinFrames frames have passed since the last keyframe was inserted and the local map is idle, where mMinFrames is the preset minimum value; a3: non-monocular and [mnMatchesInliers <nRefMatches 0.25 || bNeedToInsertClose], where mnMatchesInliers indicates the number of matching pairs verified as inliers during the matching process, nRefMatches indicates the total number of matching pairs, and bNeedToInsertClose is a Boolean value indicating whether it is necessary to insert close matching pairs; when the number of tracking inliers is less than one-fourth of the total number of matching pairs, it indicates that there are too many tracking lost points, and a keyframe is inserted; b:[mnMatchesInliers <nRefMatches thRefRatio||bNeedToInsertClose] and [mnMatchesInliers>15], where thRefRatio is a threshold ratio with a value range of [0.5, 1], which is used to determine the ratio of the number of inliers to the total number of matching pairs; the number of inliers must exceed the set minimum threshold, and the overlap cannot exceed the threshold ratio thRefRatio to avoid introducing redundant information and ensure the quality of key frame tracking; c1: The current frame of the monocular / stereo IMU is 0.5s away from the last key frame added; c2: The number of matching points between the monocular IMU and the local map is in [15,75] and the tracking is recently lost; In S200, the key frames are extracted according to the preset extraction conditions as follows: In non-IMU mode, b must be satisfied, and only one of a1, a2, and a3 needs to be satisfied; In IMU mode, only one of c1 or c2 needs to be met.
[0008] Preferably, S300 includes: S310: Update the attributes of the newly added map points, update the co-viewing link relationship, and insert the key frame into the current active sub-map; S320: based on the semantic segmentation network, dynamic map points and map points with too large errors are deleted according to the observation conditions of the map points, the current key frame and the adjacent key frames are triangulated to generate new map points, and the repeated map points in the current key frame and the adjacent key frames are checked and merged; S330: When the number of key frames in the local map is greater than 2, BA optimization of the local map is performed, redundant key frames in key frames adjacent to the current frame are detected and removed, and the remaining frames are added to the closed-loop detection queue.
[0009] Preferably, updating the attributes of the newly added map point in S310 includes: S311: Extract feature points from the image, calculate the BRIEF descriptor for each feature point, map the BRIEF descriptor to the BoW vocabulary, obtain the word ID corresponding to each feature point, calculate the word ID and its weight of each feature point to form mBowVec, record the node ID where the feature point is located and its index in the node to form mFeatVec; S312: After a feature point is converted to the map coordinate system, the system needs to determine whether the feature point has been observed. If the feature point does not appear in the observation of the current frame, a new observation is added to the map point, and the average observation direction, observation distance range and feature descriptor of the map point are updated; Updating the co-view link relationship in S310 includes: S313: Obtain the degree of common view between the current frame and other key frames. The core variable is KFcounter, which includes two parameters. The first parameter represents a key frame, and the second parameter represents how many map points of the current frame are seen by the key frame, that is, the degree of common view. S314: if the degree of common view is greater than a specified threshold, a common view connection relationship is established. The process of establishing the connection is to set the connection weights of the remaining key frames, set the degree of common view as the weight of the connection between the current frame and other key frames, and sort them according to the weights; S315: If the co-viewing degree of the key frames does not exceed the weight of the threshold, a connection is established for the key frame with the largest weight; S316: If this is the first time that the current frame establishes a connection, the parent key frame of the key frame is initialized to be the key frame with the highest degree of co-viewing, a bidirectional connection relationship is established, and the current key frame is used as its child key frame.
[0010] Preferably, in S320, based on the semantic segmentation network, dynamic map points and map points with excessive errors are deleted according to the observation conditions of the map points, including: The backbone of the semantic segmentation network is divided into two symmetrical parts. The encoder on the left extracts features from the RGB image. The original input image is downsampled four times through convolution-max pooling to obtain a four-level feature map. The decoder on the right fuses the features. The feature maps of each level are fused with the feature maps obtained through deconvolution by skipping. The last layer predicts the semantic map by calculating the loss with the label. After the semantic segmentation network completes the segmentation, the feature points of the human body in the current frame are removed, and the semantic mask is expanded so that the semantic mask covers the edge area of the human body and all dynamic feature points are removed; In the key frame queue, several key frames with the highest overlap with the current frame are selected. The evaluation of the overlap depends on the similarity of the poses between frames. Then, each key frame is feature matched with the current frame respectively, and the average reprojection error of the successfully matched feature points is calculated. If the average reprojection error is greater than the set threshold, the feature point is considered to be a dynamic feature point, and the feature point is deleted and does not participate in the subsequent pose estimation and mapping.
[0011] Preferably, S400 includes: S410: traverse each pixel of the depth map corresponding to the key frame, read the depth value, read the color information of the corresponding pixel from the RGB image, call the tracking thread to calculate the spatial coordinates of the corresponding point cloud, add the point to the map, and set the width and height of the point cloud; S420: voxelizing the map through a voxel filter, calculating the centroid coordinates of each voxel grid, and using the centroid to represent all point cloud data in the voxel grid; S430: looping through all key frames and displaying a dense point cloud map.
[0012] Preferably, S410 specifically includes: Define any spatial point in the world coordinate system as , traverse the RGB image and depth image corresponding to the key frame, extract the image pixel coordinates (u, v) and the spatial depth value d, and obtain the three-dimensional space point information in the world coordinate system according to the camera pinhole model imaging principle: ; in , s represents the actual distance, d represents the spatial depth value, and z represents the proportional coefficient between the actual distance and the spatial depth value; Represents the intrinsic parameter matrix of the camera; R and t represent the camera rotation matrix and translation matrix respectively, which are obtained through tracking thread estimation and loop closure optimization in the system; Thus, the conversion of two-dimensional image coordinates to three-dimensional point cloud information can be realized: ; S420 is specifically: According to the coordinate set of the point cloud data, find the maximum value on the three coordinate axes of X, Y, and Z , , and minimum value , , , find the side length of the point cloud distribution range , , : ; Then, according to the side length r of the voxel grid, the number of voxel grids Dx, Dy, and Dz on each axis is obtained: ; in Represents rounding down, the total number of voxel grids ; Then calculate the index h of each point cloud in the voxel grid, and the index of each axis is h x 、h y 、h z , used to determine the voxel grid coordinate position to which it belongs, assuming that a certain point cloud is i: ; Finally, the coordinates of the centroid of each voxel grid are calculated, and the centroid is used to represent all the point cloud data in the voxel grid to complete the downsampling of the point cloud data.
[0013] Preferably, S500 includes: S510: creating a DBow2 bag-of-words model, and extracting closed-loop candidate key frames according to the bag-of-words model; S520: Acquire a key frame group connected to the current frame, traverse the closed-loop candidate frame group, extract the first 10 frames of the candidate frame, and form a common view frame group with the key frame; S530: traverse the key frame group, if a frame among them appears in the current active sub-map, it means that a loop is generated, and each frame in the common view frame group is compared with the current frame, and feature points are associated, and then the map point associated with the feature point is found; S540: Summarize the above map points. If the number of map points found is greater than a set threshold, solve the sim3 transformation, perform reprojection based on the transformation matrix, and calculate the number of map points that satisfy the projection relationship in the common view frame group of the candidate frame; S550: If the number of map points successfully reprojected is greater than the set threshold, sim3 optimization is performed, and the objective function is as follows: ; in, represents the optimized transfer matrix, Represents the optimized pose information, Indicates the number of views, Represents the number of feature points on each image, Indicates the target point The observation in the i-th image, i.e. the pixel coordinates of the target point, Is a mapping function, representing the target point After homogeneous transformation matrix Afterwards, the predicted position in the i-th image; Based on the optimized sim3, the number of map points that meet the requirements of reprojection is calculated in one step; S560: If the number of map points that meet the reprojection requirement is greater than the set threshold, obtain the first 10 common view frames of the current frame, and determine the number of common view frames that meet the requirements of the sim3 transformation for the current frame. If the number of frames that meet the requirements is greater than 3, it indicates that the closed loop detection is successful. S570: After the closed-loop detection is successful, perform global BA optimization, update the camera poses and map point positions of all key frames according to the rotation matrix R, translation vector t and scale factor s obtained after optimization in S550, and output a three-dimensional image of the scene.
[0014] Preferably, S510 includes: Create a DBow2 bag-of-words model to convert the keyframe image into a bag-of-words vector representation consisting of individual words. The dimension of the vector is determined by the number of words in the bag-of-words tree. By calculating the L1 norm of the bag-of-words vector between two keyframes, the similarity score of the two frames is obtained. When the similarity score is greater than the preset similarity threshold, the keyframe is determined as a closed-loop candidate keyframe of the current keyframe.
[0015] The above-mentioned vision-based three-dimensional scene mapping method for chemical inspection robots uses RGB images and three-dimensional depth images collected by RGB-D cameras to extract and track feature points, and introduces dense mapping methods to reconstruct the laboratory in three dimensions. At the same time, in order to improve the accuracy of the algorithm in dynamic scenes, the Unet network and multi-view geometry method are used to remove dynamic feature points. After experimental verification, the algorithm of the present invention effectively improves the accuracy of the algorithm while retaining the real-time performance of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flow chart of a method for building a three-dimensional scene map of a chemical inspection robot based on vision in one embodiment of the present invention; Figure 2 This is a flow chart of a vision-based three-dimensional scene mapping method for a chemical inspection robot in another embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings.
[0018] In one embodiment, Figure 1 As shown, a three-dimensional scene mapping method for a chemical inspection robot based on vision, the method comprises the following steps: S100: Controls the chemical inspection robot to collect RGB and depth images of the scene through a multi-target navigation algorithm; S200: extract features from the RGB image and the depth map, initialize the camera pose and map points, track and relocate the feature points, and extract key frames according to preset extraction conditions; S300: Update the attributes of the newly added map points, update the co-view link relationship, insert the keyframe into the current active sub-map, and process the keyframe in the list; S400: matching the RGB image and the depth map in the key frame list to obtain three-dimensional point cloud information, performing point cloud stitching and filtering on the three-dimensional point cloud information, and constructing a dense point cloud; S500: Perform global BA optimization using the graph optimization model, stitch the obtained three-dimensional point cloud, and output a three-dimensional image of the scene.
[0019] The above-mentioned vision-based three-dimensional scene mapping method for chemical inspection robots uses RGB images and three-dimensional depth images collected by RGB-D cameras to extract and track feature points, and introduces dense mapping methods to reconstruct the laboratory in three dimensions. At the same time, in order to improve the accuracy of the algorithm in dynamic scenes, the Unet network and multi-view geometry method are used to remove dynamic feature points. After experimental verification, the algorithm of the present invention effectively improves the accuracy of the algorithm while retaining the real-time performance of the algorithm.
[0020] In one embodiment, S100 includes: Based on the multi-target point navigation algorithm of Rviz, a new robot operating system communication node is added. The received target point information is stored through this communication node. After the robot completes the navigation of the previous target point, the information of the next target point is sent to the robot chassis control node, so that the robot can automatically collect the RGB image and depth image of the scene.
[0021] Specifically, in order to realize the autonomous 3D mapping of chemical scenes by inspection robots, it is necessary to shoot and collect images of the scenes comprehensively. In order to improve efficiency, a multi-point navigation plug-in is designed. By loading the plug-in through rviz and publishing multiple points that the robot needs to reach through 2D_Navi_Goal, navigation of multiple target points can be realized, so that the robot can complete the shooting task autonomously.
[0022] The specific process is as follows: add a new topic / move_base_simple / goal_temp between the Rviz node and the / move_base node of 2D_Navi_Goal, and send the message originally sent to move_base_simple / goal to / move_base_simple / goal_temp instead. Use this topic to accumulate multiple navigation point information, and send each navigation target point message geometry_msgs / PoseStamped to the topic / move_base_simple / goal in sequence according to the feedback to complete the navigation of each target point.
[0023] In one embodiment, the extraction conditions preset in S200 include: a1: mMaxFrames frames have passed since the last keyframe was inserted, where mMAXFrames is the preset maximum value; a2: mMinFrames frames have passed since the last keyframe was inserted and the local map is idle, where mMinFrames is the preset minimum value; a3: non-monocular and [mnMatchesInliers <nRefMatches 0.25 || bNeedToInsertClose], where mnMatchesInliers indicates the number of matching pairs verified as inliers during the matching process, nRefMatches indicates the total number of matching pairs, and bNeedToInsertClose is a Boolean value indicating whether it is necessary to insert close matching pairs; when the number of tracking inliers is less than one-fourth of the total number of matching pairs, it indicates that there are too many tracking lost points, and a keyframe is inserted; b:[mnMatchesInliers <nRefMatches thRefRatio||bNeedToInsertClose] and [mnMatchesInliers>15], where thRefRatio is a threshold ratio with a value range of [0.5, 1], which is used to determine the ratio of the number of inliers to the total number of matching pairs; the number of inliers must exceed the set minimum threshold, and the overlap cannot exceed the threshold ratio thRefRatio to avoid introducing redundant information and ensure the quality of key frame tracking; c1: The current frame of the monocular / stereo IMU is 0.5s away from the last key frame added; c2: The number of matching points between the monocular IMU and the local map is in [15,75] and the tracking is recently lost; In S200, the key frames are extracted according to the preset extraction conditions as follows: In non-IMU mode, b must be satisfied, and only one of a1, a2, and a3 needs to be satisfied; In IMU mode, only one of c1 or c2 needs to be met.
[0024] Specifically, in S200, map initialization is to calculate the camera pose using the first few frames of images, construct the first batch of map points, track the extracted map points, and when tracking fails, reposition and recalculate the camera pose.
[0025] Regarding the setting of preset extraction conditions, the specific analysis is as follows: setting a1 is to prevent too many frames in the past and too much information lost, resulting in tracking loss; setting a2 is to prevent the image overlap from being too high and the local mapping thread has free time to process new key frames. mMinFrames is the minimum value preset by the source code; setting a3 is because the current number of internal points in the tracking is small and there are many tracking loss points, so the key frame is inserted, otherwise it is easy to lose the track; setting b is because the number of internal points must exceed the set minimum threshold and the overlap cannot be too large to ensure the quality of key frame tracking and avoid introducing too much information redundancy; an IMU module is added to ORB-SLAM3, so there are two more IMU judgment conditions compared to ORB-SLAM2, namely c1 and c2.
[0026] In one embodiment, Figure 2 As shown, S300 includes: S310: Update the attributes of the newly added map points, update the co-viewing link relationship, and insert the key frame into the current active sub-map; S320: based on the semantic segmentation network, dynamic map points and map points with too large errors are deleted according to the observation of the map points, the current key frame and the adjacent key frames are triangulated to generate new map points, and the repeated map points in the current key frame and the adjacent key frames (two-level adjacent) are checked and merged; S330: When the number of key frames in the local map is greater than 2, BA optimization of the local map is performed, redundant key frames in key frames adjacent to the current frame are detected and removed, and the remaining frames are added to the closed-loop detection queue.
[0027] Specifically, most visual SLAM algorithms are based on static environments, but in actual scenarios, feature points on dynamic objects will seriously affect the accuracy of front-end pose estimation when constructing a three-dimensional map. To solve this problem, the present invention, based on the ORB-SLAM3 algorithm, introduces a semantic segmentation network to identify dynamic objects in the image. When performing physical sign extraction, the label of the pixel where the extracted feature is located is determined. If the label belongs to a dynamic type (mainly "people"), the object feature will be deleted and will not participate in pose optimization and mapping. After deleting the object feature points in the image that belong to the dynamic object label, the remaining feature points are used for lightweight pose estimation to obtain a preliminary pose. However, dynamic objects with undefined label attributes may appear in the environment, affecting the pose estimation and mapping quality. Therefore, the present invention uses a multi-view geometry method that does not rely on prior information to further identify dynamic feature points.
[0028] In one embodiment, updating the attributes of the newly added map point in S310 includes: S311: Extract feature points from the image, calculate the BRIEF descriptor for each feature point, map the BRIEF descriptor to the BoW vocabulary, obtain the word ID corresponding to each feature point, calculate the word ID and its weight of each feature point to form mBowVec, record the node ID where the feature point is located and its index in the node to form mFeatVec; S312: After a feature point is converted to the map coordinate system, the system needs to determine whether the feature point has been observed. If the feature point does not appear in the observation of the current frame, a new observation is added to the map point, and the average observation direction, observation distance range and feature descriptor of the map point are updated; Updating the co-view link relationship in S310 includes: S313: Obtain the degree of common view between the current frame and other key frames. The core variable is KFcounter, which includes two parameters. The first parameter represents a key frame, and the second parameter represents how many map points of the current frame are seen by the key frame, that is, the degree of common view. S314: if the degree of common view is greater than a specified threshold, a common view connection relationship is established. The process of establishing the connection is to set the connection weights of the remaining key frames, set the degree of common view as the weight of the connection between the current frame and other key frames, and sort them according to the weights; S315: If the co-viewing degree of the key frames does not exceed the weight of the threshold, a connection is established for the key frame with the largest weight; S316: If this is the first time that the current frame establishes a connection, the parent key frame of the key frame is initialized to be the key frame with the highest degree of co-viewing, a bidirectional connection relationship is established, and the current key frame is used as its child key frame.
[0029] In one embodiment, in S320, based on the semantic segmentation network, dynamic map points and map points with excessive errors are deleted according to the observation conditions of the map points, including: The backbone of the semantic segmentation network is divided into two symmetrical parts. The encoder on the left extracts features from the RGB image. The original input image is downsampled four times through convolution-max pooling to obtain a four-level feature map. The decoder on the right fuses the features. The feature maps of each level are fused with the feature maps obtained through deconvolution by skipping. The last layer predicts the semantic map by calculating the loss with the label. After the semantic segmentation network completes the segmentation, the feature points of the human body in the current frame are removed, and the semantic mask is expanded so that the semantic mask covers the edge area of the human body and all dynamic feature points are removed; In the key frame queue, several key frames with the highest overlap with the current frame are selected. The evaluation of the overlap depends on the similarity of the poses between frames. Then, each key frame is feature matched with the current frame respectively, and the average reprojection error of the successfully matched feature points is calculated. If the average reprojection error is greater than the set threshold, the feature point is considered to be a dynamic feature point, and the feature point is deleted and does not participate in the subsequent pose estimation and mapping.
[0030] Furthermore, the calculation formula of the average reprojection error is specifically: ;
[0031] In the formula, represents the average reprojection error, Indicates the number of views, Represents the number of feature points on each image, Indicates the target point The observation in the i-th image, i.e. the pixel coordinates of the feature points, Is a mapping function, representing the target point After homogeneous transformation matrix Afterwards, the prediction of the position in the i-th image.
[0032] Furthermore, in S330, when the number of key frames in the local map is greater than 2, BA optimization of the local map is performed. Specifically, in the local mapping thread, IMU is integrated for tightly coupled BA optimization, the visual scale is optimized by initializing IMU, and the IMU zero bias is optimized by vision, so as to obtain a more accurate pose.
[0033] Specifically, neither vision nor IMU alone has the ability to estimate pose: vision has scale uncertainty, and IMU has zero bias that causes drift. In the tracking thread, pure vision calculations are performed first to build a pure vision BA (Bundle Adjustment) to optimize the camera pose; in the local mapping thread, IMU is integrated for tightly coupled BA optimization.
[0034] In one embodiment, Figure 2 As shown, S400 includes: S410: traverse each pixel of the depth map corresponding to the key frame and read the depth value, read the color information of the corresponding pixel from the RGB image and assign it to p, where p represents the spatial attribute of the feature point, including the position information and color information of the feature point, call the tracking thread to calculate the spatial coordinates of the corresponding point cloud, add the point to the map, and set the width and height of the point cloud; S420: voxelizing the map through a voxel filter, calculating the centroid coordinates of each voxel grid, and using the centroid to represent all point cloud data in the voxel grid; S430: looping through all key frames and displaying a dense point cloud map.
[0035] Specifically, ORB-SLAM3 proposes a monocular and stereo visual-inertial SLAM system that integrates three types of data association: ORB features are used for short-term and medium-term data association, co-visibility graphs are used to limit the complexity of tracking and mapping, and the DBoW2 library is used for loop closure and relocalization. The tracking thread is responsible for processing sensor information and calculating the pose of the current frame compared to the active map in real time, while also deciding whether it becomes a keyframe. The local mapping thread uses vision or vision-inertial methods to adjust the refined map, add keyframes and points to the current map, and delete redundant points. Finally, the loop and map merging thread detects the common area between Atlas and the current active map, and is responsible for loop correction and merging different submaps into one map. The original ORB-SLAM3 uses sparse point clouds to efficiently estimate the camera pose. In order to obtain a more informative three-dimensional image, the present invention adds an RGB-D dense mapping thread on this basis.
[0036] In one embodiment, S410 specifically includes: Define any spatial point in the world coordinate system as , traverse the RGB image and depth image corresponding to the key frame, extract the image pixel coordinates (u, v) and the spatial depth value d, and obtain the three-dimensional space point information in the world coordinate system according to the camera pinhole model imaging principle: ; in , s represents the actual distance, d represents the spatial depth value, and z represents the proportional coefficient between the actual distance and the spatial depth value; Represents the intrinsic parameter matrix of the camera; R and t represent the camera rotation matrix and translation matrix respectively, which are obtained through tracking thread estimation and loop closure optimization in the system; Thus, the conversion of two-dimensional image coordinates to three-dimensional point cloud information can be realized: ; Furthermore, when the camera is running, there is an overlap of the visual field, which will lead to a large number of repeated three-dimensional points representing spatial information in the overlapping area. In order to avoid the redundancy of three-dimensional point cloud data, the present invention sets a voxel network filter. In the case that the shape features of the point cloud are not lost, the centroid of all points in the voxel grid is used to approximate other points. In the present invention, the resolution is set to 0.01, that is, each There is only one spatial point in the cube, thus completing the downsampling of the three-dimensional space, solving the redundancy of the three-dimensional point cloud data, and saving storage space.
[0037] S420 is specifically: According to the coordinate set of the point cloud data, find the maximum value on the three coordinate axes of X, Y, and Z , , and minimum value , , , find the side length of the point cloud distribution range , , : ; Then, according to the side length r of the voxel grid, the number of voxel grids Dx, Dy, and Dz on each axis is obtained: ; in Represents rounding down, the total number of voxel grids ; Then calculate the index h of each point cloud in the voxel grid, and the index of each axis is h x 、h y 、h z , used to determine the voxel grid coordinate position to which it belongs, assuming that a certain point cloud is i: ; Finally, the coordinates of the centroid of each voxel grid are calculated, and the centroid is used to represent all the point cloud data in the voxel grid to complete the downsampling of the point cloud data.
[0038] In one embodiment, Figure 2 As shown, S500 includes: S510: creating a DBow2 bag-of-words model, and extracting closed-loop candidate key frames according to the bag-of-words model; S520: Acquire a key frame group connected to the current frame, traverse the closed-loop candidate frame group, extract the first 10 frames of the candidate frame, and form a common view frame group with the key frame; S530: traverse the key frame group, if a frame among them appears in the current active sub-map, it means that a loop is generated, and each frame in the common view frame group is compared with the current frame, and feature points are associated, and then the map point associated with the feature point is found; S540: Summarize the above map points. If the number of map points found is greater than a set threshold, solve the sim3 transformation, perform reprojection based on the transformation matrix, and calculate the number of map points that satisfy the projection relationship in the common view frame group of the candidate frame; S550: If the number of map points successfully reprojected is greater than the set threshold, sim3 optimization is performed, and the objective function is as follows: ; in, represents the optimized transfer matrix, Represents the optimized pose information, Indicates the number of views, Represents the number of feature points on each image, Indicates the target point The observation in the i-th image, i.e. the pixel coordinates of the target point, Is a mapping function, representing the target point After homogeneous transformation matrix Afterwards, the predicted position in the i-th image; Based on the optimized sim3, the number of map points that meet the requirements of reprojection is calculated in one step; S560: If the number of map points that meet the reprojection requirement is greater than the set threshold, obtain the first 10 common view frames of the current frame, and determine the number of common view frames that meet the requirements of the sim3 transformation for the current frame. If the number of frames that meet the requirements is greater than 3, it indicates that the closed loop detection is successful. S570: After the closed-loop detection is successful, perform global BA optimization, update the camera poses and map point positions of all key frames according to the rotation matrix R, translation vector t and scale factor s obtained after optimization in S550, and output a three-dimensional image of the scene.
[0039] In one embodiment, S510 includes: Create a DBow2 bag-of-words model to convert the keyframe image into a bag-of-words vector representation consisting of individual words. The dimension of the vector is determined by the number of words in the bag-of-words tree. By calculating the L1 norm of the bag-of-words vector between two keyframes, the similarity score of the two frames is obtained. When the similarity score is greater than the preset similarity threshold, the keyframe is determined as a closed-loop candidate keyframe of the current keyframe.
[0040] During the experiment, after the present invention incorporated semantic information and multi-view average reprojection on the basis of ORB-SLAM3, the positioning error was shown in Tables 1 to 3. In most data sets, the method of the present invention has a certain improvement over the original method, which verifies the stability and accuracy of the algorithm, and can effectively realize the three-dimensional reconstruction of the scene through RGB-D information.
[0041] Table 1 Comparison of absolute pose errors
[0042] Table 2 Translation relative pose error
[0043] Table 3 Rotational relative posture error
[0044] The real-time and precision comparison results of the method of the present invention and other methods are shown in Table 4-Table 7. DynaSLAM is the most accurate among the compared methods, but also has the worst real-time performance. RDS-SLAM is the method with the best real-time performance, but the precision is not high. The UG ORB-SLAM3 used in the present invention is similar to DynaSLAM in precision, and even outperforms DynaSLAM in some data sets, and its real-time performance is also better than RDS-SLAM.
[0045] Table 4 Comparison of real-time performance of map construction
[0046] Table 5 Absolute pose errors of different algorithms
[0047] Table 6 Translation relative pose errors of different algorithms
[0048] Table 7 Rotational relative pose errors of different algorithms
[0049] The above is a detailed introduction to a vision-based three-dimensional scene mapping method for a chemical inspection robot provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the core idea of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A three-dimensional scene mapping method for a chemical inspection robot based on vision, characterized in that: The method comprises the following steps: S100: Controls the chemical inspection robot to collect RGB and depth images of the scene through a multi-target navigation algorithm; S200: extract features from the RGB image and the depth map, initialize the camera pose and map points, track and relocate the feature points, and extract key frames according to preset extraction conditions; S300: Update the attributes of the newly added map points, update the co-view link relationship, insert the keyframe into the current active sub-map, and process the keyframe in the list; S400: matching the RGB image and the depth map in the key frame list to obtain three-dimensional point cloud information, performing point cloud stitching and filtering on the three-dimensional point cloud information, and constructing a dense point cloud; S500: Perform global BA optimization using the graph optimization model, stitch the obtained three-dimensional point cloud, and output a three-dimensional image of the scene.
2. The method according to claim 1, characterized in that S100 includes: Based on the multi-target point navigation algorithm of Rviz, a new robot operating system communication node is added. The received target point information is stored through this communication node. After the robot completes the navigation of the previous target point, the information of the next target point is sent to the robot chassis control node, so that the robot can automatically collect the RGB image and depth image of the scene.
3. The method according to claim 2, characterized in that The extraction conditions preset in S200 include: a1: mMaxFrames frames have passed since the last keyframe was inserted, where mMAXFrames is the preset maximum value; a2: mMinFrames frames have passed since the last keyframe was inserted and the local map is idle, where mMinFrames is the preset minimum value; a3: non-monocular and [mnMatchesInliers <nRefMatches 0.25 || bNeedToInsertClose ], where mnMatchesInliers indicates the number of matching pairs verified as inliers during the matching process, nRefMatches indicates the total number of matching pairs, and bNeedToInsertClose is a Boolean value indicating whether it is necessary to insert close matching pairs; when the number of tracking inliers is less than one-fourth of the total number of matching pairs, it indicates that there are too many tracking lost points, and a keyframe is inserted; b:[mnMatchesInliers <nRefMatches thRefRatio||bNeedToInsertClose] and [mnMatchesInliers>15], where thRefRatio is a threshold ratio with a value range of [0.5, 1], which is used to determine the ratio of the number of inliers to the total number of matching pairs; the number of inliers must exceed the set minimum threshold, and the overlap cannot exceed the threshold ratio thRefRatio to avoid introducing redundant information and ensure the quality of key frame tracking; c1: The current frame of the monocular / stereo IMU is 0.5s away from the last key frame added; c2: The number of matching points between the monocular IMU and the local map is in [15,75] and the tracking is recently lost; In S200, the key frames are extracted according to the preset extraction conditions as follows: In non-IMU mode, b must be satisfied, and only one of a1, a2, and a3 needs to be satisfied; In IMU mode, only one of c1 or c2 needs to be met.
4. The method according to claim 3, characterized in that S300 includes: S310: Update the attributes of the newly added map points, update the co-viewing link relationship, and insert the key frame into the current active sub-map; S320: based on the semantic segmentation network, dynamic map points and map points with too large errors are deleted according to the observation conditions of the map points, the current key frame and the adjacent key frames are triangulated to generate new map points, and the repeated map points in the current key frame and the adjacent key frames are checked and merged; S330: When the number of key frames in the local map is greater than 2, BA optimization of the local map is performed, redundant key frames in key frames adjacent to the current frame are detected and removed, and the remaining frames are added to the closed-loop detection queue.
5. The method according to claim 4, characterized in that The new map point attributes updated in S310 include: S311: Extract feature points from the image, calculate the BRIEF descriptor for each feature point, map the BRIEF descriptor to the BoW vocabulary, obtain the word ID corresponding to each feature point, calculate the word ID and its weight of each feature point to form mBowVec, record the node ID where the feature point is located and its index in the node to form mFeatVec; S312: After a feature point is converted to the map coordinate system, the system needs to determine whether the feature point has been observed. If the feature point does not appear in the observation of the current frame, a new observation is added to the map point, and the average observation direction, observation distance range and feature descriptor of the map point are updated; Updating the co-view link relationship in S310 includes: S313: Obtain the degree of common view between the current frame and other key frames. The core variable is KFcounter, which includes two parameters. The first parameter represents a key frame, and the second parameter represents how many map points of the current frame are seen by the key frame, that is, the degree of common view. S314: if the degree of common view is greater than a specified threshold, a common view connection relationship is established. The process of establishing the connection is to set the connection weights of the remaining key frames, set the degree of common view as the weight of the connection between the current frame and other key frames, and sort them according to the weights; S315: If the co-viewing degree of the key frames does not exceed the weight of the threshold, a connection is established for the key frame with the largest weight; S316: If this is the first time that the current frame establishes a connection, the parent key frame of the key frame is initialized to be the key frame with the highest degree of co-viewing, a bidirectional connection relationship is established, and the current key frame is used as its child key frame.
6. The method according to claim 5, characterized in that In S320, based on the semantic segmentation network, dynamic map points and map points with large errors are deleted according to the observation conditions of the map points, including: The backbone of the semantic segmentation network is divided into two symmetrical parts. The encoder on the left extracts features from the RGB image. The original input image is downsampled four times through convolution-max pooling to obtain a four-level feature map. The decoder on the right fuses the features. The feature maps of each level are fused with the feature maps obtained through deconvolution by skipping. The last layer predicts the semantic map by calculating the loss with the label. After the semantic segmentation network completes the segmentation, the feature points of the human body in the current frame are removed, and the semantic mask is expanded so that the semantic mask covers the edge area of the human body and all dynamic feature points are removed; In the key frame queue, several key frames with the highest overlap with the current frame are selected. The evaluation of the overlap depends on the similarity of the poses between frames. Then, each key frame is feature matched with the current frame respectively, and the average reprojection error of the successfully matched feature points is calculated. If the average reprojection error is greater than the set threshold, the feature point is considered to be a dynamic feature point, and the feature point is deleted and does not participate in the subsequent pose estimation and mapping.
7. The method according to claim 6, characterized in that S400 includes: S410: traverse each pixel of the depth map corresponding to the key frame, read the depth value, read the color information of the corresponding pixel from the RGB image, call the tracking thread to calculate the spatial coordinates of the corresponding point cloud, add the point to the map, and set the width and height of the point cloud; S420: voxelizing the map through a voxel filter, calculating the centroid coordinates of each voxel grid, and using the centroid to represent all point cloud data in the voxel grid; S430: looping through all key frames and displaying a dense point cloud map.
8. The method according to claim 7, characterized in that S410 is specifically: Define any spatial point in the world coordinate system as , traverse the RGB image and depth image corresponding to the key frame, extract the image pixel coordinates (u, v) and the spatial depth value d, and obtain the three-dimensional space point information in the world coordinate system according to the camera pinhole model imaging principle: ; in , s represents the actual distance, d represents the spatial depth value, and z represents the proportional coefficient between the actual distance and the spatial depth value; Represents the intrinsic parameter matrix of the camera; R and t represent the camera rotation matrix and translation matrix respectively, which are obtained through tracking thread estimation and loop closure optimization in the system; Thus, the conversion of two-dimensional image coordinates to three-dimensional point cloud information can be realized: ; S420 is specifically: According to the coordinate set of the point cloud data, find the maximum value on the three coordinate axes of X, Y, and Z , , and minimum value , , , find the side length of the point cloud distribution range , , : ; Then, according to the side length r of the voxel grid, the number of voxel grids Dx, Dy, and Dz on each axis is obtained: ; in Represents rounding down, the total number of voxel grids ; Then calculate the index h of each point cloud in the voxel grid, and the index of each axis is h x 、h y 、h z , used to determine the voxel grid coordinate position to which it belongs, assuming that a certain point cloud is i: ; Finally, the coordinates of the centroid of each voxel grid are calculated, and the centroid is used to represent all the point cloud data in the voxel grid to complete the downsampling of the point cloud data.
9. The method according to claim 8, characterized in that S500 includes: S510: creating a DBow2 bag-of-words model, and extracting closed-loop candidate key frames according to the bag-of-words model; S520: Acquire a key frame group connected to the current frame, traverse the closed-loop candidate frame group, extract the first 10 frames of the candidate frame, and form a common view frame group with the key frame; S530: traverse the key frame group, if a frame among them appears in the current active sub-map, it means that a loop is generated, and each frame in the common view frame group is compared with the current frame, and feature points are associated, and then the map point associated with the feature point is found; S540: Summarize the above map points. If the number of map points found is greater than a set threshold, solve the sim3 transformation, perform reprojection based on the transformation matrix, and calculate the number of map points that satisfy the projection relationship in the common view frame group of the candidate frame; S550: If the number of map points successfully reprojected is greater than the set threshold, sim3 optimization is performed, and the objective function is as follows: ; in, represents the optimized transfer matrix, Represents the optimized pose information, Indicates the number of views, Represents the number of feature points on each image, Indicates the target point The observation in the i-th image, i.e. the pixel coordinates of the target point, Is a mapping function, representing the target point After homogeneous transformation matrix Afterwards, the predicted position in the i-th image; Based on the optimized sim3, the number of map points that meet the requirements of reprojection is calculated in one step; S560: If the number of map points that meet the reprojection requirement is greater than the set threshold, obtain the first 10 common view frames of the current frame, and determine the number of common view frames that meet the requirements of the sim3 transformation for the current frame. If the number of frames that meet the requirements is greater than 3, it indicates that the closed loop detection is successful. S570: After the closed-loop detection is successful, perform global BA optimization, update the camera poses and map point positions of all key frames according to the rotation matrix R, translation vector t and scale factor s obtained after optimization in S550, and output a three-dimensional image of the scene.
10. The method according to claim 9, characterized in that S510 includes: Create a DBow2 bag-of-words model to convert the keyframe image into a bag-of-words vector representation consisting of individual words. The dimension of the vector is determined by the number of words in the bag-of-words tree. By calculating the L1 norm of the bag-of-words vector between two keyframes, the similarity score of the two frames is obtained. When the similarity score is greater than the preset similarity threshold, the keyframe is determined as a closed-loop candidate keyframe of the current keyframe.
Citation Information
Patent Citations
Visual positioning and static map construction method and system in dynamic environment
CN112991447A
Indoor mobile robot dense mapping and autonomous navigation integration method based on depth camera
CN116295412A
Cited By
Marine visual SLAM distance measurement method and device, computer equipment and storage medium
CN119027638A
Robot synchronous positioning and mapping method, system and device in dynamic environment and medium
CN119756334A
Intelligent inspection method and system based on AR (Augmented Reality) equipment
CN120747651A
Visual SLAM method and system based on lightweight semantic gating suppression
CN121074430A
Fusion positioning method for well mining long corridor environment and medium
CN121089727A
