Giter Site home page Giter Site logo

laurentveyssier / finding-lane-lines-on-the-road Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 41.8 MB

Create a Lane Finding pipeline that finds lane lines on the road

Jupyter Notebook 100.00%
hough-lines lane-lines-detection autonomous-vehicles cv2 image filtering extract-features color region-of-interest canny-edge-detection

finding-lane-lines-on-the-road's Introduction

Finding-Lane-Lines-on-the-Road

Create a Lane Finding pipeline that finds lane lines on the road

Description

When we drive, we use our eyes to decide where to go. The lines on the road act as our constant reference for where to steer the vehicle. Naturally, one of the first things we would like to do in developing a self-driving car is to automatically detect lane lines using an algorithm.

In this project a line detection algorithm is proposed to detect lane lines in images using Python and OpenCV. OpenCV means "Open-Source Computer Vision", which is a package that has many useful tools for analyzing images. Recognizing lane markings on roads is possible using well known computer vision techniques.

This project is part of UDACITY's Self-Driving Car Engineer Nanodegree.

Issue Statement

The objective is to be able to detect lane lines in images and videos real-time. Images present various difficult levels with varying levels of shade, solid and dotted lines, of different colors and various x-y dimensions. A sample of the training set is shown below.

Detection Pipeline Workflow

I started by exploring the training images and looking at various color spaces to indetify the best detection strategy. The images come with yellow and white lane lines. I opted for:

  • Using LAB color space, and more particularly the B channel, as the yellow lines stand neatly out. This strategy proved to perform superbly on images with shades while other color spaces could not perform similarly.
  • Using HLS color space for white lines.

Pipeline:

  • Extract yellow lines using LAB B channel White is not extracted at all but the yellow extraction proves robust despite some deterioration.

  • Extract white lines using HLS color space. Here, only white is extracted. I re-inforce features using cv2.dilate() and cv2.erode() steps. Note that a lot of noise is also captured (white car on the right) which will need to be handled next.

In both approaches, I used a filtring approach with cv2.inRange(). I validated the approach, even with challenging images, testing line extracting using cv2.HoughLinesP

  • Combine both extractions so that to be able to overlay onto the original images at a later stage. Note that I performed several steps using cv2.dilate() and cv2.erode() in order to enhance the extracted line patterns at this stage. The use of a Canny filter did not prove useful on top.

In the sample below, we can see a couple of yellow road signs extracted during the process ! Line re-inforcement is also visible.

At this stage we now must:

  • Eliminate captured noise using Region Of Interest approach. The output is a clean mask capturing both white and yellow lines even in shady environment. In the example below, we can see the noise which gets eliminated (no more white car!) and we are left with a neat mask capturing both lanes.

Now we can finalize:

  • Apply Hough Line detection on the mask and collect identified line segments for the next additonal step. In the example below, I validate the good performance on both line types despite shadow conditions. Next we will make up for full solid lines.

  • Calculate line formulas in order to draw and overlay full, solid, lines onto the original images. I used a mask to perform this combination step.

The output is shown in the next section below.

The line extraction pipeline proved very efficient using movies even with challenging shading conditions.

Results

Final result with good detection performance.

finding-lane-lines-on-the-road's People

Contributors

laurentveyssier avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lyf6

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.