The main goal of this implementation is the detect the lane boundaries, from images captured from a front-facing camera. For this case, the images are captured with CARLA [1] The processing pipeline takes an image, filters it (using a Sobel filter [2]). This highlights the areas with high gradient changes.
The perspective of the filtered image is changed (bird's eye view) to make easier lane detection. Then a window is applied to create a histogram of detections. The peek is taken as the highest probability for the lane. Based on the peak position, the detector-window position is adjusted to follow the detections (i.e. curve position).
After all the points were detected, a polynomial fit is applied, and a curve is interpolated. What is remaining is to un-warp the image and visualize the points.
The implementation can be tweaked to different scenarios, for outliers RANSAC can be used, or in case of a missing middle line, an equidistant approximated line can be generated [3].
Set the image projection parameters (original image size 320x240 RGB):
src=[[50, 240], [200, 240], [0, 0], [320, 0]]
dst=[[135, 270], [150, 270], [0, 0], [320, 0]]
Set the detector parameters:
scan_range={'start':0,'stop':240,'steps':10}
scan_window={'height':8,'max_adjust':8}
Simply call the python file, the detections will be displayed.
python test_detections.py
- make more robust detections - with better filtering - to reduce the false positives
- optimize the peak detector to detect the middle points of the histogram, not the first global maxima
/Enjoy