Giter Site home page Giter Site logo

advanced_road_lane_detection's Introduction

Advanced Lane Finding

The goals of this project are to

  • Compute the camera calibration matrix and distortion coefficients given a set of chessboard images.
  • Apply a distortion correction to raw images.
  • Use color transforms, gradients, etc., to create a thresholded binary image.
  • Apply a perspective transform to rectify binary image ("birds-eye view").
  • Detect lane pixels and fit to find the lane boundary.
  • Determine the curvature of the lane and vehicle position with respect to center.
  • Warp the detected lane boundaries back onto the original image.
  • Output visual display of the lane boundaries and numerical estimation of lane curvature and vehicle position.

Camera calibration

The code for this section is in the 2nd and 3rd cells of the ipython notebookAdvanced Lane Detection.ipynb. The first cell finds the corners of 20 chessboard images given as examples using the OpenCV function findChessboardCorners. This function finds the objpoints and image points. These are fed into the cv2.undistort to get the distortion matrix used to undistort the image. Here is the detected chessboard corners alt text

Here is the undistorted image alt text

Experimenting with single images

This distortion matrix is used to undistort the lane images cell number 5 shows the sample undistorted image. alt text

I then applied the perspective transform and defined a function called wrap. This function takes in image, src(source) and dst(destination) matrices. I have manually coded these matrices in the cell #7 in the notebook. After applying perspective transform we have the following image alt text

Color channels

I then explored individual RGB channels to detect the best channel for detecting lane line alt text

I then explored HSV channels alt text

I then explored the HLS channels alt text

Gradient thresholding

I then applied gradient thresholding to orginal images. I used all the three different techiniques taught the course

  1. absoulte x and y gradient using cv2.Sobel function the corresponding code is found in the cells 13 and 14 alt text

  2. Magnitude thresholding here i used the kernal size as 25 and min thresh =25 and max thresh = 255 alt text

  3. Direction thresholding. The corresponding function is in the cells 17 and 18 where i used the kernal size = 7 and min threshold is 0.0 and max thershold is 0.09 alt text

I then combined all the 3 techniques and found the best using different thresholding alt text

Color channels continued

I first used the HLS channels and used thresholds to detect lane lines. I found out the L channel is best for while lane; and thershold (220,255) are used in the custom function hls_binary. alt text

and then used the B channel in the Lab color space for detecting the yellow lines. Found in the cell 25. alt text

I then used the above developed structure and then used it on all the test images given the output is shown below alt text

Polyfit and histograms

I then used the given framework in the course to fit a polynomial to the lines detected using the above structure and also used the sliding window to detect the lane lines along throgh out the image alt text

the corresponding histogram is shown below alt text

I have also used an alternate method used to make continuas polyfit using the same code used in the course alt text

Curvature and center

I have then used the function curv_rad function to determine the radius of curvature and center of the car in the lane. Using all the framework generated we have the following image alt text

I have then used the moviepy package to apply to the project video the code was successfully able to detect all the lane lines throughout the video. The link for the video is here

Discussion

This project was pretty straight forward. The main challenge was to detect the yellow lines. After some online researching I found out that the Lab (B) channel is the best for this purpose. My code had some trouble applying to challenge video, more fine tuning is necessary for this purposes.

advanced_road_lane_detection's People

Contributors

sai19872000 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.