Skip to content

Pradip-Kathiriya/Lane-Detection-for-Autonomous-Car

Repository files navigation

Project Description

This Project is divided into two parts:

1. Straight Lane Detection: In this part, the goal is to do simple Lane Detection to mimic Lane Departure Warning systems used in Self Driving Cars. You are provided with a video sequence, taken from a car. Your task is to design an algorithm to detect lanes on the road and classify them as dashed and solid lines. For the classification of the line type, you have to use different colors. Use green for solid and red for dashed.

2. Curve Lane Detection and Turn Prediction: In this part, the goal is to detect the curved lanes and predict the turn depending on the curvature: either a left or right turn. The dataset provided has a yellow line and a white line. Your task is to design an algorithm to detect these lanes on the road and predict the turn. When your lane detection system loses track(cannot find lane lines), you must manage to use the past history of the lanes from the previous image frames to extrapolate the lines for the current frame

Dataset

Dataset for Problem 1
Dataset for Problem 2

Pipeline

Straight Lane Detection

1. Solid Lane Detection:

  • Apply mask to detect region of interest(part of the image containing lane to be detected).
  • Apply Hough Transform with minimum length value(decided by tuning) high enough to detect only solid lane.
  • Find the mean of all the start and end points.
  • Find the slope mean value calculated in step 2.
  • Draw a single line on the image with calculated slope.

2. Dashed Lane Detection:

  • Apply mask to detect region of interest(part of the image containing lane to be detected).
  • Apply Hough transform to detect all the line in the masked image.
  • Find the slope of all the lines and remove those lines which is positive slope if solid lane has positive slope and negative slope if solid line has negative slope.
  • Find the mean of all the start and end points in the remaining lines.
  • Find the slope with mean value calculated in step 3.
  • Draw a single line with calculated slope.

Curve Lane Detection and Turn Prediction

1. White Lane Detection:

  • Compute the Homography and perform warp perspective to take bird eye view of the region of interest (part of the image containing lane to be detected).
  • Thresholding to remove yellow lane and noise from the warped image. The output will be binary image containing only white lane.
  • Find the pixel coordinates having value 255.
  • Find the equation of curve from above pixel coordinate.
  • Extrapolate and plot the white lane using above equation.
  • Compute the radius of curvature using equation of curve.

2. Yellow Lane Detection:

  • convert the image into hsv color space and apply color mask to detect only yellow lane.
  • Find the pixel coordinate of the yellow pixel.
  • Find the equation of curve from above pixel coordinate.
  • Extrapolate and plot the yellow lane using above equation.
  • Compute the radius of curvature using equation of curve.

3. Radius of Curvature:

  • Take the average of white and yellow lane radius.

4. Direction of Turn:

  • If the coefficient of highest degree term in the equation of white/yellow lane is positive, then the turn would be right. If it is negative, then the turn would be left and if it is zero then then is a no turn.

Results:

Straight Lane Detection

Question2_output.mp4

Question2_output_AdobeExpress

Curve Lane Detection and Turn Prediction

Question3_output.mp4

Question3_output_AdobeExpress

How generalize the solution is?

Straight Lane Detection

The solution will work in the image that satisfies the following scenario:

  • One line should be solid, and another should be dashed irrespective of the left or right position.
  • The shade of the color of the road should not be significantly different than the given shade.
  • Field of view and direction of view of the video should not be significantly different from the given video.

Curve Lane Detection and Turn Prediction

The solution will work in the image that satisfy following scenario:

  • One line should be yellow, and another should be white irrespective of the left or right position or whether they are solid or dashed or whether they are curved or straight.
  • Field of view and direction of view of the video should not be significantly different than given video.

Requirement

Python 2.0 or above

License

License: MIT

Copyright (c) Feb 2023 Pradip Kathiriya

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages