Lane line detection is a crucial feature of Self-Driving Vehicles. It’s an extremely important step for detection of steering angles and localization on the road. The main goal of this project is to develop a pipeline for identification of lane lines on the Road using a series of images and video streams.
-
Importing useful Packages
- numpy
- matplotlib
- Some Extra OpenCV functions
cv2.inRange()
for color selection
cv2.fillPoly()
for regions selection
cv2.line()
to draw lines on an image given endpoints
cv2.addWeighted()
to coadd / overlay two images
cv2.cvtColor()
to grayscale or change color
cv2.imwrite()
to output images to file
cv2.bitwise_and()
to apply a mask to an image
-
Helper functions
- Grayscale Image function
- This function converts an image with multiple channels (colors) to a single channel (intensity data).
- Therefore, the processing is faster and it’s an essential step before the detection of lane edges.
- Gaussian blur function
- This function filters the noise, provides smoothness and prevents false edge detection.
- Canny edge detection function
- This function estimates the gradients of the image and supresses the image to determine potential edges based on the thresholds.
- Region of interest (ROI)
- This function (ROI) is responsible for filtering regions of interest based previously estimated edges and vertices. In our case, the vertice avoids regions without roads.
- Hough transformation
- The Hough transform to find lines in an image.
- Weighted image
- Mixing the lines from hough transformation with the original image. The resulting image is based on the following equation: initial_img * � + img * � + �
- Grayscale Image function
-
Calculate the x coordinate of the intersection
-
Find points with positive and negative slopes
- add_slope() , & handle Case of empty arrays in the main Pipeline
-
Plot Polygon from Vertices
-
Plot Image Processing
-
Test images & Results
-
Develop a Lane Detection Pipeline
-
Test on Videos
- process on Video Stream
- The first challenge was to tune the parameters for the hough transformation.
- I had some issues with NaNs and Inf while debbuging the main pipeline.
- The most demanding was to stabilize the lane lines of both video streams.
The lane lines are straight and very stable in both video streams, however, the pipeline does not work with the challenging video. I believe that it would be also very difficult to detect the lane lines in medium to extreme environments conditions including shades, reflections, occlusions and diverse weather constraints.
- Find a robust and stable curvature for the lane detection instead of a straigth of line.
- Tune the mask color parameters and split white and yellow lane lines for processing the challenging video.