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. Describe your pipeline. As part of the description, explain how you modified the draw_lines() function.
My pipeline consisted of 6 steps.
- Select white and yellow colors in the image using
cv2.inRange
- Convert to grayscale.
- Use gaussian blur.
- Detect edges using Canny edge detection.
- Select the region of interest in the image.
- Find hough lines in the image and extrapolate them to get one line for the left lane and one line for the right lane.
- Use
weighted_img
to draw the final output with transparency on the initial image.
In order to draw a single line on the left and right lanes, I modified the draw_lines() function using following steps:
- split all the line points from hough lines detected into two sets (left lane points, right lane points) based on slope.
- use
cv2.fitLine
to find a fit line through a points of a single lane. - use fit line slope and intercept to draw the lines from the bottom of the image to roughly the middle.
One potential shortcoming would be when there is a sharp turn, so the curve of the route is different.
Another shortcoming could be when it's not a highway but a village/city street.
A possible improvement would be to detect a region of interest automatically (for example using CNN). The wrong region of interest is one of the reason the default pipeline is not working for the challenge video.
Another potential improvement could be to reduce noise found in hough lines - some segments(points) do not belong to either of the lanes. I use very simple algorithm based on slope to reduce noise, but as the video shows it doesn't seem enough. Maybe Kalman filter could help here.
Another potential improvement could be to consider the previous frames in the pipeline - for example we could take weighted results based on previous frames, so the more blurry frames would still show somewhat valid results.