TechieYan Technologies

Identifying the lane, the vehicle is travelling

Abstract

Lane detection is a very vast area to work on, since a lot of efforts are being put on to avoid even minute error and making a safe self-driving environment sustainable and efficient. So, there are a lot of methods where we can implement this lane detection while driving, one method we have used is through OpenCV where using its in built functions such as Sobel operator, perspective transformation and edge detection we have done rather a basic lane detection model, which identifies the lane the vehicle is travelling.

Code Description & Execution

Algorithm Description

Specifically, any algorithm was not used in this particular project, most of the lane detection was done using different types of filters such as Sobel, perspective transformation, lane point detection. All these are integrated into one function that is detect edges which will detect the edges by applying all the above filters. Then we have to fit the above method into a polynomial and also, we have to calculate the curvature of the lane since some lane might be curved and some wont, so because of that we need to calculate the curvature of the lane. Finally, we have to process and render the image.

Reference: 

https://www.researchgate.net/publication/341460683_Lane_detection_technique_based_on_perspective_transformation_and_histogram_analysis_for_self-driving_cars

https://www.ijert.org/lane-line-detection-for-vehicles

How to Execute?

Make sure you have checked the add to path tick boxes while installing python, anaconda.

Refer to this link, if you are just starting and want to know how to install anaconda.

If you already have anaconda and want to check on how to create anaconda environment, refer to this article set up jupyter notebook. You can skip the article if you have knowledge of installing anaconda, setting up environment and installing requirements.txt

 
  1. Install the prerequisites/software’s required to execute the code from reading the above blog which is provided in the link above.
  2. Press windows key and type in anaconda prompt a terminal opens up.
  3. Before executing the code, we need to create a specific environment which allows us to install the required libraries necessary for our project.
  • Type conda create -name “env_name”, e.g.: conda create -name project_1
  • Type conda activate “env_name, e.g.: conda activate project_1
  1. Go to the directory where your requirement.txt file is present.
  2. cd <>. E.g., If my file is in d drive, then
  3. d:

command d

      7.cd d:\License-Plate-Recognitionmain    #CHANGE PATH AS PER YOUR PROJECT, THIS IS JUST AN EXAMPLE

command d license plate    

     8. If your project is in c drive, you can ignore step 5 and go with step 6

     9. g., cd C:\Users\Hi\License-Plate-Recognition-main

    10. CHANGE PATH AS PER YOUR PROJECT, THIS IS JUST AN EXAMPLE

    11. Run pip install -r requirements.txt or conda install requirements.txt (Requirements.txt is a text file consisting of all the necessary libraries  required for executing this python file. If it gives any error while installing libraries, you might need to install them individually.)

pipe installation

     12. To run .py file make sure you are in the anaconda terminal with the anaconda path being set as your executable file/folder is being saved. Then type python main.pyin the terminal, before running open the main.py and make sure to change the path of the dataset.

     13. If you would like to run .ipynb file, Please follow the link to setup and open jupyter notebook, You will be redirected to the local server there you can select which ever .ipynb file you’d like to run and click on it and execute each cell one by one by pressing shift+enter.

Please follow the above links on how to install and set up anaconda environment to execute files.

Data Description

This particular project doesn’t require any specific kind of dataset, we have used the existing filters to identify the lines in the lane and to get the curvature of the lane we have used polynomial fit method

Credits to the owners for giving the reference.

Final Results

  1. Perspective Transform

1.Perspective Transform image

       2.Binary Frame

Binary Frame

       3. Sliding window

Sliding window

 

       4. Polyfit (Fitting a line on the curvature)

Polyfit

      5. Final image

final result

Issues you may face while executing the code

  1. We might face an issue while installing specific libraries.
  2. Make sure you have the latest version of python, since sometimes it might cause version mismatch.
  3. Adding path to environment variables in order to run python files and anaconda environment in code editor, specifically in visual studio code.
  4. Refer to the Below link to get more details on installing python and anaconda and how to configure it.

https://techieyantechnologies.com/2022/06/get-started-with-creating-new-environment-in-anaconda-configuring-jupyter-notebook-and-installing-libraries-using-requirements-txt-2/

 

  1. Make sure to change the paths of the images used in the code.
  2. regarding Car, it was unable to correctly predict the lane curve at some point.
  3. Try changing some parameters to best fit the lane curves.
  4. You can use other Edge detection techniques instead of Sobel operator.
  5. curve fitting code cell is little complicated to understand.
+91 7075575787