Dashcam Lane Detection

handling video

Posted on September 25, 2017

Following my first and second attempts at lane detection with computer vision in Python, this third post will look at applying lane detection to dashcam video.

In my case, I’ve pulled a variety of footage from the DOD 460W dashcam in my 2007 Honda Fit. I tried to include highway and city routes, during both day and night.

Improved Codebase

I am applying the approach by Naoki Shibuya, which uses moviepy for splitting a video file into sequential images, and then applying the lane detection algorithm. This draws red markers over detected lanes in dashcam footage.

Overall, the Canny Edge Detection algorithm worked well once I cropped out the yellow text my dashcam overlays on the footage from the area of interest. However, it’s not perfect as you see in this sample clip where:

  • I change lanes and the right line detector goes wonky.
  • I pass a turn off and the left lane marker vanishes.
  • I pass a police officer writing a ticket to a fool in a jacked-up pickup truck.


Overall, this algorithm does a pretty good job of detecting lanes in dashcam footage, however taking 30 minutes or more to process 3 minutes of dashcam footage isn’t a reasonable approach. I would not want to drive in that vehicle!

Next Steps

So, in future, I will consider ways to improve this processing rate, ideally through smarter algorithms for lane detection.

More in this series…