Skip to content

ZhaoDu/Self-Driving-ND-P1-LaneLinesFinding

Repository files navigation

Project 01: Finding Lane Lines on the Road

Udacity - Self-Driving Car NanoDegree

Overview

This repo provides a pipeline of detecting lane lines from both image and video for autonomous vehicle(AV) using traditional computer vision techniques, i.e. Canny edge detection and hough transform approaches

Pipeline

My pipeline consisted of following steps

  • Read in image and convert it to grayscale with yellow color enhanced when necessary.
  • Define a kernel size and apply Gaussain smoothing cv2.GaussianBlur(), which is essential to suppressing noise and spurious gradients by averaging.
  • Define low and high thresholds and run Canny edge detectioncv2.Canny() alt text
  • Select region of interest(ROI) cv2.fillPoly() alt text
  • Define Hough transform parameters, apply Hough transformcv2.HoughLinesP() in ROI selected image to obtain lane line data.
  • Group the obtained lane line data into left and right lane. Calculate the average slope and intercept of left and right group respectively. Draw the lane line based on the average slope, average intercept and coordinate rage of each group.
  • Generate the result by weighted summation of lane line image and the initial image alt text

Note: The above pipeline needs tuning parameters for images from differen sources,i.e. image size, boundaries of ROI, parameters for Canny edge detection and Hough transform, etc

Image Test Results

Detection with extrapolated line drawn

  • solidWhiteCurve.jpg alt text
  • solidWhiteRight.jpg alt text
  • solidYellowCurve.jpg alt text
  • solidYellowCurve2.jpg alt text
  • solidYellowLeft.jpg alt text
  • whiteCarLaneSwitch.jpg alt text

Video Test Results

Test video 1: solidWhiteRight.mp4

alt text

Test video 2: solidYellowLeft.mp4

alt text

Test video 3: challenge.mp4

alt text

Shortcomings

There are a few shortcomings in current version of solution

  • Only linear lane can be found using this solution with acceptale accuracy. As for curve lane, the linear approximation method might lead to remarkable error(see test video 3 challenge.mp4).
  • The algorithm is not so robust as it fails to group left or right lane correctly in some of frames in test video 2 solidYellowLeft.mp4.
  • Bad weather conditions (snow, rain, etc.) and poor light contions will greatly affect the result.
  • In this solution, the lane line detection result is based on the selection of ROI. It's acceptable to mask a ROI mannually for input videos comes from similar scenarios. However, complex and changeful scenarios might occur when AVs come into real road. This mannual selection approach undermines the accuracy and generalization of this solution.

Future Work

Following aspects can be taken into consideration to boost the solution in the future

  • Adaptive approaches can be used to boost the generalization of current solution,especially for ROI selection.
  • Add an outlier reduction approach like RANSAC on the hough lines
  • Curve functions, such as B-spine, might be useful to detect non-linear lanes in curvy roads.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published