Coder Social home page Coder Social logo

krisharul26 / autonomous-vehicle-running-with-line-navigation-and-object-detection-using-opencv-and-ai-techniques- Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 60.8 MB

Mobility on a wide scale is moving towards complete automation. Though the technology for automating the vehicles already exists, these technologies must be optimised to fit the current environment. This project would be a scaled-down model of the Autonomous Car. By running these scaled-down models in the live streaming line detection using OpenCV.

Python 100.00%
opencv python-3 numpy-arrays computer-vision opencv-python tensorflow googlecolab raspberry-pi-4 raspberry-pi-camera oops-in-python

autonomous-vehicle-running-with-line-navigation-and-object-detection-using-opencv-and-ai-techniques-'s Introduction

Autonomous Vehicle Running with Line Navigation and Object Detection Using OpenCV and AI Techniques - Live Streaming.

Line detection/OpenCV/ SSD_mobilenet, Keras/TensorFlow/ Deep Learning and Computer Vision

Introduction

Mobility on a wide scale is moving towards complete automation. Though the technology for automating the vehicles already exists, these technologies must be optimised to fit the current environment. This project would be a scaled-down model of the Autonomous Car and focus on the live streaming lane detection using OpenCV.

Project Limitations

* Three wheels were used instead of four wheels. To build a three-wheel Car, three-wheeled was to have a mounting where the third wheel could be assembled. This mount is designed based on the space available on the model car. To provide the steering, a servo motor must be fitted so that the mounting used for the steering wheel could be extended for mounting the servo motor.

* camera mounting is required to place the camera in an optimal height to get the future images which would be adjacent to the vehicle.

Camera Holder

πŸ”‘ Prerequisites

πŸš€ Initialization For Running the car Autonomously

  1. Clone the repo with local computer
git clone https://github.com/KrishArul26/Live--streaming-Autonomous-Vehicle-running-With-line-detection-using-OpenCV.git

  1. Connect the raspberry Module with local computer via Power shell(with wireless network)
ssh pi@car_name

3.Navigate the Raspberry Module code directory

cd ...
cd share/Code
  1. For running the car: Run the main.py
sudo python main.py
  1. For visualization on the browser to see line detection: Run the app.py
sudo python app.py

Results

This project involves locating Blue lane lines in an image using Python and OpenCV.

HSV Space

The HSV colour space is often used in computer vision tasks because it has better performance than the RGB colour under different lighting conditions. So, firstly, the blue colour area is isolated from the original image to locate the path. RGB image, different levels of the blue tape may be lit with different light, resulting in them appearing as darker blue or light blue. However, in HSV colour space, the Hue component will render the entire blue tape as one colour regardless of its shading. To do this, with the help of the OpenCV's function is converted to the HSV space.

Finding HSV value

Mask Image

After converting the image to HSV space, the area of the path is extracted from the blueish colours of the image. By defining the upper level and the lower-level blue values of the paths the separation is done from the HSV space image.

Canny - Edge Detection

The goal of edge detection is to identify the lane boundaries and areas within the image.Canny edge detection function is applied to get the edges or boundaries in the mask image.

Region of Interest

The features of the image which contained the path are chosen. Based on the dimension matrix of the Canny image the masked image is created by replacing the values with zeros. Further, the half-height of the Canny image features is extracted by defining a polygon from the Car's edge. The original image is plotted using Matplotlib to find the coordinates for the Region of interest. By assigning the polygon on the mask image with the intensity of 255, the Region of interest is turned white. Further, a bitwise and operation is applied on the canny image and the mask image to get the final Region of interest (masked image).

Hough Transform

In the Hough Space, a point is plotted if the y-intercept and the slopes are known. With changing m(Slope) and b(Intercept) values, there is a possibility to plot different lines. To identify the lines, firstly, the Hough space is split into a grid. Each bin inside the grid corresponding to the slope and y-intercept value of the line. For every point of intersection in a Hough Space bin, a vote is to be cast inside of the bin to which it belongs. The bin with the maximum number of votes will be the resulting line. OpenCV contains Hough Transform, which performs this process. The function HoughLinesP essentially tries to fit many lines through all the white pixels and return the most likely set of lines, subject to certain minimum threshold constraints.

Average Slope-Intercept

Subsequently, the left lane line and right lane line (according to the Car) consists of multiple discontinuous lines. Therefore, the average slope and intercept are calculated to combine these lines into one left lane line and the right lane line.

Steering Angles

The steering angle is calculated based on three different scenarios; these are: "both lines detection condition", "only the left line detection condition" and "only right line detection condition”.

both lines detection condition

If both lines are detected by the program, firstly the X-coordinate of the left line and right line are separated from their corresponding lines and X offset is calculated using the equation β€œ((left_x2+right_x2)-width)/(height)”. Trigonometry is used to find the angle is from the vertical axis.

one line detection condition

If one line is detected by the program,firstly the X-coordinate of the left line or right line are separated from their corresponding lines and X offset is calculated using the equation"(left_x2-left_x1)/(height/2)" or "(right_x2-right_x1)/(height/2)".Trigonometry is used to find the angle is from the vertical axis.

Clockwise Testing Results

Anti Clockwise Testing Result

autonomous-vehicle-running-with-line-navigation-and-object-detection-using-opencv-and-ai-techniques-'s People

Contributors

krisharul26 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

autonomous-vehicle-running-with-line-navigation-and-object-detection-using-opencv-and-ai-techniques-'s Issues

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.