Coder Social home page Coder Social logo

lanefinding's Introduction

Finding Lane Lines on the Road

Udacity - Self-Driving Car NanoDegree

Combined Image

Overview

When we drive, we use our eyes to decide where to go. The lines on the road that show us where the lanes are 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 I have detected 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.

The Project

Approach

The main aim of the project is to detect road lane markings. I followed below sequence of steps to build the pipeline:

  • Noise removal
  • Lane mask generation
  • Edge detection
  • Hough line detection
  • Extrapolate lane markings
  • Repeat above steps on each image sequence

Noise removal

To remove sharp noise in image, 3x3 Gaussian kernel smoothing was applied to image. I have experimented with 5x5 kernel but it deteriorated the performance of lane mask generation and edge detection steps.

Edge detection

I have used Canny edge detection algorithm with (20, 100) threshold values over lane binary mask. I ended up using below parameters for edge detection.

    low_threshold = 30
    high_threshold = 100

Hough line detection

I have applied probabilistic hough transform algorithm on edge map to detect the line shapes. I have experimented with theta, minimum line size, rho and max line gap and threshold values. The hough vote count(threshold) and minimum line size values played key role in removing outliers. I ended up using below parameters for line detection.

    rho = 1
    theta = np.pi/180
    threshold = 60
    min_line_len = 30
    max_line_gap = 150

Extrapolate lane markings

The Hough line detection algorithm helped to remove lot of edge outliers but produced lot of line points. In ideal world we would expect two line points which represents lane points. Now the challenge is to pick up best two line points which represent the lanes. I came up with following algorithm to detect best line pair which represents lane markings. From car camera point of view left and right lanes show up as parallel lanes which are going to meet at vanishing point.

  • Eliminate line if its angle magnitue to the base is more that 70 degrees or less than 30 degrees . These numbers are derived based on both left and right lanes are going to meet at vanishing point.
  • The line points are categorized into left or right based on angle direction. If it is positive it belongs to left lane, if it is right it belongs to right lane.
  • I found multiple candidates for both left and right lanes. I selected one line from each category based on the minimum angle difference between pair of lines.
  • I used line pair to extrapolate the line markings by finding the line intercepts and vanishing gradient points.

lanefinding's People

Contributors

ryan-keenan avatar rajarshighoshal avatar brok-bucholtz avatar andrewpaster avatar mvirgo avatar baumanab avatar moe-elsadig avatar dmlicht avatar mikaelcarpenter avatar citlaligm avatar rasphilco avatar rajatgoyal715 avatar norman-thomas avatar mhorga avatar kokosabu avatar jeremy-shannon avatar domluna avatar quadhd avatar bayne avatar austinjalexander avatar

Watchers

James Cloos 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.