In order to solve the problem of accuracy decline of positioning and mapping of the visual SLAM (simultaneous localization and mapping) algorithm in a dynamic environment, an RGB-D SLAM algorithm is proposed based on dynamic coupling and spatial data association. Firstly, the semantic network is used to obtain pre-processed semantic segmentation images, the edge detection algorithm and adjacent semantic judgment are combined to obtain the complete semantic dynamic objects. Secondly, the initial camera attitude is estimated in the dense direct method module, and wherein the dynamic coupling scores are calculated not only by the traditional dynamic region elimination, but also by the spatial plane consistency and the depth information screening. Further, the map point set is updated in real time by the spatial data association algorithm and the camera pose, and then pose of the camera is optimized by minimizing the reprojection error and the closed-loop optimization process. Finally, the octree dense map is constructed by using the camera pose and the map point set to eliminate all the dynamic region, from plane to space, and the static map is constructed in dynamic environment. According to the test results on TUM data set in a high-dynamic environment, the positioning error of the proposed algorithm is reduced by about 90% compared with that of ORB-SLAM algorithm, and the positioning accuracy and the camera pose estimation accuracy of RGB-D SLAM algorithm are effectively improved by the proposed algorithm.