In order to improve the applicability of the visual SLAM algorithm in underground coal mines, a visual SLAM algorithm considering image enhancement is proposed, which improves the overall performance of visual SLAM through image enhancement processing. Firstly, a Retinex algorithm based on improved bilateral filtering is designed to enhance the coal mine image. Convert the original image to the HIS (Hue, Saturation, Intensity) color space, and use the improved bilateral filter function to replace the Gaussian kernel function in the Retinex algorithm to estimate the reflection component of the intensity component , and then convert back to the RGB color space to obtain an enhanced image with improved contrast and unaffected by lighting. Compared with the Single-Scale Retinex (SSR) and Muti-Scale Retinex (MSR) algorithms, the images processed by this algorithm do not appear obvious whitening and halo phenomena, and the image quality has been significantly improved. Secondly, the algorithm is introduced into the classic ORB-SLAM2 algorithm framework for subsequent pose estimation and mapping. Finally, in order to verify the feasibility and applicability of the algorithm in this paper, experiments are carried out in the coal mine roadway environment. The results show that, compared with the ORB-SLAM2 algorithm, this algorithm has better positioning accuracy and mapping effect in underground coal mine, which provides an important technical support for the visual perception and positioning of the mine robot.