/Lane-Detection

Lane detection and object detetion (YOLO) using OpenCV and python

Primary LanguagePython

Project structure

The aim of this project is to try and implement a detection algorithm to identify road features such as detecting lane boundaries and surrounding vehicles. For detecting lane boundaries, a computer vision technique library such as opencv has been used and for vehicle detection the same library with pre-trained yolo weight has been chosen to perform the algorithm.

ezgif com-video-to-gif (2)

The pipeline to identify the road boundaries, comprises the following steps:

  1. Calculate camera calibration matrix using cv2.findChessboardCorners() function in order to remove the distortion generated from lenses and ensure that lane detection algorithm can be generalized to different cameras. Then apply the distortion correction to the raw image.

  2. Detecting the edges on the image by using set of gradient and color based threshold using cv2.Sobel and cv2.cvtColor function in order to create a thresholded binary image.

  3. Apply a perspective transform to make lane boundaries extraction easier resulting to a bird's eye view of the road.

  4. Scaning the resulting frame for pixels and fit them to lane boundary and warp the detection lane boundaries back to the original image.

  5. Approximate road properties such as curvature of the road and vehicle position within the lane.

The snapshot of the afformentioned procedure can be seen as

Webp net-resizeimage

How to run the project

First clone to https://github.com/shayantaherian/Lane-Detection/.git then move to the directory cd Lane_Detection and run python lane_detection_version.py

References

  1. Detecting road features
  2. lane-detection-with-opencv