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 consisted of 5 steps.
-
Blurring the grayscale image using opencv's gaussian blur with a kernel size of 5x5
-
using the opencv canny edges filter, using low threshold = 40 and high threshold = 120
-
applying a region of interest function by giving a polygon with 4 relavent vertices that appropriately selected the region of interest.
-
using hough lines to find small linesegments. This needed a lot of hyperparameter tuning to get it to work well on all the images.
-
modifying the draw_lines() function to draw single optimum line for each left and right boundary of the lane that best fits the smaller lines that were detected by the hough. To do this, I followed the following series of steps:
- computed slope and y intercept for each line in the hough lines
- performed some sanity checks by disregarding all the slopes that were either too steep or too flat, i.e. m<abs(0.3) or m>abs(1)
- sorted and stored left and right slopes and intercepts in separate list based on a sign check on the slope
- took a mean of both slopes and intercepts to average the line so that we get the optimum parameters of the line that fits best
- calculated the extreme coordinates based on the image's shape that satisfied the left line and the right line equation
- drew lines using these coordinates and updated the cache
- for any empty list errors, which means there were no sane lines found by the hough lines function, used the cached coordinates to draw and retain the previously computed lines (useful on videos).
- used the ROI again to limit the left and right lanes to the actual lanes.
Following are some drawbacks of this pipeline
- The region of interest has to be manually set, hence not robust
- This will not work for curved lanes
- A straight line equation is used to fit the detected edges, due to which curvy lanes can not be fit well
- Edge detection might fail in poor weather conditions or bad lighting as all the hyperparameters are tuned and kept static
Following are the possible improvements to this pipeline
- Use more sophisticated algorithms like RANSAC to interpolate and find the best fit for the lane
- Use higher degree polynomial functions to properly fit curves.
- Use night vision camera to keep detecting lanes even in poor lighting
- use sensor fusion from multiple cameras