Skip to content

Latest commit

 

History

History
73 lines (49 loc) · 5.67 KB

writeup.md

File metadata and controls

73 lines (49 loc) · 5.67 KB

Finding Lane Lines on the Road

Sara Collins


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

Reflection

1. Describe your pipeline. As part of the description, explain how you modified the draw_lines() function.

The pipeline for processing the images to identify lane lines consists of six steps:

  • Grayscale: Conversion of the input image from color to gray tones.
    Grayscale Image
  • Canny Edge Detection: The grayscale image is then taken and run through OpenCV's Canny edge detection algorithm.
    Canny Image
  • Gaussian Blur: Gaussian blur is then applied to the canny edge-detected image.
    Gaussian_Blur_Image
  • Masking - Region of Interest: A mask is applied over all but a triangle shape in the lowest portion of the Gaussian-blurred image.
    Masked Image
  • Hough Lines: Finds primary lines for drawing lane lines.
    Hough_Image
  • Weighted Lines: Weighting lane lines so they show up thicker on the image.
    Weighted Lines Image

In the first portion of the project, I simply left the initial drawLines() function as it was to draw out all line segments returned from the Hough lines function. However, while this identified line segments quite well, it did not provide a solid line over a dashed lane line, and as it was, also kept all line segments regardless of their slope, including some horizontal line segments at both the horizon and in the reflection of the windshield.

In order to draw a solid line on the image over the dashed lane line and eliminate extraneous lines with slopes that were not within the range of angles typically found in the lane lines, and also calculated the intercept for each line segment. From there, added the line point list and individual x or y list for the left lane if the slope was less than the negation of a slope threshold parameter, and to lists for the right lane if the slope was greater than the slope threshold parameter.
Next, I fit all the x and y points to lines for both the left and right lane line using the np.polyfit function, calling the slope and intercept both 1 if the lines did not exist (this was necessary for some image frames in the video segment where edges were not adequately detected to form the lane line.

After that, I found the 'y' values for the endpoints for both lane lines, since they were going to be the same, thus resulting in the lines being of even length. I also shortened the lines a bit so they didn't collide with one another. From there, I extrapolated the lines by subtracting the intercepts from the y values for each line, and then dividing that calculation by the slope for each respective line. Lastly, both the left and right lines were drawn in the same fashion as they were in the original function.

After that, I found the 'y' values for the endpoints for both lane lines, since they were going to be the same, thus resulting in the lines being of even length. I also shortened the lines a bit so they didn't collide with one another. From there, I extrapolated the lines by subtracting the intercepts from the y values for each line, and then dividing that calculation by the slope for each respective line. Lastly, both the left and right lines were drawn in the same fashion as they were in the original function.

Here is what the revised Hough lines and weighted image look like:
Hough Lines:
Hough Beta
Weighted Lines on Image:
Weighted Beta

2. Identify potential shortcomings with your current pipeline

A shortcoming of this approach is that it doesn't handle curves very well, and definitely does not see things particularly far along down the road.

Another shortcoming could be roadways that turn or curve outside of the region of interest, and roads that don't have lane lines at all or are very indistinct.

Also, wet roadways that are highly reflective, and roadways covered with snow or other precipitation or sediment would also prove to be major issues for this particular approach.

3. Suggest possible improvements to your pipeline

There are many possible ways to improve this algorithm. One way would be to automatically detect the left and right lane lines by way of detecting them as parallel lines by their angle, in ways that may eliminate the need for the masking portion of the algorithm.

Another potential way to improve the algorithm would be to work with different polygons between the lane lines in order to help the car better handle curves.

Yet another improvement may be to include a function that essentially 'scans' the horizon, anticipating anomalies that may occur in the future and giving the car time to react to them. Humans are encouraged to do this while learning to drive, and since stopping time, turns and other considerations are important given the physical constraints of a moving vehicle, it would be a necessary component to include in an autonomous vehicle.