Car Lane Detection Using NumPy OpenCV Python

Download Project Document/Synopsis

Nevon Driver Drowsiness Detection System Using Python
Tested
nevon software

Automobiles have become one of the transportation tools for people to travel as society has rapidly developed. There are an increasing number of vehicles of various types on the narrow road. Every year, as more vehicles hit the road, the number of people killed in car accidents rises. The focus of attention has shifted to how to drive safely in the presence of numerous vehicles and narrow roads.

Lane detection is a challenging problem. For many years, it has captured the interest of the computer vision community. Lane detection is fundamentally a multi-feature detection problem, which has grown to be a significant obstacle for computer vision and machine learning methods. The Lane Detection System derives its information from lane markers in a complex environment and is used to reliably estimate the vehicle’s position and trajectory relative to the lane.

In this system, Canny Edge Detection is carried out as the first operation. It enables reading and detecting edges in the frame, after which the frame (i.e., image) passed is converted to grayscale using the convert colour function of cv2 and Blurred using Gaussian Blur to reduce the number of edges. The second operation is to crop the area of interest, which is our lane. The output image of canny edge detection is passed to the region of interest function, which extracts the height and width of the canny image and applies a mask to remove everything except the mask.

The next step is to crop the frame with NumPy and create a triangle to identify the locations of the lanes. The third operation is to implement the Hough Line Transform. The algorithm runs on a canny image and provides an estimate of the presence of a line in the image. It is a built-in feature of CV2.

Average Slope-Intercept is the fourth operation. It uses images from the Hough Line Transform function as input to determine the precise location of the lines. The function is only interested in lines that may represent a lane out of all the lines present. This function makes use of another function called make_points, which makes use of the slope of lines detected by the Slope intercept function.

The Fifth Operation Display Lines. In this case, the function accepts an original frame as well as the lines detected by the Average Slope intercept. If there is a line present, it is detected and plotted on a blank image. The function returns an image with lines plotted on it. The sixth operation is to add display lines to the original frame. A combo image is returned and displayed after combining the original frame and the detected lines.

Advantages

  • Detects lane in real-time.
  • It lowers the likelihood of car accidents.