An improved RGB-D ORB-SLAM2 algorithm is proposed to address the problems that the traditional ORB-SLAM2 system cannot build a dense map and lack an octree map that can be applied to the navigation and path planning of mobile robots in specific scenarios. The algorithm uses depth information to calculate the 3D spatial position of the point clouds in key frames through the pinhole imaging model and uses outlier filtering to remove redundant clutter and voxel filtering to retain point clouds with feature information for stitching and reduce map redundancy. And through dense loopback processing， the point cloud poses are further optimized and updated in keyframes， and an accurate dense point cloud map is constructed and converted into an octree map. The experimental data shows that compared with the RGB-D SLAMV2 system， the global trajectory error and relative positional error of the RGB-D ORB-SLAM2 system are improved by more than 50%， the root mean square error is 0.89%， and the mean error is 0.76%； in terms of map-building performance， the number of point clouds is reduced by about 30% on average when compared with the same type of algorithms. In addition， the octree map occupies only 0.6% of its memory when compared with the point cloud map， which better meets the high precision and fast navigation demands.