Giter VIP home page Giter VIP logo

lane-detection-1's Introduction

lane-detection

Lane and vehicle detection software for an autonomous vehicle

This project is still under development and was built for educational purposes. An application was designed following the model-view-controller architecture to enable multiple autonomous vehicle algorithms to be simulated in different views and to allow the input parameters to be altered in run time e.g. adaptive threshold parameters, coordinates for inverse perspective mapping, number of sample points etc. The code will run slower due to the MVC architecture.

main.cpp is the view, laneDetectorController.hpp is the controller for the lane detection and vehicleDetectorController.hpp is the controller for the vehicle detection (both controllers are derived from the base Controller class in controller.hpp).

Lane Detection

Files/Classes

laneDetector.hpp acts as the model for the lane detection and contains the LaneDetector class.

The lane detection utilises the LineFinder class within lineFinder.hpp which is capable of finding and drawing lines using the Hough Transform and the Probabilistic Hough Transfrom.

IPM.hpp contains the IPM class for inverse perspective mapping, based on that seen in Marco Nieto's Blog (https://marcosnietoblog.wordpress.com/2014/02/22/source-code-inverse-perspective-mapping-c-opencv/). The IPM class is capable of converting the vehicle's front view to a birds eye view.

laneTracker.hpp contains the LaneTracker class which tracks and predicts the lane markers using a Kalman filter.

Algorithm

The lane detection algorithm utilises image enhancement techniques including temporal blurring and inverse perspective mapping before splitting the image into two halves for further processing. Instances of the LaneDetector class are then created for each image in order to detect the lane markers. An adaptive threshold is then used to detect the edges within each image. The LineFinder class is then used to detect lines using both the Hough Transform and Probabilistic Hough Transform. Any lines which do not resemble lane markers are removed (incorrect orientation etc). A bitwise AND operation of the two results is then used to combine the results for optimal line selection. The Hough Transform function within the LineFinder class is then used to detect the 10 most probable lines within the resulting image.

The image is then sampled along it’s height and linear least squares regression is used to calculate the best fit line for the lane marker. The lines rho (distance from the coordinate origin) and theta (the line rotation angle in radians) are then calculated.

Two instances of the LaneTracker class are then created in order to track the lane marker in each image. The line parameters (rho, theta) are used as inputs to the Kalman Filter. If no best fit line is detected then the Kalman Filter predicts the parameters.

Vehicle Detection

Files/Classes

vehicleDetector.cpp acts as the model for the vehicle detection and contains the VehicleDetector class.

Algorithm

The vehicle detection algorithm utilises a Haar Cascade which is trained using an MIT vehicle dataset. The input frame is converted to grayscale before undergoing histogram equalisation. Objects of different sizes are then detected using the Haar Cascade and stored in a list of rectangles. The detected cars are then marked on the output image.

lane-detection-1's People

Contributors

aidanscannell avatar

Watchers

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