Computer Vision: Advanced Lane Marking Through Thresholding

Lane Detection using Gradient, Colour Thresholding and sliding window algorithm

Archit Rastogi
9 min readSep 13, 2020

In my earlier post, I talked about finding lane lines using Edge Detection and Hough Transforms. While Canny edge detection is great in finding the edges, it gives you a lot of edges in the picture, all of which are not relevant for the lane finding.

In this post, I would describe how to create a pipeline to find lane markings from a video using better algorithms than the last post. The pipeline would mark the lane, project the marked lane onto the video, tell the curvature of the road and also the position of the vehicle within that lane. I would use some of the concepts that I described before like camera calibration, perspective transform as well as a few new ones like thresholding, sliding window etc.

To begin with, the images were corrected for camera distortion using the algorithm described in my previous post. The next task was to identify the pixels in picture that belongs to the lane markings for which I used Gradient and Colour Thresholding.

Gradient Threshold

In the Canny Edge Detection, we took the overall gradient which helped us in detecting the regions which had sharp change in…