🛣 Lane Detection using Python
Cars, Machine Learning, Software Engineering
5384 views
Code I wrote in Python utilizing NumPy, OpenCV, etc., for Udacity's Self-Driving Car course. The flow goes like this:
Each video frame is processed as an image:
- Convert image to grayscale
- Apply a Gaussian blur to the grayscaled image
- Generate an image which only contains edges from the grayscaled image (Canny edge detection algorithm)
- Mask edges image to a region limited to where the camera would be positioned (a triangle in the middle)
- Determine coordinates of lines from the masked image (Hough transform algorithm)
- Extrapolate lines:
- Calculate min ys and max ys from lines
- Separate lines by slope, into left lines and right lines
- Calculate mean slope and intercept of left and right lines
- Calculate extrapolated line for each left and right lines
- Draw semi-transparent lines onto original image
Repeat for each video frame