Finding Lane Lines on the Road

Intro

In self-driving car detecting lane lines, it is necessary to guide vehicles in the roads This project shows several techniques needed to achieve this important task. The the goal is to find both left and right lane lines by plotting colored lines over its respective lane lines pixels in the image.


Finding Lane Lines on the Road

The goals of this project are the following:

  • Process input image and detect lines
  • Filter caught lines to match the lane lines
  • Drawn the left and right corresponding lane lines into the image
  • Make a pipeline that finds lane lines on the road
  • Apply this pipeline to the test set images and videos provided
  • Reflect on your work in a written report

Reflection

1. Description

The following steps describe how the pipeline was built.

  1. Detect Image Edges Using the canny technique to determine edges overall image, it requires the input image to be of one channel (grayscale), then a Gaussian function with some kernel configuration should be applied to remove some noise and finally plug the output of this to canny function.

  2. Detect lines from Hough Space This step detects lines from a given image, to facilitate it the input image already one with only edges and in addition, it receives a mask as the region of interest to only focus searching lines in the given area. The output is a collection of lines(two points) of different slopes

  3. Drawn the lines which overlap on lane lines.

The `draw_lines` function was extended to improve the drawing of the lane lines,
the hough lines of given image were filtered to separate right lane lines from left lane lines. Also, to filter out noisy lines that do not correspond to the lane lanes.
Hough lines with positive slope are right ones, and the ones with negative slope are the left ones.
Lines wich probably are the ones that overlap the lane lines should have slopes between this range
(0.5..0.9) and (-0.5..-0.9) other than those ranges are considered noise.

Having the curated list of lines the next is join all of these by averaging slope and center points.
Then using this slope(m) and center points (x1, y1) extrapolate the line with the help of this formula (y - y1) = m(x - y1); in turn, out this will lead to only two lines for left and right lanes. I've
created a helpers function `extrapolate_line` and `filter_lines` to keep code of `draw_lines` simple and
clean as possible.

Sudden movements from the lines between frames were tackle by averaging over all slopes, and centers of all frames, it was necessary to soften the drawn between frames. Also, I consider only average over the last 100 parameters which behave well. I did experiments with ten, but lines were shaking a little, then tried
1000 and lines some times get out of the lane but looks like 100 it is a good value for keeping the k last 
parameters over last frames.

As an improvement to understand what is happening in the image, I added the averaged slope and the current center
for every frame.

After work over these three steps, now there is a foundation that can be used to create the functions get_canny_edges, detect_lines and drawn_lane_lines which will join all provided helper functions to detect and draw the lines over the test images as shown above:

alt text

alt text

I’ve tried to play with region_of_interest and HSV format to improve the work above; you can find this code at the very bottom of the notebook.

2. Identify potential shortcomings with your current pipeline

I noted that the slope of different lines vary a lot it makes some times the line to don’t’ stick exactly in the lane line in some curves.

Another shortcoming could be if the road has shadows and other residual material that is near the lane lines averaging the slopes and center may don’t match at all on the lane lines.

3. Suggest possible improvements to your pipeline

I’ve tried using the function cv2.inRange for filter out colors except yellow and white this way identifying lines could be much more easy for canny and hough spaces, but it doesn’t show to much The improvement since tunning and guessing the color ranges for this seem tricky. A possible improvement should be trying to parametrize well this function get better results.

Another improvement could figure it out how to adapt automatically the bottom and top position of the lines to match the image, for example for challenge video the lines do well but one line is taller than the other. Would be nice to have a way to get the lines in the same top or bottom level.