#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
###1. Pipeline:
The pipeline consists of 7 steps:
- Conversion to grayscale image
- Masking (Reducing processed image to region of interest)
- Removing noise using gaussian blur
- Canny edge detection
- Overpaint edges introduced by masking
- Hough line detection
- Process lines ( removing non lane lines )
- Overlay the line image onto the original road image
In order to draw a single line on the left and right lanes, I processed the resulting lines from the Hough line detection in step 5 within in the function process_lines before using the draw_lines function. The latter one wasn’t changed in functionality.
####To step 6: Process lines
- in process_lines lines with slopes smaller than 0.4 are discarded to avoid lane detection errors caused by horizontal lines, i.e removing horizontal lines
- grouping remaining lines into left and right lane
- averaging each group yielding an averaged left and right line
- extrapolation of the left and the right line, which is supposed to be marking the left and right lane
Extrapolation is carried out after averaging, to keep the impact of longer lines on the resulting extrapolated line higher than of shorter lines. This should reduce the distortion of short lines not marking a lane on the averaged and extrapolated line, which is assumed to be a lane.
If you'd like to include images to show how the pipeline works, here is how to include an image:
###2. Shortcomings
The pipeline might not work well enough, if
- if the road is tightly curved
- the car is not centered between the lanes, e.g. when overtaking or exiting the highway
- high contrasts (high gradient color changes, like shadows from trees, or road color changes e.g. concrete to tar) cause edges and therwith lines detected, which are not part of the lanes. This can be seen in the output of the 'challenge.mp4' video.
- when it is dark, or generally different lighting of the road
###3. Suggest possible improvements to your pipeline
Possible improvements:
-
Auto adjusting parameters depending on averages brightness of the current frame (improving pipeline to work at night as good as at daylight)
-
Low pass filtering over frames of the video: This would remove the danger of not having any lead, if marking is not provided or not detected correctly.
-
Run hough line detection on parts of the image: divide the image into close (5m ahead of the car), near (5 to 20m) and far away (20m +). Each part will have its own masking and parameters for improving detection. For example the further away, the more likely to see curved lines if a curve is coming up. Thus filtering of non-lane lines could be adjusted differently
-
Using a transformation for curves (Hough lines for circle?)
-
Using a total different approach: Adaptive real-time road detection with neural networks, e.g. http://ieeexplore.ieee.org/abstract/document/1398891/?reload=true
-
or with a model: An Improved Linear-Parabolic Model for Lane Following http://ieeexplore.ieee.org/abstract/document/1599093/
-
Other possible improvements: Add Equalizing of the gray-scale image as step 2b. After Removing noise using the gaussian blur a threshold via (cv2.adaptiveThreshold) might make the lane detection more robust against brightness changes (daylight variations, shadows, etc.).
The resulting pipeline would be as follows:
- Using different color space HSV (Hue, Saturation, Value)
- Conversion to grayscale image
- Masking (Reducing processed image to region of interest)
- Equalized the grayscaled image (e.g. cv2.equalizeHist)
- Removing noise using gaussian blur
- Threshold (e.g. cv2.adaptiveThreshold)
- Skeletonize (skimage.morphology.skeletonize)
- Overpaint edges introduced by masking
- Hough line detection
- Process lines ( removing non lane lines )
- Overlay the line image onto the original road image