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.
The pipeline to identify the road boundaries, comprises the following steps:
-
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. -
Detecting the edges on the image by using set of gradient and color based threshold using
cv2.Sobel
andcv2.cvtColor
function in order to create a thresholded binary image. -
Apply a perspective transform to make lane boundaries extraction easier resulting to a bird's eye view of the road.
-
Scaning the resulting frame for pixels and fit them to lane boundary and warp the detection lane boundaries back to the original image.
-
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
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