Raspberry Pi Lane Departure Alert

Adding lane departure alert capabilities to my car with a Raspberry Pi 3

Similar projects worth following
The goal of this project is to push the limits of what the Raspberry Pi 3 is capable of in regards to real time image processing. Using knowledge I gained from Udacity's Self-Driving Car Engineer nanodegree, I am building a system to automatically detect lane lines, and provide a visual and possibly audible alert if the car is drifting.

Future development on the project will include communication with a Panda OBDII module. From this, I can gather and display engine information, and ensure that the lane departure alert only sounds when the turn signal was not in use.

Enjoy this project?



Beranmar wrote 11/15/2019 at 22:02 point

Hi Kyle, I was checking your projects on github. Did you think to continue with the PRi when there is version 4 - more powerful ? I like that lane alert, car detection and traffic light detection. Would like to develop something like self-driving robot car that will learn the area (or use GPS and maps when bigger) + identify details about the oponent. For antonomous robot matches. But this may need LIDAR to find the oponent than identify lanes.

  Are you sure? yes | no

mbt28 wrote 10/26/2017 at 11:24 point


I am doing research in my phd studies for a similar topic. Could you able to achieve something? What is your master plan to process image for lane following?


  Are you sure? yes | no

Kyle Rector wrote 11/03/2017 at 17:00 point

Hi there! 

Sorry for the delay! This project has been on a small hold as my family moves for my new job. 

I can give some details as to my plan though:

I am using a Pi3 as a minimum, with the PiCamera accessory. For processing, I plan on making a more naive version of the code I developed for the Udacity Self Driving Car Nanodegree's Project 4 (

Using the video processing pipeline from that project, the Pi would not likely be able to process frames very quickly. The process involves binary thresholding each frame, aggregating the pixel column data to find the base of each lane line, and then using a sliding window search to find the rest of each lane line. It then fits a polynomial to each line, and draws that back on the image.

My ideal similar approach would skip the sliding window and instead do the pixel column aggregation in several horizontal segments of the frame. Then, a polynomial would be fit to a much smaller set of points per line, cutting down on compute time. 

Some accuracy might be lost, but it might be a good enough approximation for lane departure checking.

If you are looking for a very naive approach, you could look at examples of the first project in the Udacity course on GitHub. Mine can be found at

Also, Adrian at has some excellent tutorials for installing OpenCV on a Pi.

I realize that was pretty long winded, but hopefully might help!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates