My pipeline consisted of 5 steps. First, I converted the images to grayscale, applied gaussian blur,
canny edge detection, image mask, then hough line transformation.
In order to draw a single line on the left and right lanes, I modified the draw_lines() function.
I used polyfit and poly1d function from numpy library to extrapolate line segments into a
single straight line for each lanes. I assigned points from lines to either left or right lane group,
by their gradient.
For the optional challenge, the biggest obstacle was that the front hood of the car was in the video,
interfering with lane detection. I first thought of removing bottom part of the video, but it led to
performance drop for other videos. For the submission, I set a gradient magnitude limit of 0.5 to remove
edges caused by the front hood, which made the pipe line more robust.
Fig1. Grayscaled image Fig2. Image after applying gaussian blur Fig3. Extracted lane.
One potential shortcoming would be that it may malfunction on extremely sharp curves,
due to its gradient limit.
A possible improvement would be to recalibrate the camera on start-up.
Analyze the scene before driving and adjust the camera angle to optimal position.
After that we can remove the gradient limit.