Finding Lane Lines on the Road
The goals / steps of this project are the following:
- Make a pipeline that finds lane lines on the road
- Reflect on your work in a written report
My pipeline consists of 7 steps:
- Convert images to grayscale
- Apply gaussian smoothing algorithm to reduce noise and image detail to improve processing
- Detect edges using the Canny detection algorithm
- Limit the image processing area to the region of interest. The region of interest is hardcoded to include the area in front of the car
- Apply the Hough Line Transform alogirthm to detect straight lines and identify lanes
- Draw semi-transparent red lane indicators on top of the image
- Save the image
In order to draw a single line on the left and right lanes, I modified the draw_lines() function by:
- Grouping all lines into left and right lanes based on the slope of each line
- Calculating weighted average of the slope and intercept for all lines in each group using line length as weight
- Using the slope and intercept for each lane, calculate (x,y) coordinates for the extrapolated lane, making the line bound by the region of interest
See combine_lane_lines() and line_from_slope_intercept() functions for more details
Pipeline sample:
The pipeline assumes a fixed region of interest. This works only on flat roads. If the car were to drive up a steep hill or approach the top of the hill followed by a ravine, the region will either not extend far enough to probe for the lane direction or go over the horizon
The pipeline works with straight lines only. It fails when the car drives along a curved road.
If any of the lanes are not marked, nothing will be displayed on the screen
Dynamically detect the region of interest by looking for a horizon/rate of lane convergence
Instead of assuming straight lines, fit to a curve
If any of the lines are not detected, make an assumption based on the region of interest or extend beyond the region of interest to try and detect other references, such as sidewalks