GithubHelp home page GithubHelp logo

adv_lane_finding's Introduction

Advanced Lane Finding

Udacity - Self-Driving Car NanoDegree

This project goal is to write a software pipeline to identify the lane boundaries in a video. This document will describe the algorithm in details.

The Project

The key steps of this project are the following:

  • 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

I performed camera calibration using the single image image and got camera calibration matrix:

Camera calibration matrix: [[ 872.5223319     0.          649.38554509]
 [   0.          853.10470045  213.74930061]
 [   0.            0.            1.        ]]

Original images: image Undistorted images: image

The difference is not so big but it can be noticable further if not performed right now.

Perspective

To get perspective matrix I performed the following calculations:

    srcPoints = np.float32(
       [[w * 0.18, h * 0.95],
        [w * 0.457, h * 0.63],
        [w * 0.543, h * 0.63],
        [w * 0.82, h * 0.95]])
   dstPoints = np.float32(
       [[w * 0.25, h],
        [w * 0.25, 0],
        [w * 0.75, 0],
        [w * 0.75, h]])
   
   M = cv2.getPerspectiveTransform(srcPoints, dstPoints)
   Minv = cv2.getPerspectiveTransform(dstPoints, srcPoints)

and checked the result using straight image: image vertical lines on the first image shows that perspective matrix is correct.

Pipeline

Next steps are performed for every frame in the video.

Warping

Warping is performed using M matrix. The result is displayed on previous image.

Binarization

After many experiments I found the following binarization algorithm is the best:

  1. Convert image to HLS color space
  2. Get L and S channels: image
  3. Adjust gamma on L channel: image
  4. Sum gamma(L) with S images using Max function (i.e. get the brightest pixel from two): image
  5. Do binary thresholding using values min=110, max=255: image image

Lines detection

Perform lines detection using provided in the lesson algorithm: image

Draw lane highlighting

Draw the polygon on warped clear image

Unwarp the image

Unwarp the image using inverted M matrix

Combine original and highliting image

Draw text on the image

The final image: image

The final video

video

adv_lane_finding's People

Contributors

ruslan-yanchyshyn avatar

Watchers

Ruslan Yanchyshyn avatar  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.