Visual SLAM has rich application scenarios and can work both indoors and outdoors. However, it is greatly affected by ambient light and cannot work in dark places. There are cumulative errors in map construction, which poses challenging requirements for precise positioning and low computing costs. To solve this problem, this paper introduces a SLAM system based on fusion of vision and inertial measurement unit (IMU). Aiming at the angle error existing in the raw data of the IMU sensor, a mean filtering algorithm is designed in this paper. The IMU data is filtered and the visual information is used as input to the SLAM system to improve the positioning accuracy and robustness of the system. Experimental results prove that the mean filtering algorithm for IMU data processing can effectively decrease the angular error of the system. The implementation of the proposed method shows its potential in practical applications, especially in environments with high precision requirements.