Advanced Lane Detection


Detect lanes using computer vision techniques. This project is part of the Udacity Self-Driving Car Nanodegree, and much of the code is leveraged from the lecture notes.

The following steps were performed for lane detection:

  • Compute the camera calibration matrix and distortion coefficients given a set of chessboard images.
  • Apply a distortion correction to raw images.
  • Use color transforms, gradients, etc., to create a thresholded binary image.
  • Apply a perspective transform to rectify binary image (“birds-eye view”).
  • Detect lane pixels and fit to find the lane boundary.
  • Determine the curvature of the lane and vehicle position with respect to center.
  • Warp the detected lane boundaries back onto the original image.
  • Output visual display of the lane boundaries and numerical estimation of lane curvature and vehicle position.

Here is the final video output on Youtube. The same video is ‘out.mp4’ in this repo. The original video is ‘project_video.mp4’.


  • Python 3.5
  • Numpy
  • OpenCV-Python
  • Matplotlib
  • Pickle

How to run

Run python This will take the raw video file at ‘project_video.mp4’, and create an annotated output video at ‘out.mp4’. Afterwards, it will display an example annotated image on screen.

To run the lane detector on arbitrary video files, update the last few lines of ‘’.




Let's Expert Up