In order to address the challenges of low lane line detection rates caused by complex road conditions,we propose a novel algorithm that integrates frost and ice optimisation with optimal thresholding. A pre-processing model based on Retinex theory is used to reduce noise and preserve grey scale detail. The optimal OTSU threshold is determined for segmentation, which is enhanced by tent mapping. To further enhance the precision of the detection process, the binarized image is transformed into a bird’s-eye view, and the lane line pixel features are identified through the use of an adaptive sliding window. Ultimately, the RANSAC algorithm is utilized in conjunction with a parabolic model for lane line fitting. The experimental results demonstrate that, in comparison to similar image segmentation algorithms, the proposed method exhibits a notable advantage in terms of threshold calculation error and computational efficiency. Moreover, in comparison to analogous line detection algorithms, the detection accuracy rate reaches 93.87%, effectively reducing the impact of interference factors and demonstrating remarkable robustness that surpasses the traditional Hough Transform, which has an accuracy of 43.2%, and sliding window and Hough transform, with an accuracy of 89.16%. The code of our research work is publicly available at: https://github.com/zx2000430/rime.