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.
- Grayscale: I converted the images to grayscale using "cv2.cvtColor".
- Guassian smoothing: The "cv2.GaussianBlur" is applied on the image.
- Edge detection: The "cv2.Canny" is applied to obtain gradient plot.
- Hough transform: A mask with polygon region of interest is first created then together with "cv2.HoughLinesP" the lane lines are obtained.
- Overlay plots: A final figure is created with "cv2.addWeighted".
To draw a single line on the left and right lanes, I modified the function by:
-
Instead of draw every lines, an average value is calculated for the slope, the x coordiate, and the y coordinate.
-
A final line is drawn using the following function. \begin{equation} y-y_{ave}=k_{ave}*{x-x_{ave}} \end{equation}
One potential shortcoming would be the line drawn is not stable, it is shaking frequently.
Another shortcoming could be not able to deal with curved lane, as in the "Challenge" part.
A possible improvement would be to add a filter in the calculatio of the slope.(only allow slopes in a certain range to be considered.)
Another potential improvement could be that, instead of a single line, draw a curved line. (Or multiple small lines connected together? Not sure yet.)